function _displaylist($tpl = null) { $document = JFactory::getDocument(); $this->assignRef('rules', $this->rules); $pagination = new JPagination($this->total, $this->limitstart, $this->limit); $document->setTitle($document->getTitle() . ' - ' . $pagination->getPagesCounter()); $this->assignRef('pagination', $pagination); $this->assignRef('params', $this->params); parent::display($tpl); }
function _displaydetailrank($tpl = null) { $document = JFactory::getDocument(); $this->assignRef('detailrank', $this->detailrank); $pagination = new JPagination($this->total, $this->limitstart, $this->limit); // insert the page counter in the title of the window page $document->setTitle($document->getTitle() . ' - ' . $pagination->getPagesCounter()); $this->assignRef('pagination', $pagination); $this->assignRef('params', $this->params); $this->assignRef('useAvatarFrom', $this->useAvatarFrom); $this->assignRef('linkToProfile', $this->linkToProfile); $this->assignRef('allowGuestUserViewProfil', $this->allowGuestUserViewProfil); parent::display("listing"); }
function _display($tpl = null) { $document = JFactory::getDocument(); $uri = JFactory::getURI(); $uri2string = $uri->toString(); $document->addScript(JURI::base(true) . '/media/system/js/core.js'); $pagination = new JPagination($this->total, $this->limitstart, $this->limit); // insert the page counter in the title of the window page $titlesuite = $this->limitstart ? ' - ' . $pagination->getPagesCounter() : ''; $document->setTitle($document->getTitle() . $titlesuite); $this->assignRef('params', $this->params); $this->assignRef('allowGuestUserViewProfil', $this->allowGuestUserViewProfil); $this->assignRef('rows', $this->rows); $this->assignRef('lists', $this->lists); $this->assignRef('limit', $this->limit); $this->assignRef('pagination', $pagination); $this->assignRef('action', $uri2string); $this->assignRef('useAvatarFrom', $this->useAvatarFrom); $this->assignRef('linkToProfile', $this->linkToProfile); parent::display($tpl); }
/** * Plugin that adds a pagebreak into the text and truncates text at that point * * @param string $context The context of the content being passed to the plugin. * @param object &$row The article object. Note $article->text is also available * @param mixed &$params The article params * @param integer $page The 'page' number * * @return mixed Always returns void or true * * @since 1.6 */ public function onContentPrepare($context, &$row, &$params, $page = 0) { $canProceed = $context == 'com_content.article'; if (!$canProceed) { return; } $style = $this->params->get('style', 'pages'); // Expression to search for. $regex = '#<hr(.*)class="system-pagebreak"(.*)\\/>#iU'; $input = JFactory::getApplication()->input; $print = $input->getBool('print'); $showall = $input->getBool('showall'); if (!$this->params->get('enabled', 1)) { $print = true; } if ($print) { $row->text = preg_replace($regex, '<br />', $row->text); return true; } // Simple performance check to determine whether bot should process further. if (JString::strpos($row->text, 'class="system-pagebreak') === false) { return true; } $view = $input->getString('view'); $full = $input->getBool('fullview'); if (!$page) { $page = 0; } if ($params->get('intro_only') || $params->get('popup') || $full || $view != 'article') { $row->text = preg_replace($regex, '', $row->text); return; } // Find all instances of plugin and put in $matches. $matches = array(); preg_match_all($regex, $row->text, $matches, PREG_SET_ORDER); if ($showall && $this->params->get('showall', 1)) { $hasToc = $this->params->get('multipage_toc', 1); if ($hasToc) { // Display TOC. $page = 1; $this->_createToc($row, $matches, $page); } else { $row->toc = ''; } $row->text = preg_replace($regex, '<br />', $row->text); return true; } // Split the text around the plugin. $text = preg_split($regex, $row->text); // Count the number of pages. $n = count($text); // We have found at least one plugin, therefore at least 2 pages. if ($n > 1) { $title = $this->params->get('title', 1); $hasToc = $this->params->get('multipage_toc', 1); // Adds heading or title to <site> Title. if ($title) { if ($page) { if ($page && @$matches[$page - 1][2]) { $attrs = JUtility::parseAttributes($matches[$page - 1][1]); if (@$attrs['title']) { $row->page_title = $attrs['title']; } } } } // Reset the text, we already hold it in the $text array. $row->text = ''; if ($style == 'pages') { // Display TOC. if ($hasToc) { $this->_createToc($row, $matches, $page); } else { $row->toc = ''; } // Traditional mos page navigation $pageNav = new JPagination($n, $page, 1); // Page counter. $row->text .= '<div class="pagenavcounter">'; $row->text .= $pageNav->getPagesCounter(); $row->text .= '</div>'; // Page text. $text[$page] = str_replace('<hr id="system-readmore" />', '', $text[$page]); $row->text .= $text[$page]; // $row->text .= '<br />'; $row->text .= '<div class="pager">'; // Adds navigation between pages to bottom of text. if ($hasToc) { $this->_createNavigation($row, $page, $n); } // Page links shown at bottom of page if TOC disabled. if (!$hasToc) { $row->text .= $pageNav->getPagesLinks(); } $row->text .= '</div>'; } else { $t[] = $text[0]; $t[] = (string) JHtml::_($style . '.start', 'article' . $row->id . '-' . $style); foreach ($text as $key => $subtext) { if ($key >= 1) { $match = $matches[$key - 1]; $match = (array) JUtility::parseAttributes($match[0]); if (isset($match['alt'])) { $title = stripslashes($match['alt']); } elseif (isset($match['title'])) { $title = stripslashes($match['title']); } else { $title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $key + 1); } $t[] = (string) JHtml::_($style . '.panel', $title, 'article' . $row->id . '-' . $style . $key); } $t[] = (string) $subtext; } $t[] = (string) JHtml::_($style . '.end'); $row->text = implode(' ', $t); } } return true; }
</tr> <?php } ?> <tr> <td colspan = "6" class = "<?php echo $boardclass; ?> profile-bottomnav fbm " align="center"> <?php // TODO: fxstein - Need to perform SEO cleanup echo $pageNav->getPagesLinks("index.php?option=com_kunena&func=fbprofile&task=showprf&userid={$userid}" . KUNENA_COMPONENT_ITEMID_SUFFIX); echo $pageNav->getLimitBox("index.php?option=com_kunena&func=fbprofile&task=showprf&userid={$userid}" . KUNENA_COMPONENT_ITEMID_SUFFIX); ?> <br/> <?php echo $pageNav->getPagesCounter(); ?> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div>
/** * Tests the getPagesCounter method. * * @param integer $total The total number of items. * @param integer $limitstart The offset of the item to start at. * @param integer $limit The number of items to display per page. * @param array $expected The expected results for the JPagination object * * @return void * * @covers JPagination::getPagesCounter * @dataProvider dataTestGetPagesCounter * @since 3.2 */ public function testGetPagesCounter($total, $limitstart, $limit, $expected) { $pagination = new JPagination($total, $limitstart, $limit, '', $this->app); $this->assertEquals($pagination->getPagesCounter(), $expected); unset($pagination); }
/** * Page break plugin * * <b>Usage:</b> * <code><hr class="system-pagebreak" /></code> * <code><hr class="system-pagebreak" title="The page title" /></code> * or * <code><hr class="system-pagebreak" alt="The first page" /></code> * or * <code><hr class="system-pagebreak" title="The page title" alt="The first page" /></code> * or * <code><hr class="system-pagebreak" alt="The first page" title="The page title" /></code> * */ function plgContentPagebreak(&$row, &$params, $page = 0) { // expression to search for $regex = '#<hr([^>]*?)class=(\\"|\')system-pagebreak(\\"|\')([^>]*?)\\/*>#iU'; // Get Plugin info $plugin =& JPluginHelper::getPlugin('content', 'pagebreak'); $pluginParams = new JParameter($plugin->params); $print = JRequest::getBool('print'); $showall = JRequest::getBool('showall'); JPlugin::loadLanguage('plg_content_pagebreak'); if (!$pluginParams->get('enabled', 1)) { $print = true; } if ($print) { $row->text = preg_replace($regex, '<br />', $row->text); return true; } //simple performance check to determine whether bot should process further if (strpos($row->text, 'class="system-pagebreak') === false && strpos($row->text, 'class=\'system-pagebreak') === false) { return true; } $db =& JFactory::getDBO(); $view = JRequest::getCmd('view'); if (!$page) { $page = 0; } // check whether plugin has been unpublished if (!JPluginHelper::isEnabled('content', 'pagebreak') || $params->get('intro_only') || $params->get('popup') || $view != 'article') { $row->text = preg_replace($regex, '', $row->text); return; } // find all instances of plugin and put in $matches $matches = array(); preg_match_all($regex, $row->text, $matches, PREG_SET_ORDER); if ($showall && $pluginParams->get('showall', 1)) { $hasToc = $pluginParams->get('multipage_toc', 1); if ($hasToc) { // display TOC $page = 1; plgContentCreateTOC($row, $matches, $page); } else { $row->toc = ''; } $row->text = preg_replace($regex, '<br/>', $row->text); return true; } // split the text around the plugin $text = preg_split($regex, $row->text); // count the number of pages $n = count($text); // we have found at least one plugin, therefore at least 2 pages if ($n > 1) { // Get plugin parameters $pluginParams = new JParameter($plugin->params); $title = $pluginParams->get('title', 1); $hasToc = $pluginParams->get('multipage_toc', 1); // adds heading or title to <site> Title if ($title) { if ($page) { $page_text = $page + 1; if ($page && @$matches[$page - 1][2]) { $attrs = JUtility::parseAttributes($matches[$page - 1][0]); if (@$attrs['title']) { $row->page_title = $attrs['title']; } } } } // reset the text, we already hold it in the $text array $row->text = ''; // display TOC if ($hasToc) { plgContentCreateTOC($row, $matches, $page); } else { $row->toc = ''; } // traditional mos page navigation jimport('joomla.html.pagination'); $pageNav = new JPagination($n, $page, 1); // page counter $row->text .= '<div class="pagenavcounter">'; $row->text .= $pageNav->getPagesCounter(); $row->text .= '</div>'; // page text $text[$page] = str_replace("<hr id=\"\"system-readmore\"\" />", "", $text[$page]); $row->text .= $text[$page]; $row->text .= '<br />'; $row->text .= '<div class="pagenavbar">'; // adds navigation between pages to bottom of text if ($hasToc) { plgContentCreateNavigation($row, $page, $n); } // page links shown at bottom of page if TOC disabled if (!$hasToc) { $row->text .= $pageNav->getPagesLinks(); } $row->text .= '</div><br />'; } return true; }
/** * @param string The context of the content being passed to the plugin. * @param object The article object. Note $article->text is also available * @param object The article params * @param int The 'page' number * * @return void * @since 1.6 */ public function onContentPrepare($context, &$row, &$params, $page = 0) { // Expression to search for. $regex = '#<hr(.*)class="system-pagebreak"(.*)\\/>#iU'; $print = JRequest::getBool('print'); $showall = JRequest::getBool('showall'); if (!$this->params->get('enabled', 1)) { $print = true; } if ($print) { $row->text = preg_replace($regex, '<br />', $row->text); return true; } // Simple performance check to determine whether bot should process further. if (JString::strpos($row->text, 'class="system-pagebreak') === false) { return true; } $db = JFactory::getDbo(); $view = JRequest::getString('view'); $full = JRequest::getBool('fullview'); if (!$page) { $page = 0; } if ($params->get('intro_only') || $params->get('popup') || $full || $view != 'article') { $row->text = preg_replace($regex, '', $row->text); return; } // Find all instances of plugin and put in $matches. $matches = array(); preg_match_all($regex, $row->text, $matches, PREG_SET_ORDER); if ($showall && $this->params->get('showall', 1)) { $hasToc = $this->params->get('multipage_toc', 1); if ($hasToc) { // Display TOC. $page = 1; $this->_createToc($row, $matches, $page); } else { $row->toc = ''; } $row->text = preg_replace($regex, '<br />', $row->text); return true; } // Split the text around the plugin. $text = preg_split($regex, $row->text); // Count the number of pages. $n = count($text); // We have found at least one plugin, therefore at least 2 pages. if ($n > 1) { $title = $this->params->get('title', 1); $hasToc = $this->params->get('multipage_toc', 1); // Adds heading or title to <site> Title. if ($title) { if ($page) { $page_text = $page + 1; if ($page && @$matches[$page - 1][2]) { $attrs = JUtility::parseAttributes($matches[$page - 1][1]); if (@$attrs['title']) { $row->page_title = $attrs['title']; } } } } // Reset the text, we already hold it in the $text array. $row->text = ''; // Display TOC. if ($hasToc) { $this->_createToc($row, $matches, $page); } else { $row->toc = ''; } // traditional mos page navigation jimport('joomla.html.pagination'); $pageNav = new JPagination($n, $page, 1); // Page counter. $row->text .= '<div class="pagenavcounter">'; $row->text .= $pageNav->getPagesCounter(); $row->text .= '</div>'; // Page text. $text[$page] = str_replace('<hr id="system-readmore" />', '', $text[$page]); $row->text .= $text[$page]; // $row->text .= '<br />'; $row->text .= '<div class="pagination">'; // Adds navigation between pages to bottom of text. if ($hasToc) { $this->_createNavigation($row, $page, $n); } // Page links shown at bottom of page if TOC disabled. if (!$hasToc) { $row->text .= $pageNav->getPagesLinks(); } $row->text .= '</div>'; } return true; }
function show_listing($listing, $url, $params, $searchbox, $searchboxbutton, $lists, $pagination, $options, $lang, $menuid, $categoriesbegenningby) { global $mainframe; $document =& JFactory::getDocument(); $user =& JFactory::getUser(); // show search bar if ($searchbox) { $jumpmenulist = "\t\t<!--\n\t\tfunction jumpmenu(target,obj,restore){\n\t\t eval(target+\".location='\"+obj.options[obj.selectedIndex].value+\"'\");\t\t\n\t\t if (restore) obj.selectedIndex=0;\t\t\n\t\t}\t\t\n\t\t//-->"; ?> <?php $document->addScriptDeclaration($jumpmenulist); ?> <div id="searchbar"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <form name="adminFormSearchAC" action="" method="post"> <?php echo $searchbox; ?> <?php echo $lists['list_searchfield']; ?> <?php echo $searchboxbutton; ?> </form> </td> <td><div class="orderinglist"> <?php if (count($listing) && @$listing[0]->id != '' && $options['letter'] == '') { echo $lists['list_defaultordering']; } ?> </div></td> </tr> </table> </div> <?php } // If result search letter -> show result categories beginning with this letter if ($categoriesbegenningby) { echo "<div id=\"alphapcategoriesbegenningby\"><span class=\"bigletter\">" . $options['letter'] . "</span><span class=\"allcategoriesbeginningby\">" . $categoriesbegenningby . "</span></div>"; } if (count($listing) > $pagination->limit) { $newlimit = count($listing); $pagination = new JPagination($options['total'], $newlimit, $pagination->limitstart); } // show Pages Counter if ($params->get('list_shownumberpagetotal') && (count($listing) && @$listing[0]->id != '')) { if (!($options['section'] == '' && ($options['letter'] != '' || $options['search'] != '') && ($params->get('weblinkssection') || $params->get('contactsection')))) { echo "<div id=\"alphapagecounter\"><p>"; echo $pagination->getResultsCounter(); echo "</p></div>"; } } $ac_alignimage = $params->get('list_imageposition'); $ac_numcolumnslisting = $params->get('list_numcols'); $ac_k = $ac_alignimage == '2' ? 0 : 'none'; // for alternate image left-right $line = 0; // just using for 2 columns for ($i = 0; $i < count($listing); $i++) { //for ( $i=0; $i < $new_pagination ; $i++ ){ // prepare each listing if (@$listing[$i]->id != '') { // define all vars for listing template $id_article = $listing[$i]->id; // id of item article $num = $params->get('list_numindex') ? $i + 1 + $options['limitstart'] : ''; //num listing $title = ""; // title of item $featured = ""; // show "Featured" article on homepage of AlphaContent if this option is selected $icon_new = ""; // icon new $icon_hot = ""; // icon hot $section_category = ""; // section / category $author = ""; // author or alias author if defined in item $content = ""; // content intro $date = ""; // date created $hits = ""; // num hits $comments = ""; // num of comments $rating = ""; // rating bar (native Joomla) $print = ""; // link to print $pdf = ""; // link to pdf $emailthis = ""; // link to email this $report = ""; // link to report this listing $readmore = ""; // readmore link if exist $ratingbar = ""; // ajax rating bar integrated in AlphaContent $googlemaps = ""; // link to Google Maps Location $tags = ""; // tags / keywords $link_to_article = $listing[$i]->reallink; // real link to article or contact or weblink /* * * Notes * --------- $rating is disabled if you use ajax rating bar integrated in AlphaContent ($ratingbar) * */ $url_article = $listing[$i]->slug; if ($listing[$i]->catslug && $url_article != '') { $url_article .= "&catid=" . $listing[$i]->catslug; } $url_article .= "&directory=" . $menuid; $start_url_article = "<a href=\"" . JRoute::_($listing[$i]->href . $url_article) . "\">"; $end_url_article = "</a>"; // get Title article/contact/weblink if ($params->get('list_titlelinkable')) { $title = $start_url_article . $listing[$i]->title . $end_url_article; if ($listing[$i]->is_article == 'weblink') { $title = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . $listing[$i]->title . "</a>"; } } else { $title = $listing[$i]->title; } // Featured if ($listing[$i]->is_article) { $featuredID = @explode(',', $params->get('list_featuredID')); $featured = $listing[$i]->featured || @in_array($listing[$i]->id, $featuredID) ? JText::_('AC_FEATURED') : ''; } // get icon new and hot $typedatearticle = $params->get('list_showdate') ? $params->get('list_showdate') : 'created'; if ($params->get('list_iconnew')) { $icon_new = showIconNew($listing[$i]->{$typedatearticle}, $params->get('list_numdaynew'), $lang); } if ($params->get('list_iconhot')) { $icon_hot = showIconHot($listing[$i]->hits, $params->get('list_numhitshot'), $lang); } if ($params->get('list_showsectioncategory')) { $section_category = $listing[$i]->section; } // get Section/Category $section_category = $params->get('list_showsectioncategory') ? $listing[$i]->section : ''; // get Author $author = $params->get('list_showauthor') ? $listing[$i]->author : ''; // get Ajax rating bar for AlphaContent if ($params->get('showsystemrating') && $params->get('activeglobalsystemrating') && $params->get('systemrating')) { switch ($options['section']) { case 'weblinks': $component4rating = 'com_weblinks'; break; case 'contacts': $component4rating = 'com_contact'; break; default: $component4rating = 'com_content'; } $document =& JFactory::getDocument(); $document->addScript(JURI::base(true) . '/components/com_alphacontent/assets/js/behavior.js'); $document->addScript(JURI::base(true) . '/components/com_alphacontent/assets/js/rating.js'); $document->addStyleSheet(JURI::base(true) . '/components/com_alphacontent/assets/css/rating.css'); require_once JPATH_COMPONENT . DS . 'assets' . DS . 'includes' . DS . 'alphacontent.drawrating.php'; $ratingbar = rating_bar($listing[$i]->id, $params->get('numstars'), $component4rating, $params->get('widthstars', 16), '', '', 0, 0, $params->get('showinfosrating')); // usage rating_bar( id article, num stars, component, width stars, default=16 ), static, model (example for module), comment id, review id, show or hide sum*rating/num stars (num votes) ); } // get Joomla native rating bar if ($params->get('showsystemrating') && $params->get('systemrating') == '0' && $listing[$i]->rating_count != '') { // look for images in template if available $img = ""; $starImageOn = JHTML::_('image.site', 'rating_star.png', '/images/M_images/'); $starImageOff = JHTML::_('image.site', 'rating_star_blank.png', '/images/M_images/'); for ($rb = 0; $rb < $listing[$i]->rating; $rb++) { $img .= $starImageOn; } for ($rb = $listing[$i]->rating; $rb < 5; $rb++) { $img .= $starImageOff; } $rating = '<span class="content_rating">'; $rating .= JText::_('User Rating') . ':' . $img . ' / '; $rating .= intval($listing[$i]->rating_count); $rating .= "</span>"; } // Location Google Maps link //if ( $params->get('list_showlinkmap') && $params->get('apikeygooglemap') ) { if ($params->get('list_showlinkmap')) { $mapIsDefined = 0; if (preg_match('#{ALPHAGMAP=(.*)}#Uis', $listing[$i]->text, $m)) { $listing[$i]->text = preg_replace("#{ALPHAGMAP=(.*)}#Uis", "", $listing[$i]->text); $mapIsDefined = 1; } elseif (preg_match('#{ALPHAGMAP=(.*)}#Uis', $listing[$i]->fulltext, $m)) { $listing[$i]->fulltext = preg_replace("#{ALPHAGMAP=(.*)}#Uis", "", $listing[$i]->fulltext); $mapIsDefined = 1; } $a = array(); if ($mapIsDefined) { $a = explode("|", $m[1]); if (count($a) == 3) { $thewidthmap = $params->get('widthgooglemap') + 20; $theheightmap = $params->get('heightgooglemap') + 20; $status = "status=no,toolbar=no,scrollbars=no,titlebar=no,menubar=no,resizable=no,width=" . $thewidthmap . ",height=" . $theheightmap . ",directories=no,location=no"; $googlemaps = "<a href=\"javascript:void window.open('index2.php?option=com_alphacontent&task=viewmap&la=" . $a[0] . "&lo=" . $a[1] . "&txt=" . $a[2] . "', 'win2', '{$status}');\">" . JTEXT::_('AC_MAP') . "</a>"; } } } $listing[$i]->text = preg_replace('#{ALPHAGMAP=(.*)}#Uis', '', $listing[$i]->text); // prepare content $cuttext = 0; switch ($params->get('list_introstyle')) { case '1': // text only $numcharsintro = $params->get('list_numcharsintro') ? $params->get('list_numcharsintro') : '999999'; $cuttext = strlen($listing[$i]->text) > $numcharsintro ? 1 : 0; $content = acPrepareAlphaContent($listing[$i]->text, $numcharsintro, ''); break; case '2': // Original intro with plugins //if ( $listing[$i]->attribs!='' ) { // Process the prepare content plugins JPluginHelper::importPlugin('content'); $dispatcher =& JDispatcher::getInstance(); $tparams =& $mainframe->getParams('com_content'); // Merge article parameters into the page configuration $aparams = new JParameter($listing[$i]->attribs); $tparams->merge($aparams); //$results = @$dispatcher->trigger('onPrepareContent', array (& $listing[$i]->text, & $tparams, 0)); $results = @$dispatcher->trigger('onPrepareContent', array(&$listing[$i], &$tparams, 0)); $content = $listing[$i]->text; //} break; case '3': // Metadesc $numcharsintro = $params->get('list_numcharsintro') ? $params->get('list_numcharsintro') : '999999'; $content = $listing[$i]->metadesc ? $listing[$i]->metadesc : acPrepareAlphaContent($listing[$i]->text, $numcharsintro, ''); break; } if ($listing[$i]->created) { if ($params->get('list_showdate') == 'created') { $date = JHTML::_('date', $listing[$i]->created, JText::_($params->get('list_formatdate'))); } elseif ($params->get('list_showdate') == 'modified') { $date = JHTML::_('date', $listing[$i]->modified, JText::_($params->get('list_formatdate'))); } } $hits = $params->get('list_showhits') ? intval($listing[$i]->hits) : ''; // get number of comments if ($params->get('list_shownumcomments') && $params->get('list_commentsystem') && $listing[$i]->is_article == '1') { $comments = getNumberComments($params->get('list_commentsystem'), $listing[$i]->id); } // PDF link if ($listing[$i]->is_article == '1' && $params->get('list_showpdf')) { $url = 'index.php?view=article'; $url .= @$listing[$i]->catslug ? '&catid=' . $listing[$i]->catslug : ''; $url .= '&id=' . $listing[$i]->id . $listing[$i]->slug . '&format=pdf&option=com_content'; $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; $text = JText::_('PDF'); $attribs['title'] = JText::_('PDF'); $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $attribs['rel'] = 'nofollow'; $pdf = JHTML::_('link', JRoute::_($url), $text, $attribs); } // Print link if ($listing[$i]->is_article == '1' && $params->get('list_showprint')) { $url = 'index.php?view=article'; $url .= @$listing[$i]->catslug ? '&catid=' . $listing[$i]->catslug : ''; $url .= '&id=' . $listing[$i]->id . $listing[$i]->slug . '&tmpl=component&print=1&option=com_content'; $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; $text = JText::_('Print'); $attribs['title'] = JText::_('Print'); $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $print = JHTML::_('link', JRoute::_($url), $text, $attribs); } // Email link if ($listing[$i]->is_article == '1' && $params->get('list_showemail')) { $uri =& JURI::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $link = $base . JRoute::_("index.php?view=article&id=" . $listing[$i]->id . $listing[$i]->slug, false); $url = 'index.php?option=com_mailto&tmpl=component&link=' . base64_encode($link); $status = 'width=400,height=300,menubar=yes,resizable=yes'; $text = ' ' . JText::_('Email'); $attribs['title'] = JText::_('Email'); $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $emailthis = JHTML::_('link', JRoute::_($url), $text, $attribs); } // report this listing link if ($params->get('list_showreportlisting')) { $url = 'index.php?option=com_alphacontent&task=report'; //switch ( $options['section'] ) { switch ($listing[$i]->is_article) { case 'weblink': $report_type = 'com_weblinks'; break; case 'contact': $report_type = 'com_contact'; break; default: $report_type = 'com_content'; } $url .= '&type=' . $report_type . '&id=' . $id_article . '&tmpl=component'; $status = 'width=400,height=300,menubar=yes,resizable=yes'; $text = JText::_('AC_REPORT'); $attribsr['title'] = JText::_('AC_REPORT_THIS_LISTING'); $attribsr['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $report = JHTML::_('link', JRoute::_($url), $text, $attribsr); } // readmore link if (($listing[$i]->readmore || $cuttext) && $params->get('list_showreadmore')) { $sluggy = $listing[$i]->slug; if ($listing[$i]->catslug && $sluggy != '') { $sluggy .= "&catid=" . $listing[$i]->catslug; } $sluggy .= "&directory=" . $menuid; $readmore = "<a href=\"" . JRoute::_($listing[$i]->href . $sluggy) . "\">" . JText::_('Readmore') . "</a>"; if ($listing[$i]->access > $user->aid) { $readmore = "<a href=\"" . JRoute::_($listing[$i]->href . $sluggy) . "\">" . JText::_("REGISTER TO READ MORE...") . "</a>"; } } // prepare image $linkimgsrc = ""; if ($params->get('list_showimage')) { if ($listing[$i]->is_article == '1') { $linkIMG = findIMG($listing[$i]->text, $params->get('list_showimage')); if ($linkIMG == "") { $linkIMG = findIMG($listing[$i]->fulltext, $params->get('list_showimage')); } $linkimgsrc = $linkIMG ? $start_url_article . "<img src=\"" . $linkIMG . "\" width=\"" . $params->get('list_widthimage') . "px\" alt=\"\" />" . $end_url_article : ""; } elseif ($listing[$i]->is_article == 'contact' && $listing[$i]->images) { $linkimgsrc = $start_url_article . "<img src=\"images/stories/" . $listing[$i]->images . "\" width=\"" . $params->get('list_widthimage') . "px\" alt=\"\" />" . $end_url_article; } elseif ($listing[$i]->is_article == 'weblink' && $params->get('weblinksthumbnail') == '1') { $forcewidth = "width=\"" . $params->get('list_widthimage') . "px\""; if ($params->get('list_keywebsnapr') && $params->get('list_sizewebsnapr', 'AC') != 'AC') { $sizewebsnapr = "size=" . $params->get('list_sizewebsnapr'); $sizewebsnapr .= "&key=" . $params->get('list_keywebsnapr'); $forcewidth = ""; } else { $sizewebsnapr = "size=s"; } $linkimgsrc = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . "<img src=\"http://images.websnapr.com/?" . $sizewebsnapr . "&url=" . $listing[$i]->reallink . "\" alt=\"" . $listing[$i]->reallink . "\" {$forcewidth} />" . "</a>"; } } if ($listing[$i]->is_article == 'weblink') { // prepare link for weblink $content = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . $listing[$i]->reallink . "</a><br />" . $content; } if ($listing[$i]->is_article == 'contact' && $listing[$i]->author != '') { // prepare link for email contact $content .= "<br /><a href=\"mailto:" . $listing[$i]->author . "\">" . $listing[$i]->author . "</a>"; $author = ""; } if ($listing[$i]->is_article == 'contact' && $listing[$i]->reallink != '') { // prepare link for webpage url $content .= "<br /><a href=\"" . $listing[$i]->reallink . "\" target=\"_blank\">" . $listing[$i]->reallink . "</a><br />"; } if ($listing[$i]->metakey != '' && $params->get('showtags')) { $keywords = array(); $keywords = explode(",", trim($listing[$i]->metakey)); for ($a = 0, $b = count($keywords); $a < $b; $a++) { $metakey = trim($keywords[$a]); if ($a > 0) { $tags .= ", "; } $tags .= " <a href=\"" . JRoute::_("index.php?option=com_search&searchword={$metakey}&submit=Search&searchphrase=any&ordering=newest") . "\">" . $metakey . "</a>"; } } // START LAYOUT $ac_m = $line % 2 + 1; // using 2 columns if ($ac_numcolumnslisting && $ac_m == '1') { echo "\n<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"><tr><td width=\"50%\" valign=\"top\">\n"; } if ($ac_numcolumnslisting && $ac_m == '2') { echo "\n<td width=\"50%\" valign=\"top\">\n"; } ?> <!-- STARTING DIV CONTAINER ARTICLE --> <div id="container<?php echo $num; ?> " class="alphalisting"> <table width="100%"><tr> <?php if ($params->get('list_showimage') && $linkimgsrc != '') { if ($ac_alignimage == 0 && $ac_k == 'none' || $ac_alignimage == '2' && $ac_k == 0) { ?> <td valign="top" width="<?php echo $params->get('list_widthimage'); ?> px"> <!-- STARTING DIV IMAGE LEFT --> <div class="_imageleft"><?php echo $linkimgsrc; ?> </div> <!-- END DIV IMAGE LEFT --> </td> <?php } } ?> <!-- STARTING DIV ARTICLE --> <td> <div id="article<?php echo $num; ?> "> <div id="title<?php echo $num; ?> "> <?php if ($num) { ?> <span class="_alphanum" style="display:inline;"><?php echo $num; ?> . </span><?php } ?> <?php if ($title) { ?> <span class="_alphatitle" style="display:inline;"><?php echo $title; ?> </span> <span class="_alphafeatured"><sup><?php echo $featured; ?> </sup></span> <?php } ?> <?php if ($icon_new || $icon_hot) { ?> <span style="display:inline;"><?php echo " " . $icon_new . " " . $icon_hot; ?> </span><?php } ?> </div> <?php if ($ratingbar || $rating) { ?> <div id="ratingbar<?php echo $num; ?> " class="small"> <?php echo $ratingbar; if ($rating) { echo $rating; } ?> </div> <?php } ?> <?php if ($section_category) { ?> <div class="small"><?php echo $section_category; ?> </div> <?php } ?> <?php if ($author) { ?> <div class="small"> <?php echo JTEXT::_('AC_AUTHOR') . $author; ?> </div> <?php } ?> <?php if ($tags) { ?> <div class="small"> <?php echo JTEXT::_('AC_TAGS') . $tags; ?> </div> <?php } ?> <?php if ($content) { ?> <div id="content<?php echo $num; ?> "><?php echo $content; ?> </div> <?php } ?> <div id="features<?php echo $num; ?> "> <?php if ($date) { ?> <span class="small"><?php echo $date; ?> </span><?php } ?> <?php if ($hits) { ?> | <span class="small"><?php $labelHit = $hits > 1 ? 'AC_HITS' : 'AC_HIT'; echo $hits . " " . JTEXT::_($labelHit); ?> </span><?php } ?> <?php if ($comments) { ?> | <span class="small"><?php $labelComment = $comments > 1 ? JTEXT::_('AC_COMMENTS') : JTEXT::_('AC_COMMENT'); echo $comments . " " . $start_url_article . $labelComment . $end_url_article; ?> </span><?php } ?> <?php if ($print) { ?> | <span class="small"><?php echo $print; ?> </span><?php } ?> <?php if ($pdf) { ?> | <span class="small"><?php echo $pdf; ?> </span><?php } ?> <?php if ($emailthis) { ?> | <span class="small"><?php echo $emailthis; ?> </span><?php } ?> <?php if ($report) { ?> | <span class="small"><?php echo $report; ?> </span><?php } ?> <?php if ($readmore) { ?> | <span class="small"><?php echo $readmore; ?> </span><?php } ?> <?php if ($googlemaps) { ?> | <span class="small"><?php echo $googlemaps; ?> </span><?php } ?> </div> </div><!-- END DIV ARTICLE --> </td> <?php if ($params->get('list_showimage') && $linkimgsrc != '') { if ($ac_alignimage == 1 && $ac_k == 'none' || $ac_alignimage == '2' && $ac_k == 1) { ?> <td valign="top" width="<?php echo $params->get('list_widthimage'); ?> px"> <!-- STARTING DIV IMAGE RIGHT --> <div class="_imageright"><?php echo $linkimgsrc; ?> </div> <!-- END DIV IMAGE RIGHT --> </td> <?php } } ?> </tr></table></div><!-- END DIV CONTAINER --> <div class="_separate"></div> <?php // END LAYOUT HTML // using 2 columns if ($ac_numcolumnslisting && $ac_m == '1') { echo "\n</td>\n"; } if ($ac_numcolumnslisting && $ac_m == '1' && $i == count($listing) - 1) { echo "\n<td width=\"50%\" valign=\"top\"> "; } if ($ac_numcolumnslisting && $ac_m == '2' || $ac_numcolumnslisting && $ac_m == '1' && $i == count($listing) - 1) { echo "\n</td></tr></table>\n"; } $line++; if ($ac_alignimage == '2') { $ac_k = 1 - $ac_k; } } else { if ($i > 0) { $i = $i - 1; } } } ?> <?php if (count($listing) && @$listing[0]->id != '') { if (!($options['section'] == '' && ($options['letter'] != '' || $options['search'] != '') && ($params->get('weblinkssection') || $params->get('contactsection')))) { echo "<div id=\"alphapagination\"><p>"; echo $pagination->getPagesLinks(); echo "<br />"; echo $pagination->getPagesCounter(); echo "</p></div>"; } } }
<?php if ($this->multiple_stats == 1) { ?> <div class="fulltablelink"> <?php echo JHtml::link(JoomleagueHelperRoute::getStatsRankingRoute($this->project->id, $this->division ? $this->division->id : 0, $this->teamid, $rows->id), JText::_('COM_JOOMLEAGUE_STATSRANKING_VIEW_FULL_TABLE')); ?> </div> <?php } else { jimport('joomla.html.pagination'); $pagination = new JPagination($this->playersstats[$rows->id]->pagination_total, $this->limitstart, $this->limit); ?> <div class="pageslinks"> <?php echo $pagination->getPagesLinks(); ?> </div> <p class="pagescounter"> <?php echo $pagination->getPagesCounter(); ?> </p> <?php } ?> <?php }
/** function that will create pagination for views * @param object $setLimit * total - total number of rows * start - number or index to start e.g 0 ( will start from 0 - limit ) * value - ending number or limit e.g 20 ( will only show 20 rows ) * @return $display */ private static function _pagination($setLimit, $onlyBox = false, $showTotal = false) { jimport('joomla.html.pagination'); $total = $setLimit->total; $start = $setLimit->start; $value = $setLimit->end; $pagination = new JPagination($total, $start, $value); //alex pagination $pagination->setAdditionalUrlParam('limit', JRequest::getVar('limit')); if (version_compare(JVERSION, '3.0.0', '<')) { if ($onlyBox) { $display = "<div class=\"list-footer\">\n"; $display .= "\n<div class=\"limit\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . JText::_('Display Num') . ' ' . $pagination->getLimitBox() . "</div>"; $display .= "\n<div class=\"counter\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . ' ' . $pagination->getPagesCounter() . "</div>"; if ($showTotal) { $display .= "\n<div class=\"outof\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . ' ' . JText::_('Total Result:') . ' <span style="font-weight: bold; text-decoration: underlined;">' . $total . "</span></div>"; } $display .= "\n</div>"; } else { $display = $pagination->getListFooter(); } } else { $display = '<div style="display:inline; font-size:14px;">'; $display .= '<div class="jnews_pagination_one" style="float:right; margin-left:15px;">'; $display .= $pagination->getLimitBox(); $display .= '</div>'; $pagi = $pagination->getListFooter(); if (!empty($pagi)) { $display .= '<div class="jnews_pagination" style="float:right; margin-left:15px;">'; $display .= $pagi; $display .= '</div>'; } $pagi = $pagination->getPagesCounter(); if (!empty($pagi)) { $display .= '<div style="float:right;padding-top: 4px;">'; $display .= $pagi; $display .= '</div>'; } $display .= '</div>'; } return $display; }
function viewCategory() { $app = JFactory::getApplication('site'); $db = JFactory::getDBO(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $document = JFactory::getDocument(); $filter_order = $app->getUserStateFromRequest('com_datsogallery.filter_order', 'filter_order', 'a.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_datsogallery.filter_order_Dir', 'filter_order_Dir', '', 'word'); $catid = JRequest::getVar('catid', 0, '', 'int'); $menu = JSite::getMenu(); $ids = $menu->getItems('link', 'index.php?option=com_datsogallery&view=datsogallery'); $itemid = isset($ids[0]) ? '&Itemid=' . $ids[0]->id : ''; $is_editor = strtolower($user->usertype) == 'editor' || strtolower($user->usertype) == 'administrator' || strtolower($user->usertype) == 'super administrator'; GalleryHeader(); $db->setQuery("select count(*) from #__datsogallery_catg where cid = " . $catid . " AND access IN (" . $groups . ")"); $is_allowed = $db->loadResult(); if (!$is_allowed) { $app->redirect(JRoute::_('index.php?option=com_datsogallery' . $itemid, false), JText::_('COM_DATSOGALLERY_NOT_ACCESS_THIS_CATEGORY'), 'notice'); } //echo dgCategories($catid); require JPATH_COMPONENT_ADMINISTRATOR . DS . 'config.datsogallery.php'; if ($ad_sbcat) { $ssa = !$ad_slideshow_auto ? ',onOpen:function(currentImage){Shadowbox.play();Shadowbox.pause();}' : ''; $document->addStyleSheet(JURI::base(true) . '/components/com_datsogallery/libraries/shadowbox/shadowbox.css'); $document->addScript(JURI::base(true) . '/components/com_datsogallery/libraries/shadowbox/shadowbox.js'); $sbinit = 'Shadowbox.init({slideshowDelay:' . $ad_slideshow_delay . $ssa . '});'; $document->addScriptDeclaration($sbinit); } $db->setQuery("SELECT COUNT(*)" . " FROM #__datsogallery AS a" . " LEFT JOIN #__datsogallery_catg AS c" . " ON c.cid = a.catid" . " WHERE a.published = 1" . " AND a.catid = " . $catid . " AND a.approved = 1" . " AND c.access IN (" . $groups . ")"); $count = $db->loadResult(); if (!in_array($filter_order, array('a.imgcounter', 'a.imgdownloaded', 'a.imgtitle', 'a.imgdate', 'a.ordering'))) { $filter_order = 'a.ordering'; } if (!in_array(strtoupper($filter_order_Dir), array('ASC', 'DESC'))) { $filter_order_Dir = $ad_sortby; } $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir; if ($ad_picincat && $count > 0) { echo JText::sprintf('COM_DATSOGALLERY_CATEGORY_IMAGES', $count); } ?> <form method="post" id="adminForm"> <?php $query = "SELECT count(*) AS count" . " FROM #__datsogallery" . " WHERE catid = " . $catid . " AND published = 1" . " AND approved = 1"; $db->setQuery($query); $row = $db->LoadObject(); $total = $row->count; jimport('joomla.html.pagination'); $limit = JRequest::getVar('limit', $ad_perpage, '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); $pagination = new JPagination($total, $limitstart, $limit); if ($count > $ad_perpage) { $page_nav_links = $pagination->getPagesLinks(); ?> <div class="datso_pgn"><?php echo $page_nav_links; ?> </div> <div style="clear:both"></div> <?php } $db->setQuery("SELECT * FROM #__datsogallery_catg WHERE cid = " . $catid); $rows = $db->loadObjectList(); $catname = $rows[0]->name; if ($show_grid) { echo '<div class="dg_head_background">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', $catname . ' ', 'a.imgtitle', $filter_order_Dir, $filter_order)); echo '<span class="grid_txt"><div class="grid_border">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', JText::_('COM_DATSOGALLERY_ORDER') . ' ', 'a.ordering', $filter_order_Dir, $filter_order)) . '</div>'; echo '<div class="grid_border">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', JText::_('COM_DATSOGALLERY_DATE_ADD') . ' ', 'a.imgdate', $filter_order_Dir, $filter_order)) . '</div>'; echo '<div class="grid_border">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', JText::_('COM_DATSOGALLERY_HITS') . ' ', 'a.imgcounter', $filter_order_Dir, $filter_order)) . '</div>'; echo '<div class="grid_border">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', JText::_('COM_DATSOGALLERY_DOWNLOADS') . ' ', 'a.imgdownloaded', $filter_order_Dir, $filter_order)) . '</div>'; echo '</span></div>'; } else { echo '<div class="dg_head_background">' . $catname . '</div>'; } echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"dg_body_background\">\n"; if ($count > $ad_perpage) { $addspace = ' - '; } else { $addspace = ''; } $pages = $pagination->getPagesCounter(); $document->setTitle($catname . $addspace . $pages); if ($ad_metagen) { if ($rows[0]->description) { $document->setTitle($catname . $addspace . $pages); $document->setDescription(limit_words($rows[0]->description, 25)); $document->setMetadata('keywords', metaGen($rows[0]->description)); } } $query = 'SELECT a.*' . ' FROM #__datsogallery AS a' . ' LEFT JOIN #__datsogallery_catg AS c' . ' ON c.cid = a.catid' . ' WHERE a.published = 1' . ' AND a.catid = ' . $catid . ' AND a.approved = 1' . ' AND c.access IN (' . $groups . ')' . $orderby; $db->setQuery($query, $pagination->limitstart, $pagination->limit); $rows = $db->loadObjectList(); $rowcounter = 0; if (count($rows) > 0) { foreach ($rows as $row1) { if ($ad_ncsc) { $cw = 100 / $ad_cp . "%"; } if ($rowcounter % $ad_cp == 0) { echo " <tr>\n"; } echo " <td width=\"" . $cw . "\" class=\"dg_body_background_td\" align=\"center\" valign=\"top\">\n"; $tle = jsspecialchars($row1->imgtitle); if ($ad_showdetail) { $picdate = strftime($ad_datef, $row1->imgdate); } $na = $ad_na ? '#dgtop' : ''; $ld = "<a href='" . JRoute::_("index.php?option=com_datsogallery&task=image&catid=" . $catid . "&id=" . $row1->id . $itemid) . $na . "' title='" . $tle . "'>"; if ($ad_sbcat) { echo " <a rel='shadowbox[screenshots];player=img' href='" . JURI::root() . "index.php?option=com_datsogallery&task=sbox&catid=" . $catid . "&id=" . $row1->id . "&format=raw' title='" . $tle . "'>"; } else { echo $ld; } echo " <img src=\"" . resize($row1->imgoriginalname, $ad_thumbwidth, $ad_thumbheight, $ad_crop, $ad_cropratio, 0, $row1->catid) . "\" " . get_width_height($row1->imgoriginalname, $ad_thumbwidth, $ad_thumbheight, $catid, $ad_cropratio) . " class=\"dgimg\" title=\"" . $tle . "\" alt=\"" . $tle . "\" /></a>"; if ($ad_showdetail) { echo " <div style=\"width:" . $ad_thumbwidth . "px;margin:10px auto 0 auto;text-align:left;text-transform: uppercase;\">"; echo $ad_showimgtitle ? $ld . '<span>' . $row1->imgtitle . '</span></a><br />' : ''; echo " <span>"; echo $ad_showfimgdate ? '<strong>' . JText::_('COM_DATSOGALLERY_DATE_ADD') . '</strong>: ' . $picdate . '<br />' : ''; echo $ad_showimgcounter ? '<strong>' . JText::_('COM_DATSOGALLERY_HITS') . '</strong>: ' . $row1->imgcounter . '<br />' : ''; echo $ad_showdownloads ? '<strong>' . JText::_('COM_DATSOGALLERY_DOWNLOADS') . '</strong>: ' . $row1->imgdownloaded . '<br />' : ''; echo $ad_showrating ? showVote($row1->id, $row1->imgvotes, $row1->imgvotesum) : ''; if ($ad_showcomments) { $and = $is_editor ? '' : ' AND published = 1'; $db->setQuery('SELECT COUNT(cmtid) FROM #__datsogallery_comments WHERE cmtpic = ' . $row1->id . $and); $comments = $db->loadResult(); echo "<strong>" . JText::_('COM_DATSOGALLERY_COMMENTS') . "</strong>: {$comments}"; } echo " </span>"; echo " </div>"; } echo " </td>\n"; $rowcounter++; } } else { echo " <td width=\"" . @$cw . "\" class=\"dg_body_background_td\">" . JText::_('COM_DATSOGALLERY_NO_RESULTS') . "</td>\n"; } if ($rowcounter % $ad_cp != 0) { for ($i = 1; $i <= $ad_cp - $rowcounter % $ad_cp; $i++) { echo " <td width=\"" . @$cw . "\" class=\"dg_body_background_td\"> </td>\n"; } } echo " </tr>\n"; echo "</table>\n"; if ($count > $ad_perpage) { $page_nav_links = $pagination->getPagesLinks(); ?> <div class="datso_pgn"><?php echo $page_nav_links; ?> </div> <?php } ?> <input type="hidden" name="filter_order" value="<?php echo $filter_order; ?> " /> <input type="hidden" name="filter_order_Dir" value="<?php echo $filter_order_Dir; ?> " /> <?php echo JHTML::_('form.token'); ?> </form> <?php echo dgCategories($catid); GalleryFooter(); }
/** * Shows thumbnails for gallery */ function showThumbs() { global $rsgConfig; $my = JFactory::getUser(); $itemCount = $this->gallery->itemCount(); $limit = $rsgConfig->get("display_thumbs_maxPerPage"); $limitstart = rsgInstance::getInt('limitstart'); //instantiate page navigation jimport('joomla.html.pagination'); $pagenav = new JPagination($itemCount, $limitstart, $limit); //MK gaat goed: thumbs in gallery // increase the gallery hit counter $this->gallery->hit(); if (!$this->gallery->itemCount()) { if ($this->gallery->id) { // if gallery is not the root gallery display the message echo JText::_('No images in gallery'); } // no items to display, so we can return; return; } //Old rights management. If user is owner or user is Super Administrator, you can edit this gallery if ($my->id != 0 and ($this->gallery->uid == $my->id or $my->usertype == 'Super Administrator')) { $this->allowEdit = true; } else { $this->allowEdit = false; } switch ($rsgConfig->get('display_thumbs_style')) { case 'float': $this->display('thumbs_float.php'); break; case 'table': $this->display('thumbs_table.php'); break; } ?> <div class="rsg2-pageNav"> <?php if ($itemCount > $limit) { echo $pagenav->getPagesLinks(); echo "<br /><br />" . $pagenav->getPagesCounter(); } ?> </div> <?php }
public function onAfterRender() { $app = JFactory::getApplication(); $document = JFactory::getDocument(); if ($app->isSite() && method_exists($document, 'addCustomTag')) { $vb_path = str_replace('//', '/', JPATH_BASE . '/plugins/system/videobox/'); // Clear cache and unset the clear parameter if ($this->params->get('clear')) { $this->params->set('clear', '0'); $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->update('#__extensions AS a'); $query->set('a.params = ' . $db->quote((string) $this->params)); $query->where('a.element = "videobox"'); $db->setQuery($query); $db->query(); foreach (new DirectoryIterator($vb_path . 'cache') as $fileInfo) { if (!$fileInfo->isDot() && $fileInfo->getFilename() != 'index.html' && !$fileInfo->isDir()) { unlink($vb_path . 'cache/' . $fileInfo->getFilename()); } } } // Get content $pageload = JResponse::getBody(); preg_match('/<(\\s*)body(.*)\\/(\\s*)body(\\s*)>/s', $pageload, $buffer); $buffer = $buffer[2]; $old_buffer = $buffer; $buffer = str_replace(array("{", "}"), array("{", "}"), $buffer); // Avoid rendering Videobox inside texteditors preg_match_all('/<(\\s*)textarea([^>]*)>(.*?)<\\/(\\s*)textarea(\\s*)>/s', $buffer, $areas); foreach ($areas[0] as $area) { $area1 = str_replace(array("{", "}"), array("{", "}"), $area); $buffer = str_replace($area, $area1, $buffer); } // Avoid rendering Videobox when {raw} is used preg_match_all('/{raw}([\\s\\S]*){\\/raw}/isU', $buffer, $matches); foreach ($matches[1] as $match) { $raw_text = str_replace(array("{", "}"), array("{", "}"), $match); $buffer = preg_replace('/{raw}([\\s\\S]*){\\/raw}/isU', $raw_text, $buffer, 1); } // Get custom tag $tags = array('videobox'); $tag = preg_replace("/[^a-zA-Z0-9]/", "", $this->params->get('tag', 'videobox')); if ($tag != 'videobox' && $tag != '') { $tags[] = $tag; } foreach ($tags as $tag) { // Match Videobox calls $regex = '/{' . $tag . '}(.*){\\/' . $tag . '}/isU'; preg_match_all($regex, $buffer, $matches); // Get pages for the gallery display $url2 = explode(',', JRequest::getVar('vblimitstart', '')); $co = 0; foreach ($matches[1] as $match) { $co++; $match = strip_tags($match); $this->parametri = explode('||', $match); $videos = explode('|,', $this->parametri[0]); $count = count($videos); // Match parameters in code $para_match = array(array()); if (isset($this->parametri[1])) { preg_match_all('/([^=, ]*)=(([^,]*)|"([^"]*)")/i', $this->parametri[1], $para_match); } foreach ($para_match[0] as $para) { if (preg_match('/([^=]+)="{0,1}([^"]*)"{0,1}/i', $para, $parameter) > 0) { if (isset($parameter[1]) && isset($parameter[2])) { if (trim($parameter[1]) != '' && trim($parameter[2]) != '') { $this->parametri[trim($parameter[1])] = trim($parameter[2]); } } } } if (isset($this->parametri['alternative']) && $this->parametri['alternative'] == 1) { $this->parametri['alternative'] = 99; } if (isset($this->parametri['display'])) { $this->parametri['display'] = strtolower($this->parametri['display']); if ($this->parametri['display'] == 'links' || $this->parametri['display'] == 'link' || $this->parametri['display'] == 1) { $this->parametri['display'] = 1; } else { if ($this->parametri['display'] == 'box' || $this->parametri['display'] == 2) { $this->parametri['display'] = 2; } else { $this->parametri['display'] = 0; } } } if (isset($this->parametri['player'])) { $this->parametri['player'] = strtolower($this->parametri['player']); if ($this->parametri['player'] == 'inline' || $this->parametri['player'] == 0) { $this->parametri['player'] = 0; } else { $this->parametri['player'] = 1; } } // Get the required parameters if (!isset($this->parametri['cache'])) { $this->parametri['cache'] = $this->params->get('cache'); } $this->parametri['display_suffix'] = ''; if ($count > 1) { if (!isset($this->parametri['display']) || $this->parametri['display'] > 1) { $this->parametri['display'] = $this->params->get('links_g'); } if ($this->parametri['display'] == 1) { $this->parametri['player'] = 1; $this->parametri['display_suffix'] = '_lg'; if (!isset($this->parametri['class'])) { $this->parametri['class'] = $this->params->get('class_lg'); } if (!isset($this->parametri['style'])) { $this->parametri['style'] = $this->params->get('style_lg'); } if (!isset($this->parametri['separator'])) { $this->parametri['separator'] = $this->params->get('separator'); } if (!isset($this->parametri['width'])) { $this->parametri['width'] = $this->params->get('width_lg'); } if (!isset($this->parametri['height'])) { $this->parametri['height'] = $this->params->get('height_lg'); } } else { if (!isset($this->parametri['player'])) { $this->parametri['player'] = $this->params->get('player_g'); } if ($this->parametri['player'] == -1) { $this->parametri['player'] = $this->params->get('player'); } if (!isset($this->parametri['class'])) { $this->parametri['class'] = $this->params->get('class_g'); } if (!isset($this->parametri['style'])) { $this->parametri['style'] = $this->params->get('style_g'); } if (!isset($this->parametri['alternative'])) { $this->parametri['alternative'] = $this->params->get('cs_g'); } if (!isset($this->parametri['pagination_class'])) { $this->parametri['pagination_class'] = $this->params->get('pages_class'); } if ($this->parametri['player'] != $this->params->get('player_g') && $this->params->get('player_g') != -1 && $this->parametri['alternative'] == 1 || $this->parametri['alternative'] == 99) { $this->parametri['display_suffix'] = '_alt_g'; if (!isset($this->parametri['width'])) { $this->parametri['width'] = $this->params->get('width_nlb_g'); } if (!isset($this->parametri['height'])) { $this->parametri['height'] = $this->params->get('height_nlb_g'); } if (!isset($this->parametri['t_width'])) { $this->parametri['t_width'] = $this->params->get('width_nlb_gt'); } if (!isset($this->parametri['t_height'])) { $this->parametri['t_height'] = $this->params->get('height_nlb_gt'); } if (!isset($this->parametri['button'])) { $this->parametri['button'] = $this->params->get('play_nlb_g'); } if (!isset($this->parametri['break'])) { $this->parametri['break'] = $this->params->get('break_nlb'); } if (!isset($this->parametri['pages'])) { $this->parametri['pages'] = $this->params->get('pages_nlb'); } } else { $this->parametri['display_suffix'] = '_g'; if (!isset($this->parametri['width'])) { $this->parametri['width'] = $this->params->get('width_g'); } if (!isset($this->parametri['height'])) { $this->parametri['height'] = $this->params->get('height_g'); } if (!isset($this->parametri['t_width'])) { $this->parametri['t_width'] = $this->params->get('width_gt'); } if (!isset($this->parametri['t_height'])) { $this->parametri['t_height'] = $this->params->get('height_gt'); } if (!isset($this->parametri['button'])) { $this->parametri['button'] = $this->params->get('play_g'); } if (!isset($this->parametri['break'])) { $this->parametri['break'] = $this->params->get('break'); } if (!isset($this->parametri['pages'])) { $this->parametri['pages'] = $this->params->get('pages'); } if (!isset($this->parametri['pages_results'])) { $this->parametri['pages_results'] = $this->params->get('pages_results'); } } } } else { if (!isset($this->parametri['display'])) { $this->parametri['display'] = $this->params->get('display'); } if ($this->parametri['display'] == 2) { if (!isset($this->parametri['player'])) { $this->parametri['player'] = $this->params->get('player_b'); } if ($this->parametri['player'] == -1) { $this->parametri['player'] = $this->params->get('player'); } if (!isset($this->parametri['class'])) { $this->parametri['class'] = $this->params->get('class_b'); } if (!isset($this->parametri['style'])) { $this->parametri['style'] = $this->params->get('style_b'); } if (!isset($this->parametri['alternative'])) { $this->parametri['alternative'] = $this->params->get('cs_b'); } if ($this->parametri['player'] != $this->params->get('player_b') && $this->params->get('player_b') != -1 && $this->parametri['alternative'] == 1 || $this->parametri['alternative'] == 99) { $this->parametri['display_suffix'] = '_alt_b'; if (!isset($this->parametri['t_width'])) { $this->parametri['t_width'] = $this->params->get('width_nlb_bt'); } if (!isset($this->parametri['t_height'])) { $this->parametri['t_height'] = $this->params->get('height_nlb_bt'); } if (!isset($this->parametri['width'])) { $this->parametri['width'] = $this->params->get('width_nlb_b'); } if (!isset($this->parametri['height'])) { $this->parametri['height'] = $this->params->get('height_nlb_b'); } if (!isset($this->parametri['button'])) { $this->parametri['button'] = $this->params->get('play_nlb_b'); } } else { $this->parametri['display_suffix'] = '_b'; if (!isset($this->parametri['t_width'])) { $this->parametri['t_width'] = $this->params->get('width_bt'); } if (!isset($this->parametri['t_height'])) { $this->parametri['t_height'] = $this->params->get('height_bt'); } if (!isset($this->parametri['width'])) { $this->parametri['width'] = $this->params->get('width_b'); } if (!isset($this->parametri['height'])) { $this->parametri['height'] = $this->params->get('height_b'); } if (!isset($this->parametri['button'])) { $this->parametri['button'] = $this->params->get('play_b'); } } } else { if ($this->parametri['display'] == 1) { $this->parametri['player'] = 1; $this->parametri['display_suffix'] = '_l'; if (!isset($this->parametri['class'])) { $this->parametri['class'] = $this->params->get('class_l'); } if (!isset($this->parametri['style'])) { $this->parametri['style'] = $this->params->get('style_l'); } if (!isset($this->parametri['width'])) { $this->parametri['width'] = $this->params->get('width_l'); } if (!isset($this->parametri['height'])) { $this->parametri['height'] = $this->params->get('height_l'); } } else { $this->parametri['display_suffix'] = '_d'; if (!isset($this->parametri['width'])) { $this->parametri['width'] = $this->params->get('width'); } if (!isset($this->parametri['height'])) { $this->parametri['height'] = $this->params->get('height'); } if (!isset($this->parametri['class'])) { $this->parametri['class'] = $this->params->get('class'); } if (!isset($this->parametri['style'])) { $this->parametri['style'] = $this->params->get('style'); } if (!isset($this->parametri['play'])) { $this->parametri['play'] = $this->params->get('autoplay'); } } } } $this->parametri['path'] = $vb_path; if (!isset($this->parametri['pages']) || $this->parametri['pages'] == 0) { $this->parametri['pages'] = 99999999; } // Create video adapter object for each video $video_objects = array(); foreach ($videos as $video) { $video = $this->_getVideo($video); if ($video) { $video_objects[] = $video; } } $videos = $video_objects; $count = count($videos); if ($count) { // Create pagination if needed $start = 0; $pagination = ''; if ($count > $this->parametri['pages'] && $this->parametri['pages'] != 0 && $this->parametri['display'] == 0) { if (isset($url2[$co - 1])) { $start = (int) $url2[$co - 1]; } $path = ''; for ($h = 0; $h < $co - 1; $h++) { if (!isset($url2[$h])) { $url2[$h] = ''; } if ($url2[$h] == '') { $url2[$h] = '0'; } $path .= ',' . $url2[$h]; } $after = ''; for ($h = $co; $h < count($url2); $h++) { if ($url2[$h] == '') { $url2[$h] = '0'; } $after .= ',' . $url2[$h]; } jimport('joomla.html.pagination'); $pg = new JPagination($count, $start, $this->parametri['pages']); $pg->prefix = 'vb'; $pagination = '<div class="' . $this->parametri['pagination_class'] . ' pagination">'; if ($this->parametri['pages_results']) { $pagination .= '<p class="counter">' . $pg->getPagesCounter() . '</p>'; } $pagination .= $pg->getPagesLinks() . '</div>'; $pagination = str_replace(array('vblimitstart=,', ',,'), array('vblimitstart=', ','), preg_replace('/vblimitstart=(\\d+)/', 'vblimitstart=' . $path . ',$1' . $after, $pagination)); } // Create the appropriate display method code $thumbnails = ''; if ($count == 1) { if ($this->parametri['display'] == 2) { $thumbnails .= $this->_videoBox($videos[0], $co); } elseif ($this->parametri['display'] == 1) { $thumbnails .= $this->_videoLink($videos[0], $co); } else { $thumbnails .= $this->_videoCode($videos[0]); } } elseif ($count > 1) { if ($this->parametri['display'] == 1) { foreach ($videos as $n => $video) { if ($n < $count - 1) { $thumbnails .= $this->_videoLink($video, $co, $this->parametri['separator']); } else { $thumbnails .= $this->_videoLink($video, $co); } } } else { $thumbnails .= '<div style="' . $this->parametri['style']; if ($this->parametri['break'] != 0) { $thumbnails .= ' max-width: ' . (($this->parametri['t_width'] + 30) * $this->parametri['break'] - 20) . 'px;'; } $thumbnails .= '" class="vb_gallery_frame ' . $this->parametri['class'] . '"><ul class="vb_video" rel="vbResponsiveRow" elementWidth="' . ($this->parametri['t_width'] + 30) . '">'; for ($n = $start; $n < $start + $this->parametri['pages']; $n++) { if (isset($videos[$n])) { $thumbnails .= $this->_videoThumb($videos[$n], $co); } else { break; } } $thumbnails .= '</ul></div>'; } } // Insert the code into the content $buffer = preg_replace($regex, str_replace('&', '&', $thumbnails) . $pagination, $buffer, 1); } } } $pageload = str_replace($old_buffer, $buffer, $pageload); JResponse::setBody($pageload); return true; } }