Пример #1
0
 public static function getInstance(&$query = null)
 {
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     if (isset($query['langswitch'])) {
         if ($query['langswitch'] != VMLANG) {
             $instanceKey = $query['langswitch'];
         }
         unset($query['langswitch']);
     } else {
         $instanceKey = VMLANG;
     }
     if (!array_key_exists($instanceKey, self::$_instances)) {
         self::$_instances[$instanceKey] = new vmrouterHelper($instanceKey, $query);
         if (self::$limit === null) {
             $mainframe = Jfactory::getApplication();
             $view = 'virtuemart';
             if (isset($query['view'])) {
                 $view = $query['view'];
             }
             self::$limit = $mainframe->getUserStateFromRequest('com_virtuemart.' . $view . '.limit', VmConfig::get('list_limit', 20), 'int');
             // 				self::$limit= $mainframe->getUserStateFromRequest('global.list.limit', 'limit', VmConfig::get('list_limit', 20), 'int');
         }
     }
     return self::$_instances[$instanceKey];
 }
 public static function getInstance(&$query = null)
 {
     if (empty(self::$_instances)) {
         JLoader::register('VmConfig', JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php');
         VmConfig::loadConfig();
     }
     if (isset($query['langswitch'])) {
         if ($query['langswitch'] != VMLANG) {
             $instanceKey = $query['langswitch'];
         }
         unset($query['langswitch']);
     } else {
         $instanceKey = VMLANG;
     }
     if (!isset(self::$_instances[$instanceKey])) {
         self::$_instances[$instanceKey] = new vmrouterHelper($instanceKey, $query);
         if (self::$limit === null) {
             $mainframe = Jfactory::getApplication();
             $view = 'virtuemart';
             if (isset($query['view'])) {
                 $view = $query['view'];
             }
             self::$limit = $mainframe->getUserStateFromRequest('com_virtuemart.' . $view . '.limit', VmConfig::get('list_limit', 20), 'int');
             // 				self::$limit= $mainframe->getUserStateFromRequest('global.list.limit', 'limit', VmConfig::get('list_limit', 20), 'int');
         }
     }
     return self::$_instances[$instanceKey];
 }
Пример #3
0
 public static function getInstance(&$query = null)
 {
     defined('DS') or define('DS', DIRECTORY_SEPARATOR);
     if (!class_exists('VmConfig')) {
         require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     if (!self::$_instance) {
         self::$_instance = new vmrouterHelper($query);
         if (self::$limit === null) {
             $mainframe = Jfactory::getApplication();
             $view = 'virtuemart';
             if (isset($query['view'])) {
                 $view = $query['view'];
             }
             self::$limit = $mainframe->getUserStateFromRequest('com_virtuemart.' . $view . '.limit', VmConfig::get('list_limit', 20), 'int');
         }
     }
     self::$_instance->query = $query;
     return self::$_instance;
 }
Пример #4
0
                $limitstart = 0;
                shAddToGETVarsList('limitstart', $limitstart);
                shRemoveFromGETVarsList('limitstart');
            }
        }
        ShlSystem_Log::debug('sh404sef', 'Inside com_virtuemart.php, building url from menu item route');
        $title = array($item->route);
    }
}
if (empty($title)) {
    ShlSystem_Log::debug('sh404sef', 'Loading component own router.php file from inside com_virtuemart.php');
    $functionName = ucfirst(str_replace('com_', '', $option)) . 'BuildRoute';
    if (!function_exists($functionName)) {
        include JPATH_ROOT . '/components/' . $option . '/router.php';
    }
    $helper = vmrouterHelper::getInstance($originalVars);
    $menuItem = $helper->menuVmitems;
    $shopName = empty($menuItem) ? 'vm' : $menuItem[0]->alias;
    // check for shop root url, else normal routing
    if (!empty($originalVars['view']) && $originalVars['view'] == 'virtuemart') {
        // if VM is homepage, then that's fine
        if (!shIsAnyHomepage($string)) {
            // else use menu item alias as slug
            $title[] = $shopName;
            unset($originalVars['view']);
        }
    } else {
        // various checks as VM2 seem to produce funky non-sef urls
        if (!empty($originalVars['view']) && $originalVars['view'] == 'productdetails') {
            if (empty($originalVars['virtuemart_product_id'])) {
                // request for product details, but product id is 0