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


PHP JHelperTags::getItemTags方法代码示例

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


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

示例1: onCCK_FieldPrepareContent

 public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
 {
     if (self::$type != $field->type) {
         return;
     }
     parent::g_onCCK_FieldPrepareContent($field, $config);
     $html = '';
     if ($value || ($config['client'] == 'list' || $config['client'] == 'item')) {
         $location = isset($config['location']) && $config['location'] ? $config['location'] : 'joomla_article';
         $properties = array('context');
         $properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
         /* temporary fix for content categories */
         if ($properties['context'] == 'com_categories.category') {
             $properties['context'] = 'com_content.category';
             // todo: dynamic context per extension (#__categories)
         }
         /* temporary fix for content categories */
         if (is_object($value) && isset($value->tags)) {
             $value = $value->tags;
         }
         $tags = new JHelperTags();
         $tags->getItemTags($properties['context'], $config['pk']);
         $tagLayout = new JLayoutFile('joomla.content.tags');
         $html = $tagLayout->render($tags->itemTags);
     }
     // Set
     $field->value = $value;
     $field->html = $html;
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:29,代码来源:jform_tag.php

示例2: getTags

 /**
  * This method returns category description.
  *
  * <code>
  * $categoryId = 1;
  *
  * $category   = new Userideas\Category\Category(\JFactory::getDbo());
  * $category->load($categoryId);
  *
  * $category->setTagsHelper(new \JHelperTags);
  * </code>
  *
  * @param bool $getTagData If true, data from the tags table will be included, defaults to true.
  *
  * @return null|array
  */
 public function getTags($getTagData = true)
 {
     if ($this->tags === null and $this->tagsHelper instanceof \JHelperTags) {
         $this->tags = $this->tagsHelper->getItemTags($this->contentAlias, $this->id, $getTagData);
     }
     return $this->tags;
 }
开发者ID:bellodox,项目名称:UserIdeas,代码行数:23,代码来源:Category.php

示例3: getItem

 /**
  * Method to get an object.
  *
  * @param    integer $id The id of the object to get.
  *
  * @return    mixed    Object on success, false on failure.
  */
 public function getItem($id = null)
 {
     if (!$id) {
         $id = $this->getState($this->getName() . '.id');
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id, a.title, a.description, a.votes, a.record_date, a.catid, a.user_id, a.status_id, a.hits, a.params, ' . $query->concatenate(array('a.id', 'a.alias'), '-') . ' AS slug, ' . 'b.name, b.username, ' . 'c.title AS category, ' . $query->concatenate(array('c.id', 'c.alias'), '-') . ' AS catslug, ' . 'd.name AS status_name, d.params AS status_params, d.default AS status_default');
     $query->from($db->quoteName('#__uideas_items', 'a'));
     $query->leftJoin($db->quoteName('#__users', 'b') . ' ON a.user_id = b.id');
     $query->leftJoin($db->quoteName('#__categories', 'c') . ' ON a.catid = c.id');
     $query->leftJoin($db->quoteName('#__uideas_statuses', 'd') . ' ON a.status_id = d.id');
     $query->where('a.id = ' . (int) $id);
     $db->setQuery($query);
     $this->item = $db->loadObject();
     // Prepare status object
     if ($this->item !== null and (int) $this->item->id > 0) {
         $this->prepareStatus($this->item);
         $tags = new JHelperTags();
         $this->item->tags = $tags->getItemTags('com_userideas.item', $this->item->id);
         $registry = new Joomla\Registry\Registry();
         $registry->loadString($this->item->params);
         $this->item->params = $registry;
     }
     return $this->item;
 }
开发者ID:bellodox,项目名称:UserIdeas,代码行数:33,代码来源:details.php

示例4: loadTags

 function loadTags($type, $element)
 {
     if (!isset($this->structure[$type]) || !$this->_isCompatible) {
         return false;
     }
     $structure = $this->structure[$type];
     $component = 'hikashop';
     if (!empty($structure['component'])) {
         $component = $structure['component'];
     }
     $alias = 'com_' . $component . '.' . $structure['table'];
     $id = $structure['id'];
     $ret = false;
     if (!empty($element->{$id})) {
         $tagsHelper = new JHelperTags();
         $ret = $tagsHelper->getItemTags($alias, $element->{$id}, false);
     }
     return $ret;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:19,代码来源:tags.php

示例5: getList

 public static function getList(&$params)
 {
     $list = array();
     $show_tag = $params->get('item_tags_display', 0);
     $show_description = $params->get('item_desc_display', 1);
     $maxlength_desc = $params->get('item_desc_maxlength', 200);
     $show_title = $params->get('title_display');
     $maxlength_title = $params->get('item_title_maxlength', 25);
     $articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $appParams = $app->getParams();
     $articles->setState('params', $appParams);
     $articles->setState('list.start', 0);
     $articles->setState('list.limit', (int) $params->get('count', 0));
     $articles->setState('filter.published', 1);
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $articles->setState('filter.access', $access);
     $catids = $params->get('catid');
     if ($catids) {
         if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) {
             $categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true));
             $categories->setState('params', $appParams);
             $levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999;
             $categories->setState('filter.get_children', $levels);
             $categories->setState('filter.published', 1);
             $categories->setState('filter.access', $access);
             $additional_catids = array();
             foreach ($catids as $catid) {
                 $categories->setState('filter.parentId', $catid);
                 $recursive = true;
                 $items = $categories->getItems($recursive);
                 if ($items) {
                     foreach ($items as $category) {
                         $condition = $category->level - $categories->getParent()->level <= $levels;
                         if ($condition) {
                             $additional_catids[] = $category->id;
                         }
                     }
                 }
             }
             $catids = array_unique(array_merge($catids, $additional_catids));
         }
         $articles->setState('filter.category_id', $catids);
     }
     $articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering'));
     $articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
     $articles->setState('filter.featured', $params->get('show_front', 'show'));
     $articles->setState('filter.language', $app->getLanguageFilter());
     $items = $articles->getItems();
     if (!empty($items)) {
         foreach ($items as &$item) {
             $item->slug = $item->id . ':' . $item->alias;
             $item->catslug = $item->catid ? $item->catid . ':' . $item->category_alias : $item->catid;
             if ($access || in_array($item->access, $authorised)) {
                 $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
             } else {
                 $app = JFactory::getApplication();
                 $menu = $app->getMenu();
                 $menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login');
                 if (isset($menuitems[0])) {
                     $Itemid = $menuitems[0]->id;
                 } elseif ($app->input->getInt('Itemid') > 0) {
                     $Itemid = $app->input->getInt('Itemid');
                 }
                 $item->link = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $Itemid);
             }
             $item->_introtext = self::_cleanText($item->introtext);
             $item->_description = self::_trimEncode($item->_introtext) != '' && $show_description ? self::truncate($item->_introtext, $maxlength_desc) : '';
             $item->tags = '';
             if ($show_tag && class_exists('JHelperTags')) {
                 $tagLayout = new JLayoutFile('joomla.content.tags');
                 $tags = new JHelperTags();
                 $tags->getItemTags('com_content.article', $item->id);
                 $item->tags = $tagLayout->render($tags->itemTags);
             }
             $item->sub_title = $show_title ? self::truncate($item->title, $maxlength_title) : '';
             $image = self::createThumbs($item, $params, 'imgf');
             $attr = ' ';
             $attr .= isset($image['title']) ? ' title = "' . $image['title'] . '"' : '';
             $attr .= isset($image['alt']) ? ' alt = "' . $image['alt'] . '"' : '';
             $attr .= isset($image['class']) ? ' class = "' . $image['class'] . '"' : '';
             $item->image_src = isset($image['src']) ? $image['src'] : '';
             $item->image_attr = $attr;
             $item->link_target = self::linkTarget($params->get('link_target'));
             $list[] = $item;
         }
     }
     return $list;
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:91,代码来源:helper.php

