當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TagPeer類代碼示例

本文整理匯總了PHP中TagPeer的典型用法代碼示例。如果您正苦於以下問題:PHP TagPeer類的具體用法?PHP TagPeer怎麽用?PHP TagPeer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TagPeer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateTagRelationCache

 public static function updateTagRelationCache($manualLock = false)
 {
     if (!$manualLock) {
         self::checkTagRelationCache('lock');
     }
     try {
         $tagRelationsFile = sfConfig::get('sf_root_dir') . "/cache/objcache/tagsRelations.php";
         $c = new Criteria();
         $allTags = TagPeer::doSelect($c);
         $content = "<?php \n";
         foreach ($allTags as $singleTag) {
             $c = new Criteria();
             $c->add(TagrelationPeer::TAG_ID, $singleTag->getId());
             $tagRelations = TagrelationPeer::doSelect($c);
             if ($tagRelations) {
                 $elementsArr = "array(";
                 foreach ($tagRelations as $tagRelation) {
                     $elementsArr .= $tagRelation->getId() . ",";
                 }
                 $content .= "\$_TagRel['" . $singleTag->getTagId() . "'] = " . substr($elementsArr, 0, -1) . ");\n";
             }
         }
         $content .= "\n?>";
         if (FileHelper::writeFile($tagRelationsFile, $content)) {
             BackendService::loadTagsRelations();
         } else {
             echo FileHelper::Log("Unable to write tag cache in: " . $tagRelationsFile, UtilsHelper::MSG_ERROR);
         }
     } catch (Exception $e) {
         echo FileHelper::Log("Unable to refresh tag cache: " . $e->getMessage(), UtilsHelper::MSG_ERROR);
     }
     if (!$manualLock) {
         self::checkTagRelationCache('unlock');
     }
 }
開發者ID:kotow,項目名稱:work,代碼行數:35,代碼來源:Tagrelation.php

示例2: recordTags

 public static function recordTags($phrase, $model, $obj)
 {
     $tags = TagTools::splitPhrase($phrase);
     foreach ($tags as $settag) {
         $tag = new Tag();
         if ($model == "etime") {
             $modelTag = new EtimeTag();
         } else {
             $modelTag = new EventTag();
         }
         $tag->setTag($settag);
         $c = new Criteria();
         $c->add(TagPeer::NORMALIZED_TAG, $tag->getNormalizedTag());
         $tag_exists = TagPeer::doSelectOne($c);
         if (!$tag_exists) {
             $tag->save();
         } else {
             $tag = $tag_exists;
         }
         if ($model == "etime") {
             $modelTag->setEtime($obj);
         } else {
             $modelTag->setEvent($obj);
         }
         $modelTag->setTag($tag);
         $modelTag->save();
     }
     return true;
 }
開發者ID:soon0009,項目名稱:EMS,代碼行數:29,代碼來源:TagTools.class.php

示例3: parseItem

function parseItem($blog, $item, $ts)
{
    if ($ts != 0 && $item->pubdate <= $ts) {
        logmsg('Zatrzymanie na wpisie: %s', StringUtils::removeAccents($item->title));
        return false;
    }
    logmsg('  - Parsowanie wpisu: %s', StringUtils::removeAccents($item->title));
    $post = new Post();
    $post->setBlog($blog);
    foreach ($item->tags as $name) {
        $tag = TagPeer::retriveByName($name, true);
        if ($post->addTag($tag)) {
            logmsg('    - Znaleziono tag: %s', $name);
        }
    }
    if ($post->hasTags()) {
        $shortened = $post->setFullContent($item->content);
        $post->setLink(htmlspecialchars($item->link));
        $post->setTitle($item->title);
        $post->setCreatedAt($item->pubdate);
        $post->setShortened($shortened);
        $post->save();
    } else {
        logmsg('    - Nie znaleziono tagow');
    }
    return true;
}
開發者ID:noose,項目名稱:Planeta,代碼行數:27,代碼來源:refresh.php

示例4: run_a0_get_main_acts_for_tags

/**
 * estrae gli N atti più rilevanti per determinati argomenti (tag)
 */
