當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DiscussHelper::permalinkSlug方法代碼示例

本文整理匯總了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;
 }
開發者ID:pguilford,項目名稱:vcomcc,代碼行數:18,代碼來源:helper.php

示例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);
 }
開發者ID:BetterBetterBetter,項目名稱:B3App,代碼行數:20,代碼來源:tags.php

示例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);
         }
     }
 }
開發者ID:pguilford,項目名稱:vcomcc,代碼行數:21,代碼來源:profile.php

示例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;
 }
開發者ID:BetterBetterBetter,項目名稱:B3App,代碼行數:14,代碼來源:category.php


注:本文中的DiscussHelper::permalinkSlug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。