本文整理汇总了PHP中FlexicontentHelperRoute::getCategoryRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentHelperRoute::getCategoryRoute方法的具体用法?PHP FlexicontentHelperRoute::getCategoryRoute怎么用?PHP FlexicontentHelperRoute::getCategoryRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentHelperRoute
的用法示例。
在下文中一共展示了FlexicontentHelperRoute::getCategoryRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLinks
public function getLinks($args)
{
$view = isset($args->view) ? $args->view : '';
if (!($view = 'category')) {
return array();
}
require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'route.php';
$items = array();
$CategoryId = $args->cid;
//adding categoryes
$db =& JFactory::getDBO();
$query = $db->getQuery(true);
$query->clear();
$query->select('id, title, lft, CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug');
$query->from('#__categories');
$query->where('published = 1 AND extension = \'com_content\' AND parent_id = ' . $CategoryId);
$query->order('lft ASC');
$db->setQuery($query);
$categories = $db->loadObjectList();
foreach ($categories as $category) {
$items[] = array('url' => FlexicontentHelperRoute::getCategoryRoute($category->slug), 'id' => 'index.php?option=com_flexicontent_items&view=category&cid=' . $category->id, 'name' => $category->title, 'class' => 'folderflexiitems');
}
//adding items
$query->clear();
$query->select(' i.id as iid, i.title AS ititle, c.id as catid,' . ' CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as slug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug');
$query->from('#__content AS i' . ' LEFT JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id ' . ' LEFT JOIN #__categories AS c ON c.id = rel.catid ');
$query->where('c.id = ' . $CategoryId);
$query->order('i.title ASC');
$db->setQuery($query);
$contents = $db->loadObjectList();
foreach ($contents as $content) {
$items[] = array('url' => FlexicontentHelperRoute::getItemRoute($content->slug, $content->catslug), 'id' => 'index.php?option=com_flexicontent_items&view=category&cid=' . $category->id . '&id=' . $content->iid, 'name' => $content->ititle . '(id=' . $content->iid . ')', 'class' => 'fileflexiitems');
}
return $items;
}
示例2: getAssociations
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);
$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view == 'item') {
if ($id) {
//$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id);
$associations = FlexicontentHelperAssociation::getItemAssociations($id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = FlexicontentHelperRoute::getItemRoute($item->id, $item->catid, 0, $item);
}
return $return;
}
} else {
if ($view == 'category') {
$cid = $jinput->getInt('cid');
if ($cid) {
$associations = FlexicontentHelperAssociation::getCatAssociations($cid);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = FlexicontentHelperRoute::getCategoryRoute($item->catid, 0, array(), $item);
}
return $return;
}
}
}
return array();
}
示例3: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
static $author_links = array();
if (!isset($author_links[$item->created_by])) {
$author_links[$item->created_by] = JRoute::_(FlexicontentHelperRoute::getCategoryRoute(0, 0, array('layout' => 'author', 'authorid' => $item->created_by)));
}
$field->{$prop} = '<a href="' . $author_links[$item->created_by] . '" itemprop="author">' . JText::_('FLEXI_FIELD_AI_MORE_ITEMS_BY_THIS_AUTHOR') . '</a>';
}
示例4: getsefurl
/**
* Logic to create SEF urls via AJAX requests
*
* @access public
* @return void
* @since 1.0
*/
function getsefurl()
{
$view = JRequest::getVar('view');
if ($view == 'category') {
$cid = (int) JRequest::getVar('cid');
if ($cid) {
$db = JFactory::getDBO();
$query = 'SELECT CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as categoryslug' . ' FROM #__categories AS c WHERE c.id = ' . $cid;
$db->setQuery($query);
$categoryslug = $db->loadResult();
echo JRoute::_(FlexicontentHelperRoute::getCategoryRoute($categoryslug), false);
}
}
jexit();
}
示例5: onDisplayCoreFieldValue
//.........这里部分代码省略.........
// dummy value to force display
$favs = flexicontent_html::favoured_userlist($field, $item, $favourites);
$field->display = $pretext . '
<span class="fav-block">
' . flexicontent_html::favicon($field, $favoured, $item) . '
<span id="fcfav-reponse_' . $field->item_id . '" class="fcfav-reponse">
<small>' . $favs . '</small>
</span>
</span>
' . $posttext;
break;
case 'categories':
// assigned categories
$field->display = '';
if ($_categories === false) {
$categories =& $item->cats;
} else {
$categories =& $_categories;
}
if ($categories) {
// Get categories that should be excluded from linking
global $globalnoroute;
if (!is_array($globalnoroute)) {
$globalnoroute = array();
}
// Create list of category links, excluding the "noroute" categories
$field->display = array();
foreach ($categories as $category) {
$cat_id = $category->id;
if (in_array($cat_id, @$globalnoroute)) {
continue;
}
if (!isset($cat_links[$cat_id])) {
$cat_links[$cat_id] = JRoute::_(FlexicontentHelperRoute::getCategoryRoute($category->slug));
}
$cat_link = $cat_links[$cat_id];
$display = '<a class="fc_categories fc_category_' . $cat_id . ' link_' . $field->name . '" href="' . $cat_link . '">' . $category->title . '</a>';
$field->display[] = $pretext . $display . $posttext;
$field->value[] = $category->title;
}
$field->display = implode($separatorf, $field->display);
$field->display = $opentag . $field->display . $closetag;
}
break;
case 'tags':
// assigned tags
$field->display = '';
if ($_tags === false) {
$tags =& $item->tags;
} else {
$tags =& $_tags;
}
if ($tags) {
// Create list of tag links
$field->display = array();
foreach ($tags as $tag) {
$tag_id = $tag->id;
if (!isset($tag_links[$tag_id])) {
$tag_links[$tag_id] = JRoute::_(FlexicontentHelperRoute::getTagRoute($tag->slug));
}
$tag_link = $tag_links[$tag_id];
$display = '<a class="fc_tags fc_tag_' . $tag->id . ' link_' . $field->name . '" href="' . $tag_link . '">' . $tag->name . '</a>';
$field->display[] = $pretext . $display . $posttext;
$field->value[] = $tag->name;
}
$field->display = implode($separatorf, $field->display);
示例6: display
//.........这里部分代码省略.........
$item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$params, $limitstart));
$item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$params, $limitstart));
$item->event->afterDisplayContent = trim(implode("\n", $results));
// Reverse the compatibility steps, set the view and option back to 'items' and 'com_flexicontent'
JRequest::setVar('view', FLEXI_ITEMVIEW);
JRequest::setVar('option', 'com_flexicontent');
// Restore suppressed plugins
FLEXIUtilities::suppressPlugins($suppress_arr, 'restore');
// Put text back into the description field, THESE events SHOULD NOT modify the item text, but some plugins may do it anyway... , so we assign text back for compatibility
if (!empty($item->positions)) {
foreach ($item->positions as $pos_fields) {
foreach ($pos_fields as $pos_field) {
if ($pos_field->name !== 'text') {
continue;
}
$pos_field->display =& $item->text;
}
}
}
$item->fields['text']->display =& $item->text;
// (TOC) TABLE OF Contents has been created inside description field (named 'text') by
// the pagination plugin, this should be assigned to item as a property with same name
if (isset($item->fields['text']->toc)) {
$item->toc =& $item->fields['text']->toc;
}
// ********************************************************************************************
// Create pathway, if automatic pathways is enabled, then path will be cleared before populated
// ********************************************************************************************
$pathway = $app->getPathWay();
// Clear pathway, if automatic pathways are enabled
if ($params->get('automatic_pathways', 0)) {
$pathway_arr = $pathway->getPathway();
$pathway->setPathway(array());
//$pathway->set('_count', 0); // not needed ??
$item_depth = 0;
// menu item depth is now irrelevant ???, ignore it
} else {
$item_depth = $params->get('item_depth', 0);
}
// Respect menu item depth, defined in menu item
$p = $item_depth;
while ($p < count($parents)) {
// For some Content Types the pathway should not be populated with category links
if (in_array($item->type_id, $globalnopath)) {
break;
}
// Do not add to pathway unroutable categories
if (in_array($parents[$p]->id, $globalnoroute)) {
$p++;
continue;
}
// Add current parent category
$pathway->addItem($this->escape($parents[$p]->title), JRoute::_(FlexicontentHelperRoute::getCategoryRoute($parents[$p]->slug)));
$p++;
}
if ($params->get('add_item_pathway', 1)) {
$pathway->addItem($this->escape($item->title), JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug, 0, $item)));
}
// **********************************************************************
// Print link ... must include layout and current filtering url vars, etc
// **********************************************************************
$curr_url = $_SERVER['REQUEST_URI'];
$print_link = $curr_url . (strstr($curr_url, '?') ? '&' : '?') . 'pop=1&tmpl=component&print=1';
//$print_link = JRoute::_('index.php?view='.FLEXI_ITEMVIEW.'&cid='.$item->categoryslug.'&id='.$item->slug.'&pop=1&tmpl=component&print=1');
$pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->assignRef('item', $item);
$this->assignRef('user', $user);
$this->assignRef('params', $params);
$this->assignRef('print_link', $print_link);
$this->assignRef('pageclass_sfx', $pageclass_sfx);
$this->assignRef('parentcat', $parentcat);
$this->assignRef('fields', $item->fields);
$this->assignRef('tmpl', $tmpl);
/*
* Set template paths : this procedure is issued from K2 component
*
* "K2" Component by JoomlaWorks for Joomla! 1.5.x - Version 2.1
* Copyright (c) 2006 - 2009 JoomlaWorks Ltd. All rights reserved.
* Released under the GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
* More info at http://www.joomlaworks.gr and http://k2.joomlaworks.gr
* Designed and developed by the JoomlaWorks team
*/
$this->addTemplatePath(JPATH_COMPONENT . DS . 'templates');
$this->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_flexicontent' . DS . 'templates');
$this->addTemplatePath(JPATH_COMPONENT . DS . 'templates' . DS . 'default');
$this->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_flexicontent' . DS . 'templates' . DS . 'default');
if ($ilayout) {
$this->addTemplatePath(JPATH_COMPONENT . DS . 'templates' . DS . $ilayout);
$this->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_flexicontent' . DS . 'templates' . DS . $ilayout);
}
if ($print_logging_info) {
$start_microtime = microtime(true);
}
parent::display($tpl);
if ($print_logging_info) {
$fc_run_times['template_render'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
}
示例7: getUrl
/**
* Returns the URL for an article
*
* @param Table $row
* @param boolean $htmlspecialchars
* @param string $type 'article', 'section' or 'category'
* @return string URL
*/
static public function getUrl( $row, $htmlspecialchars = true, $type = 'article' , $iid = 499)
{
global $_CB_framework;
/** @noinspection PhpIncludeInspection */
require_once ( $_CB_framework->getCfg( 'absolute_path' ) . '/components/com_flexicontent/helpers/route.php' );
$categorySlug = $row->get( 'category' ) . ( $row->get( 'category_alias' ) ? ':' . $row->get( 'category_alias' ) : null );
$articleSlug = $row->get( 'id' ) . ( $row->get( 'alias' ) ? ':' . $row->get( 'alias' ) : null );
switch ( $type ) {
case 'section':
$url = FlexicontentHelperRoute::getCategoryRoute( $row->get( 'section' ) );
break;
case 'category':
$url = FlexicontentHelperRoute::getCategoryRoute( $categorySlug );
break;
case 'article':
default:
$url = FlexicontentHelperRoute::getItemRoute( $articleSlug, $categorySlug , $iid ); //itemid 499
break;
}
if ( ! stristr( $url, 'Itemid' ) ) {
$url = $_CB_framework->getCfg( 'live_site' ) . '/' . $url;
} else {
//$url = JRoute::_( $url, false );
}
if ( $url ) {
if ( $htmlspecialchars ) {
$url = htmlspecialchars( $url );
}
}
return $url;
}
示例8: floor
<?php
$html = '<span class="flexi fc-pagenav">';
$tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip';
// CATEGORY back link
if ($use_category_link) {
$cat_image = $this->getCatThumb($category, $field->parameters);
$limit = $item_count;
$limit = $limit ? $limit : 10;
$start = floor($location / $limit) * $limit;
if (!empty($rows[$item->id]->categoryslug)) {
$html .= '
<span class="fc-pagenav-return">
<a class="btn" href="' . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($rows[$item->id]->categoryslug)) . '?start=' . $start . '">' . htmlspecialchars($category_label, ENT_NOQUOTES, 'UTF-8') . ($cat_image ? '
<br/>
<img src="' . $cat_image . '" alt="Return"/>' : '') . '
</a>
</span>';
}
}
// Item location and total count
$html .= $show_prevnext_count ? '<span class="fc-pagenav-items-cnt badge badge-info">' . ($location + 1) . ' / ' . $item_count . '</span>' : '';
// Next item linking
if ($field->prev) {
$tooltip = $use_tooltip ? ' title="' . flexicontent_html::getToolTip($tooltip_title_prev, $field->prevtitle, 0) . '"' : '';
$html .= '
<span class="fc-pagenav-prev' . ($use_tooltip ? $tooltip_class : '') . '" ' . ($use_tooltip ? $tooltip : '') . '>
<a class="btn" href="' . $field->prevurl . '">
<i class="icon-previous"></i>
' . ($use_title ? $field->prevtitle : htmlspecialchars($prev_label, ENT_NOQUOTES, 'UTF-8')) . '
' . ($field->prevThumb ? '
示例9: display
//.........这里部分代码省略.........
// Add css to document
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
// Add js function to overload the joomla submitform
$document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/admin.js');
$document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/validate.js');
// ********************
// Initialise variables
// ********************
$editor_name = $user->getParam('editor', $app->getCfg('editor'));
$editor = JFactory::getEditor($editor_name);
$cparams = JComponentHelper::getParams('com_flexicontent');
$bar = JToolBar::getInstance('toolbar');
if (!FLEXI_J16GE) {
$pane = JPane::getInstance('sliders');
$tpane = JPane::getInstance('tabs', array('startOffset' => 0, 'allowAllClose' => true, 'opacityTransition' => true, 'duration' => 600));
}
$categories = $globalcats;
// ******************
// Create the toolbar
// ******************
// Create Toolbar title and add the preview button
if (!$isnew) {
JToolBarHelper::title(JText::_('FLEXI_EDIT_CATEGORY'), 'fc_categoryedit');
$autologin = $cparams->get('autoflogin', 1) ? '&fcu=' . $user->username . '&fcp=' . $user->password : '';
$previewlink = JRoute::_(JURI::root() . FlexicontentHelperRoute::getCategoryRoute($categories[$cid]->slug)) . $autologin;
// Add a preview button
$bar->appendButton('Custom', '<a class="preview btn btn-small" href="' . $previewlink . '" target="_blank"><span title="' . JText::_('Preview') . '" class="icon-32-preview"></span>' . JText::_('Preview') . '</a>', 'preview');
} else {
JToolBarHelper::title(JText::_('FLEXI_NEW_CATEGORY'), 'fc_categoryadd');
}
// Add apply and save buttons
if (FLEXI_J16GE) {
JToolBarHelper::apply('category.apply');
JToolBarHelper::save('category.save');
} else {
JToolBarHelper::apply();
JToolBarHelper::save();
}
// Add a save and new button, if user can create inside at least one (com_content) category
if ($cancreate_cat) {
if (FLEXI_J16GE) {
JToolBarHelper::save2new('category.save2new');
} else {
JToolBarHelper::custom('saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
}
}
// Add a save as copy button, if editing an existing category (J2.5 only)
if (FLEXI_J16GE && !$isnew && $cancreate_cat) {
JToolBarHelper::save2copy('category.save2copy');
}
// Add a cancel or close button
if ($isnew) {
if (FLEXI_J16GE) {
JToolBarHelper::cancel('category.cancel');
} else {
JToolBarHelper::cancel();
}
示例10: display
/**
* Creates the RSS for the View
*
* @since 1.0
*/
function display($tpl = null)
{
$db = JFactory::getDBO();
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$params = $this->get('Params');
$doc->link = JRoute::_(FlexicontentHelperRoute::getCategoryRoute(JRequest::getVar('cid', null, '', 'int')));
$category = $this->get('Category');
// Prepare query to match feed data
JRequest::setVar('limit', $params->get('feed_limit'));
// Force a specific limit, this will be moved to the model
$params->set('orderby', $params->get('feed_orderby', 'rdate'));
$params->set('orderbycustomfield', $params->get('feed_orderbycustomfield', 1));
$params->set('orderbycustomfieldid', $params->get('feed_orderbycustomfieldid', 0));
$params->set('orderbycustomfielddir', $params->get('feed_orderbycustomfielddir', 'ASC'));
$params->set('orderbycustomfieldint', $params->get('feed_orderbycustomfieldint', 0));
$params->set('orderby_2nd', $params->get('feed_orderby', 'alpha'));
$params->set('orderbycustomfield_2nd', $params->get('feed_orderbycustomfield_2nd', 1));
$params->set('orderbycustomfieldid_2nd', $params->get('feed_orderbycustomfieldid_2nd', 0));
$params->set('orderbycustomfielddir_2nd', $params->get('feed_orderbycustomfielddir_2nd', 'ASC'));
$params->set('orderbycustomfieldint_2nd', $params->get('feed_orderbycustomfieldint_2nd', 0));
$model = $this->getModel();
$model->setState('limit', $params->get('feed_limit', $model->getState('limit')));
$rows = $this->get('Data');
$feed_summary = $params->get('feed_summary', 0);
$feed_summary_cut = $params->get('feed_summary_cut', 200);
$feed_use_image = $params->get('feed_use_image', 1);
$feed_link_image = $params->get('feed_link_image', 1);
$feed_image_source = $params->get('feed_image_source', '');
$feed_image_size = $params->get('feed_image_size', '');
$feed_image_method = $params->get('feed_image_method', 1);
$feed_image_width = $params->get('feed_image_width', 100);
$feed_image_height = $params->get('feed_image_height', 80);
// Retrieve default image for the image field
if ($feed_use_image && $feed_image_source) {
$query = 'SELECT attribs, name FROM #__flexicontent_fields WHERE id = ' . (int) $feed_image_source;
$db->setQuery($query);
$image_dbdata = $db->loadObject();
//$image_dbdata->params = FLEXI_J16GE ? new JRegistry($image_dbdata->params) : new JParameter($image_dbdata->params);
$img_size_map = array('l' => 'large', 'm' => 'medium', 's' => 'small', '' => '');
$img_field_size = $img_size_map[$feed_image_size];
$img_field_name = $image_dbdata->name;
}
// TODO render and add extra fields here ... maybe via special display function for feeds view
$extra_fields = $params->get('feed_extra_fields', '');
$extra_fields = array_unique(preg_split("/\\s*,\\s*/u", $extra_fields));
if ($extra_fields) {
foreach ($extra_fields as $fieldname) {
// Render given field for ALL ITEMS
FlexicontentFields::getFieldDisplay($rows, $fieldname, $values = null, $method = 'display');
}
}
foreach ($rows as $row) {
// strip html from feed item title
$title = $this->escape($row->title);
$title = html_entity_decode($title);
// url link to article
// & used instead of & as this is converted by feed creator
$link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $category->slug, 0, $row));
// strip html from feed item description text
$description = $feed_summary ? $row->introtext . $row->fulltext : $row->introtext;
$description = flexicontent_html::striptagsandcut($description, $feed_summary_cut);
if ($feed_use_image) {
// feed image is enabled
$src = '';
$thumb = '';
if ($feed_image_source) {
// case 1 use an image field
FlexicontentFields::getFieldDisplay($row, $img_field_name, null, 'display', 'module');
$img_field = $row->fields[$img_field_name];
if (!$img_field_size) {
$src = str_replace(JURI::root(), '', $img_field->thumbs_src['large'][0]);
} else {
$src = '';
$thumb = $img_field->thumbs_src[$img_field_size][0];
}
} else {
// case 2 extract from item
$src = flexicontent_html::extractimagesrc($row);
}
$RESIZE_FLAG = !$feed_image_source || !$img_field_size;
if ($src && $RESIZE_FLAG) {
// Resize image when src path is set and RESIZE_FLAG: (a) using image extracted from item main text OR (b) not using image field's already created thumbnails
$h = '&h=' . $feed_image_height;
$w = '&w=' . $feed_image_width;
$aoe = '&aoe=1';
$q = '&q=95';
$zc = $feed_image_method ? '&zc=' . $feed_image_method : '';
$ext = pathinfo($src, PATHINFO_EXTENSION);
$f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : '';
$conf = $w . $h . $aoe . $q . $zc . $f;
$base_url = !preg_match("#^http|^https|^ftp|^/#i", $src) ? JURI::base(true) . '/' : '';
$thumb = JURI::base(true) . '/components/com_flexicontent/librairies/phpthumb/phpThumb.php?src=' . $base_url . $src . $conf;
} else {
// Do not resize image when (a) image src path not set or (b) using image field's already created thumbnails
//.........这里部分代码省略.........
示例11: switchLangAssocItem
//.........这里部分代码省略.........
// Check Joomla switching language for (a) Home Page menu items OR (b) other language associated menu items
if ( $curr_menu && $curr_menu->language!='*' && $curr_menu->language!=$prev_lang_tag )
{
// (a) Home Page menu items
if ($prev_page_ishome && $curr_page_ishome)
{
if ($this->params->get('debug_lang_switch', 0))
$app->enqueueMessage( "Joomla language switched Home Page menu items<br><br>", 'message');
$switching_language = false;
}
// (b) Other language associated menu items
else
{
// Get menu item associations for previously activated menu item
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'helpers'.DS.'menus.php');
$helper = new MenusHelper();
$associated = $helper->getAssociations($prev_menu_id);
if ( isset($associated[$curr_lang_tag]) && $associated[$curr_lang_tag] == $curr_menu_id ) {
if ($this->params->get('debug_lang_switch', 0))
$app->enqueueMessage( "Associated menu for $prev_menu_id: ".print_r($associated, true)."<br>" , 'message');
if ( ($prev_page_isitemview && !$prev_menu_isitem) || ($prev_page_iscatview && !$prev_menu_iscat) ){
if ($this->params->get('debug_lang_switch', 0))
$app->enqueueMessage( "Joomla language switched associated menu items that did not point to current content: Doing FLEXI switch<br>", 'message');
$switching_language = true;
} else {
if ($this->params->get('debug_lang_switch', 0))
$app->enqueueMessage( "Joomla language switched associated menu items: that do point to current content: Aborting FLEXI switch<br><br>", 'message');
$switching_language = false;
}
}
}
}
/*echo "<br>prev_page_isflexi: $prev_page_isflexi, curr_page_ishome: $curr_page_ishome,"
."<br>language_changed: $language_changed,"
."<br>prev_page_isitemview: $prev_page_isitemview, prev_page_iscatview: $prev_page_iscatview"
."<br>curr_page_isitemview: $curr_page_isitemview, curr_page_iscatview: $curr_page_iscatview";*/
// Decide to execute switching:
if ( !$switching_language && // (a) if previous page was a FLEXIcontent view (item or category view) and we switched language
!$curr_page_isitemview // (b) if current page is FLEXIcontent item in order to check if language specified is not that of item's language
) return;
$cat_id = (int) (($switching_language && $this->params->get('lang_switch_cats', 1)) ? $cat_slug : JRequest::getVar('cid'));
$item_id = (int) ($switching_language ? $item_slug : JRequest::getVar('id'));
$view = $switching_language ? $view : JRequest::getVar('view');
$option = $switching_language ? $option : JRequest::getVar('option');
$task = $switching_language ? $task : JRequest::getVar('task');
}
if ( FLEXI_J16GE && $view=='category' ) {
// Execute only if category id is set, and switching for categories is enabled
if (!$cat_id) return;
if (!$this->params->get('lang_switch_cats', 1)) return;
if ($this->params->get('debug_lang_switch', 0))
$app->enqueueMessage( "*** Language switching category no: $cat_id<br><br>", 'message');
$session->set('flexi_lang_switched', 1);
$cat_url = JRoute::_( FlexicontentHelperRoute::getCategoryRoute($cat_slug).'&lang='.$curr_lang, false );
$app->redirect( $cat_url );
}
if (!$item_id) return; // Execute only if item id is set
if ($task=="edit") return; // Execute only if not in item edit form
if (!$this->params->get('lang_switch_items', 1)) return; // Execute only if switching for items is enabled
// Execute only when not doing a task (e.g. edit) BROKEN !!! DISABLED
//if ( !empty(JRequest::getVar('task')) ) return;
// Get associated translating item for current language
$lta = FLEXI_J16GE || $use_tmp ? 'i': 'ie';
$db = JFactory::getDBO();
$query = "SELECT i.id, CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug, ".$lta.".language, ie.type_id"
. " FROM #__content AS i "
. " LEFT JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id "
. " WHERE "
. " ie.language LIKE ".$db->Quote( $curr_lang .'%' )." AND "
. " ie.lang_parent_id = (SELECT lang_parent_id FROM #__flexicontent_items_ext WHERE item_id=".(int) $item_id.")";
;
$db->setQuery($query);
$translation = $db->loadObject();
if( $db->getErrorNum() ) { $app->enqueueMessage( $db->getErrorMsg(), 'warning'); }
if ( !$translation || $item_id==$translation->id ) return; // No associated item translation found
if ($this->params->get('debug_lang_switch', 0))
$app->enqueueMessage( "*** Found translation of item {$item_id} for language $curr_lang. <br>Translating item is {$translation->id}<br><br>", 'message');
if (FLEXI_J16GE) {
$item_url = JRoute::_( FlexicontentHelperRoute::getItemRoute($translation->slug, $cat_id, 0, $translation), false );
$session->set('flexi_lang_switched', 1);
$app->redirect( $item_url );
} else {
JRequest::setVar('id', $translation->id);
}
}
示例12: onDisplayCoreFieldValue
//.........这里部分代码省略.........
<div class="fav-block">
' . flexicontent_html::favicon($field, $favoured, $item) . '
<div id="fcfav-reponse_item_' . $item->id . '" class="fcfav-reponse-tip">
<div class="fc-mssg-inline fc-info fc-iblock fc-nobgimage ' . ($favoured ? 'fcfavs-is-subscriber' : 'fcfavs-isnot-subscriber') . '">
' . JText::_($favoured ? 'FLEXI_FAVS_YOU_HAVE_SUBSCRIBED' : 'FLEXI_FAVS_CLICK_TO_SUBSCRIBE') . '
</div>
' . $favs . '
</div>
</div>
' . $posttext;
break;
case 'categories':
// assigned categories
$field->{$prop} = '';
if ($_categories === false) {
$categories =& $item->cats;
} else {
$categories =& $_categories;
}
if ($categories) {
// Get categories that should be excluded from linking
global $globalnoroute;
if (!is_array($globalnoroute)) {
$globalnoroute = array();
}
// Create list of category links, excluding the "noroute" categories
$field->{$prop} = array();
foreach ($categories as $category) {
$cat_id = $category->id;
if (in_array($cat_id, @$globalnoroute)) {
continue;
}
if (!isset($cat_links[$cat_id])) {
$cat_links[$cat_id] = JRoute::_(FlexicontentHelperRoute::getCategoryRoute($category->slug));
}
$cat_link =& $cat_links[$cat_id];
$display = '<a class="fc_categories fc_category_' . $cat_id . ' link_' . $field->name . '" href="' . $cat_link . '">' . $category->title . '</a>';
$field->{$prop}[] = $pretext . $display . $posttext;
$field->value[] = $category->title;
}
$field->{$prop} = implode($separatorf, $field->{$prop});
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
}
break;
case 'tags':
// assigned tags
$use_catlinks = $cparams->get('tags_using_catview', 0);
$field->{$prop} = '';
if ($_tags === false) {
$tags =& $item->tags;
} else {
$tags =& $_tags;
}
if ($tags) {
// Create list of tag links
$field->{$prop} = array();
foreach ($tags as $tag) {
$tag_id = $tag->id;
if (!isset($tag_links[$tag_id])) {
$tag_links[$tag_id] = $use_catlinks ? JRoute::_(FlexicontentHelperRoute::getCategoryRoute(0, 0, array('layout' => 'tags', 'tagid' => $tag->slug))) : JRoute::_(FlexicontentHelperRoute::getTagRoute($tag->slug));
}
$tag_link =& $tag_links[$tag_id];
$display = '<a class="fc_tags fc_tag_' . $tag->id . ' link_' . $field->name . '" href="' . $tag_link . '">' . $tag->name . '</a>';
$field->{$prop}[] = $pretext . $display . $posttext;
$field->value[] = $tag->name;
}
示例13: array
$subcat_cont_class = $show_description_subcat ? "fc_block" : "fc_inline_block";
$subcat_info_class = $show_description_subcat ? "fc_inline_clear" : "fc_inline";
$subcats_html = array();
foreach ($this->categories as $sub) {
if (!$show_empty_cats && $show_itemcount && $sub->assigneditems == 0) {
continue;
}
$subsubcount = count($sub->subcats);
// a. Optional sub-category image
$subcats_html[$i] = "<span class='floattext subcat " . $subcat_cont_class . "'>\n";
if ($show_description_image_subcat && $sub->image) {
$subcats_html[$i] .= " <span class='catimg'>" . $sub->image . "</span>\n";
}
$subcats_html[$i] .= " <span class='catinfo " . $subcat_info_class . "'>\n";
// b. Category title with link and optional item counts
$cat_link = $layout == 'myitems' || $layout == 'author' ? $this->action . (strstr($this->action, '?') ? '&' : '?') . 'cid=' . $sub->slug : JRoute::_(FlexicontentHelperRoute::getCategoryRoute($sub->slug));
$infocount_str = '';
if ($show_itemcount) {
$infocount_str .= (int) $sub->assigneditems . $itemcount_label;
}
if ($show_subcatcount) {
$infocount_str .= ($show_itemcount ? ' / ' : '') . count($sub->subcats) . $subcatcount_label;
}
if (strlen($infocount_str)) {
$infocount_str = ' (' . $infocount_str . ')';
}
$subcats_html[$i] .= " <a class='catlink' href='" . $cat_link . "'>" . $this->escape($sub->title) . "</a>" . $infocount_str . "</span>\n";
// c. Optional sub-category description stripped of HTML and cut to given length
if ($show_description_subcat && $sub->description) {
$subcats_html[$i] .= " <span class='catdescription'>" . flexicontent_html::striptagsandcut($sub->description, $description_cut_text_subcat) . "</span>";
}
示例14: floor
<?php
$html = '<span class="fcpagenav btn-group">';
$tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip';
// CATEGORY back link
if ($use_category_link) {
$cat_image = $this->getCatThumb($category, $field->parameters);
$limit = $item_count;
$limit = $limit ? $limit : 10;
$start = floor($location / $limit) * $limit;
if (!empty($rows[$item->id]->categoryslug)) {
$tooltip = $use_tooltip ? ' title="' . flexicontent_html::getToolTip($category_label, $category->title, 0) . '"' : '';
$html .= '
<a class="fcpagenav-return btn' . ($use_tooltip ? $tooltip_class : '') . '" ' . ($use_tooltip ? $tooltip : '') . ' href="' . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($rows[$item->id]->categoryslug)) . '?start=' . $start . '">
<i class="icon-undo"></i>
' . htmlspecialchars($category->title, ENT_NOQUOTES, 'UTF-8') . '
' . ($cat_image ? '
<br/><img src="' . $cat_image . '" alt="Return"/>
' : '') . '
</a>';
}
}
// Next item linking
if ($field->prev) {
$tooltip = $use_tooltip ? ' title="' . flexicontent_html::getToolTip($tooltip_title_prev, $field->prevtitle, 0) . '"' : '';
$html .= '
<a class="fcpagenav-prev btn' . ($use_tooltip ? $tooltip_class : '') . '" ' . ($use_tooltip ? $tooltip : '') . ' href="' . $field->prevurl . '">
<i class="icon-backward-circle"></i>
' . ($use_title ? $field->prevtitle : htmlspecialchars($prev_label, ENT_NOQUOTES, 'UTF-8')) . '
' . ($field->prevThumb ? '
<br/><img src="' . $field->prevThumb . '" alt="Previous"/>
示例15: display
//.........这里部分代码省略.........
}
// Overwrite with menu META data if menu matched
if ($menu_matches) {
if ($_mp = $menu->params->get('menu-meta_description')) {
$document->setDescription($_mp);
}
if ($_mp = $menu->params->get('menu-meta_keywords')) {
$document->setMetadata('keywords', $_mp);
}
if ($_mp = $menu->params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
if ($_mp = $menu->params->get('secure')) {
$document->setMetadata('secure', $_mp);
}
}
// *********************************************************************
// Create category link, but also consider current 'layout', and use the
// layout specific variables so that filtering form will work properly
// *********************************************************************
$non_sef_link = null;
$category_link = flexicontent_html::createCatLink($category->slug, $non_sef_link, $model);
// ****************************************************************
// Make sure Joomla SEF plugin has inserted a correct REL canonical
// or that it has not insert any REL if current URL is sufficient
// ****************************************************************
if ($params->get('add_canonical')) {
// Get canonical URL that SEF plugin adds, also $domain passed by reference, to get the domain configured in SEF plugin (multi-domain website)
$domain = null;
$defaultCanonical = flexicontent_html::getDefaultCanonical($domain);
$domain = $domain ? $domain : $uri->toString(array('scheme', 'host', 'port'));
// Create desired REL canonical URL
$start = JRequest::getInt('start', '');
$ucanonical = $domain . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($category->slug) . ($start ? "&start=" . $start : ''));
// Check if SEF plugin inserted a different REL canonical
if ($defaultCanonical != $ucanonical) {
// Add REL canonical only if different than current URL
$head_obj = $document->addHeadLink(htmlspecialchars($ucanonical), 'canonical', 'rel', '');
if ($uri->toString() == $ucanonical) {
unset($head_obj->_links[htmlspecialchars($ucanonical)]);
}
// Remove canonical inserted by SEF plugin
unset($head_obj->_links[htmlspecialchars($defaultCanonical)]);
}
}
if ($params->get('show_feed_link', 1) == 1) {
//add alternate feed link
$link = $non_sef_link . '&format=feed';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
}
// ********************************************************************************************
// Create pathway, if automatic pathways is enabled, then path will be cleared before populated
// ********************************************************************************************
$pathway = $app->getPathWay();
// Clear pathway, if automatic pathways are enabled
if ($params->get('automatic_pathways', 0)) {
$pathway_arr = $pathway->getPathway();
$pathway->setPathway(array());
//$pathway->set('_count', 0); // not needed ??
$item_depth = 0;
// menu item depth is now irrelevant ???, ignore it
} else {
$item_depth = $params->get('item_depth', 0);