• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Tags类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: indexAction

 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Tag cloud";
     // Get the archives
     $db_tags = new Tags(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     if ($tags = $db_tags->getTopTags(20)) {
         $max = $tags[0]['count'];
         $min = $tags[count($tags) - 1]['count'];
         sort($tags);
         $this->view->tags = $tags;
         $this->view->max = $max;
         $this->view->min = $min;
     }
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:26,代码来源:TagsController.php


示例2: updateMeta

 public function updateMeta($event, Tags $tag)
 {
     $meta = $tag->getTagmetaOrNew();
     if ($meta->id) {
         $meta->save();
     }
 }
开发者ID:huoybb,项目名称:standard,代码行数:7,代码来源:tagsEventsHandler.php


示例3: actionCreate

 public function actionCreate()
 {
     $request = Yii::app()->request->getIsPostRequest();
     $ajaxRequest = Yii::app()->request->getIsAjaxRequest();
     if ($request) {
         $berita = new Berita();
         $kategori = new Kategori();
         $tags = new Tags();
         $image = new Image();
         $postBerita = !empty($_POST['Berita']) ? $_POST['Berita'] : "";
         $postKategori = !empty($_POST['Kategori']) ? $_POST['Kategori'] : "";
         $postTags = !empty($_POST['Tags']) ? $_POST['Tags'] : "";
         if ($kategori) {
             $kategori->setAttributes($postKategori);
         }
         if ($tags) {
             $tags->setAttributes($postTags);
         }
         if ($postBerita) {
             $berita->setAttributes($postBerita);
             $berita->setCreatetime($postBerita['tgl_create']);
             $berita->setUpdatetime($postBerita['tgl_update']);
         }
     }
     $jsonData = array();
     if ($ajaxRequest) {
         echo CJSON::encode($jsonData);
         Yii::app()->end();
     } else {
         $this->render("create", array());
     }
 }
开发者ID:hansenmakangiras,项目名称:disperindag,代码行数:32,代码来源:BeritaController.php


示例4: tagslist

function tagslist()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
    $lang =& DoceboLanguage::createInstance('tags', 'framework');
    $id_tag = Get::req('id_tag', DOTY_INT, 0);
    $tag_name = Get::req('tag', DOTY_STRING, '');
    $filter = Get::req('filter', DOTY_STRING, '');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
    $nav_bar->setLink('index.php?modname=tags&op=tags&id_tag=' . $id_tag);
    $ini = $nav_bar->getSelectedElement();
    $tags = new Tags('*');
    $resources = $tags->getResourceByTags($id_tag, false, false, $ini, Get::sett('visuItem'));
    $GLOBALS['page']->add(getTitleArea(array($lang->def('_TAGS')), 'tags') . '<div class="std_block">' . '<div class="tag_list">', 'content');
    while (list(, $res) = each($resources['list'])) {
        $link = $res['permalink'];
        $delim = strpos($link, '?') === false ? '?' : '&';
        if (strpos($link, '#') === false) {
            $link = $link . $delim . 'sop=setcourse&sop_idc=' . $res['id_course'];
        } else {
            $link = str_replace('#', $delim . 'sop=setcourse&sop_idc=' . $res['id_course'] . '#', $link);
        }
        $GLOBALS['page']->add('' . '<h2>' . '<a href="' . $link . '">' . $res['title'] . '</a>' . '</h2>' . '<p>' . $res['sample_text'] . '</p>' . '<div class="tag_cloud">' . '<span>' . $lang->def('_TAGS') . ' : </span>' . '<ul><li>' . implode('</li><li>', $res['related_tags']) . '</li></ul>' . '</div>' . '<br />', 'content');
    }
    $GLOBALS['page']->add('</div>' . $nav_bar->getNavBar($ini, $resources['count']) . '</div>', 'content');
}
开发者ID:abhinay100,项目名称:forma_app,代码行数:26,代码来源:tags.php


