当前位置: 首页>>代码示例>>PHP>>正文


PHP XoopsLocale::isMultiByte方法代码示例

本文整理汇总了PHP中XoopsLocale::isMultiByte方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLocale::isMultiByte方法的具体用法?PHP XoopsLocale::isMultiByte怎么用?PHP XoopsLocale::isMultiByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XoopsLocale的用法示例。


在下文中一共展示了XoopsLocale::isMultiByte方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: xlanguage_convert_item

/**
 * @param string $value
 * @param string $out_charset
 * @param string $in_charset
 *
 * @return string
 */
function xlanguage_convert_item($value, $out_charset, $in_charset)
{
    $xoops = Xoops::getInstance();
    if (strtolower($in_charset) == strtolower($out_charset)) {
        return $value;
    }
    $xconv_handler = $xoops->getModuleHandler('xconv', 'xconv', true);
    if (is_object($xconv_handler) && ($converted_value = @$xconv_handler->convert_encoding($value, $out_charset, $in_charset))) {
        return $converted_value;
    }
    if (XoopsLocale::isMultiByte() && function_exists('mb_convert_encoding')) {
        $converted_value = @mb_convert_encoding($value, $out_charset, $in_charset);
    } elseif (function_exists('iconv')) {
        $converted_value = @iconv($in_charset, $out_charset, $value);
    }
    $value = empty($converted_value) ? $value : $converted_value;
    return $value;
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:25,代码来源:functions.php

示例2: body

 /**
  * This method returns the body to be displayed. Not to be used for editing
  *
  * @param int    $maxLength
  * @param string $format
  * @param string $stripTags
  *
  * @return mixed|string
  */
 public function body($maxLength = 0, $format = 'S', $stripTags = '')
 {
     $ret = $this->getVar('body', $format);
     $wrap_pos = strpos($ret, '[pagewrap=');
     if (!($wrap_pos === false)) {
         $wrap_pages = array();
         $wrap_code_length = strlen('[pagewrap=');
         while (!($wrap_pos === false)) {
             $end_wrap_pos = strpos($ret, ']', $wrap_pos);
             if ($end_wrap_pos) {
                 $wrap_page_name = substr($ret, $wrap_pos + $wrap_code_length, $end_wrap_pos - $wrap_code_length - $wrap_pos);
                 $wrap_pages[] = $wrap_page_name;
             }
             $wrap_pos = strpos($ret, '[pagewrap=', $end_wrap_pos - 1);
         }
         foreach ($wrap_pages as $page) {
             $wrap_page_content = $this->wrappage($page);
             $ret = str_replace("[pagewrap={$page}]", $wrap_page_content, $ret);
         }
     }
     if ($this->publisher->getConfig('item_disp_blocks_summary')) {
         $summary = $this->summary($maxLength, $format, $stripTags);
         if ($summary) {
             $ret = $this->summary() . '<br /><br />' . $ret;
         }
     }
     if (!empty($stripTags)) {
         $ret = strip_tags($ret, $stripTags);
     }
     if ($maxLength != 0) {
         if (!XoopsLocale::isMultiByte()) {
             if (strlen($ret) >= $maxLength) {
                 //$ret = PublisherUtils::substr($ret , 0, $maxLength);
                 $ret = PublisherUtils::truncateTagSafe($ret, $maxLength, $etc = '...', $break_words = false);
             }
         }
     }
     return $ret;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:48,代码来源:item.php

示例3: publisher_displayCategory

function publisher_displayCategory(PublisherCategory $categoryObj, $level = 0)
{
    $publisher = Publisher::getInstance();
    $description = $categoryObj->getVar('description');
    if (!XoopsLocale::isMultiByte()) {
        if (strlen($description) >= 100) {
            $description = substr($description, 0, 100 - 1) . "...";
        }
    }
    $modify = "<a href='category.php?op=mod&amp;categoryid=" . $categoryObj->getVar('categoryid') . "&amp;parentid=" . $categoryObj->getVar('parentid') . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>";
    $delete = "<a href='category.php?op=del&amp;categoryid=" . $categoryObj->getVar('categoryid') . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>";
    $spaces = '';
    for ($j = 0; $j < $level; ++$j) {
        $spaces .= '&nbsp;&nbsp;&nbsp;';
    }
    echo "<tr>";
    echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . "/category.php?categoryid=" . $categoryObj->getVar('categoryid') . "'><img src='" . PUBLISHER_URL . "/images/links/subcat.gif' alt='' />&nbsp;" . $categoryObj->getVar('name') . "</a></td>";
    echo "<td class='even' align='center'>" . $categoryObj->getVar('weight') . "</td>";
    echo "<td class='even' align='center'> {$modify} {$delete} </td>";
    echo "</tr>";
    $subCategoriesObj = $publisher->getCategoryHandler()->getCategories(0, 0, $categoryObj->getVar('categoryid'));
    if (count($subCategoriesObj) > 0) {
        ++$level;
        foreach ($subCategoriesObj as $thiscat) {
            publisher_displayCategory($thiscat, $level);
        }
    }
    unset($categoryObj);
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:29,代码来源:category.php


注:本文中的XoopsLocale::isMultiByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。