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


PHP JURI::hasVar方法代码示例

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


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

示例1: ajaxGetRender

 /**
  *
  * Ajax render to store in session
  */
 public function ajaxGetRender()
 {
     /** load libraries for the system rener **/
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     /** get url **/
     $render_url = JRequest::getVar('render_url', '');
     $urlRender = base64_decode($render_url);
     $session = JSession::getInstance('files', array('name' => 'jsnpoweradmin'));
     if ($render_url == '') {
         $urlRender = JSNDatabase::getDefaultPage()->link;
     }
     $currUri = new JURI($urlRender);
     if (!$currUri->hasVar('Itemid')) {
         $currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id);
     }
     $urlString = $currUri->toString();
     $session->set('rawmode_render_url', base64_encode($urlString));
     $parts = JString::parse_url($urlString);
     if (!empty($parts['query'])) {
         parse_str($parts['query'], $params);
     } else {
         $params = array();
     }
     $jsntemplate = JSNFactory::getTemplate();
     $jsnrawmode = JSNRawmode::getInstance($params);
     $jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions());
     $jsnrawmode->renderAll();
     $session = JSession::getInstance('files', array('name' => 'jsnajaxgetrender'));
     $session->set('component', $jsnrawmode->getHTML('component'));
     $session->set('jsondata', $jsnrawmode->getScript('positions', 'JSON'));
     jexit('success');
 }
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:37,代码来源:rawmode.php

示例2: testHasVar

	public function testHasVar() {
		$this->object->parse('http://someuser:somepass@www.example.com:80/path/file.html?var=value#fragment');

		$this->assertThat(
			$this->object->hasVar('somevar'),
			$this->equalTo(false)
		);

		$this->assertThat(
			$this->object->hasVar('var'),
			$this->equalTo(true)
		);
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:13,代码来源:JURITest.php

示例3: display

 /**
  * Display function
  */
 public function display($tpl = null)
 {
     if (function_exists('error_reporting')) {
         error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT);
     }
     /** load libraries for the system rener **/
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     /** Assignment variables **/
     $jsntemplate = JSNFactory::getTemplate();
     $jsnmenuitems = JSNMenuitems::getInstance();
     /** get url **/
     $render_url = JRequest::getVar('render_url', '');
     $session = JSession::getInstance('files', array('name' => 'jsnpoweradmin'));
     if ($render_url == '' && $session->get('rawmode_render_url')) {
         $render_url = $session->get('rawmode_render_url');
     }
     $urlRender = base64_decode($render_url);
     if ($render_url == '') {
         $urlRender = JSNDatabase::getDefaultPage()->link;
     }
     $currUri = new JURI($urlRender);
     if (!$currUri->hasVar('Itemid')) {
         $currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id);
     }
     $urlString = $currUri->toString();
     $session->set('rawmode_render_url', base64_encode($urlString));
     $parts = JString::parse_url($urlString);
     if (!empty($parts['query'])) {
         parse_str($parts['query'], $params);
     } else {
         $params = array();
     }
     $jsnrawmode = JSNRawmode::getInstance($params);
     $jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions());
     $jsnrawmode->renderAll();
     $this->assign('component', $jsnrawmode->getHTML('component'));
     $this->assign('modules', $jsnrawmode->getHTML('positions'));
     $this->assign('jsnmenuitems', $jsnmenuitems);
     $this->assign('urlRender', $urlRender);
     /** add toolbar buttons **/
     $this->addToolBar();
     /** add scripts and css **/
     //$this->addMedia( $currUri->getVar('Itemid'), $urlString, array());//$jsnrawmode->getScript('positions', 'Array'));
     $this->addMedia($currUri->getVar('Itemid'), $urlString, $jsnrawmode->getScript('positions', 'Array'));
     return parent::display();
 }
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:50,代码来源:view.html.php