示例5: getProductById

 function getProductById($product_id)
 {
     $sql = "SELECT p.* FROM {$this->table_prefix}products p WHERE p.id=" . $product_id;
     $result = $this->dbstuff->GetRow($sql);
     if (empty($result) || !$result) {
         return false;
     }
     $result['pubdate'] = @date("Y-m-d", $result['created']);
     if (!empty($result['picture'])) {
         $result['imgsmall'] = "../" . pb_get_attachmenturl($result['picture']) . ".small.jpg";
         $result['imgmiddle'] = "../" . pb_get_attachmenturl($result['picture']) . ".middle.jpg";
         $result['image'] = "../" . pb_get_attachmenturl($result['picture']);
         $result['image_url'] = rawurlencode($result['picture']);
     } else {
         $result['image'] = pb_get_attachmenturl('', '', 'middle');
     }
     if (!empty($result['tag_ids'])) {
         uses("tag");
         $tag = new Tags();
         $tag_res = $tag->getTagsByIds($result['tag_ids']);
         if (!empty($tag_res)) {
             $tags = null;
             foreach ($tag_res as $key => $val) {
                 $tags .= '<a href="product/list.php?do=search&q=' . urlencode($val) . '" target="_blank">' . $val . '</a>&nbsp;';
             }
             $result['tag'] = $tags;
             unset($tags, $tag_res, $tag);
         }
     }
     $this->info = $result;
     return $result;
 }
开发者ID:vuong93st,项目名称:w-game,代码行数:32,代码来源:product.php


