当前位置: 首页>>代码示例>>PHP>>正文


PHP JUri::setvar方法代码示例

本文整理汇总了PHP中JUri::setvar方法的典型用法代码示例。如果您正苦于以下问题:PHP JUri::setvar方法的具体用法?PHP JUri::setvar怎么用?PHP JUri::setvar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUri的用法示例。


在下文中一共展示了JUri::setvar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getExtensions

 public function getExtensions()
 {
     // Get catid, search filter, order column, order direction
     $cache = JFactory::getCache();
     $cache->setCaching(1);
     $http = new JHttp();
     $http->setOption('timeout', 60);
     $componentParams = JComponentHelper::getParams('com_apps');
     $api_url = new JUri();
     $default_limit = $componentParams->get('default_limit', 8);
     $input = new JInput();
     $catid = $input->get('id', null, 'int');
     $order = $input->get('ordering', $this->getOrderBy());
     $orderCol = $this->state->get('list.ordering', $order);
     $orderDirn = $orderCol == 'core_title' ? 'ASC' : 'DESC';
     $release = preg_replace('/[^\\d]/', '', base64_decode($input->get('release', '', 'base64')));
     $limitstart = $input->get('limitstart', 0, 'int');
     $limit = $input->get('limit', $default_limit, 'int');
     $dashboard_limit = $componentParams->get('extensions_perrow') * 6;
     // 6 rows of extensions
     $search = str_replace('_', ' ', urldecode(trim($input->get('filter_search', null))));
     $release = intval($release / 5) * 5;
     $api_url->setScheme('http');
     $api_url->setHost('extensions.joomla.org/index.php');
     $api_url->setvar('option', 'com_jed');
     $api_url->setvar('controller', 'filter');
     $api_url->setvar('view', 'extension');
     $api_url->setvar('format', 'json');
     $api_url->setvar('limit', $limit);
     $api_url->setvar('limitstart', $limitstart);
     $api_url->setvar('filter[approved]', '1');
     $api_url->setvar('filter[published]', '1');
     $api_url->setvar('extend', '0');
     $api_url->setvar('order', $orderCol);
     $api_url->setvar('dir', $orderDirn);
     if ($search) {
         $api_url->setvar('searchall', urlencode($search));
     }
     $extensions_json = $cache->call(array($http, 'get'), $api_url);
     $items = json_decode($extensions_json->body);
     $items = $items->data;
     // Populate array
     $extensions = array(0 => array(), 1 => array());
     foreach ($items as $item) {
         $item->image = $this->getBaseModel()->getMainImageUrl($item);
         if ($search) {
             $extensions[1 - $item->foundintitle][] = $item;
         } else {
             $extensions[0][] = $item;
         }
     }
     return array_merge($extensions[0], $extensions[1]);
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:53,代码来源:dashboard.php

示例2: getExtension

 public function getExtension()
 {
     // Get extension id
     $cache = JFactory::getCache();
     $cache->setCaching(1);
     $http = new JHttp();
     $http->setOption('timeout', 60);
     $api_url = new JUri();
     $input = new JInput();
     $id = $input->get('id', null, 'int');
     $release = preg_replace('/[^\\d]/', '', base64_decode($input->get('release', '', 'base64')));
     $release = intval($release / 5) * 5;
     $api_url->setScheme('http');
     $api_url->setHost('extensions.joomla.org/index.php');
     $api_url->setvar('option', 'com_jed');
     $api_url->setvar('controller', 'filter');
     $api_url->setvar('view', 'extension');
     $api_url->setvar('format', 'json');
     $api_url->setvar('filter[approved]', '1');
     $api_url->setvar('filter[published]', '1');
     $api_url->setvar('extend', '0');
     $api_url->setvar('filter[id]', $id);
     $extension_json = $cache->call(array($http, 'get'), $api_url);
     // Create item
     $items = json_decode($extension_json->body);
     $item = $items->data[0];
     $this->_catid = $item->core_catid->value;
     $item->image = $this->getBaseModel()->getMainImageUrl($item);
     $item->downloadurl = $item->download_integration_url->value;
     if (preg_match('/\\.xml\\s*$/', $item->downloadurl)) {
         $app = JFactory::getApplication();
         $product = addslashes(base64_decode($app->input->get('product', '', 'base64')));
         $release = preg_replace('/[^\\d\\.]/', '', base64_decode($app->input->get('release', '', 'base64')));
         $dev_level = (int) base64_decode($app->input->get('dev_level', '', 'base64'));
         $updatefile = JPATH_ROOT . '/libraries/joomla/updater/update.php';
         $fh = fopen($updatefile, 'r');
         $theData = fread($fh, filesize($updatefile));
         fclose($fh);
         $theData = str_replace('<?php', '', $theData);
         $theData = str_replace('$ver->PRODUCT', "'" . $product . "'", $theData);
         $theData = str_replace('$ver->RELEASE', "'" . $release . "'", $theData);
         $theData = str_replace('$ver->DEV_LEVEL', "'" . $dev_level . "'", $theData);
         eval($theData);
         $update = new JUpdate();
         $update->loadFromXML($item->downloadurl);
         $package_url_node = $update->get('downloadurl', false);
         if (isset($package_url_node->_data)) {
             $item->downloadurl = $package_url_node->_data;
         }
     }
     $item->download_type = $this->getTypeEnum($item->download_integration_type->value);
     return array($item);
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:53,代码来源:extension.php


注:本文中的JUri::setvar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。