当前位置: 首页>>代码示例>>PHP>>正文


PHP EBR::normalizePermalink方法代码示例

本文整理汇总了PHP中EBR::normalizePermalink方法的典型用法代码示例。如果您正苦于以下问题:PHP EBR::normalizePermalink方法的具体用法?PHP EBR::normalizePermalink怎么用?PHP EBR::normalizePermalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EBR的用法示例。


在下文中一共展示了EBR::normalizePermalink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Override parent's implementation of store
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function store($updateNulls = false)
 {
     if (!$this->created) {
         $this->created = EB::date()->toSql();
     }
     // Generate an alias if alias is empty
     if (!$this->alias) {
         $this->alias = EBR::normalizePermalink($this->title);
     }
     $my = JFactory::getUser();
     // Add point integrations for new categories
     if ($this->id == 0 && $my->id > 0) {
         EB::loadLanguages();
         // Integrations with EasyDiscuss
         EB::easydiscuss()->log('easyblog.new.category', $my->id, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_CATEGORY', $this->title));
         EB::easydiscuss()->addPoint('easyblog.new.category', $my->id);
         EB::easydiscuss()->addBadge('easyblog.new.category', $my->id);
         // AlphaUserPoints
         EB::aup()->assign('plgaup_easyblog_add_category', '', 'easyblog_add_category_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_NEW_CATEGORY_CREATED', $this->title));
         // JomSocial integrations
         EB::jomsocial()->assignPoints('com_easyblog.category.add', $my->id);
         // Assign EasySocial points
         EB::easysocial()->assignPoints('category.create', $my->id);
     }
     // Figure out the proper nested set model
     if ($this->id == 0 && $this->lft == 0) {
         // No parent id, we use the current lft,rgt
         if ($this->parent_id) {
             $left = $this->getLeft($this->parent_id);
             $this->lft = $left;
             $this->rgt = $this->lft + 1;
             // Update parent's right
             $this->updateRight($left);
             $this->updateLeft($left);
         } else {
             $this->lft = $this->getLeft() + 1;
             $this->rgt = $this->lft + 1;
         }
     }
     if ($this->id == 0) {
         // new cats. we need to store the ordering.
         $this->ordering = $this->getOrdering($this->parent_id) + 1;
     }
     $isNew = !$this->id ? true : false;
     $state = parent::store();
     return $state;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:55,代码来源:category.php

示例2: normalizePermalink

 /**
  * Converts a string into a valid permalink
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function normalizePermalink($string, $postId = null)
 {
     $permalink = EBR::normalizePermalink($string);
     $i = 1;
     while ($this->permalinkExists($permalink, $postId)) {
         $permalink = $string . '-' . $i;
         $i++;
     }
     $permalink = EBR::normalizePermalink($permalink);
     return $permalink;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:19,代码来源:blog.php

示例3: newCategory

 /**
  * Creates a new category on the site.
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public static function newCategory($blogId, $username, $password, $data)
 {
     global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
     // Login the user
     $state = self::login($username, $password);
     if ($state !== true) {
         return $state;
     }
     $category = EB::table('Category');
     if (isset($data['name'])) {
         $category->title = $data['name'];
     }
     if (isset($data['slug'])) {
         $category->alias = EBR::normalizePermalink($data['slug']);
     }
     if (isset($data['parent_id'])) {
         $category->parent_id = $data['parent_id'];
     }
     // Set the state to published
     $category->published = true;
     $category->created_by = JFactory::getUser()->id;
     // Save the category.
     $state = $category->store();
     if (!$state) {
         return new xmlrpcresp(0, $xmlrpcerruser + 1, $category->getError());
     }
     return new xmlrpcresp(new xmlrpcval($category->id, $xmlrpcInt));
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:36,代码来源:services.php

示例4: getAlias

 /**
  * Retrieves the alias of a post
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getAlias()
 {
     static $permalinks = array();
     if (!isset($permalinks[$this->id])) {
         $date = EB::date($this->created);
         // Default permalink
         $permalink = $this->permalink;
         // Ensure that the permalink is valid.
         $permalink = EBR::normalizePermalink($permalink);
         if ($this->config->get('main_sef_unicode') || !EBR::isSefEnabled()) {
             $permalink = $this->id . '-' . $permalink;
         }
         // Date based permalink
         $datePermalink = $date->format('Y') . '/' . $date->format('m') . '/' . $date->format('d');
         // Date based SEF settings
         if ($this->config->get('main_sef') == 'date') {
             $permalink = $datePermalink . '/' . $permalink;
         }
         // Category based permalink type
         if ($this->config->get('main_sef') == 'datecategory' || $this->config->get('main_sef') == 'category') {
             // Get the current primary category
             $category = $this->getPrimaryCategory();
             $categoryPermalink = $category->getAlias();
             // Date and category based permalink type
             if ($this->config->get('main_sef') == 'datecategory') {
                 $permalink = $categoryPermalink . '/' . $datePermalink . '/' . $permalink;
             } else {
                 $permalink = $categoryPermalink . '/' . $permalink;
             }
         }
         // Custom based permalink type
         if ($this->config->get('main_sef') == 'custom') {
             $permalink = EBR::getCustomPermalink($this);
         }
         $permalinks[$this->id] = $permalink;
     }
     return $permalinks[$this->id];
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:46,代码来源:post.php

示例5: getAlias

 /**
  * Retrieves the alias for this author
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getAlias()
 {
     static $permalinks = array();
     if (!isset($permalinks[$this->id])) {
         $config = EB::config();
         if (!$this->user && $this->id) {
             $this->user = JFactory::getuser($this->id);
         }
         // If the username is invalid
         if (!$this->user->username) {
             return JText::_('COM_EASYBLOG_INVALID_PERMALINK_BLOGGER');
         }
         // If user doesn't have a permalink, generate it for them
         if (!$this->permalink) {
             $this->permalink = EBR::normalizePermalink($this->user->username);
             $this->store();
         }
         $permalink = $this->permalink;
         if ($config->get('main_sef_unicode') || !EBR::isSefEnabled()) {
             $permalink = $this->id . '-' . $this->permalink;
         }
         $permalinks[$this->id] = $permalink;
     }
     return $permalinks[$this->id];
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:33,代码来源:profile.php

示例6: bind

 /**
  * Binds the posted data with the object
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function bind($data, $ignore = array())
 {
     parent::bind($data, $ignore);
     if (empty($this->created)) {
         $date = EB::date();
         $this->created = $date->toMySQL();
     }
     // we check the alias only when this teamblog is a new teamblog or the alias is empty
     if (empty($this->id) || empty($this->alias)) {
         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 = EBR::normalizePermalink($this->alias);
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:26,代码来源:teamblog.php


注:本文中的EBR::normalizePermalink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。