/** * Creates the email button * * @param string $print_link * @param array $params * @since 1.0 */ static function mailbutton($view, &$params, $slug = null, $itemslug = null, $item = null) { static $initialize = null; static $uri, $base; if (!$params->get('show_email_icon') || JRequest::getCmd('print')) { return; } if ($initialize === null) { if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php')) { require_once JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php'; $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $initialize = true; } else { $initialize = false; } } if ($initialize === false) { return; } //TODO: clean this static stuff (Probs when determining the url directly with subdomains) if ($view == 'category') { $non_sef_link = null; flexicontent_html::createCatLink($slug, $non_sef_link); $link = $base . JRoute::_($non_sef_link); //$link = $base . JRoute::_( 'index.php?view='.$view.'&cid='.$slug, false ); } elseif ($view == FLEXI_ITEMVIEW) { $link = $base . JRoute::_(FlexicontentHelperRoute::getItemRoute($itemslug, $slug, 0, $item)); //$link = $base . JRoute::_( 'index.php?view='.$view.'&cid='.$slug.'&id='.$itemslug, false ); } elseif ($view == 'tags') { $link = $base . JRoute::_(FlexicontentHelperRoute::getTagRoute($itemslug)); //$link = $base . JRoute::_( 'index.php?view='.$view.'&id='.$slug, false ); } else { $link = $base . JRoute::_('index.php?view=' . $view, false); } $mail_to_url = JRoute::_('index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($link)); $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,left=50,width=\'+(screen.width-100)+\',top=20,height=\'+(screen.height-160)+\',directories=no,location=no'; $status = 'left=50,width=\'+((screen.width-100) > 800 ? 800 : (screen.width-100))+\',top=20,height=\'+((screen.width-160) > 800 ? 800 : (screen.width-160))+\',menubar=yes,resizable=yes'; $onclick = ' window.open(this.href,\'win2\',\'' . $status . '\'); return false; '; // This checks template image directory for image, if none found, default image is returned $show_icons = $params->get('show_icons'); if ($show_icons) { $attribs = ''; $image = JHTML::image(FLEXI_ICONPATH . 'emailButton.png', JText::_('FLEXI_EMAIL'), $attribs); } else { $image = ''; } $overlib = JText::_('FLEXI_EMAIL_TIP'); $text = JText::_('FLEXI_EMAIL'); $button_classes = 'fc_mailbutton'; if ($show_icons == 1) { $caption = ''; $button_classes .= ''; } else { $caption = $text; $button_classes .= FLEXI_J30GE ? ' btn btn-small' : ' fc_button fcsimple fcsmall'; } $button_classes .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $tooltip_title = flexicontent_html::getToolTip($text, $overlib, 0); // emailed link was set above $output = '<a href="' . $mail_to_url . '" class="' . $button_classes . '" title="' . $tooltip_title . '" onclick="' . $onclick . '" >' . $image . $caption . '</a>'; $output = JText::_('FLEXI_ICON_SEP') . $output . JText::_('FLEXI_ICON_SEP'); return $output; }
/** * Creates the page's display * * @since 1.0 */ function display($tpl = null) { // Get Non-routing Categories, and Category Tree global $globalnoroute, $globalcats; if (!is_array($globalnoroute)) { $globalnoroute = array(); } //initialize variables $dispatcher = JDispatcher::getInstance(); $app = JFactory::getApplication(); $session = JFactory::getSession(); $option = JRequest::getVar('option'); $document = JFactory::getDocument(); $menus = $app->getMenu(); $menu = $menus->getActive(); $uri = JFactory::getURI(); $user = JFactory::getUser(); $aid = JAccess::getAuthorisedViewLevels($user->id); // Get model $model = $this->getModel(); // Get category and set category parameters as VIEW's parameters (category parameters are merged with component/page/author parameters already) $category = $this->get('Category'); $params = $category->parameters; if ($category->id) { $meta_params = new JRegistry($category->metadata); } // Get various data from the model $categories = $this->get('Childs'); // this will also count sub-category items is if 'show_itemcount' is enabled $peercats = $this->get('Peers'); // this will also count sub-category items is if 'show_subcatcount_peercat' is enabled $items = $this->get('Data'); $total = $this->get('Total'); $filters = $this->get('Filters'); if ($params->get('show_comments_count', 0)) { $comments = $this->get('CommentsInfo'); } else { $comments = null; } $alpha = $params->get('show_alpha', 1) ? $this->get('Alphaindex') : array(); // This is somwhat expensive so calculate it only if required // Request variables, WARNING, must be loaded after retrieving items, because limitstart may have been modified $limitstart = JRequest::getInt('limitstart'); $format = JRequest::getCmd('format', null); // ******************************** // Load needed JS libs & CSS styles // ******************************** FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); flexicontent_html::loadFramework('jQuery'); flexicontent_html::loadFramework('flexi_tmpl_common'); // ************************ // CATEGORY LAYOUT handling // ************************ // (a) Decide to use mobile or normal category template layout $useMobile = $params->get('use_mobile_layouts', 0); if ($useMobile) { $force_desktop_layout = $params->get('force_desktop_layout', 0); $mobileDetector = flexicontent_html::getMobileDetector(); $isMobile = $mobileDetector->isMobile(); $isTablet = $mobileDetector->isTablet(); $useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile; } $_clayout = $useMobile ? 'clayout_mobile' : 'clayout'; // (b) Get from category parameters, allowing URL override $clayout = JRequest::getCmd($_clayout, false); if (!$clayout) { $desktop_clayout = $params->get('clayout', 'blog'); $clayout = !$useMobile ? $desktop_clayout : $params->get('clayout_mobile', $desktop_clayout); } // (c) Get cached template data $themes = flexicontent_tmpl::getTemplates($lang_files = array($clayout)); // (d) Verify the category layout exists if (!isset($themes->category->{$clayout})) { $fixed_clayout = 'blog'; $app->enqueueMessage("<small>Current Category Layout Template is '{$clayout}' does not exist<br>- Please correct this in the URL or in Content Type configuration.<br>- Using Template Layout: '{$fixed_clayout}'</small>", 'notice'); $clayout = $fixed_clayout; FLEXIUtilities::loadTemplateLanguageFile($clayout); // Manually load Template-Specific language file of back fall clayout } // (e) finally set the template name back into the category's parameters $params->set('clayout', $clayout); // Get URL variables $layout_vars = flexicontent_html::getCatViewLayoutVars($model); $layout = $layout_vars['layout']; $authorid = $layout_vars['authorid']; $tagid = $layout_vars['tagid']; $cids = $layout_vars['cids']; $cid = $layout_vars['cid']; // Get Tag data if current layout is 'tags' if ($tagid) { $tag = $this->get('Tag'); } $authordescr_item = false; if ($authorid && $params->get('authordescr_itemid') && $format != 'feed') { $authordescr_itemid = $params->get('authordescr_itemid'); } // Bind Fields if ($format != 'feed') { $items = FlexicontentFields::getFields($items, 'category', $params, $aid); } //Set layout $this->setLayout('category'); $limit = $app->getUserStateFromRequest('com_flexicontent' . $category->id . '.category.limit', 'limit', $params->def('limit', 0), 'int'); // Get category titles needed by pathway, this will allow Falang to translate them $catshelper = new flexicontent_cats($cid); $parents = $catshelper->getParentlist($all_cols = false); //echo "<pre>".print_r($parents,true)."</pre>"; /*$parents = array(); if ( $cid && isset($globalcats[$cid]->ancestorsarray) ) { $parent_ids = $globalcats[$cid]->ancestorsarray; foreach ($parent_ids as $parent_id) $parents[] = $globalcats[$parent_id]; }*/ $rootcat = (int) $params->get('rootcat'); if ($rootcat) { $root_parents = $globalcats[$rootcat]->ancestorsarray; } // ********************************************************** // Calculate a (browser window) page title and a page heading // ********************************************************** // Verify menu item points to current FLEXIcontent object if ($menu) { $view_ok = 'category' == @$menu->query['view']; $cid_ok = $cid == (int) @$menu->query['cid']; $layout_ok = $layout == @$menu->query['layout']; // null is equal to empty string $authorid_ok = $authorid == (int) @$menu->query['authorid']; // null is equal to zero $tagid_ok = $tagid == (int) @$menu->query['tagid']; // null is equal to zero $menu_matches = $view_ok && $cid_ok && $layout_ok && $authorid_ok && $tagid_ok; //$menu_params = FLEXI_J16GE ? $menu->params : new JParameter($menu->params); // Get active menu item parameters } else { $menu_matches = false; } // MENU ITEM matched, use its page heading (but use menu title if the former is not set) if ($menu_matches) { $default_heading = FLEXI_J16GE ? $menu->title : $menu->name; // Cross set (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template) $params->def('page_heading', $params->get('page_title', $default_heading)); $params->def('page_title', $params->get('page_heading', $default_heading)); $params->def('show_page_heading', $params->get('show_page_title', 0)); $params->def('show_page_title', $params->get('show_page_heading', 0)); } else { // Clear some menu parameters //$params->set('pageclass_sfx', ''); // CSS class SUFFIX is behavior, so do not clear it ? // Calculate default page heading (=called page title in J1.5), which in turn will be document title below !! ... switch ($layout) { case '': $default_heading = $category->title; break; case 'myitems': $default_heading = JText::_('FLEXICONTENT_MYITEMS'); break; case 'author': $default_heading = JText::_('FLEXICONTENT_AUTHOR') . ': ' . JFactory::getUser($authorid)->get('name'); break; case 'tags': $default_heading = JText::_('FLEXI_ITEMS_WITH_TAG') . ': ' . $tag->name; break; case 'favs': $default_heading = JText::_('FLEXI_YOUR_FAVOURED_ITEMS'); break; default: $default_heading = JText::_('FLEXICONTENT_CATEGORY'); } if ($layout && $cid) { // Non-single category listings, limited to a specific category $default_heading .= ', ' . JText::_('FLEXI_IN_CATEGORY') . ': ' . $category->title; } // Decide to show page heading (=J1.5 page title) only if a custom layout is used (=not a single category layout) $show_default_heading = $layout ? 1 : 0; // Set both (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template) $params->set('page_title', $default_heading); $params->set('page_heading', $default_heading); $params->set('show_page_heading', $show_default_heading); $params->set('show_page_title', $show_default_heading); } // Prevent showing the page heading if (a) IT IS same as category title and (b) category title is already configured to be shown if ($params->get('show_cat_title', 1)) { if ($params->get('page_heading') == $category->title) { $params->set('show_page_heading', 0); } if ($params->get('page_title') == $category->title) { $params->set('show_page_title', 0); } } // ************************************************************ // Create the document title, by from page title and other data // ************************************************************ // Use the page heading as document title, (already calculated above via 'appropriate' logic ...) // or the overriden custom <title> ... set via parameter $doc_title = empty($meta_params) ? $params->get('page_title') : $meta_params->get('page_title', $params->get('page_title')); // Check and prepend or append site name to page title if ($doc_title != $app->getCfg('sitename')) { if ($app->getCfg('sitename_pagetitles', 0) == 1) { $doc_title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $doc_title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $doc_title = JText::sprintf('JPAGETITLE', $doc_title, $app->getCfg('sitename')); } } // Finally, set document title $document->setTitle($doc_title); // ************************ // Set document's META tags // ************************ // Workaround for Joomla not setting the default value for 'robots', so component must do it $app_params = $app->getParams(); if ($_mp = $app_params->get('robots')) { $document->setMetadata('robots', $_mp); } if ($category->id) { // possibly not set for author items OR my items if ($category->metadesc) { $document->setDescription($category->metadesc); } if ($category->metakey) { $document->setMetadata('keywords', $category->metakey); } // meta_params are always set if J1.6+ and category id is set if ($meta_params->get('robots')) { $document->setMetadata('robots', $meta_params->get('robots')); } // ?? Deprecated <title> tag is used instead by search engines if ($app->getCfg('MetaTitle') == '1') { $meta_title = $meta_params->get('page_title') ? $meta_params->get('page_title') : $category->title; $document->setMetaData('title', $meta_title); } if ($app->getCfg('MetaAuthor') == '1') { if ($meta_params->get('author')) { $meta_author = $meta_params->get('author'); } else { $table = JUser::getTable(); $meta_author = $table->load($category->created_user_id) ? $table->name : ''; } $document->setMetaData('author', $meta_author); } } // 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); // ************************************ // Add rel canonical html head link tag (TODO: improve multi-page handing) // ************************************ $port = $uri->getPort(); $base = $uri->getScheme() . '://' . $uri->getHost() . ($port ? ':' . $port : ''); $start = JRequest::getInt('start', ''); $start = $start ? "&start=" . $start : ""; // ******************************************************************************************** // 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)) { // Do not add the directory root category or its parents (this when coming from a directory view) if (!empty($root_parents) && in_array($parents[$p]->id, $root_parents)) { $p++; continue; } // 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++; } $authordescr_item_html = false; if ($authordescr_item) { $flexi_html_helper = new flexicontent_html(); $authordescr_item_html = $flexi_html_helper->renderItem($authordescr_itemid); } //echo $authordescr_item_html; exit(); if ($clayout) { // Add the templates css files if availables if (isset($themes->category->{$clayout}->css)) { foreach ($themes->category->{$clayout}->css as $css) { $document->addStyleSheet($this->baseurl . '/' . $css); } } // Add the templates js files if availables if (isset($themes->category->{$clayout}->js)) { foreach ($themes->category->{$clayout}->js as $js) { $document->addScript($this->baseurl . '/' . $js); } } // Set the template var $tmpl = $themes->category->{$clayout}->tmplvar; } else { $tmpl = '.category.default'; } // @TODO trigger the plugin selectively // and delete the plugins tags if not active if ($params->get('trigger_onprepare_content_cat')) { JPluginHelper::importPlugin('content'); // Allow to trigger content plugins on category description // NOTE: for J2.5, we will trigger the plugins as if description text was an article text, using ... 'com_content.article' $category->text = $category->description; $results = $dispatcher->trigger('onContentPrepare', array('com_content.article', &$category, &$params, 0)); JRequest::setVar('layout', $layout); // Restore LAYOUT variable should some plugin have modified it $category->description = $category->text; } // Maybe here not to import all plugins but just those for description field or add a parameter for this // Anyway these events are usually not very time consuming as is the the event onPrepareContent(J1.5)/onContentPrepare(J1.6+) JPluginHelper::importPlugin('content'); foreach ($items as $item) { $item->event = new stdClass(); $item->params = new JRegistry($item->attribs); // !!! The triggering of the event onPrepareContent(J1.5)/onContentPrepare(J1.6+) of content plugins // !!! for description field (maintext) along with all other flexicontent // !!! fields is handled by flexicontent.fields.php // !!! Had serious performance impact // CODE REMOVED // We must check if the current category is in the categories of the item .. $item_in_category = false; if ($item->catid == $category->id) { $item_in_category = true; } else { foreach ($item->cats as $cat) { if ($cat->id == $category->id) { $item_in_category = true; break; } } } // ADVANCED CATEGORY ROUTING (=set the most appropriate category for the item ...) // CHOOSE APPROPRIATE category-slug FOR THE ITEM !!! ( ) if ($item_in_category && !in_array($category->id, $globalnoroute)) { // 1. CATEGORY SLUG: CURRENT category // Current category IS a category of the item and ALSO routing (creating links) to this category is allowed $item->categoryslug = $category->slug; } else { if (!in_array($item->catid, $globalnoroute)) { // 2. CATEGORY SLUG: ITEM's MAIN category (already SET, ... no assignment needed) // Since we cannot use current category (above), we will use item's MAIN category // ALSO routing (creating links) to this category is allowed } else { // 3. CATEGORY SLUG: ANY ITEM's category // We will use the first for which routing (creating links) to the category is allowed $allcats = array(); $item->cats = $item->cats ? $item->cats : array(); foreach ($item->cats as $cat) { if (!in_array($cat->id, $globalnoroute)) { $item->categoryslug = $globalcats[$cat->id]->slug; break; } } } } // Just put item's text (description field) inside property 'text' in case the events modify the given text, $item->text = isset($item->fields['text']->display) ? $item->fields['text']->display : ''; // Set the view and option to 'category' and 'com_content' (actually view is already called category) JRequest::setVar('option', 'com_content'); JRequest::setVar("isflexicontent", "yes"); // These events return text that could be displayed at appropriate positions by our templates $item->event = new stdClass(); $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.category', &$item, &$params, 0)); $item->event->afterDisplayTitle = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.category', &$item, &$params, 0)); $item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.category', &$item, &$params, 0)); $item->event->afterDisplayContent = trim(implode("\n", $results)); // Set the option back to 'com_flexicontent' JRequest::setVar('option', 'com_flexicontent'); // 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 $item->fields['text']->display =& $item->text; } // Calculate CSS classes needed to add special styling markups to the items flexicontent_html::calculateItemMarkups($items, $params); // ***************************************************** // Remove unroutable categories from sub/peer categories // ***************************************************** // sub-cats $_categories = array(); foreach ($categories as $i => $cat) { if (in_array($cat->id, $globalnoroute)) { continue; } $_categories[] = $categories[$i]; } $categories = $_categories; // peer-cats $_categories = array(); foreach ($peercats as $i => $cat) { if (in_array($cat->id, $globalnoroute)) { continue; } $_categories[] = $peercats[$i]; } $peercats = $_categories; // ************************************ // Get some variables needed for images // ************************************ $joomla_image_path = $app->getCfg('image_path', ''); $joomla_image_url = str_replace(DS, '/', $joomla_image_path); $joomla_image_path = $joomla_image_path ? $joomla_image_path . DS : ''; $joomla_image_url = $joomla_image_url ? $joomla_image_url . '/' : ''; $phpThumbURL = JURI::base(true) . '/components/com_flexicontent/librairies/phpthumb/phpThumb.php?src='; // ************** // CATEGORY IMAGE // ************** // category image params $show_cat_image = $params->get('show_description_image', 0); // we use different name for variable $cat_image_source = $params->get('cat_image_source', 2); // 0: extract, 1: use param, 2: use both $cat_link_image = $params->get('cat_link_image', 1); $cat_image_method = $params->get('cat_image_method', 1); $cat_image_width = $params->get('cat_image_width', 80); $cat_image_height = $params->get('cat_image_height', 80); $cat_default_image = $params->get('cat_default_image', ''); if ($show_cat_image) { $h = '&h=' . $cat_image_height; $w = '&w=' . $cat_image_width; $aoe = '&aoe=1'; $q = '&q=95'; $zc = $cat_image_method ? '&zc=' . $cat_image_method : ''; } if ($cat_default_image) { $src = JURI::base(true) . "/" . $joomla_image_url . $cat_default_image; $ext = pathinfo($src, PATHINFO_EXTENSION); $f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : ''; $conf = $w . $h . $aoe . $q . $zc . $f; $default_image = $phpThumbURL . $src . $conf; $default_image = '<img class="fccat_image" style="float:' . $cat_image_float . '" src="' . $default_image . '" alt="%s" title="%s"/>'; } else { $default_image = ''; } // Create category image/description/etc data $cat = $category; $image = ""; if ($cat) { if ($cat->id && $show_cat_image) { $cat->image = $params->get('image'); $cat->introtext =& $cat->description; $cat->fulltext = ""; if ($cat_image_source && $cat->image && JFile::exists(JPATH_SITE . DS . $joomla_image_path . $cat->image)) { $src = JURI::base(true) . "/" . $joomla_image_url . $cat->image; $ext = pathinfo($src, PATHINFO_EXTENSION); $f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : ''; $conf = $w . $h . $aoe . $q . $zc . $f; $image = $phpThumbURL . $src . $conf; } else { if ($cat_image_source != 1 && ($src = flexicontent_html::extractimagesrc($cat))) { $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) . '/' : ''; $src = $base_url . $src; $image = $phpThumbURL . $src . $conf; } } $cat->image_src = @$src; // Also add image category URL for developers if ($image) { $image = '<img class="fccat_image" src="' . $image . '" alt="' . $this->escape($cat->title) . '" title="' . $this->escape($cat->title) . '"/>'; } else { if ($default_image) { $image = sprintf($default_image, $cat->title, $cat->title); } } if ($cat_link_image && $image) { $image = '<a href="' . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($cat->slug)) . '">' . $image . '</a>'; } } $cat->image = $image; } // ****************************** // SUBCATEGORIES (some templates) // ****************************** // sub-category image params $show_cat_image = $params->get('show_description_image_subcat', 1); // we use different name for variable $cat_image_source = $params->get('subcat_image_source', 2); // 0: extract, 1: use param, 2: use both $cat_link_image = $params->get('subcat_link_image', 1); $cat_image_method = $params->get('subcat_image_method', 1); $cat_image_width = $params->get('subcat_image_width', 24); $cat_image_height = $params->get('subcat_image_height', 24); $cat_default_image = $params->get('subcat_default_image', ''); if ($show_cat_image) { $h = '&h=' . $cat_image_height; $w = '&w=' . $cat_image_width; $aoe = '&aoe=1'; $q = '&q=95'; $zc = $cat_image_method ? '&zc=' . $cat_image_method : ''; } if ($cat_default_image) { $src = JURI::base(true) . "/" . $joomla_image_url . $cat_default_image; $ext = pathinfo($src, PATHINFO_EXTENSION); $f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : ''; $conf = $w . $h . $aoe . $q . $zc . $f; $default_image = $phpThumbURL . $src . $conf; $default_image = '<img class="fccat_image" style="float:' . $cat_image_float . '" src="' . $default_image . '" alt="%s" title="%s"/>'; } else { $default_image = ''; } // Create sub-category image/description/etc data foreach ($categories as $cat) { $image = ""; if ($show_cat_image) { if (!is_object($cat->params)) { $cat->params = new JRegistry($cat->params); } $cat->image = $cat->params->get('image'); $cat->introtext =& $cat->description; $cat->fulltext = ""; if ($cat_image_source && $cat->image && JFile::exists(JPATH_SITE . DS . $joomla_image_path . $cat->image)) { $src = JURI::base(true) . "/" . $joomla_image_url . $cat->image; $ext = pathinfo($src, PATHINFO_EXTENSION); $f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : ''; $conf = $w . $h . $aoe . $q . $zc . $f; $image = $phpThumbURL . $src . $conf; } else { if ($cat_image_source != 1 && ($src = flexicontent_html::extractimagesrc($cat))) { $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) . '/' : ''; $src = $base_url . $src; $image = $phpThumbURL . $src . $conf; } } $cat->image_src = @$src; // Also add image category URL for developers if ($image) { $image = '<img class="fccat_image" src="' . $image . '" alt="' . $this->escape($cat->title) . '" title="' . $this->escape($cat->title) . '"/>'; } else { if ($default_image) { $image = sprintf($default_image, $cat->title, $cat->title); } } if ($cat_link_image && $image) { $image = '<a href="' . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($cat->slug)) . '">' . $image . '</a>'; } } $cat->image = $image; } // ******************************* // PEERCATEGORIES (some templates) // ******************************* // peer-category image params $show_cat_image = $params->get('show_description_image_peercat', 1); // we use different name for variable $cat_image_source = $params->get('peercat_image_source', 2); // 0: extract, 1: use param, 2: use both $cat_link_image = $params->get('peercat_link_image', 1); $cat_image_method = $params->get('peercat_image_method', 1); $cat_image_width = $params->get('peercat_image_width', 24); $cat_image_height = $params->get('peercat_image_height', 24); $cat_default_image = $params->get('peercat_default_image', ''); if ($show_cat_image) { $h = '&h=' . $cat_image_height; $w = '&w=' . $cat_image_width; $aoe = '&aoe=1'; $q = '&q=95'; $zc = $cat_image_method ? '&zc=' . $cat_image_method : ''; } if ($cat_default_image) { $src = JURI::base(true) . "/" . $joomla_image_url . $cat_default_image; $ext = pathinfo($src, PATHINFO_EXTENSION); $f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : ''; $conf = $w . $h . $aoe . $q . $zc . $f; $default_image = $phpThumbURL . $src . $conf; $default_image = '<img class="fccat_image" style="float:' . $cat_image_float . '" src="' . $default_image . '" alt="%s" title="%s"/>'; } else { $default_image = ''; } // Create peer-category image/description/etc data foreach ($peercats as $cat) { $image = ""; if ($show_cat_image) { if (!is_object($cat->params)) { $cat->params = new JRegistry($cat->params); } $cat->image = $cat->params->get('image'); $cat->introtext =& $cat->description; $cat->fulltext = ""; if ($cat_image_source && $cat->image && JFile::exists(JPATH_SITE . DS . $joomla_image_path . $cat->image)) { $src = JURI::base(true) . "/" . $joomla_image_url . $cat->image; $ext = pathinfo($src, PATHINFO_EXTENSION); $f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : ''; $conf = $w . $h . $aoe . $q . $zc . $f; $image = $phpThumbURL . $src . $conf; } else { if ($cat_image_source != 1 && ($src = flexicontent_html::extractimagesrc($cat))) { $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) . '/' : ''; $src = $base_url . $src; $image = $phpThumbURL . $src . $conf; } } $cat->image_src = @$src; // Also add image category URL for developers if ($image) { $image = '<img class="fccat_image" src="' . $image . '" alt="' . $this->escape($cat->title) . '" title="' . $this->escape($cat->title) . '"/>'; } else { if ($default_image) { $image = sprintf($default_image, $cat->title, $cat->title); } } if ($cat_link_image && $image) { $image = '<a href="' . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($cat->slug)) . '">' . $image . '</a>'; } } $cat->image = $image; } // remove previous alpha index filter //$uri->delVar('letter'); // remove filter variables (includes search box and sort order) preg_match_all('/filter[^=]*/', $uri->toString(), $matches); foreach ($matches[0] as $match) { //$uri->delVar($match); } // Build Lists $lists = array(); //ordering $lists['filter_order'] = JRequest::getCmd('filter_order', 'i.title', 'default'); $lists['filter_order_Dir'] = JRequest::getCmd('filter_order_Dir', 'ASC', 'default'); $lists['filter'] = JRequest::getString('filter', '', 'default'); // Add html to filter objects $form_name = 'adminForm'; if ($filters) { FlexicontentFields::renderFilters($params, $filters, $form_name); } // **************************** // Create the pagination object // **************************** $pageNav = $this->get('pagination'); $resultsCounter = $pageNav->getResultsCounter(); // for overriding model's result counter // ********************************************************************** // 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'; $pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->assignRef('layout_vars', $layout_vars); $this->assignRef('action', $category_link); $this->assignRef('print_link', $print_link); $this->assignRef('category', $category); $this->assignRef('categories', $categories); $this->assignRef('peercats', $peercats); $this->assignRef('items', $items); $this->assignRef('authordescr_item_html', $authordescr_item_html); $this->assignRef('lists', $lists); $this->assignRef('params', $params); $this->assignRef('pageNav', $pageNav); $this->assignRef('pageclass_sfx', $pageclass_sfx); $this->assignRef('pagination', $pageNav); // compatibility Alias for old templates $this->assignRef('resultsCounter', $resultsCounter); // for overriding model's result counter $this->assignRef('limitstart', $limitstart); // compatibility shortcut $this->assignRef('filters', $filters); $this->assignRef('comments', $comments); $this->assignRef('alpha', $alpha); $this->assignRef('tmpl', $tmpl); //HERE WE NEED TO PRINT THE DATA || But I think it is not protected yet echo @json_encode($items); }