File manager - Edit - /home/jardides/www/Jardi-design/j37/components/com_pagebuilderck/router.php
Back
<?php /** * @name Page Builder CK * @package com_pagebuilderck * @copyright Copyright (C) 2015. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr */ defined('_JEXEC') or die; /** * Routing class from com_pagebuilderck * * @since 3.3 */ class PagebuilderckRouter extends JComponentRouterBase { /** * Build the route for the com_pagebuilderck component * * @param array &$query An array of URL arguments * * @return array The URL arguments to use to assemble the subsequent URL. * * @since 3.3 */ public function build(&$query) { $segments = array(); // Get a menu item based on Itemid or currently active $params = JComponentHelper::getParams('com_pagebuilderck'); $advanced = $params->get('sef_advanced_link', 0); // We need a menu item. Either the one specified in the query, or the current active one if none specified if (empty($query['Itemid'])) { $menuItem = $this->menu->getActive(); $menuItemGiven = false; } else { $menuItem = $this->menu->getItem($query['Itemid']); $menuItemGiven = true; } // Check again if ($menuItemGiven && isset($menuItem) && $menuItem->component != 'com_pagebuilderck') { $menuItemGiven = false; unset($query['Itemid']); } if (isset($query['view'])) { $view = $query['view']; } else { // We need to have a view in the query or it is an invalid URL return $segments; } // Are we dealing with an page or category that is attached to a menu item? if (($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == (int) $query['id']) { unset($query['view']); // if (isset($query['catid'])) // { // unset($query['catid']); // } if (isset($query['layout'])) { unset($query['layout']); } unset($query['id']); return $segments; } if ($view == 'page') { if (!$menuItemGiven) { $segments[] = $view; } unset($query['view']); return $segments; // unset($query['id']); } /* * If the layout is specified and it is the same as the layout in the menu item, we * unset it so it doesn't go into the query string. */ if (isset($query['layout'])) { if ($menuItemGiven && isset($menuItem->query['layout'])) { if ($query['layout'] == $menuItem->query['layout']) { unset($query['layout']); } } else { if ($query['layout'] == 'default') { unset($query['layout']); } } } $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = str_replace(':', '-', $segments[$i]); } return $segments; } /** * Parse the segments of a URL. * * @param array &$segments The segments of the URL to parse. * * @return array The URL attributes to be used by the application. * * @since 3.3 */ public function parse(&$segments) { $total = count($segments); $vars = array(); for ($i = 0; $i < $total; $i++) { $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1); } // Get the active menu item. $item = $this->menu->getActive(); $params = JComponentHelper::getParams('com_pagebuilderck'); $advanced = $params->get('sef_advanced_link', 0); $db = JFactory::getDbo(); // Count route segments $count = count($segments); /* * Standard routing for pages. If we don't pick up an Itemid then we get the view from the segments * the first segment is the view and the last segment is the id of the page or category. */ if (!isset($item)) { $vars['view'] = $segments[0]; $vars['id'] = $segments[$count - 1]; return $vars; } /* * If there is only one segment, then it points to either an page or a category. * We test it first to see if it is a category. If the id and alias match a category, * then we assume it is a category. If they don't we assume it is an page */ if ($count == 1) { $vars['view'] = 'page'; $vars['id'] = (int) $segments[0]; return $vars; } return $vars; } } /** * Content router functions * * These functions are proxys for the new router interface * for old SEF extensions. * * @param array &$query An array of URL arguments * * @return array The URL arguments to use to assemble the subsequent URL. * * @deprecated 4.0 Use Class based routers instead */ function PagebuilderckBuildRoute(&$query) { $router = new PagebuilderckRouter; return $router->build($query); } /** * Parse the segments of a URL. * * This function is a proxy for the new router interface * for old SEF extensions. * * @param array $segments The segments of the URL to parse. * * @return array The URL attributes to be used by the application. * * @since 3.3 * @deprecated 4.0 Use Class based routers instead */ function PagebuilderckParseRoute($segments) { $router = new PagebuilderckRouter; return $router->parse($segments); }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings