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


PHP Tags类代码示例

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


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


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