示例6: _contact

 private function _contact($id, &$xml, $options)
 {
     JLog::add(new JLogEntry(__METHOD__, JLOG::DEBUG, 'lib_j2xml'));
     JLog::add(new JLogEntry('id: ' . $id, JLOG::DEBUG, 'lib_j2xml'));
     JLog::add(new JLogEntry('options: ' . print_r($options, true), JLOG::DEBUG, 'lib_j2xml'));
     jimport('eshiol.j2xml.table.contact');
     $item = JTable::getInstance('contact', 'eshTable');
     if (!$item->load($id)) {
         return;
     }
     if ($xml->xpath("//j2xml/contact/id[text() = '" . $item->id . "']")) {
         return;
     }
     $doc = dom_import_simplexml($xml)->ownerDocument;
     $fragment = $doc->createDocumentFragment();
     $fragment->appendXML($item->toXML());
     $doc->documentElement->appendChild($fragment);
     if ($options['users']) {
         if ($item->created_by) {
             self::_user($item->created_by, $xml, $options);
         }
         if ($item->modified_by) {
             self::_user($item->modified_by, $xml, $options);
         }
     }
     if ($options['images']) {
         if (isset($item->image)) {
             self::_image($item->image, $xml, $options);
         }
     }
     if ($options['categories'] && $item->catid > 0) {
         self::_category($item->catid, $xml, $options);
     }
     if (class_exists('JHelperTags')) {
         $htags = new JHelperTags();
         $itemtags = $htags->getItemTags('com_contact.contact', $id);
         foreach ($itemtags as $itemtag) {
             self::_tag($itemtag->tag_id, $xml, $options);
         }
     }
 }
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:41,代码来源:exporter.php

