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


PHP JUri::getPath方法代码示例

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


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

示例1: testSetPath

 /**
  * Test the setPath method.
  *
  * @return  void
  *
  * @since   11.1
  * @covers  JUri::setPath
  */
 public function testSetPath()
 {
     $this->object->setPath('/this/is/a/path/to/a/file.htm');
     $this->assertThat($this->object->getPath(), $this->equalTo('/this/is/a/path/to/a/file.htm'));
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:13,代码来源:JURITest.php

示例2: isUserOperation

 /**
  * isUserOperation
  *
  * @param \JUri $uri
  *
  * @return  boolean
  */
 public function isUserOperation(\JUri $uri)
 {
     $path = $uri->getPath();
     $root = \JUri::root(true);
     $route = substr($path, strlen($root));
     return strpos($route, '/api/user') === 0;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:14,代码来源:ApiServer.php

示例3: _buildSefRoute

 /**
  * Function to build a sef route
  *
  * @param   JUri  $uri  The uri
  *
  * @return  void
  */
 protected function _buildSefRoute($uri)
 {
     // Get the route
     $route = $uri->getPath();
     // Get the query data
     $query = $uri->getQuery(true);
     if (!isset($query['option'])) {
         return;
     }
     $app = JApplication::getInstance('site');
     $menu = $app->getMenu();
     /*
      * Build the component route
      */
     $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $query['option']);
     $tmp = '';
     $itemID = !empty($query['Itemid']) ? $query['Itemid'] : null;
     // Use the component routing handler if it exists
     $path = JPATH_SITE . '/components/' . $component . '/router.php';
     // Use the custom routing handler if it exists
     if (file_exists($path) && !empty($query)) {
         require_once $path;
         $function = substr($component, 4) . 'BuildRoute';
         $function = str_replace(array("-", "."), "", $function);
         $parts = $function($query);
         // Encode the route segments
         if ($component != 'com_search') {
             // Cheep fix on searches
             $parts = $this->_encodeSegments($parts);
         } else {
             // Fix up search for URL
             $total = count($parts);
             for ($i = 0; $i < $total; $i++) {
                 // Urlencode twice because it is decoded once after redirect
                 $parts[$i] = urlencode(urlencode(stripcslashes($parts[$i])));
             }
         }
         $result = implode('/', $parts);
         $tmp = $result != "" ? $result : '';
     }
     /*
      * Build the application route
      */
     $built = false;
     if (!empty($query['Itemid'])) {
         $item = $menu->getItem($query['Itemid']);
         if (is_object($item) && $query['option'] == $item->component) {
             if (!$item->home || $item->language != '*') {
                 $tmp = !empty($tmp) ? $item->route . '/' . $tmp : $item->route;
             }
             $built = true;
         }
     }
     if (empty($query['Itemid']) && !empty($itemID)) {
         $query['Itemid'] = $itemID;
     }
     if (!$built) {
         $tmp = 'component/' . substr($query['option'], 4) . '/' . $tmp;
     }
     if ($tmp) {
         $route .= '/' . $tmp;
     } elseif ($route == 'index.php') {
         $route = '';
     }
     // Unset unneeded query information
     if (isset($item) && $query['option'] == $item->component) {
         unset($query['Itemid']);
     }
     unset($query['option']);
     // Set query again in the URI
     $uri->setQuery($query);
     $uri->setPath($route);
 }
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:80,代码来源:site.php

示例4: getCurrentURI

 /**
  * Generate a URI based on current URL.
  *
  * @param JUri $url
  *
  * @return string
  */
 private function getCurrentURI(JUri $url)
 {
     $uri = $url->getPath();
     if ($url->getQuery()) {
         $uri .= "?" . $url->getQuery();
     }
     return $uri;
 }
开发者ID:emeraldstudio,项目名称:somosmaestros,代码行数:15,代码来源:itpsocialbuttons.php

示例5: testBuildBase

 /**
  * Tests the buildBase() method
  *
  * @return  void
  *
  * @since   4.0
  */
 public function testBuildBase()
 {
     $server = array('HTTP_HOST' => 'www.example.com:80', 'SCRIPT_NAME' => '/joomla/index.php', 'PHP_SELF' => '/joomla/index.php', 'REQUEST_URI' => '/joomla/index.php?var=value 10');
     $_SERVER = array_merge($_SERVER, $server);
     $uri = new JUri('index.php');
     $this->assertEquals('index.php', $uri->getPath());
     $this->object->buildBase($this->object, $uri);
     $this->assertEquals(JUri::base(true) . '/' . 'index.php', $uri->getPath());
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:16,代码来源:JRouterSiteTest.php

示例6: parseRule

 /**
  * Parse rule hook.
  *
  * @param \JRouter $router The router object.
  * @param \JUri    $uri    The uri object.
  *
  * @return  array
  *
  * @throws \InvalidArgumentException
  */
 public function parseRule(\JRouter $router, \JUri $uri)
 {
     $path = $uri->getPath();
     // No path & method, return 404.
     if ($this->isRoot($uri)) {
         throw new \InvalidArgumentException('No method.', 404);
     }
     // Direct our URI to component
     $path = 'component/' . $this->component . '/' . $path;
     $uri->setPath($path);
     $uri->setVar('format', 'json');
     return array();
 }
开发者ID:Biromain,项目名称:windwalker-joomla-rad,代码行数:23,代码来源:ApiServer.php

示例7: pathAddHost

 /**
  * Give a relative path, return path with host.
  *
  * @param   string $path A system path.
  *
  * @return  string  Path with host added.
  */
 public static function pathAddHost($path)
 {
     if (!$path) {
         return '';
     }
     // Build path
     $uri = new \JUri($path);
     if ($uri->getHost()) {
         return $path;
     }
     $uri->parse(\JUri::root());
     $root_path = $uri->getPath();
     if (strpos($path, $root_path) === 0) {
         $num = Utf8String::strlen($root_path);
         $path = Utf8String::substr($path, $num);
     }
     $uri->setPath($uri->getPath() . $path);
     $uri->setScheme('http');
     $uri->setQuery(null);
     return $uri->toString();
 }
开发者ID:Biromain,项目名称:windwalker-joomla-rad,代码行数:28,代码来源:UriHelper.php


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