本文整理汇总了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');
}
}
示例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;
}
示例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;
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例8: executeToggleApproved
public function executeToggleApproved()
{
$tag = TagPeer::retrieveByPK($this->getRequestParameter('id'));
$this->forward404Unless($tag);
$tag->setApproved(!$tag->getApproved());
$tag->save();
$this->redirect('tag/index');
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}