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


PHP Slug::slugify方法代码示例

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


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

示例1: buildLanguageMenu

 /**
  * This method builds a menu.
  *
  * @access private
  * @author Kalmer Piiskop
  * @param string  $parameters['id']      the ID of the object
  * @param boolean $parameters['isError'] Are we in the error state?
  * @param string  $parameters['type']    the type of the object
  * @param string  $parameters['suffix']  the suffix
  * @param integer $parameters['width']   the width of <code>body</code> in
  * 		pixels
  * @return string the parsed menu
  * @uses ALIAS_HUMAN_LIST   for the translation of the list of humans
  * @uses ALIAS_OF_LANGUAGES for the list of languages
  * @uses ALT_LANGUAGE       for the alternative text of the update indicator
  * @uses DOMAIN             for addressing
  * @uses IMAGES_FOLDER      for displaying images
  * @uses O_FOLDER           for the common files
  * @uses LANGUAGE           for languages
  * @uses TITLE_LANGUAGE     for the explanation of the change of the
  * 		language
  */
 private static function buildLanguageMenu($parameters)
 {
     if (!isset($parameters['isError']) || !$parameters['isError']) {
         require_once 'HTML/Template/IT.php';
         $tpl = new \HTML_Template_IT(sprintf('%1$s/../assets/tpl/%2$u', dirname(__FILE__), $parameters['width']));
         $tpl->loadTemplatefile('languages.tpl');
         require_once O_FOLDER . '/keeled/Language.php';
         $language = new Language();
         if (isset($_SESSION['language'])) {
             $language->setId($_SESSION['language']);
             $idOfLanguageToExclude = $_SESSION['language'];
         } else {
             $language->setId(DEFAULT_LANGUAGE);
             $idOfLanguageToExclude = DEFAULT_LANGUAGE;
         }
         $language->setLanguage();
         require_once O_FOLDER . 'errors/Error.php';
         // echo ' 1658: ', $parameters['type'];
         $languagesInUse = Language::createLanguagesInUse(array('classes' => array('SystemMenuItem', 'Page', 'PageNews', 'SystemString'), 'idOfLanguageToExclude' => $idOfLanguageToExclude, 'object' => isset($parameters['id']) ? Error::requireFile(array('id' => $parameters['id'], 'type' => $parameters['type'], 'isInstance' => TRUE, 'isToBeCompleted' => TRUE, 'isView' => FALSE)) : NULL));
         // echo ' 1675: <pre>';print_r($languageInUse); echo '</pre>';
         $numberOfLanguage = 0;
         foreach ($languagesInUse as $languageInUse) {
             $numberOfLanguage++;
             if ($numberOfLanguage < 3) {
                 switch ($parameters['type']) {
                     case 'Error':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('errors_Error_error');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'Feedback':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('configuration_formOfFeedback');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'Hierarchy':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('configuration_hierarchy');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'Humans':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId(ALIAS_HUMAN_LIST);
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'Pages':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('configuration_pages');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'SystemStrings':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('configuration_systemStrings');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     default:
                         require_once O_FOLDER . '/errors/Error.php';
                         $object = Error::requireFile(array('id' => $parameters['id'], 'type' => $parameters['type'], 'isInstance' => TRUE, 'isToBeCompleted' => TRUE, 'typeOfError' => 'JSON', 'isInstance' => TRUE, 'isView' => FALSE));
                         $object->setIdOfLanguage($languageInUse['id']);
                         $title = $object->translate(array('block' => 'title'));
                         // echo ' 1717: ', $title;
                         require_once O_FOLDER . 'Slug.php';
                         $alias = Slug::slugify(array('original' => $title));
                 }
                 $currentLanguage = new Language();
                 $currentLanguage->setId($languageInUse['id']);
//.........这里部分代码省略.........
开发者ID:piiskop,项目名称:pstk,代码行数:101,代码来源:BodyView.php

示例2: getLinkId

 public function getLinkId()
 {
     return Slug::slugify($this->getName() . "-" . $this->RefId);
 }
开发者ID:vtex,项目名称:MagentoToVtex,代码行数:4,代码来源:Product.php

示例3: processForm

 /**
  * Proces club before form handleRequest
  * 
  * @param Club $club
  */
 private function processForm(Athlete $athlete)
 {
     if ($athlete->getSlug() == null) {
         $em = $this->getDoctrine()->getManager();
         $i = 1;
         $slug = Slug::slugify($athlete->getTitle());
         $exists = $em->getRepository("OesteveGrupetaBundle:Athlete")->findOneBy(array('slug' => $slug));
         while ($exists != null) {
             $slug = Slug::slugify($athlete->getTitle() . '-' . $i++);
             $exists = $em->getRepository("OesteveGrupetaBundle:Athlete")->findOneBy(array('slug' => $slug));
         }
         $athlete->setSlug($slug);
     }
     if ($athlete->getImageFile() != null) {
         $image = new Image();
         $image->setFile($athlete->getImageFile());
         $image->setName($athlete->getImageFile()->getClientOriginalName());
         $athlete->setImage($image);
     }
     if ($athlete->getCoverImageFile() != null) {
         $image = new Image();
         $image->setFile($athlete->getCoverImageFile());
         $image->setName($athlete->getCoverImageFile()->getClientOriginalName());
         $athlete->setCoverImage($image);
     }
     return $athlete;
 }
开发者ID:oesteve,项目名称:grupeta,代码行数:32,代码来源:AthleteController.php


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