本文整理汇总了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;
}
示例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;
}
示例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&categoryid=" . $categoryObj->getVar('categoryid') . "&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&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 .= ' ';
}
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='' /> " . $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);
}