本文整理汇总了PHP中XoopsLocale::convert_encoding方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLocale::convert_encoding方法的具体用法?PHP XoopsLocale::convert_encoding怎么用?PHP XoopsLocale::convert_encoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsLocale
的用法示例。
在下文中一共展示了XoopsLocale::convert_encoding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decode
/**
* @return string
*/
public static function decode($url, $width, $height)
{
$config = parent::loadConfig(__DIR__);
if (empty($url) || empty($config['link'])) {
return $url;
}
$charset = !empty($config['charset']) ? $config['charset'] : "UTF-8";
$ret = "<a href='" . sprintf($config['link'], urlencode(XoopsLocale::convert_encoding($url, $charset))) . "' rel='external' title=''>{$text}</a>";
return $ret;
}
示例2: buildRssFeedCache
function buildRssFeedCache($rssurl)
{
$snoopy = new Snoopy();
$cnt = 0;
foreach ($rssurl as $url) {
if ($snoopy->fetch($url)) {
$rssdata = $snoopy->results;
$rss2parser = new XoopsXmlRss2Parser($rssdata);
if (false != $rss2parser->parse()) {
$_items = $rss2parser->getItems();
$count = count($_items);
for ($i = 0; $i < $count; $i++) {
$_items[$i]['title'] = XoopsLocale::convert_encoding($_items[$i]['title'], XoopsLocale::getCharset(), 'UTF-8');
$_items[$i]['description'] = XoopsLocale::convert_encoding($_items[$i]['description'], XoopsLocale::getCharset(), 'UTF-8');
$items[(string) strtotime($_items[$i]['pubdate']) . "-" . (string) ++$cnt] = $_items[$i];
}
} else {
echo $rss2parser->getErrors();
}
}
}
krsort($items);
return $items;
}
示例3: getimagesize
$dimension = getimagesize($xoops->path($imgPath));
$tpl->assign('image_width', $dimension[0]);
$tpl->assign('image_height', $dimension[1]);
$items = array();
if ($xoops->isModule()) {
/* @var $plugin SystemPluginInterface */
$plugin = Xoops_Module_Plugin::getPlugin($dirname, 'system');
$res = $plugin->backend(10);
if (is_array($res) && count($res) > 0) {
foreach ($res as $item) {
$date[] = array('date' => $item['date']);
$items[] = array('date' => XoopsLocale::formatTimestamp($item['date'], 'rss'), 'title' => XoopsLocale::convert_encoding(htmlspecialchars($item['title'])), 'content' => XoopsLocale::convert_encoding(htmlspecialchars($item['content'])), 'link' => $item['link'], 'guid' => $item['link']);
}
}
} else {
$plugins = Xoops_Module_Plugin::getPlugins('system');
/* @var $plugin SystemPluginInterface */
foreach ($plugins as $plugin) {
$res = $plugin->backend(10);
if (is_array($res) && count($res) > 0) {
foreach ($res as $item) {
$date[] = array('date' => $item['date']);
$items[] = array('date' => XoopsLocale::formatTimestamp($item['date'], 'rss'), 'title' => XoopsLocale::convert_encoding(htmlspecialchars($item['title'])), 'content' => XoopsLocale::convert_encoding(htmlspecialchars($item['content'])), 'link' => $item['link'], 'guid' => $item['link']);
}
}
}
}
array_multisort($date, SORT_DESC, $items);
$tpl->assign('items', $items);
}
$tpl->display('module:' . $dirname . '/system_rss.tpl');