示例7: keywordsData

 /**
  * Extracts the keywords or tags from the articles. The tags are used if the parameter "tags" is entered in the syntax call.
  *
  * @param array $articles - Array of possible articles
  *
  * @return array $keyword_list - List of allowed keywords
  */
 private function keywordsData($articles)
 {
     $keywords_list = array();
     foreach ($articles as $article) {
         if (empty($this->eks_parameters['tags'])) {
             if (!empty($article->metakey)) {
                 $metakey_array = array_map('trim', explode(',', $article->metakey));
                 foreach ($metakey_array as $metakey) {
                     $keywords_list[String::ucfirst($metakey)][] = $article;
                 }
             }
         } else {
             $tags_helper = new JHelperTags();
             $tags = $tags_helper->getItemTags('com_content.article', $article->id);
             if (!empty($tags)) {
                 foreach ($tags as $tag) {
                     $keywords_list[String::ucfirst($tag->title)][] = $article;
                 }
             }
         }
     }
     ksort($keywords_list);
     if (!empty($this->eks_parameters['keyword'])) {
         foreach ($keywords_list as $key => $value) {
             if (is_array($this->eks_parameters['keyword'])) {
                 if (!in_array(String::strtolower($key), $this->eks_parameters['keyword'])) {
                     unset($keywords_list[$key]);
                     continue;
                 }
             } else {
                 if (String::strtolower($key) != String::strtolower($this->eks_parameters['keyword'])) {
                     unset($keywords_list[$key]);
                     continue;
                 }
             }
         }
     } elseif (!empty($this->eks_parameters['nokeyword'])) {
         foreach ($keywords_list as $key => $value) {
             if (is_array($this->eks_parameters['nokeyword'])) {
                 if (in_array(String::strtolower($key), $this->eks_parameters['nokeyword'])) {
                     unset($keywords_list[$key]);
                     continue;
                 }
             } else {
                 if (String::strtolower($key) == String::strtolower($this->eks_parameters['nokeyword'])) {
                     unset($keywords_list[$key]);
                     continue;
                 }
             }
         }
     }
     return $keywords_list;
 }
开发者ID:spiridonov-oa,项目名称:remontvolt,代码行数:60,代码来源:easykeywordsitemap.php