function run_a0_get_main_acts_for_tags($task, $args, $options)
{
    static $loaded;
    // load application context
    if (!$loaded) {
        task_loader();
        $loaded = true;
    }
    echo "memory usage: " . memory_get_usage() . "\n";
    $msg = sprintf("start time: %s\n", date('H:i:s'));
    echo $msg;
    $n = 1;
    if (array_key_exists('nrecs', $options)) {
        $n = (int) $options['nrecs'];
    }
    if (!is_int($n) || $n < 1) {
        throw new Exception("il numero di atti deve essere un intero\n");
    }
    if (count($args) > 0) {
        $argomenti = array();
        foreach ($args as $cnt => $arg) {
            $id = TagPeer::getIdFromTagValue($arg);
            $xml_url = sprintf("http://parlamento.openpolis.it/xml/indici/tag/%d.xml", $id);
            $xsl_file = SF_ROOT_DIR . "/web/xml/indici/xslt/tagActsSorter.xslt";
            printf("Argomento %s:\n", $arg, $id);
            getImportantActs($xml_url, $xsl_file, $n);
            print "\n";
        }
    }
    $start_time = time();
    $msg = sprintf("end time: %s\n", date('H:i:s'));
    echo $msg;
    $msg = sprintf("memory usage: %10d\n", memory_get_usage());
    echo pakeColor::colorize($msg, array('fg' => 'red', 'bold' => false));
}
開發者ID:valerio-bozzolan,項目名稱:openparlamento,代碼行數:38,代碼來源:anno0Tasks.php

示例5: getConsolidatedKeywords

 public function getConsolidatedKeywords($sLanguageId = null, $bReturnArray = false)
 {
     if ($sLanguageId == null) {
         $sLanguageId = Session::language();
     }
     $aKeywords = array();
     $aKeywords[] = TranslationPeer::getString('meta.keywords', null, '');
     $aTags = TagPeer::tagInstancesForObject($this);
     foreach ($aTags as $iKey => $oTag) {
         $aTags[$iKey] = $oTag->getTag()->getName();
     }
     $aKeywords[] = $aTags;
     $aKeywords[] = Settings::getSetting('frontend', 'keywords', '');
     $aKeywords[] = $this->getActivePageString()->getMetaKeywords();
     $aResult = array();
     foreach ($aKeywords as $iKey => $mKeywords) {
         if (!is_array($mKeywords)) {
             $mKeywords = explode(',', $mKeywords);
         }
         foreach ($mKeywords as $sKeyword) {
             $sKeyword = trim($sKeyword);
             if (!isset($aResult[$sKeyword]) && $sKeyword !== '') {
                 $aResult[$sKeyword] = true;
             }
         }
     }
     if ($bReturnArray) {
         return array_keys($aResult);
     }
     return implode(', ', array_keys($aResult));
 }
開發者ID:rapila,項目名稱:cms-base,代碼行數:31,代碼來源:Page.php

示例6: executeTagList

 public function executeTagList()
 {
   $c = new Criteria();
   $c->add(sfSimpleBlogPostPeer::IS_PUBLISHED, true);
   $c->add(TaggingPeer::TAGGABLE_ID, TaggingPeer::TAGGABLE_ID.' = '. sfSimpleBlogPostPeer::ID, Criteria::CUSTOM);
   $this->tags = TagPeer::getPopulars($c);
 }
開發者ID:nibsirahsieu,項目名稱:sfSimpleBlog15Plugin,代碼行數:7,代碼來源:BasesfSimpleBlogComponents.class.php

示例7: executeEditableTagsAutocomplete

 public function executeEditableTagsAutocomplete()
 {
     $this->my_str = $this->getRequestParameter('value');
     $c = new Criteria();
     $c->add(TagPeer::TRIPLE_VALUE, $this->my_str . "%", Criteria::LIKE);
     $this->tags = TagPeer::getAll($c);
 }
開發者ID:valerio-bozzolan,項目名稱:openparlamento,代碼行數:7,代碼來源:BasedeppTaggingActions.class.php

示例8: executeToggleApproved

 public function executeToggleApproved()
 {
     $tag = TagPeer::retrieveByPK($this->getRequestParameter('id'));
     $this->forward404Unless($tag);
     $tag->setApproved(!$tag->getApproved());
     $tag->save();
     $this->redirect('tag/index');
 }