示例4: JURI

 static function _($url, $xhtml = false, $ssl = null, $d = false)
 {
     // skip any external urls
     if (strpos($url, "option") !== false && strpos($url, "option=com_fss") === false) {
         return JRoute::_($url, $xhtml, $ssl);
     }
     global $FSSRoute_debug;
     global $FSSRoute_menus;
     global $FSSRoute_access;
     self::$d = $d;
     // get any menu items for fss
     FSS_Helper::GetRouteMenus();
     // Get the router
     $router = JFactory::getApplication()->getRouter();
     // if the url dont start with index.php, we need to add the exisitng url to what we want
     if (substr($url, 0, 9) != "index.php") {
         //echo "Making FUll URL: $url<br>";
         $url = self::_fullURL($router, $url);
         //echo "Resut : $url<br>";
     }
     $uri = new JURI($url);
     // work out is we are in an Itemid already, if so, set it as the best match
     if ($uri->hasVar('Itemid')) {
         $bestmatch = $uri->getVar('Itemid');
     } else {
         $bestmatch = '';
     }
     $bestcount = 0;
     $uriquery = $uri->toString(array('query'));
     $urivars = FSSRoute::SplitURL($uriquery);
     $sourcevars = FSSRoute::SplitURL($url);
     // check through the menu item for the current url, and add any items to the new url that are missing
     if ($bestmatch && array_key_exists($bestmatch, $FSSRoute_menus)) {
         foreach ($FSSRoute_menus[$bestmatch] as $key => $value) {
             if (!array_key_exists($key, $urivars) && !array_key_exists($key, $sourcevars)) {
                 $urivars[$key] = $value;
             }
         }
     }
     $current_access = 0;
     if (array_key_exists(FSS_Input::getInt('Itemid'), $FSSRoute_access)) {
         $current_access = $FSSRoute_access[FSS_Input::getInt('Itemid')];
     }
     if ($d) {
         echo "Incoming Link : {$url}<br>";
         echo "Cur Item ID : " . FSS_Input::getInt('Itemid') . "<br>";
         //print_p($FSSRoute_menus);
     }
     foreach ($FSSRoute_menus as $id => $vars) {
         if ($d) {
             echo "{$id} => <Br>";
             print_p($vars);
         }
         // need to check if the access level is the same
         if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
             if ($d) {
                 echo "No Access<br>";
             }
             continue;
         }
         $count = FSSRoute::MatchVars($urivars, $vars);
         if (FSS_Input::getInt('Itemid') == $id && $count > 0) {
             if ($d) {
                 echo "Current ItemId: increase count<br>";
             }
             $count++;
         }
         if ($d) {
             echo "Count: {$count}<br>";
         }
         if ($count > $bestcount) {
             if ($d) {
                 echo "New best match - {$id}<br>";
             }
             $bestcount = $count;
             $bestmatch = $id;
         }
     }
     if ($bestcount == 0 && array_key_exists('view', $sourcevars) && substr($sourcevars['view'], 0, 6) == "admin_") {
         foreach ($FSSRoute_menus as $id => $item) {
             // need to check if the access level is the same
             if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
                 continue;
             }
             if ($item['view'] == "admin") {
                 $bestcount = 1;
                 $bestmatch = $id;
             }
         }
     }
     // no match found, try to fallback on the main support menu id
     if ($bestcount == 0) {
         foreach ($FSSRoute_menus as $id => $item) {
             // need to check if the access level is the same
             if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
                 continue;
             }
             if ($item['view'] == "main") {
                 $bestcount = 1;
                 $bestmatch = $id;
//.........这里部分代码省略.........
开发者ID:vstorm83,项目名称:propertease,代码行数:101,代码来源:route.php

示例5: curlResponse

 /**
  * Using CURL get page source.
  *
  * @param   string  $url  Link to get content
  *
  * @return  string
  */
 protected static function curlResponse($url)
 {
     $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => true, CURLOPT_USERAGENT => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10, CURLOPT_SSL_VERIFYPEER => false);
     $ch = curl_init($url);
     curl_setopt_array($ch, $options);
     $contents = curl_exec($ch);
     $err = curl_errno($ch);
     $errmsg = curl_error($ch);
     $header = curl_getinfo($ch);
     curl_close($ch);
     if ($err > 0) {
         exit('cUrl error number: ' . $err);
     }
     $response = new stdClass();
     $response->contents = $contents;
     $response->redirect_url = $header['redirect_url'];
     if ($response->redirect_url != self::$_renderUrl and trim($response->redirect_url) != '') {
         $old_uri = new JURI(self::$_renderUrl);
         $redirect_uri = new JURI($response->redirect_url);
         if ($old_uri->hasVar('tp') and !$redirect_uri->hasVar('tp')) {
             $redirect_uri->setVar('tp', 1);
         }
         if ($old_uri->hasVar('jsntpl_position') and !$redirect_uri->hasVar('jsntpl_position')) {
             $redirect_uri->setVar('jsntpl_position', 1);
         }
         if ($old_uri->hasVar('secret_key') and !$redirect_uri->hasVar('secret_key')) {
             $config = JFactory::getConfig();
             $secret = $config->get('secret');
             $redirect_uri->setVar('secret_key', md5($secret));
         }
         if ($old_uri->hasVar('Itemid') and !$redirect_uri->hasVar('Itemid')) {
             $redirect_uri->setVar('Itemid', $old_uri->getVar('Itemid'));
         }
         // Save redirect url
         self::$_renderUrl = $redirect_uri->toString();
         $response = self::curlResponse(self::$_renderUrl);
     }
     return $response;
 }
开发者ID:akilajwasala,项目名称:BuffetCorner,代码行数:46,代码来源:positionrender.php

示例6: setRenderUrl

 /**
  * Set URL for get front-end content. Correct URL
  *
  * @param   string  $url  Link
  *
  * @return  void
  */
 public function setRenderUrl($url = '')
 {
     $uri = new JURI($url);
     if ($uri->getScheme() == '') {
         $scheme = 'http';
         if (@$_SERVER['HTTPS']) {
             $scheme = 'https';
         }
         $uri->setScheme($scheme);
     }
     @(list($host, $port) = explode(':', $_SERVER['HTTP_HOST']));
     if ($uri->getHost() == '') {
         $uri->setHost($host);
     }
     if ($uri->getPort() == '') {
         $uri->setPort($port);
     }
     if (JString::strtolower($uri->getHost()) != JString::strtolower($host)) {
         $this->_isExternal = true;
     } else {
         if (!$uri->hasVar('poweradmin')) {
             $uri->setVar('poweradmin', '1');
         }
         if ($uri->hasVar('Itemid') and $uri->getVar('Itemid') == '') {
             $uri->delVar('Itemid');
         }
         $this->_renderUrl = $uri->toString();
     }
 }
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:36,代码来源:render.php


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