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


PHP Tag::normalize方法代码示例

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


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

示例1: test_normalize

 public function test_normalize()
 {
     $tests = array('FOO' => 'foo', '   foo' => 'foo', 'foo  ' => 'foo', ' foo ' => 'foo', 'foo-bar' => 'foobar', ' FOo-bar ' => 'foobar');
     foreach ($tests as $tag => $normalized_tag) {
         $this->assertEqual($normalized_tag, Tag::normalize($tag));
     }
 }
开发者ID:emacsattic,项目名称:symfony,代码行数:7,代码来源:TagTest.php

示例2: removeTag

 public function removeTag($question, $tag)
 {
     $c = new Criteria();
     $c->add(QuestionTagPeer::QUESTION_ID, $question->getId());
     $c->add(QuestionTagPeer::USER_ID, $this->getId());
     $c->add(QuestionTagPeer::NORMALIZED_TAG, Tag::normalize($tag));
     QuestionTagPeer::doDelete($c);
 }
开发者ID:emacsattic,项目名称:symfony,代码行数:8,代码来源:User.php

示例3: execute

 /**
  * Execute this filter.
  *
  * @param FilterChain The filter chain.
  *
  * @return void
  * @throws <b>FilterException</b> If an erro occurs during execution.
  */
 public function execute($filterChain)
 {
     // execute this filter only once
     if (sfConfig::get('app_universe') && $this->isFirstCall()) {
         // is there a tag in the hostname?
         $request = $this->getContext()->getRequest();
         $hostname = $request->getHost();
         if (!preg_match($this->getParameter('host_exclude_regex'), $hostname) && ($pos = strpos($hostname, '.'))) {
             $tag = Tag::normalize(substr($hostname, 0, $pos));
             // add a permanent tag constant
             sfConfig::set('app_permanent_tag', $tag);
             // add a custom stylesheet
             $this->getContext()->getResponse()->addStylesheet($tag);
             // is the tag a culture?
             if (is_readable(sfConfig::get('sf_app_i18n_dir') . '/messages.' . strtolower($tag) . '.xml')) {
                 $this->getContext()->getUser()->setCulture(strtolower($tag));
             } else {
                 $this->getContext()->getUser()->setCulture('en');
             }
         }
     }
     // execute next filter
     $filterChain->execute();
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:32,代码来源:myTagFilter.class.php

示例4: executeShow

 public function executeShow()
 {
     $this->question_pager = QuestionPeer::getPopularByTag($this->getRequestParameter('tag'), $this->getRequestParameter('page', 1));
     $this->getResponse()->setTitle('askeet! &raquo; question tagged ' . Tag::normalize($this->getRequestParameter('tag')));
 }
开发者ID:emacsattic,项目名称:symfony,代码行数:5,代码来源:actions.class.php

示例5: setTag

 public function setTag($v)
 {
     parent::setTag($v);
     $this->setNormalizedTag(Tag::normalize($v));
 }
开发者ID:emacsattic,项目名称:symfony,代码行数:5,代码来源:QuestionTag.php

示例6: deleteSpam

 public static function deleteSpam($moderator, $tag, $question_id = null)
 {
     if ($question_id === null) {
         $tags = self::getByNormalizedTag($tag);
     } else {
         $c = new Criteria();
         $c->add(self::NORMALIZED_TAG, Tag::normalize($tag));
         $c->add(self::QUESTION_ID, $question_id);
         $tags = self::doSelect($c);
     }
     $con = Propel::getConnection();
     try {
         $con->begin();
         foreach ($tags as $tag) {
             $user = $tag->getUser();
             $user->setDeletions($user->getDeletions() + 1);
             $user->save();
             $tag->delete();
         }
         $con->commit();
         $log = 'moderator "%s" deleted tag "%s"';
         $log = sprintf($log, $moderator->getNickname(), $tag->getNormalizedTag());
         sfContext::getInstance()->getLogger()->warning($log);
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:emacsattic,项目名称:symfony,代码行数:28,代码来源:QuestionTagPeer.php

示例7: hasTag

 public function hasTag($tag)
 {
     $c = new Criteria();
     $c->add(QuestionTagPeer::QUESTION_ID, $this->getId());
     $c->add(QuestionTagPeer::NORMALIZED_TAG, Tag::normalize($tag));
     return QuestionTagPeer::doSelectOne($c) ? true : false;
 }
开发者ID:emacsattic,项目名称:symfony,代码行数:7,代码来源:Question.php


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