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


PHP EasyBlogRouter::generatePermalink方法代码示例

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


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

示例1: getPermalink

 public static function getPermalink($title)
 {
     $permalink = EasyBlogRouter::generatePermalink($title);
     // Make sure no such permalink exists.
     $originalSlug = $permalink;
     $i = 1;
     while (EasyBlogRouter::_isBlogPermalinkExists($permalink)) {
         $permalink = $originalSlug . '-' . $i;
         $i++;
     }
     return $permalink;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:12,代码来源:helper.php

示例2: getBloggerPermalink

 public static function getBloggerPermalink($id)
 {
     $config = EasyBlogHelper::getConfig();
     JTable::addIncludePath(EBLOG_TABLES);
     if ($id == 0) {
         $id = null;
     }
     $user = JFactory::getUser($id);
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($id);
     $profile->setUser($user);
     if (empty($user->username)) {
         // blogger not exists
         return JText::_('COM_EASYBLOG_INVALID_PERMALINK_BLOGGER');
     }
     $bloggerPermalink = $profile->permalink;
     if (empty($bloggerPermalink)) {
         $bloggerPermalink = EasyBlogRouter::generatePermalink($user->username);
         $db = EasyBlogHelper::db();
         $query = 'UPDATE `#__easyblog_users` SET `permalink` =' . $db->Quote($bloggerPermalink) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('id') . '=' . $db->Quote($profile->id);
         $db->setQuery($query);
         $db->query();
     }
     if ($config->get('main_sef_unicode')) {
         return $profile->id . '-' . $bloggerPermalink;
     } else {
         return $bloggerPermalink;
     }
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:29,代码来源:router.php

示例3: bind

 /**
  * Must only be bind when using POST data
  **/
 function bind($data, $post = false)
 {
     parent::bind($data);
     if ($post) {
         $acl = EasyBlogACLHelper::getRuleSet();
         $my = JFactory::getUser();
         // Some properties needs to be overriden.
         $content = JRequest::getVar('write_content_hidden', '', 'post', 'string', JREQUEST_ALLOWRAW);
         if ($this->id == 0) {
             // this is to check if superadmin assign blog author during blog creation.
             if (empty($this->created_by)) {
                 $this->created_by = $my->id;
             }
         }
         //remove unclean editor code.
         $pattern = array('/<p><br _mce_bogus="1"><\\/p>/i', '/<p><br mce_bogus="1"><\\/p>/i', '/<br _mce_bogus="1">/i', '/<br mce_bogus="1">/i', '/<p><br><\\/p>/i');
         $replace = array('', '', '', '', '');
         $content = preg_replace($pattern, $replace, $content);
         // Search for readmore tags using Joomla's mechanism
         $pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i';
         $pos = preg_match($pattern, $content);
         if ($pos == 0) {
             $this->intro = $content;
             // @rule: Since someone might update this post, we need to clear out the content
             // if it doesn't contain anything.
             $this->content = '';
         } else {
             list($intro, $main) = preg_split($pattern, $content, 2);
             $this->intro = $intro;
             $this->content = $main;
         }
         $publish_up = '';
         $publish_down = '';
         $created_date = '';
         $tzoffset = EasyBlogDateHelper::getOffSet();
         if (!empty($this->created)) {
             $date = EasyBlogHelper::getDate($this->created, $tzoffset);
             $created_date = $date->toMySQL();
         }
         if ($this->publish_down == '0000-00-00 00:00:00') {
             $publish_down = $this->publish_down;
         } else {
             if (!empty($this->publish_down)) {
                 $date = EasyBlogHelper::getDate($this->publish_down, $tzoffset);
                 $publish_down = $date->toMySQL();
             }
         }
         if (!empty($this->publish_up)) {
             $date = EasyBlogHelper::getDate($this->publish_up, $tzoffset);
             $publish_up = $date->toMySQL();
         }
         //default joomla date obj
         $date = EasyBlogHelper::getDate();
         $this->created = !empty($created_date) ? $created_date : $date->toMySQL();
         $this->modified = $date->toMySQL();
         $this->publish_up = !empty($publish_up) ? $publish_up : $date->toMySQL();
         $this->publish_down = empty($publish_down) ? '0000-00-00 00:00:00' : $publish_down;
         $this->ispending = empty($acl->rules->publish_entry) ? 1 : 0;
         $this->title = trim($this->title);
         $i = 1;
         while ($this->aliasExists() || empty($this->permalink)) {
             $this->permalink = empty($this->permalink) ? $this->title : $this->permalink . '-' . $i;
             $i++;
         }
         $this->permalink = EasyBlogRouter::generatePermalink($this->permalink);
     }
     return true;
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:71,代码来源:blog.php

示例4: bind

 /**
  * Overrides parent's bind method to add our own logic.
  *
  * @param Array $data
  **/
 function bind($data, $ignore = array())
 {
     parent::bind($data, $ignore);
     if (empty($this->created)) {
         $this->created = EasyBlogHelper::getDate()->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 	= JFilterOutput::stringURLSafe( $this->alias );
     $this->alias = EasyBlogRouter::generatePermalink($this->alias);
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:20,代码来源:category.php

示例5: store

 public function store($updateNulls = false)
 {
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     // @rule: Check for empty title
     if (empty($this->title)) {
         $this->setError(JText::_('COM_EASYBLOG_INVALID_TAG'));
         return false;
     }
     // @rule: Check if such tag exists.
     if ($this->exists($this->title, !$this->id)) {
         $this->setError(JText::_('COM_EASYBLOG_TAG_ALREADY_EXISTS'));
         return false;
     }
     // @task: If alias is null, we need to generate them here.
     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 = EasyBlogRouter::generatePermalink($this->alias);
     if (!empty($this->created)) {
         $offset = EasyBlogDateHelper::getOffSet();
         $newDate = EasyBlogHelper::getDate($this->created, $offset);
         $this->created = $newDate->toMySQL();
     } else {
         $newDate = EasyBlogHelper::getDate();
         $this->created = $newDate->toMySQL();
     }
     $isNew = !$this->id;
     $state = parent::store();
     $my = JFactory::getUser();
     if ($isNew && $my->id != 0) {
         JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
         $config = EasyBlogHelper::getConfig();
         // @rule: Integrations with EasyDiscuss
         EasyBlogHelper::getHelper('EasyDiscuss')->log('easyblog.new.tag', $my->id, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_TAG', $this->title));
         EasyBlogHelper::getHelper('EasyDiscuss')->addPoint('easyblog.new.tag', $my->id);
         EasyBlogHelper::getHelper('EasyDiscuss')->addBadge('easyblog.new.tag', $my->id);
         // Assign EasySocial points
         $easysocial = EasyBlogHelper::getHelper('EasySocial');
         $easysocial->assignPoints('tag.create', $my->id);
         if ($config->get('main_jomsocial_userpoint')) {
             $jsUserPoint = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'userpoints.php';
             if (JFile::exists($jsUserPoint)) {
                 require_once $jsUserPoint;
                 CUserPoints::assignPoint('com_easyblog.tag.add', $my->id);
             }
         }
         // AlphaUserPoints
         // since 1.2
         if (EasyBlogHelper::isAUPEnabled()) {
             AlphaUserPointsHelper::newpoints('plgaup_easyblog_add_tag', '', 'easyblog_add_tag_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_TAG_ADDED', $this->title));
         }
     }
     if ($state) {
         //activity logging.
         $activity = new stdClass();
         $activity->actor_id = $my->id;
         $activity->target_id = '0';
         $activity->context_type = 'tag';
         $activity->context_id = $this->id;
         $activity->verb = $isNew ? 'add' : 'update';
         $activity->uuid = $this->title;
         EasyBlogHelper::activityLog($activity);
     }
     return $state;
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:68,代码来源:tag.php


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