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


PHP Slug::get方法代碼示例

本文整理匯總了PHP中Slug::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Slug::get方法的具體用法?PHP Slug::get怎麽用?PHP Slug::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Slug的用法示例。


在下文中一共展示了Slug::get方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: elseif

 /**
  * Get the item tinyslug. If not exists -> create new
  *
  * @return string|boolean tinyslug on success, false otherwise
  */
 function get_tinyslug()
 {
     global $preview;
     $tinyslug_ID = $this->tiny_slug_ID;
     if ($tinyslug_ID != NULL) {
         // the tiny slug for this item was already created
         $SlugCache =& get_SlugCache();
         $Slug =& $SlugCache->get_by_ID($tinyslug_ID, false, false);
         return $Slug === false ? false : $Slug->get('title');
     } elseif ($this->ID > 0 && !$preview) {
         // create new tiny Slug for this item
         // Note: This may happen only in case of posts created before the tiny slug was introduced
         global $DB;
         load_funcs('slugs/model/_slug.funcs.php');
         $Slug = new Slug();
         $Slug->set('title', getnext_tinyurl());
         $Slug->set('itm_ID', $this->ID);
         $Slug->set('type', 'item');
         $DB->begin();
         if (!$Slug->dbinsert()) {
             // Slug dbinsert failed
             $DB->rollback();
             return false;
         }
         $this->set('tiny_slug_ID', $Slug->ID);
         // Update Item preserving mod date:
         if (!$this->dbupdate(false)) {
             // Item dbupdate failed
             $DB->rollback();
             return false;
         }
         $DB->commit();
         // update last tinyurl value on database
         // Note: This doesn't have to be part of the above transaction, no problem if it doesn't succeed to update, or if override a previously updated value.
         global $Settings;
         $Settings->set('tinyurl', $Slug->get('title'));
         $Settings->dbupdate();
         return $Slug->get('title');
     }
     return false;
 }
開發者ID:Ariflaw,項目名稱:b2evolution,代碼行數:46,代碼來源:_item.class.php


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