示例8: getHashtagsFromTags

 /**
  * getHashtagsFromTags
  *
  * @param   int  $id  Param.
  *
  * @return	string
  */
 protected function getHashtagsFromTags($id)
 {
     if (EXTLY_J25) {
         return null;
     }
     jimport('cms.helper.tags');
     $jtags = new JHelperTags();
     $tags = $jtags->getItemTags('com_content.article', $id);
     if (count($tags) > 0) {
         $titles = array_map(function ($v) {
             return $v->title;
         }, $tags);
         $c = count($titles);
         $tags = implode(',', $titles);
         return $this->getHashtags($tags, $c);
     }
     return null;
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:25,代码来源:autotweetcontent.php

示例9: updateSliderAjax

 /**
  * Loads article information for the category (and sub-categories)
  * that the user selected in the slider and returns that to the calling
  * AJAX function.
  */
 public static function updateSliderAjax()
 {
     $input = JFactory::getApplication()->input;
     $categoryId = $input->get('data');
     // Prepare answer array.
     $result = array();
     $result['url'] = JURI::root();
     // -1 represents all categories - fetch all articles in that case.
     if ($categoryId == -1) {
         // Get article info from database.
         $categoryData = modNavSliderHelper::queryDatabase('#__content', 'title, images, alias, publish_up, id, introtext', 'state = 1', 0, 'publish_up DESC');
         // Also parse the images String.
         for ($j = 0; $j < count($categoryData); $j++) {
             $categoryData[$j] += array('image_fulltext' => modNavSliderHelper::parseImageString('image_fulltext', $categoryData[$j]['images']));
             $categoryData[$j] += array('image_intro' => modNavSliderHelper::parseImageString('image_intro', $categoryData[$j]['images']));
         }
         // Otherwise we have a category id.
     } else {
         // Get children categories.
         $ids = array();
         $ids[0] = $categoryId;
         $ids = modNavSliderHelper::getChildrenCategoryIds($ids[0], $ids);
         // Go through all IDs.
         // Concatenate IDs into select string.
         $select_ids = "catid = " . $ids[0];
         for ($i = 1; $i < count($ids); $i++) {
             $select_ids .= " OR catid = " . $ids[$i];
         }
         // Get article info from database.
         $categoryData = modNavSliderHelper::queryDatabase('#__content', 'title, images, alias, publish_up, id, introtext', 'state = 1 AND ' . $select_ids, 0, 'publish_up DESC');
         // Also parse the images String.
         for ($j = 0; $j < count($categoryData); $j++) {
             $categoryData[$j] += array('image_fulltext' => modNavSliderHelper::parseImageString('image_fulltext', $categoryData[$j]['images']));
             $categoryData[$j] += array('image_intro' => modNavSliderHelper::parseImageString('image_intro', $categoryData[$j]['images']));
         }
     }
     // Retrieve tags for articles.
     for ($i = 0; $i < count($categoryData); $i++) {
         $tags = new JHelperTags();
         $tags->getItemTags('com_content.article', $categoryData[$i]['id']);
         $itemTags = $tags->itemTags;
         // itemTags contains all info on the tags - filter out what we need.
         $strippedTags = array();
         for ($j = 0; $j < count($itemTags); $j++) {
             $strippedTags[] = array('title' => $itemTags[$j]->title, 'id' => $itemTags[$j]->id);
         }
         $categoryData[$i] += array('tags' => $strippedTags);
     }
     $result['articles'] = $categoryData;
     return json_encode($result);
 }
开发者ID:kunterbunt,项目名称:mod_navslider,代码行数:56,代码来源:helper.php

示例10: JHelperTags

 function tags_out($row)
 {
     $tags_out = "";
     if ($this->params->get('show_tags') and version_compare($this->getShortVersion(), '3.2.0', '>=')) {
         $tags = new JHelperTags();
         $itemTags = $tags->getItemTags('com_content.article', $row->id);
         $onlyTags = array();
         if ($this->params->get('display_tags_type') == 1 and $this->params->get('set_tags')) {
             foreach ($itemTags as $tag) {
                 if (in_array($tag->id, $this->params->get('set_tags'))) {
                     $onlyTags[] = $tag;
                 }
             }
         } elseif ($this->params->get('display_tags_type') == 2 and $this->params->get('display_tags')) {
             foreach ($itemTags as $tag) {
                 if (in_array($tag->id, $this->params->get('display_tags'))) {
                     $onlyTags[] = $tag;
                 }
             }
         } elseif ($this->params->get('display_tags_type') == 3 and $this->params->get('display_tags')) {
             foreach ($itemTags as $tag) {
                 if (!in_array($tag->id, $this->params->get('display_tags'))) {
                     $onlyTags[] = $tag;
                 }
             }
         } else {
             $onlyTags = $itemTags;
         }
         if ($this->params->get('show_tags') && !empty($onlyTags)) {
             $tagLayout = new JLayoutFile('joomla.content.tags');
             $tags_out = $tagLayout->render($onlyTags);
         }
     }
     return $tags_out;
 }
开发者ID:esorone,项目名称:efcpw,代码行数:35,代码来源:helper.php

示例11: tagsForType

 function tagsForType($type, $id)
 {
     if (!$id) {
         return array();
     }
     $tags = new JHelperTags();
     $alltags = $tags->getItemTags($type, $id);
     $names = array();
     foreach ($alltags as $tag) {
         $names[] = $tag->title;
     }
     return $names;
 }
开发者ID:JozefAB,项目名称:qk,代码行数:13,代码来源:content.php


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