本文整理汇总了PHP中Tags::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Tags::get方法的具体用法?PHP Tags::get怎么用?PHP Tags::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_template_vars
/**
* Add additional template variables to the template output.
*
* You can assign additional output values in the template here, instead of
* having the PHP execute directly in the template. The advantage is that
* you would easily be able to switch between template types (RawPHP/Smarty)
* without having to port code from one to the other.
*
* You could use this area to provide "recent comments" data to the template,
* for instance.
*
* Note that the variables added here should possibly *always* be added,
* especially 'user'.
*
* Also, this function gets executed *after* regular data is assigned to the
* template. So the values here, unless checked, will overwrite any existing
* values.
*/
public function add_template_vars()
{
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
}
if (!$this->template_engine->assigned('user')) {
$this->assign('user', User::identify());
}
if (!$this->template_engine->assigned('tags')) {
$this->assign('tags', Tags::get());
}
if (!$this->template_engine->assigned('page')) {
$this->assign('page', isset($page) ? $page : 1);
}
if (!$this->template_engine->assigned('feed_alternate')) {
$matched_rule = URL::get_matched_rule();
switch ($matched_rule->name) {
case 'display_entry':
case 'display_page':
$feed_alternate = URL::get('atom_entry', array('slug' => Controller::get_var('slug')));
break;
case 'display_entries_by_tag':
$feed_alternate = URL::get('atom_feed_tag', array('tag' => Controller::get_var('tag')));
break;
case 'display_home':
default:
$feed_alternate = URL::get('atom_feed', array('index' => '1'));
}
$this->assign('feed_alternate', $feed_alternate);
}
// Specify pages you want in your navigation here
$this->assign('nav_pages', Posts::get(array('content_type' => 'page', 'status' => 'published', 'nolimit' => 1)));
parent::add_template_vars();
}
示例2: add_template_vars
public function add_template_vars()
{
//Theme Options
$this->assign('header_text', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.');
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
}
if (!$this->template_engine->assigned('user')) {
$this->assign('user', User::identify()->loggedin);
}
/* if( !$this->template_engine->assigned( 'page' ) ) {
$this->assign('page', isset( $page ) ? $page : 1 );
}*/
if (!$this->template_engine->assigned('all_tags')) {
// List of all the tags
$tags = Tags::get();
$this->assign('all_tags', $tags);
}
//visiting page/2, /3 will offset to the next page of posts in the sidebar
$page = Controller::get_var('page');
$pagination = Options::get('pagination');
if ($page == '') {
$page = 1;
}
$this->assign('more_posts', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $pagination * $page, 'limit' => 5)));
parent::add_template_vars();
$this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
$this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
}
示例3: test_delete_tag
public function test_delete_tag()
{
$count = count(Tags::get());
$t = $this->tag->insert();
$this->assertEquals($count + 1, count(Tags::get()));
$t->delete();
$this->assertEquals($count, count(Tags::get()));
}
示例4: theme_magic_archives
public function theme_magic_archives($theme)
{
$tags = Tags::get(array('nolimit' => true));
$theme->tags = $tags;
$theme->posts = self::get_posts();
$theme->display('magicarchives');
return $archives;
}
示例5: get
/**
* Return a single requested tag.
*
* <code>
* $tag= Tag::get( array( 'tag_slug' => 'wooga' ) );
* </code>
*
* @param array $paramarray An associated array of parameters, or a querystring
* @return Tag The first tag that matched the given criteria
**/
static function get($paramarray = array())
{
// Defaults
$defaults = array('where' => array(), 'fetch_fn' => 'get_row');
foreach ($defaults['where'] as $index => $where) {
$defaults['where'][$index] = array_merge(Controller::get_handler()->handler_vars, $where, Utils::get_params($paramarray));
}
// make sure we get at most one result
$defaults['limit'] = 1;
return Tags::get($defaults);
}
示例6: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->dataFieldByName('Title')->setTitle('City Hotel Name');
$fields->dataFieldByName('Content')->setTitle('City Hotel Introduction');
$fields->insertBefore(NumericField::create("NoOfRooms")->setTitle("Total Number of Rooms"), 'Content');
$fields->insertBefore(TextField::create("AirportDistance")->setTitle("Distance from Airport"), 'Content');
$fields->addFieldToTab('Root.Main', new DropdownField('AtollID', 'Atoll', Atolls::get()->map('ID', 'Name')), 'Content');
$fields->addFieldToTab('Root.Main', new DropdownField('IslandID', 'Island', Islands::get()->map('ID', 'Name')), 'Content');
$fields->addFieldToTab('Root.Main', new DropdownField('CategoryID', 'Category', Categories::get()->map('ID', 'Name')), 'Content');
$fields->addFieldToTab('Root.Main', new DropdownField('TransferTypeID', 'TransferType', TransferTypes::get()->map('ID', 'Name')), 'Content');
$fields->insertBefore(NumericField::create("Rating")->setTitle("Star Rating"), 'Content');
$fields->insertBefore(CheckboxField::create("InSide")->setTitle("Show City Hotel in Slide Show"), 'Content');
$fields->insertBefore(CheckboxField::create("Featured")->setTitle("Show City Hotel in Featured List"), 'Content');
$fields->insertBefore(TextField::create("Cordinates")->setTitle("Map Cordinates, Longitute & Latitude, separated by comma"), 'Content');
$imgfield = UploadField::create('FeaturedPhoto')->setTitle("Default Cover Photo");
$imgfield->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
$fields->insertBefore($imgfield, 'Content');
$defaultTag = $this->Tags()->column('ID');
// print_r($defaultTag);
$tagMap = Tags::get()->map('ID', 'Name')->toArray();
$tagList = ListboxField::create('Tags', 'Tags')->setMultiple(true)->setSource($tagMap)->setDefaultItems($defaultTag);
$fields->addFieldToTab('Root.Main', $tagList, 'Content');
$defaultItem = $this->HolidayTypes()->column('ID');
$Map = HolidayTypes::get()->map('ID', 'Name')->toArray();
$List = ListboxField::create('HolidayTypes', 'Holiday Types')->setMultiple(true)->setSource($Map)->setDefaultItems($defaultItem);
$fields->addFieldToTab('Root.Main', $List, 'Content');
$fields->addFieldToTab('Root.CityHotelImages', $uploadField = new uploadField($name = "CityHotelImages", $title = "Upload one or more images (max 10 in total)"));
$uploadField->setAllowedMaxFileNumber(10);
$gridConfig = GridFieldConfig_RelationEditor::create();
$GridField = new GridField('Rooms', 'Rooms', $this->Rooms(), $gridConfig);
$fields->addFieldToTab("Root.Rooms", $GridField);
$GridField = new GridField('Dining', 'Dining', $this->Dining(), $gridConfig);
$fields->addFieldToTab("Root.Dining", $GridField);
$GridField = new GridField('Facilities', 'Facilities', $this->Facilities(), $gridConfig);
$fields->addFieldToTab("Root.Facilities", $GridField);
$GridField = new GridField('Activities', 'Activities', $this->Activities(), $gridConfig);
$fields->addFieldToTab("Root.Activities", $GridField);
return $fields;
}
示例7: action_edit
/**
* 编辑专题
*/
public function action_edit()
{
$sid = (int) $this->getQuery('sid');
$tag = new Tags();
$select = DB::select('s.*', 'u.username')->from(array('specialpics', 's'))->join(array('users', 'u'), 'LEFT')->on('u.uid', '=', 's.uid')->where('sid', '=', $sid);
$this->template->info = $select->execute()->current();
$this->template->tags = $tags = $tag->get($sid, 'img_subject', $info['uid']);
if ($this->isPost()) {
$is_share = $this->getPost('is_share', 0);
$title = trim($this->getPost('title'));
$content = trim($this->getPost('content'));
$uid = (int) $this->getPost('uid');
$sid = $this->getPost('sid', 0);
$tags = $this->getPost('tags');
if (empty($title) || empty($content)) {
$this->show_message('专题标题和内容不能为空...');
}
if ($sid > 0) {
$set = array('title' => $title, 'content' => $content, 'is_share' => $is_share);
DB::update('specialpics')->set($set)->where('sid', '=', $sid)->execute();
$tags = explode(' ', $tags);
$tag->set($sid, 'img_subject', $tags, $uid);
$links[] = array('text' => '返回专题列表', 'href' => '/admin/picsubject/list');
$this->show_message('编辑专题操作成功。', 1, $links);
}
}
}
示例8: array
if ($data['transType'] == $type['id']) {
$haserror = false;
break;
}
}
if ($haserror) {
RestUtils::sendResponse('406', array('data' => 'transType', 'message' => 'O tipo de conta não existe.'));
}
//Connect
$sql = new DataBase();
$sql->connect();
//Generate ID
$transactionId = generateId();
//Get all tags to compare
$allTagsCompare = array();
foreach ($tags->get() as $tag) {
$tag = strtolower(clearUTF($tag['name']));
array_push($allTagsCompare, $tag);
}
//Get all tags of transaction
$transactionTags = explode(',', $data['tags']);
$i = 0;
foreach ($transactionTags as $tag) {
if ($tag == "" || $tag == " " || $tag == "," || $tag == ", ") {
unset($transactionTags[$i]);
}
$i++;
}
//Get all tags of USER of transaction compare
$transactionTagsCompare = array();
foreach ($transactionTags as $tag) {
示例9: getQueuedCommands
/**
* Function to get the queued commands from the history
*/
public function getQueuedCommands()
{
$entrymaskMgr = new Entrymasks();
$jsQueue = new JSQueue(NULL);
$tagMgr = new Tags();
$queuedCommands = array();
$currentQueueId = sGuiLH();
if (!$currentQueueId || $currentQueueId == 'false') {
return;
// if running first time (only)
//$currentQueueId = $jsQueue->getLastQueueId();
}
if ($currentQueueId) {
$queuedCommandsRaw = $jsQueue->getQueue($currentQueueId, sGuiUS());
$templateMgr = new Templates();
$viewMgr = new Views();
foreach ($queuedCommandsRaw as $queuedCommandRaw) {
// Check permissions
$permissionsObj = NULL;
$objectID = $queuedCommandRaw['OID'];
$siteID = $queuedCommandRaw['SITEID'];
$icons = new Icons();
$url = $imgurl = '';
switch ($queuedCommandRaw['TYPE']) {
case HISTORYTYPE_MAILING:
$mailingMgr = new MailingMgr();
$mailingObj = $mailingMgr->getMailing($objectID);
$permissionsObj = $mailingObj->permissions;
break;
case HISTORYTYPE_PAGE:
if ($siteID > 0 && $objectID > 0) {
$pageMgr = new PageMgr($siteID);
$pageObj = $pageMgr->getPage($objectID);
if ($pageObj) {
$url = $pageObj->getUrl();
$permissionsObj = $pageObj->permissions;
}
}
break;
case HISTORYTYPE_CO:
if (!$objectID) {
continue;
}
$cb = sCblockMgr()->getCblock($objectID);
$permissionsObj = $cb->permissions;
break;
case HISTORYTYPE_ENTRYMASK:
$permissionsObj = $entrymaskMgr->permissions;
break;
case HISTORYTYPE_FILE:
$permissionsObj = sFileMgr()->permissions;
if ($objectID) {
$file = sFileMgr()->getFile($objectID);
if ($file) {
$info = $file->get();
$url = sApp()->webroot . "download/" . $info['PNAME'] . "/";
$hiddenviews = $file->views->getHiddenViews();
foreach ($hiddenviews as $hiddenview) {
if ($hiddenview['IDENTIFIER'] == "YGSOURCE") {
$tmpviewinfo = $file->views->getGeneratedViewInfo($hiddenview['ID']);
if ($tmpviewinfo[0]['TYPE'] == FILE_TYPE_WEBIMAGE) {
$imgurl = sApp()->webroot . "image/" . $info['PNAME'] . "/";
}
}
}
}
}
break;
case HISTORYTYPE_TEMPLATE:
$permissionsObj = $templateMgr->permissions;
break;
case HISTORYTYPE_TAG:
$permissionsObj = $tagMgr->permissions;
break;
case HISTORYTYPE_SITE:
$pageMgr = new PageMgr($siteID);
$sitePages = $pageMgr->tree->get(0, 1);
$tmpPageID = $sitePages[0]["ID"];
if ($tmpPageID) {
$pageObj = $pageMgr->getPage($tmpPageID);
$permissionsObj = $pageObj->permissions;
}
break;
case HISTORYTYPE_USER:
$permissionsObj = sUsergroups()->usergroupPermissions;
break;
case HISTORYTYPE_USERGROUP:
case HISTORYTYPE_EXTERNAL:
case HISTORYTYPE_IMAGE:
case HISTORYTYPE_FILETYPES:
case HISTORYTYPE_FILEVIEWS:
case HISTORYTYPE_JSQUEUE:
case HISTORYTYPE_PERMISSION:
default:
break;
}
if ($queuedCommandRaw['TEXT'] == 'NOPERMISSIONCHECK' || strpos($queuedCommandRaw['OLDVALUE'], 'HIGHLIGHT') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'UNHIGHLIGHT') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_MOVE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_HIDE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_UNHIDE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_ACTIVATE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'RELOAD_WINDOW') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'CLEAR_USERINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'SET_USERINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'CLEAR_FILEINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'REFRESH_WINDOW') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'ADD_FILE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_DELETE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_ADD_TAG') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGECLASS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGEPNAME') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGEBGIMAGE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGE_LOCK_STATE') === 0) {
//.........这里部分代码省略.........
示例10: action_view
/**
* 查看相片
*/
public function action_view()
{
$tag = new Tags();
$this->template->pid = $pid = $this->request->param('id');
$imgSelect = DB::select('i.id', 'i.cate_id', 'i.uploadtime', 'i.picname', 'i.userid', 'i.disk_id', 'i.picname', 'i.custom_name', array('i.disk_id', 'disk_domain'), 'i.click', 'i.comment_num', 'i.support', 'i.oppose', array('i.disk_name', 'img_dir'))->from(array('imgs', 'i'))->order_by('i.id', 'DESC');
$imgInfo = $imgSelect->where('i.id', '=', (int) $pid)->fetch_row();
$this->template->pageTitle = $imgInfo['custom_name'];
$imgInfo['cate_name'] = DB::select('cate_name')->from('img_categories')->where('cate_id', '=', (int) $imgInfo['cate_id'])->fetch_one();
$user = ORM::factory('user', $imgInfo['userid']);
$imgInfo['username'] = $user->username;
$imgInfo['avatar'] = $user->avatar;
$imgInfo['uid'] = $user->uid;
$imgInfo['sign'] = ORM::factory('user_field', (int) $imgInfo['userid'])->sign;
$this->template->imgInfo = $imgInfo;
if (empty($imgInfo)) {
$this->show_message('非法访问', 0, array(), true);
}
if ($user->status != 'approved' || $user->expire_time < time()) {
$links[] = array('text' => '返回首页', 'href' => '/');
$this->show_message('该用户已经过期或者禁止,不允许访问其所属的图片', 1, $links, true, 10000);
}
$this->template->tags = $tags = $tag->get($pid, 'img');
$select = DB::select('c.*', 'u.username', 'u.avatar')->from(array('comments', 'c'))->where('c.item_id', '=', (int) $pid)->where('c.app', '=', 'img')->join(array('users', 'u'), 'LEFT')->on('u.uid', '=', 'c.author');
$this->template->commentList = $select->execute()->as_array();
if ($this->isPost()) {
$tags = trim($this->getPost('tags'));
$pid = (int) $this->getPost('pid');
$tags = explode(' ', $tags);
$tag->add($pid, 'img', $tags, $imgInfo['userid']);
$this->request->redirect('/' . $pid . '.html');
}
// 更新访问量
DB::update('users')->set(array('visit' => DB::expr("visit + 1")))->where('uid', '=', (int) $imgInfo['userid'])->execute();
DB::update('imgs')->set(array('click' => DB::expr('click + 1')))->where('id', '=', (int) $pid)->execute();
}
示例11: array
*/
case 'put':
//Requisições
$_DATA = $request->getRequestVars();
//Informações cadastradas
$data = array('tagName' => trim($_DATA['tagName']));
//Instâncias
$tags = new Tags();
//Verificar inputs básicos
if ($data['tagName'] == '' || count($data['tagName']) > 28) {
//Nome da tag
RestUtils::sendResponse('406', array('data' => 'tagName', 'message' => 'Por favor, verifique o nome da tag.'));
}
//Verifica se a tag já não existe
$allTagsCompare = array();
foreach ($tags->get(500) as $tag) {
$tag = strtolower(clearUTF($tag['name']));
array_push($allTagsCompare, $tag);
}
if (in_array(prepareToCompare($data['tagName']), $allTagsCompare)) {
//Se a tag já existe
RestUtils::sendResponse('406', array('data' => 'tagName', 'message' => 'A tag a ser cadastrada já existe.'));
}
//Conexão
$sql = new DataBase();
$sql->connect();
//Adiciona a tag no banco
$sql->query("INSERT INTO tags(name, profile_id) VALUES ('" . ucfirst(trim(convertToUnicode($data['tagName']))) . "','" . CurrentUser::getId() . "')");
//Termina execução com sucesso
$sql->close();
RestUtils::sendResponse('201');
示例12: Tags
* Add tags to image
*
* @param tags commaseparated string of tags
* @param image valid image id
*/
case 'addTags':
if (!isset($_GET['tags']) || !isset($_GET['image'])) {
echo "-20 Tags or image where not given";
break;
}
if (!is_numeric($_GET['image'])) {
echo "-21 Image ID " . $_GET['image'] . " is not a number!";
break;
}
$t = new Tags();
echo json_encode($t->get($t->connect((int) $_GET['image'], $_GET['tags'])));
break;
/**
* Upload a file by URL
*
* @param url url to upload to imagescript
*/
/**
* Upload a file by URL
*
* @param url url to upload to imagescript
*/
case 'uploadByURL':
if (!isset($_GET['url'])) {
echo "-20 URL not set!";
break;
示例13: action_edit
/**
* 编辑专题
*/
public function action_edit()
{
$this->checklogin();
$this->template->pageTitle = '编辑专题';
$this->_add_css('styles/album/add_topics.css');
$this->_add_script('scripts/copy.js');
$sid = (int) $this->getQuery('sid');
$specialpic = ORM::factory('specialpic');
$tag = new Tags();
if ($this->isPost()) {
$post = Validate::factory($this->getPost())->filter(TRUE, 'trim')->rule('title', 'not_empty')->rule('content', 'not_empty');
if ($post->check()) {
$set = array('title' => trim($this->getPost('title')), 'content' => trim($this->getPost('content')));
$sid = (int) $this->getPost('sid');
DB::update('specialpics')->set($set)->where('sid', '=', $sid)->where('uid', '=', $this->auth['uid'])->execute();
$tags = $this->getPost('tags');
$tags = explode(' ', $tags);
$tag->set($sid, 'img_subject', $tags, $this->auth['uid']);
$links[] = array('text' => '返回专题列表', 'href' => '/picsubject/list');
$this->show_message('编辑专题操作成功。', 1, $links);
}
}
$this->template->tags = $tags = $tag->get($sid, 'img_subject', $this->auth['uid']);
$this->template->info = ORM::factory('specialpic')->where('sid', '=', $sid)->where('uid', '=', $this->auth['uid'])->find();
}
示例14: tag_cloud
/**
* Retrieve an unordered list of tags.
*
* @return string
*/
public function tag_cloud()
{
$tags = Tags::get();
if (count($tags) == 0) {
return;
}
$counts = array();
foreach ($tags as $tag) {
$counts[] = $tag->count;
}
$min = min($counts);
$step = 14 / max(max($counts) - $min, 1);
$out[] = '<ul class="tag-cloud">';
foreach ($tags as $tag) {
$link = URL::get('display_entries_by_tag', array('tag' => $tag->slug));
$size = 8 + ($tag->count - $min) * $step;
$out[] = '<li>';
$out[] = "<a href='{$link}' class='tag-link-{$tag->id}' title='" . $tag->count . " topic(s)' rel='tag' style='font-size:" . $size . "pt;'>{$tag->tag}</a>";
$out[] = '</li>';
}
$out[] = '</ul>';
return implode("\n", $out);
}
示例15: sCblockMgr
if ($file) {
$fileInfo = $file->get();
$controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
}
}
}
if ($controlFormfields[$w]['FORMFIELD'] == 7) {
if ($controlFormfields[$w]['VALUE01']) {
$cbw = sCblockMgr()->getCblock($controlFormfields[$w]['VALUE01']);
$info = $cbw->get();
$controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
}
}
if ($controlFormfields[$w]['FORMFIELD'] == 8) {
if ($controlFormfields[$w]['VALUE01']) {
$info = $tagMgr->get($controlFormfields[$w]['VALUE01']);
$controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
}
}
}
$colist[$x]['ENTRYMASKS'][$c]['FORMFIELDS'] = $controlFormfields;
}
}
}
$contentareas[$i]['LIST'] = $colist;
}
}
// Save order here
$colnkorder = array();
foreach ($contentareas as $contentareas_item) {
if ($contentareas_item['CODE'] == $contentarea) {