本文整理汇总了PHP中DiscussHelper::permalinkSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::permalinkSlug方法的具体用法?PHP DiscussHelper::permalinkSlug怎么用?PHP DiscussHelper::permalinkSlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::permalinkSlug方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAlias
public static function getAlias($title, $type = 'post', $id = '0')
{
$items = explode(' ', $title);
foreach ($items as $index => $item) {
if (strpos($item, '*') !== false) {
$items[$index] = 'censored';
}
}
$title = implode($items, ' ');
$alias = DiscussHelper::permalinkSlug($title);
// Make sure no such alias exists.
$i = 1;
while (DiscussRouter::_isAliasExists($alias, $type, $id)) {
$alias = DiscussHelper::permalinkSlug($title) . '-' . $i;
$i++;
}
return $alias;
}
示例2: bind
/**
* Overrides parent's bind method to add our own logic.
*
* @param Array $data
**/
public function bind($data, $ignore = array())
{
parent::bind($data);
if (empty($this->created)) {
$date = DiscussHelper::getDate();
$this->created = $date->toMySQL();
}
jimport('joomla.filesystem.filter.filteroutput');
$i = 1;
while ($this->aliasExists() || empty($this->alias)) {
$this->alias = empty($this->alias) ? $this->title : $this->alias . '-' . $i;
$i++;
}
$this->alias = DiscussHelper::permalinkSlug($this->alias);
}
示例3: _createDefault
public function _createDefault($id)
{
$db = DiscussHelper::getDBO();
$user = JFactory::getUser($id);
$date = DiscussHelper::getDate();
if ($user->id) {
$obj = new stdClass();
$obj->id = $user->id;
$obj->nickname = $user->name;
$obj->avatar = 'default.png';
$obj->description = '';
$obj->url = '';
$obj->params = '';
//default to username for blogger alias
$obj->alias = DiscussHelper::permalinkSlug($user->username);
$isCreated = $db->insertObject('#__discuss_users', $obj);
if ($isCreated) {
$this->bind($obj);
}
}
}
示例4: setAlias
public function setAlias()
{
jimport('joomla.filesystem.filter.filteroutput');
$i = 1;
$alias = $this->alias ? $this->alias : $this->title;
$alias = DiscussHelper::permalinkSlug($alias);
$tmp = $alias;
while ($this->aliasExists($tmp) || empty($tmp)) {
$alias = empty($alias) ? DiscussHelper::permalinkSlug($this->title) : $alias;
$tmp = empty($tmp) ? DiscussHelper::permalinkSlug($this->title) : $alias . '-' . $i;
$i++;
}
$this->alias = $tmp;
}