示例6: addTags

 private static function addTags($model)
 {
     // add tags
     if (!empty($_POST['tags'])) {
         $taglist = explode(',', $_POST['tags']);
         if ($taglist !== false) {
             foreach ($taglist as &$tag) {
                 if ($tag === '') {
                     continue;
                 }
                 if (substr($tag, 0, 1) != '#') {
                     $tag = '#' . $tag;
                 }
                 $tagModel = new Tags();
                 $tagModel->taggedBy = 'API';
                 $tagModel->timestamp = time();
                 $tagModel->type = get_class($model);
                 $tagModel->itemId = $model->id;
                 $tagModel->tag = $tag;
                 $tagModel->itemName = $model->name;
                 $tagModel->save();
                 X2Flow::trigger('RecordTagAddTrigger', array('model' => $model, 'tags' => $tag));
             }
         }
     }
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:26,代码来源:WebFormAction.php


示例7: assocciatePhotoWith

 /**
  * Assocciates photo with supplied tags, if tags does not exists 
  * they will be created.
  *
  * @param Zend_Db_Row $photo
  * @param array $tagNames
  */
 public function assocciatePhotoWith($photo, array $tagNames)
 {
     if ($photo instanceof Yag_Db_Table_Row) {
         $photoId = $photo->id;
     }
     $photoId = $photo;
     // Remove all references
     $this->deleteByPhotoId($photoId);
     $tags = new Tags();
     $assoccTags = array();
     foreach ($tagNames as $name) {
         $name = trim($name);
         // TODO: should be fixed by a filter automagic
         if ($name == '') {
             continue;
             // skip bogus names in array.
         }
         $tag = $tags->findByName($name);
         if (null == $tag) {
             $tag = $tags->createRow();
             $tag->name = (string) $name;
             $tag->created_on = date('Y-m-d H:i:s');
             // TODO: Should be handle behind
             $tag->save();
         }
         $taggedPhotos = $this->createRow(array('tag_id' => $tag->id, 'photo_id' => $photoId));
         $taggedPhotos->save();
         $assoccTags[] = $tag;
     }
     return $assoccTags;
 }
开发者ID:johannilsson,项目名称:yag,代码行数:38,代码来源:TaggedPhotos.php


示例8: findAndAdd

 public static function findAndAdd($title, $classify, $logid)
 {
     $title = zmf::filterInput($title, 't', 1);
     if (!$title) {
         return false;
     }
     $info = Tags::model()->find('title=:title AND classify=:classify', array(':title' => $title, ':classify' => $classify));
     if (!$info) {
         if (Yii::app()->session['checkHasBadword'] == 'yes') {
             $status = Posts::STATUS_STAYCHECK;
         } else {
             $status = Posts::STATUS_PASSED;
         }
         unset(Yii::app()->session['checkHasBadword']);
         $_data = array('title' => $title, 'name' => tools::pinyin($title), 'classify' => $classify, 'status' => $status, 'cTime' => time(), 'length' => mb_strlen($title, 'GBK'));
         $modelB = new Tags();
         $modelB->attributes = $_data;
         if ($modelB->save()) {
             $tagid = $modelB->id;
         }
     } else {
         $tagid = $info['id'];
     }
     if ($tagid && $logid) {
         $_info = TagRelation::model()->find('tagid=:tagid AND logid=:logid AND classify=:classify', array(':tagid' => $tagid, ':logid' => $logid, ':classify' => $classify));
         if (!$_info) {
             $_tagre = array('tagid' => $tagid, 'logid' => $logid, 'classify' => $classify, 'cTime' => zmf::now());
             $modelC = new TagRelation();
             $modelC->attributes = $_tagre;
             $modelC->save();
         }
     }
     return $tagid;
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:34,代码来源:Tags.php


示例9: action_list

 /**
  * 列表页
  */
 public function action_list()
 {
     $this->_add_css('styles/album/my_library.css');
     $this->_add_script('scripts/dtree.js');
     $tag = new Tags();
     $cate = new Bookcategory();
     $position = trim($this->getQuery('position'));
     switch ($position) {
         case 'is_hot':
             $pageTitle = '热门文章';
             break;
         case 'is_recommend':
             $pageTitle = '美文推荐';
             break;
         default:
             $pageTitle = '最新文章';
             break;
     }
     $this->template->position = $pageTitle;
     $select = DB::select('a.*', 'cate.cate_name', 'u.username')->from(array('articles', 'a'))->join(array('article_categories', 'cate'))->on('cate.cate_id', '=', 'a.cate_id')->join(array('users', 'u'))->on('u.uid', '=', 'a.uid')->where('a.recycle', '=', 0)->where('a.is_show', '=', 1)->order_by('a.article_id', 'DESC');
     if (!empty($position) && $position != 'is_new') {
         $select->where('a.' . $position, '=', 1);
     }
     $this->template->cate_id = $cate_id = trim($this->getQuery('cate_id'));
     if ($cate_id > 0) {
         $select->where('a.cate_id', '=', $cate_id);
     }
     $this->template->pagination = $pagination = Pagination::factory(array('total_items' => count($select->execute()->as_array()), 'items_per_page' => 30));
     $this->template->results = $select->limit($pagination->items_per_page)->offset($pagination->offset)->execute();
     $this->template->tags = $tags = $tag->getHotTags('article');
     if ($this->auth) {
         $this->template->categories = $categories = $cate->getCates($this->auth['uid']);
     }
 }
开发者ID:BGCX261,项目名称:zhongyycode-svn-to-git,代码行数:37,代码来源:index.php


示例10: showTagAction

 public function showTagAction(Users $user, Tags $tag, $page = 1)
 {
     $this->view->mytag = $tag;
     $this->view->page = $this->getPaginator($tag->getTaggedFiles($user), 25, $page);
     $this->view->form = myForm::buildCommentForm($tag);
     //这个应该去掉
     $this->view->user = $user;
 }
开发者ID:huoybb,项目名称:standard,代码行数:8,代码来源:UsersController.php


示例11: testMultiSearch

 /**
  * @covers Instaphp\Instagram\Tags::MultiSearch
  * @todo   Implement testMultiSearch().
  */
 public function testMultiSearch()
 {
     $res = $this->object->multiSearch('test insta', ['count' => 10]);
     $this->assertNotEmpty($res);
     $this->assertInstanceOf('\\Instaphp\\Instagram\\Response', $res[0]);
     $res = $this->object->multiSearch(['test', 'insta'], ['count' => 10]);
     $this->assertNotEmpty($res);
     $this->assertInstanceOf('\\Instaphp\\Instagram\\Response', $res[0]);
 }
开发者ID:delta98,项目名称:Instaphp,代码行数:13,代码来源:TagsTest.php


示例12: editAction

 public function editAction(Tags $tag)
 {
     if ($this->request->isPost()) {
         $data = $this->request->getPost();
         $tag->update($data);
         $this->redirectByRoute(['for' => 'tags.show', 'tag' => $tag->id]);
     }
     $this->view->myTag = $tag;
     $this->view->form = $this->buildFormFromModel($tag);
 }
开发者ID:huoybb,项目名称:movie,代码行数:10,代码来源:TagsController.php


示例13: getTagByName

 public function getTagByName($name)
 {
     $tag = Tags::findFirst(['conditions' => 'name = :name:', 'bind' => ['name' => $name]]);
     if (null == $tag) {
         $tag = new Tags();
         $tag->name = $name;
         $tag->save();
     }
     return $tag;
 }
开发者ID:huoybb,项目名称:movie,代码行数:10,代码来源:Tags.php


示例14: insertRel

 private function insertRel($value)
 {
     try {
         $this->log->addInfo("Inicia funcion MainPeople::insertRel() ");
         $tags = new Tags();
         $rel = array(0, "lkp_persons", $value->id);
         $tags->insert($rel);
     } catch (\Excetion $e) {
         $this->log->addError($e->getMessage(), array(basename(__FILE__) . "::" . __LINE__));
     }
 }
开发者ID:javierTerry,项目名称:api-teamwork,代码行数:11,代码来源:MainPeople.php


示例15: tagsToLinks

 public function tagsToLinks($item)
 {
     $tags = $this->tagsModel->extractTags($item);
     if ($tags) {
         foreach ($tags[0] as $index => $tag) {
             $url = $this->linkFactory->link('Search:default', ['s' => 'tag:' . $tag]);
             $item = str_replace('[' . $tags[1][$index] . ']', "<a href=\"{$url}\"><span class=\"label label-info\">{$tag}</span></a> ", $item);
         }
     }
     return $item;
 }
开发者ID:zoidbergthepopularone,项目名称:fitak,代码行数:11,代码来源:TemplateHelpers.php


示例16: populate

 function populate()
 {
     $t = new Tags();
     $this->tags = $t->allTags;
     $this->folders[0] = new FeedFolder(null, null, $this);
     foreach ($this->tags as $tag => $count) {
         $this->tagCount++;
         $this->countTaggedItems += $count;
         $tt = new TagListItem($tag, $count, $t->makeTagLink($tag));
         $this->folders[0]->feeds[] = $tt;
     }
 }
开发者ID:jphpsf,项目名称:gregarius,代码行数:12,代码来源:taglist.php


示例17: incTagsData

 public function incTagsData($startDate, $endDate)
 {
     $INC = new Incomes();
     $Tags = new Tags();
     $inctags = [];
     $allTags = $Tags->find('all');
     foreach ($allTags as $tag) {
         $amount = (int) $this->db->query("SELECT Sum(inc.cost ) as total FROM inc_tags as tag,incomes as inc where tag_id = ? and inc.inc_id = tag.inc_id and  inc.date >= ? and inc.date <= ? ", [$tag->id, $startDate, $endDate])->first()->total;
         if ($amount > 0) {
             $inctags[$tag->name] = $amount;
         }
     }
     return $inctags;
 }
开发者ID:tawazz,项目名称:spendee,代码行数:14,代码来源:inc_tags.php


示例18: expTagsData

 public function expTagsData($user_id, $startDate, $endDate)
 {
     $EXP = new Expenses();
     $Tags = new Tags();
     $exptags = [];
     $allTags = $Tags->find('all');
     foreach ($allTags as $tag) {
         $amount = (int) $this->db->query("SELECT Sum(exp.cost ) as total FROM exp_tags as tag,expenses as exp where tag_id = ? and exp.exp_id = tag.exp_id and  exp.date >= ? and exp.date <= ? and exp.user_id = ?", [$tag->id, $startDate, $endDate, $user_id])->first()->total;
         if ($amount > 0) {
             $exptags[$tag->name] = $amount;
         }
     }
     return $exptags;
 }
开发者ID:tawazz,项目名称:spendee,代码行数:14,代码来源:exp_tags.php


示例19: testAction

 public function testAction()
 {
     $authors = new Authors();
     $me = $authors->find(1)->current();
     echo '<span>' . $me->name() . '</span>';
     $meAgain = $authors->fetchRow('id = 3');
     $pubs = $meAgain->findDependentRowset('Entry')->toArray();
     //Zend_Debug::dump($pubs);
     // list of entries by tag "Test tag 1"
     $tags = new Tags();
     $firstTag = $tags->fetchRow('id = 2');
     $tagEntries = $firstTag->findManyToManyRowset('Entry', 'TagsLinks')->toArray();
     //Zend_Debug::dump($tagEntries);
 }
开发者ID:kalimatas,项目名称:zbook,代码行数:14,代码来源:IndexController.php


示例20: test_create_post

	public function test_create_post()
	{
		$tags = array('one', 'two', 'THREE');
		$params = array(
			'title' => 'A post title',
			'content' => 'Some great content. Really.',
			'user_id' => $this->user->id,
			'status' => Post::status('published'),
			'content_type' => Post::type('entry'),
			'tags' => 'one, two, THREE',
			'pubdate' => HabariDateTime::date_create( time() ),
		);
		$post = Post::create($params);

		$this->assert_true( $post instanceof Post, 'Post should be created.' );

		// Check the post's id is set.
		$this->assert_true( (int)$post->id > 0, 'The Post id should be greater than zero' );

		// Check the post's tags are usable.
		$this->assert_equal(count($post->tags), count($tags), 'All tags should have been created.');
		foreach ( $post->tags as $tag ) {
			$this->assert_equal($tag->tag_slug, Utils::slugify($tag->tag_text), 'Tags key should be slugified tag.');
		}
		foreach( $post->tags as $tag ) {
			Tags::vocabulary()->delete_term( $tag );
		}

	}
开发者ID:rynodivino,项目名称:tests,代码行数:29,代码来源:test_post.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TagsHelperRoute类代码示例发布时间:2022-05-23
下一篇:
PHP TagURI类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap