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


PHP ElementHelper::applySeparators方法代码示例

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


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

示例1: render

 public function render($params = array())
 {
     $countries = $this->_data->get('country', array());
     $keys = array_flip($countries);
     $countries = array_intersect_key(self::getCountryArray(), $keys);
     $countries = array_map(create_function('$a', 'return JText::_($a);'), $countries);
     return ElementHelper::applySeparators($params['separated_by'], $countries);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:8,代码来源:country.php

示例2: render

 public function render($params = array())
 {
     $linked = isset($params['linked']) && $params['linked'];
     $values = array();
     foreach ($this->_item->getRelatedCategories(true) as $category) {
         $values[] = $linked ? '<a href="' . JRoute::_(RouteHelper::getCategoryRoute($category)) . '">' . $category->name . '</a>' : $category->name;
     }
     return ElementHelper::applySeparators($params['separated_by'], $values);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:9,代码来源:itemcategory.php

示例3: render

 public function render($params = array())
 {
     $category_ids = $this->_data->get('category', array());
     $category_links = array();
     $categories = YTable::getInstance('category')->getById($category_ids, true);
     foreach ($categories as $category) {
         $category_links[] = '<a href="' . RouteHelper::getCategoryRoute($category) . '">' . $category->name . '</a>';
     }
     return ElementHelper::applySeparators($params['separated_by'], $category_links);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:10,代码来源:relatedcategories.php

示例4: render

 public function render($params = array())
 {
     $options_from_config = $this->_config->get('options');
     $selected_options = $this->_data->get('option', array());
     $options = array();
     foreach ($options_from_config as $option) {
         if (in_array($option['value'], $selected_options)) {
             $options[] = $option['name'];
         }
     }
     return ElementHelper::applySeparators($params['separated_by'], $options);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:12,代码来源:option.php

示例5: render

 public function render($params = array())
 {
     $linked = isset($params['linked']) && $params['linked'];
     $values = array();
     if ($linked) {
         foreach ($this->_item->getTags() as $tag) {
             $values[] = '<a href="' . JRoute::_(RouteHelper::getTagRoute($this->_item->application_id, $tag)) . '">' . $tag . '</a>';
         }
     } else {
         $values = $this->_item->getTags();
     }
     return ElementHelper::applySeparators($params['separated_by'], $values);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:13,代码来源:itemtag.php

示例6: render

 public function render($params = array())
 {
     $result = array();
     foreach ($this as $self) {
         $result[] = $this->_render($params);
     }
     return ElementHelper::applySeparators($params['separated_by'], $result);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:8,代码来源:repeatable.php

示例7: render

 public function render($params = array())
 {
     $jplugins = $this->_config->get('jplugins');
     $display = isset($params['display']) ? $params['display'] : 'all';
     $result = array();
     switch ($display) {
         case 'all':
             foreach ($this as $self) {
                 if (($text = $this->_data->get('value', '')) && !empty($text)) {
                     $result[] = $text;
                 }
             }
             break;
         case 'first':
             $this->rewind();
             if (($text = $this->_data->get('value', '')) && !empty($text)) {
                 $result[] = $text;
             }
             break;
         case 'all_without_first':
             $this->rewind();
             while ($this->next()) {
                 if (($text = $this->_data->get('value', '')) && !empty($text)) {
                     $result[] = $text;
                 }
             }
             break;
     }
     // trigger joomla content plugins
     if ($jplugins) {
         for ($i = 0; $i < count($result); $i++) {
             $result[$i] = ZooHelper::triggerContentPlugins($result[$i]);
         }
     }
     return ElementHelper::applySeparators($params['separated_by'], $result);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:36,代码来源:textarea.php

示例8: render

 public function render($params = array())
 {
     // init vars
     $params = new YArray($params);
     $items = array();
     $output = array();
     $layout_path = $params->get('layout_path');
     $renderer = new ItemRenderer();
     $renderer->addPath($layout_path);
     $layout = $params->get('layout');
     $items = $this->_getRelatedItems();
     // sort items
     $order = $params->get('order');
     if (in_array($order, array('alpha', 'ralpha'))) {
         usort($items, create_function('$a,$b', 'return strcmp($a->name, $b->name);'));
     } elseif (in_array($order, array('date', 'rdate'))) {
         usort($items, create_function('$a,$b', 'return (strtotime($a->created) == strtotime($b->created)) ? 0 : (strtotime($a->created) < strtotime($b->created)) ? -1 : 1;'));
     } elseif (in_array($order, array('hits', 'rhits'))) {
         usort($items, create_function('$a,$b', 'return ($a->hits == $b->hits) ? 0 : ($a->hits < $b->hits) ? -1 : 1;'));
     } elseif ($order == 'random') {
         shuffle($items);
     } else {
     }
     if (in_array($order, array('ralpha', 'rdate', 'rhits'))) {
         $items = array_reverse($items);
     }
     // create output
     foreach ($items as $item) {
         $path = 'item';
         $prefix = 'item.';
         $type = $item->getType()->id;
         if ($renderer->pathExists($path . DIRECTORY_SEPARATOR . $type)) {
             $path .= DIRECTORY_SEPARATOR . $type;
             $prefix .= $type . '.';
         }
         if (in_array($layout, $renderer->getLayouts($path))) {
             $output[] = $renderer->render($prefix . $layout, array('item' => $item));
         } elseif ($params->get('link_to_item', false) && $item->getState()) {
             $url = RouteHelper::getItemRoute($item);
             $output[] = '<a href="' . JRoute::_($url) . '" title="' . $item->name . '">' . $item->name . '</a>';
         } else {
             $output[] = $item->name;
         }
     }
     return ElementHelper::applySeparators($params->get('separated_by'), $output);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:46,代码来源:relateditems.php


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