本文整理汇总了PHP中strlen_utf函数的典型用法代码示例。如果您正苦于以下问题:PHP strlen_utf函数的具体用法?PHP strlen_utf怎么用?PHP strlen_utf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strlen_utf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: substr_utf
/**
* Extended substr function. If it finds mbstring extension it will use, else
* it will use old substr() function
*
* @param string $string String that need to be fixed
* @param integer $start Start extracting from
* @param integer $length Extract number of characters
* @return string
*/
function substr_utf($string, $start = 0, $length = null)
{
$start = (int) $start >= 0 ? (int) $start : 0;
if (is_null($length)) {
$length = strlen_utf($string) - $start;
}
return substr($string, $start, $length);
}
开发者ID:urichalex,项目名称:sourcebansv1,代码行数:17,代码来源:system-functions.php
示例2: substr_utf
/**
* Extended substr function. If it finds mbstring extension it will use, else
* it will use old substr() function
*
* @param string $string
* @param integer $start
* @param integer $length
* @return string
*/
function substr_utf($string, $start = 0, $length = null)
{
$start = (int) $start >= 0 ? (int) $start : 0;
if (is_null($length)) {
$lenght = strlen_utf($string) - $start;
}
// if
return CAN_USE_MBSTRING ? mb_substr($string, $start, $length, 'UTF-8') : substr($string, $start, $length);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:18,代码来源:utf.php
示例3: getPreviewText
/**
* Return the first $len - 3 characters of the comment's text followed by "..."
*
* @param unknown_type $len
*/
function getPreviewText($len = 30) {
if ($len <= 3) return "...";
$text = $this->getText();
if (strlen_utf($text) > $len) {
return substr_utf($text, 0, $len - 3) . "...";
} else {
return $text;
}
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:14,代码来源:Comment.class.php
示例4: substr_utf
/**
* Extended substr function. If it finds mbstring extension it will use, else
* it will use old substr() function
*
* @access public
* @param string $string String that need to be fixed
* @param integer $start Start extracting from
* @param integer $length Extract number of characters
* @return string
*/
function substr_utf($string, $start = 0, $length = null)
{
$start = (int) $start >= 0 ? (int) $start : 0;
if (is_null($length)) {
$length = strlen_utf($string) - $start;
}
// if
if (function_exists('mb_substr')) {
return mb_substr($string, $start, $length);
} else {
return substr($string, $start, $length);
}
// if
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:24,代码来源:utf.php
示例5: getObjectName
/**
* Return object name
*
* @access public
* @param void
* @return string
*/
function getObjectName($charLimit = 0)
{
$name = $this->getTitle();
if (!$name) {
$name = $this->getText();
}
if ($charLimit > 0 && strlen_utf($name) > $charLimit) {
return substr_utf($name, 0, $charLimit) . '...';
} else {
return $name;
}
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:19,代码来源:ProjectTask.class.php
示例6: format_date
} else {
$real_duration = $event_duration;
}
}
}
$pre_tf = $real_start->getDay() == $real_duration->getDay() ? '' : 'D j, ';
$ev_hour_text = format_date($real_start, $pre_tf . $timeformat, 0) . " - " . format_date($real_duration, $pre_tf . $timeformat, 0);
$assigned = "";
if ($event instanceof ProjectTask && $event->getAssignedToContactId() > 0) {
$assigned = "<br>" . lang('assigned to') . ': ' . $event->getAssignedToName();
$tipBody = purify_html($event->getText());
} else {
$tipBody = $ev_hour_text . $assigned . (trim(clean($event->getDescription())) != '' ? '<br><br>' . clean($event->getDescription()) : '');
$tipBody = str_replace(array("\r", "\n"), array(' ', '<br>'), $tipBody);
}
if (strlen_utf($tipBody) > 200) {
$tipBody = substr_utf($tipBody, 0, strpos($tipBody, ' ', 200)) . ' ...';
}
?>
<script>
if (<?php
echo $top;
?>
< scroll_to || scroll_to == -1) {
scroll_to = <?php
echo $top;
?>
;
}
addTip('d_ev_div_' + <?php
echo $event->getId();
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:viewdate.php
示例7: get_conversation_info
function get_conversation_info()
{
$email = MailContents::findById(array_var($_GET, 'id'));
if (!$email instanceof MailContent) {
flash_error(lang('email dnx'));
ajx_current("empty");
return;
}
$info = array();
$mails = MailContents::getMailsFromConversation($email);
foreach ($mails as $mail) {
$text = $mail->getBodyPlain();
if (strlen_utf($text) > 80) {
$text = substr_utf($text, 0, 80) . "...";
}
$state = $mail->getState();
$show_user_icon = false;
if ($state == 1 || $state == 3 || $state == 5) {
if ($mail->getCreatedById() == logged_user()->getId()) {
$from = lang('you');
} else {
$from = $mail->getCreatedByDisplayName();
}
$show_user_icon = true;
} else {
$from = $mail->getFrom();
}
$info[] = array('id' => $mail->getId(), 'date' => $mail->getReceivedDate() instanceof DateTimeValue ? $mail->getReceivedDate()->isToday() ? format_time($mail->getReceivedDate()) : format_datetime($mail->getReceivedDate()) : lang('n/a'), 'has_att' => $mail->getHasAttachments(), 'text' => htmlentities($text), 'read' => $mail->getIsRead(logged_user()->getId()), 'from_name' => $state == 1 || $state == 3 || $state == 5 ? lang('you') : $mail->getFromName(), 'from' => $from, 'show_ico' => $show_user_icon);
}
tpl_assign('source_email_id', array_var($_GET, 'id'));
tpl_assign('emails_info', $info);
$this->setLayout("html");
$this->setTemplate("llo_email_conversation");
ajx_current("empty");
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:35,代码来源:MailController.class.php
示例8: export_to_csv_file
function export_to_csv_file()
{
$ids = array_var($_REQUEST, 'ids');
$idsall = array_var($_REQUEST, 'allIds');
$export_all = array_var($_REQUEST, 'export_all');
$this->setTemplate('csv_export');
$type = array_var($_REQUEST, 'type', array_var($_SESSION, 'import_type', 'contact'));
//type of import (contact - company)
tpl_assign('import_type', $type);
if (!isset($_SESSION['import_type']) || $type != $_SESSION['import_type'] && $type != '') {
$_SESSION['import_type'] = $type;
}
$delimiter = array_var($_REQUEST, 'delimiter', ',');
if ($delimiter == '') {
$delimiter = ',';
}
$checked_fields = $type == 'contact' ? array_var($_REQUEST, 'check_contact') : array_var($_REQUEST, 'check_company');
if (is_array($checked_fields) && ($ids || $idsall || $export_all)) {
$titles = '';
$imp_type = array_var($_SESSION, 'import_type', 'contact');
if ($imp_type == 'contact') {
$field_names = Contacts::getContactFieldNames();
foreach ($checked_fields as $k => $v) {
if (isset($field_names["contact[{$k}]"]) && $v == 'checked') {
$titles .= $field_names["contact[{$k}]"] . $delimiter;
}
}
$titles = substr_utf($titles, 0, strlen_utf($titles) - 1) . "\n";
} else {
$field_names = Contacts::getCompanyFieldNames();
foreach ($checked_fields as $k => $v) {
if (isset($field_names["company[{$k}]"]) && $v == 'checked') {
$titles .= $field_names["company[{$k}]"] . $delimiter;
}
}
$titles = substr_utf($titles, 0, strlen_utf($titles) - 1) . "\n";
}
// export the same type of contact objects that are enabled in the contacts tab.
$extra_conditions = "";
if (array_var($_SESSION, 'import_type', 'contact') == 'contact') {
$extra_conditions = ' `is_company` = 0 ';
if (!user_config_option("viewContactsChecked")) {
$extra_conditions .= ' AND `user_type` != 0 ';
}
if (!user_config_option("viewUsersChecked")) {
$extra_conditions .= ' AND `user_type` < 1 ';
}
}
// --
$filename = rand() . '.tmp';
$handle = fopen(ROOT . '/tmp/' . $filename, 'wb');
fwrite($handle, $titles);
$conditions = $extra_conditions;
$ids_sql = "";
if (!$export_all) {
$ids_sql = $ids ? " AND id IN (" . $ids . ") " : "";
}
$members = active_context_members(false);
$context_condition = $this->getActiveContextConditions();
if (array_var($_SESSION, 'import_type', 'contact') == 'contact') {
$conditions .= " AND `archived_by_id` = 0 ";
$conditions .= $ids_sql;
$conditions .= $context_condition;
$contacts = Contacts::instance()->getAllowedContacts($conditions);
foreach ($contacts as $contact) {
fwrite($handle, $this->build_csv_from_contact($contact, $checked_fields, $delimiter) . "\n");
}
} else {
$conditions .= ($conditions == "" ? "" : " AND ") . "`archived_by_id` = 0" . ($conditions ? " AND {$conditions}" : "");
$conditions .= $ids_sql;
$conditions .= $context_condition;
$companies = Contacts::getVisibleCompanies(logged_user(), $conditions);
foreach ($companies as $company) {
fwrite($handle, $this->build_csv_from_company($company, $checked_fields, $delimiter) . "\n");
}
}
fclose($handle);
$_SESSION['contact_export_filename'] = $filename;
flash_success($imp_type == 'contact' ? lang('success export contacts') : lang('success export companies'));
}
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:81,代码来源:ContactController.class.php
示例9: getObjectName
/**
* Return object name
*
* @access public
* @param void
* @return string
*/
function getObjectName()
{
$return = substr_utf($this->getText(), 0, 50);
return strlen_utf($this->getText()) > 50 ? $return . '...' : $return;
}
开发者ID:ukd1,项目名称:Project-Pier,代码行数:12,代码来源:ProjectTask.class.php
示例10: getShortDescription
/**
* Return shortened description
*
* @access public
* @param void
* @return string
*/
function getShortDescription()
{
$return = substr_utf($this->getDescription(), 0, 50);
return strlen_utf($this->getDescription()) > 50 ? $return . '...' : $return;
}
开发者ID:469306621,项目名称:Languages,代码行数:12,代码来源:ProjectCategory.class.php
示例11: getActivityLogComment
/**
* Return comment that need to be stored in activity log
*
* By default this function will extract data from body field (if present).
* If you need a bit different behavior override this function in subclasses
*
* @param void
* @return string
*/
function getActivityLogComment()
{
$body = strip_tags($this->getBody());
if ($body) {
$beginning = substr_utf($body, 0, 120);
if (strlen_utf($beginning) < strlen_utf($body)) {
$beginning .= '...';
}
// if
return $beginning;
}
// if
return null;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:23,代码来源:ProjectObject.class.php
示例12: getObjectName
/**
* Return object name
*
* @access public
* @param void
* @return string
*/
function getObjectName()
{
$name = $this->getText();
$len = strlen_utf($name);
$i = strpos($name, "\n");
if ($i !== false) {
$name = substr_utf($name, 0, $i - 1);
}
$return = substr_utf($name, 0, 50);
return $len > 50 ? $return . '...' : $return;
}
开发者ID:469306621,项目名称:Languages,代码行数:18,代码来源:ProjectTask.class.php
示例13: prepare_html
/**
* Prepare HTML before saving it into database
*
* @param string $value
* @param boolean $purify
* @return string
*/
function prepare_html($value, $purify = false)
{
require_once ANGIE_PATH . '/classes/htmlpurifier/init.php';
$value = trim($value);
if ($value != '') {
// Remove brs from the end of the string
if (str_ends_with($value, '<br /><br />')) {
$value = substr_utf($value, 0, strlen_utf($value) - 12);
}
// if
if ($purify) {
$value = purify_html($value);
}
// if
// Clean up Microsoft Office paste:
// <p> <!-- /* Font Definitions */--> </p>
if (str_starts_with($value, '<p> <!-- /* Font Definitions */')) {
$value = preg_replace('/(<p>)[\\s]+(\\<\\!--)[\\s]+(\\/\\*)[\\s]+(Font)[\\s]+(Definitions)[\\s]+(\\*\\/)(.*)(--\\>\\;)[\\s]+(<\\/p>)/i', '', $value);
}
// if
return str_replace(array('<br>', '<br/>', '<br />'), array("\n", "\n", "\n"), $value);
}
// if
return '';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:32,代码来源:general.php
示例14: minWordLength
private function minWordLength($str) {
$min = null ;
foreach ( explode(" ", $str) as $word ){
if ( $len = strlen_utf(trim($word)) ){
if (is_null($min) || $len < $min) {
$min = $len ;
}
}
}
return $min ;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:11,代码来源:SearchController.class.php
示例15: lang
$tip_pre = 'end_';
} else {
$tip_title = lang('start of task');
$img_url = image_url('/16x16/task_start.png');
$tip_pre = 'st_';
}
$tip_pre .= gen_id()."_";
$count++;
if ($count <= $max_events_to_show){
$color = 'B1BFAC';
$subject = clean($task->getObjectName()).'- <span class="italic">'.lang('task').'</span>';
$cal_text = clean($task->getObjectName());
$tip_text = str_replace("\r", '', lang('assigned to') .': '. clean($task->getAssignedToName()) . (trim($task->getText()) == '' ? '' : '<br><br>'. $task->getText()));
$tip_text = purify_html(str_replace("\n", '<br>', $tip_text));
if (strlen_utf($tip_text) > 200) $tip_text = substr_utf($tip_text, 0, strpos($tip_text, ' ', 200)) . ' ...';
?>
<div id="m_ta_div_<?php echo $tip_pre.$task->getId()?>" class="<?php echo "og-wsname-color-$ws_color" ?>" style="height:20px;margin: 1px;padding-left:1px;padding-bottom:0px;border-radius:4px;border: 1px solid;border-color:<?php echo $border_color ?>;<?php echo $extra_style ?>">
<a href='<?php echo $task->getViewUrl()?>' class='internalLink nobr' onclick="og.disableEventPropagation(event);return true;" style="border-width:0px">
<img src="<?php echo $img_url ?>" style="vertical-align: middle;">
<span><?php echo $cal_text ?></span>
</a>
</div>
<script>
addTip('m_ta_div_<?php echo $tip_pre.$task->getId() ?>', '<span class="italic">' + '<?php echo $tip_title ?>' + '</span> - ' + <?php echo json_encode(clean($task->getTitle()))?>, <?php echo json_encode(trim($tip_text) != '' ? trim($tip_text) : '');?>);
<?php if (!logged_user()->isGuest()) { ?>
og.createMonthlyViewDrag('m_ta_div_<?php echo $tip_pre.$task->getId() ?>', '<?php echo $task->getId()?>', false, 'task'); // Drag
<?php } ?>
</script>
<?php
}//if count
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:calendar.php
示例16: user_config_option
$show_help_option = user_config_option('show_context_help');
if ($show_help_option == 'always' || ($show_help_option == 'until_close' && user_config_option('show_active_tasks_widget_context_help', true, logged_user()->getId()))) {
render_context_help($this, 'chelp active tasks widget', 'active_tasks_widget');
} ?>
<div style="padding:10px">
<table id="dashTableTIP" style="width:100%;">
<?php
$c = 0;
foreach ($tasks_in_progress as $task) {
$stCount = $task->countAllSubTasks();
$c++;
$text = $task->getText();
if ($text != '')
$text = ": " . $text;
if(strlen_utf($text)>100)
$text = substr_utf($text,0,100) . " ...";
$text = clean($text);
?>
<tr class="<?php echo $c % 2 == 1? '':'dashAltRow'?>"><td><div class="db-ico ico-task"> ></div></td><td style="padding-left:5px;padding-bottom:2px">
<?php $dws = $task->getWorkspaces(logged_user()->getWorkspacesQuery());
$projectLinks = array();
foreach ($dws as $ws) {
$projectLinks[] = $ws->getId();
}
echo '<span class="project-replace">' . implode(',',$projectLinks) . '</span>';?>
<a class='internalLink' href='<?php echo $task->getViewUrl() ?>'><?php echo clean($task->getTitle())?><?php echo $text ?></a></td>
<?php /*<td align="right"><?php $timeslot = Timeslots::getOpenTimeslotByObject($task,logged_user());
if ($timeslot) {
if (!$timeslot->isPaused()) {?>
<div id="<?php echo $genid . $task->getId() ?>timespan"></div>
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:widget_active_tasks.php
示例17: strlen_utf
"></span>
<script>
var crumbHtml = <?php
echo $crumbJs;
?>
;
$("#object_crumb_<?php
echo $object->getId();
?>
").html(crumbHtml);
</script>
<?php
if ($object instanceof ProjectTask) {
$text = strlen_utf($object->getText()) > 100 ? substr_utf(html_to_text($object->getText()), 0, 100) . "..." : strip_tags($object->getText());
$text = remove_scripts($text);
if (strlen_utf($text) > 0) {
?>
- <span class="desc nobr"><?php
echo $text;
?>
</span>
<?php
}
?>
<?php
}
?>
</div>
</td>
</tr>
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:template.php
示例18: str_excerpt
/**
* Return begining of the string
*
* @param string $string
* @param integer $lenght
* @param string $etc
* @return string
*/
function str_excerpt($string, $lenght = 100, $etc = '...')
{
return strlen_utf($string) <= $lenght + 3 ? $string : substr_utf($string, 0, $lenght) . $etc;
}
开发者ID:hamednazari,项目名称:Vogram-1,代码行数:12,代码来源:functions_helper.php
示例19: format_date
}
$pre_tf = $real_start->getDay() == $real_duration->getDay() ? '' : 'D j, ';
$ev_hour_text = (!$event->isRepetitive() && $real_start->getDay() != $event_start->getDay()) ? "... ".format_date($real_duration, $timeformat, 0) : format_date($real_start, $timeformat, 0);
$assigned = "";
if ($event instanceof ProjectTask && $event->getAssignedToContactId() > 0) {
$assigned = "<br>" . lang('assigned to') .': '. $event->getAssignedToName();
$task_desc = purify_html($event->getText());
$tipBody = lang('assigned to') .': '. clean($event->getAssignedToName()) . (trim(clean($event->getText())) != '' ? '<br><br>' . trim($task_desc) : '');
} else {
$tipBody = format_date($real_start, $pre_tf.$timeformat, 0) .' - '. format_date($real_duration, $pre_tf.$timeformat, 0) . $assigned . (trim(clean($event->getDescription())) != '' ? '<br><br>' . clean($event->getDescription()) : '');
$tipBody = str_replace("\r", '', $tipBody);
$tipBody = str_replace("\n", '<br>', $tipBody);
}
if (strlen_utf($tipBody) > 200) $tipBody = substr_utf($tipBody, 0, strpos($tipBody, ' ', 200)) . ' ...';
$ev_duration = DateTimeValueLib::get_time_difference($event_start->getTimestamp(), $event_duration->getTimestamp());
$id_suffix = "_$day_of_week";
?>
<script>
if (<?php echo $top; ?> < scroll_to || scroll_to == -1) {
scroll_to = <?php echo $top;?>;
}
addTip('w_ev_div_' + '<?php echo $event->getId() . $id_suffix ?>', <?php echo json_encode(clean($event->getObjectName())) ?>, <?php echo json_encode($tipBody);?>);
</script>
<?php
$bold = "bold";
if ($event instanceof Contact || $event->getIsRead(logged_user()->getId())){
$bold = "normal";
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:viewweek.php
示例20: reset_password
/**
* Reset users password
*
* @param void
* @return null
*/
function reset_password()
{
$user_id = $this->request->getId('user_id');
$code = trim($this->request->get('code'));
if (empty($user_id) || empty($code)) {
$this->httpError(HTTP_ERR_INVALID_PROPERTIES);
}
// if
$user = null;
if ($user_id) {
$user = Users::findById($user_id);
}
// if
// Valid user and key
if (!instance_of($user, 'User')) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if ($user->getPasswordResetKey() != $code) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
// Not expired
$reset_on = $user->getPasswordResetOn();
if (instance_of($reset_on, 'DateTimeValue')) {
if ($reset_on->getTimestamp() + 172800 < time()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
} else {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
$reset_data = $this->request->post('reset');
$this->smarty->assign(array('reset_data' => $reset_data, 'user' => $user));
if ($this->request->isSubmitted()) {
$password = array_var($reset_data, 'password');
$password_a = array_var($reset_data, 'password_a');
$errors = new ValidationErrors();
if (strlen_utf($password) < 3) {
$errors->addError(lang('Minimal password length is 3 characters'), 'password');
}
// if
if ($password != $password_a) {
$errors->addError(lang('Passwords do not match'), 'passwords');
}
// if
if ($errors->hasErrors()) {
$this->smarty->assign('errors', $errors);
$this->render();
}
// if
$user->setPassword($password);
$user->setPasswordResetKey(null);
$user->setPasswordResetOn(null);
$save = $user->save();
if ($save && !is_error($save)) {
$this->authentication->provider->logUserIn($user);
flash_success('Welcome back :name', array('name' => $user->getDisplayName()));
$this->redirectTo('dashboard');
} else {
$this->smarty->assign('errors', $errors);
}
// if
}
// if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:73,代码来源:AuthController.class.php
注:本文中的strlen_utf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论