本文整理汇总了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));
}
}
示例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);
}
示例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();
}
示例4: executeShow
public function executeShow()
{
$this->question_pager = QuestionPeer::getPopularByTag($this->getRequestParameter('tag'), $this->getRequestParameter('page', 1));
$this->getResponse()->setTitle('askeet! » question tagged ' . Tag::normalize($this->getRequestParameter('tag')));
}
示例5: setTag
public function setTag($v)
{
parent::setTag($v);
$this->setNormalizedTag(Tag::normalize($v));
}
示例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;
}
}
示例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;
}