本文整理汇总了PHP中DiscussHelper::permalinkUnicodeSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::permalinkUnicodeSlug方法的具体用法?PHP DiscussHelper::permalinkUnicodeSlug怎么用?PHP DiscussHelper::permalinkUnicodeSlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::permalinkUnicodeSlug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: permalinkSlug
public static function permalinkSlug($string)
{
$config = DiscussHelper::getConfig();
if ($config->get('main_sef_unicode')) {
// Unicode support.
$alias = DiscussHelper::permalinkUnicodeSlug($string);
} else {
// Replace accents to get accurate string
//$alias = DiscussRouter::replaceAccents( $string );
// hällö wörldß became hallo-world instead haelloe-woerld thus above line is commented
// for consistency with joomla
$alias = JFilterOutput::stringURLSafe($string);
// check if anything return or not. If not, then we give a date as the alias.
if (trim(str_replace('-', '', $alias)) == '') {
$alias = DiscussHelper::getDate()->format("Y-m-d-H-i-s");
}
}
return $alias;
}
示例2: getUserAlias
public static function getUserAlias($id)
{
static $loaded = array();
if (!isset($loaded[$id])) {
$config = DiscussHelper::getConfig();
$profile = DiscussHelper::getTable('Profile');
$profile->load($id);
if ($config->get('main_sef_user') == 'realname') {
$urlname = $profile->id . ':' . $profile->user->name;
}
if ($config->get('main_sef_user') == 'username') {
$urlname = $profile->id . ':' . $profile->user->username;
}
if ($config->get('main_sef_user') == 'default') {
$urlname = empty($profile->alias) ? $profile->user->name : $profile->alias;
}
$urlname = DiscussHelper::permalinkUnicodeSlug($urlname);
if ($config->get('main_sef_unicode')) {
//unicode support.
$alias = DiscussHelper::permalinkUnicodeSlug($urlname);
} else {
$alias = JFilterOutput::stringURLSafe($urlname);
}
$loaded[$id] = $alias;
}
return $loaded[$id];
}