開發者ID:noose,項目名稱:Planeta,代碼行數:8,代碼來源:actions.class.php

示例9: retrieveTagsFromTTPK

 public static function retrieveTagsFromTTPK($id)
 {
     $c = new Criteria();
     $c->add(OppTagHasTtPeer::TESEOTT_ID, $id);
     $c->addJoin(OppTagHasTtPeer::TAG_ID, TagPeer::ID);
     $c->addAscendingOrderByColumn(TagPeer::TRIPLE_VALUE);
     return TagPeer::doSelect($c);
 }
開發者ID:valerio-bozzolan,項目名稱:openparlamento,代碼行數:8,代碼來源:OppTeseottPeer.php

示例10: executeShow

 /**
  * Executes index action
  *
  */
 public function executeShow()
 {
     $c = new Criteria();
     $c->add(TagPeer::NORMALIZED_TAG, $this->getRequestParameter('tag'));
     $this->tag = TagPeer::doSelectOne($c);
     $this->events = EventPeer::getTaggedEvents($this->getRequestParameter('tag'));
     $this->forward404Unless($this->events);
 }
開發者ID:soon0009,項目名稱:EMS,代碼行數:12,代碼來源:actions.class.php

示例11: getTags

 public function getTags()
 {
     $c = new Criteria();
     $c->add(OppTagHasTtPeer::TESEOTT_ID, $this->getId());
     $c->addJoin(OppTagHasTtPeer::TAG_ID, TagPeer::ID);
     $c->addAscendingOrderByColumn(TagPeer::TRIPLE_VALUE);
     return TagPeer::doSelect($c);
 }
開發者ID:valerio-bozzolan,項目名稱:openparlamento,代碼行數:8,代碼來源:OppTeseott.php

示例12: hasPeerFieldName

 public function hasPeerFieldName($fieldName)
 {
     if (strpos($fieldName, '.') === false) {
         $fieldName = strtoupper($fieldName);
         $fieldName = "tag.{$fieldName}";
     }
     $entryFields = TagPeer::getFieldNames(BasePeer::TYPE_COLNAME);
     return in_array($fieldName, $entryFields);
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:9,代碼來源:SphinxTagCriteria.php

示例13: generate

 public static function generate()
 {
     $urls = array();
     $tags = TagPeer::getPopularTags(500);
     $urls[] = new sitemapURL("tag/list", date('Y-m-d\\TH:i:s\\Z'), 'daily', 1.0);
     foreach ($tags as $tag) {
         $urls[] = new sitemapURL("tag/" . $tag['tag'], date('Y-m-d\\TH:i:s\\Z'), 'daily', 1.0);
     }
     return $urls;
 }
開發者ID:hoydaa,項目名稱:snippets.hoydaa.org,代碼行數:10,代碼來源:tagSitemapGenerator.class.php

示例14: doClean

 protected function doClean($value)
 {
     $criteria = new Criteria();
     $criteria->add(TagPeer::JOTAG, $value);
     $object = TagPeer::doSelectOne($criteria);
     if (is_null($object)) {
         throw new sfValidatorError($this, 'invalid', array('value' => $value));
     }
     return $object->getId();
 }
開發者ID:psskhal,項目名稱:symfony-sample,代碼行數:10,代碼來源:sfValidatorSearchTag.class.php

示例15: listTags

 private function listTags()
 {
     $c = new Criteria();
     $c->add(TagPeer::NAME, $this->getRequestParameter('name'));
     $tag = TagPeer::doSelectOne($c);
     $this->getResponse()->setTitle(sprintf('Planeta PHP.pl - Wpisy dla tagu: %s', $tag->getName()));
     $c = new Criteria();
     $c->addJoin(PostTagPeer::POST_ID, PostPeer::ID, Criteria::LEFT_JOIN);
     $c->add(PostTagPeer::TAG_ID, $tag->getId());
     return $c;
 }
開發者ID:noose,項目名稱:Planeta,代碼行數:11,代碼來源:actions.class.php


注:本文中的TagPeer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。