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


PHP Router::fullBaseUrl方法代码示例

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


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

示例1: tearDown

 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->Table, $this->Behavior, $this->Email);
     Router::fullBaseUrl($this->fullBaseBackup);
     Email::dropTransport('test');
     parent::tearDown();
 }
开发者ID:drmonkeyninja,项目名称:users,代码行数:12,代码来源:SocialAccountBehaviorTest.php

示例2: assetUrl

 /**
  * Generate URL for given asset file. Depending on options passed provides full URL with domain name.
  * Also calls Helper::assetTimestamp() to add timestamp to local files
  *
  * @param string|array $path Path string or URL array
  * @param array $options Options array. Possible keys:
  *   `fullBase` Return full URL with domain name
  *   `pathPrefix` Path prefix for relative URLs
  *   `ext` Asset extension to append
  *   `plugin` False value will prevent parsing path as a plugin
  * @return string Generated URL
  */
 public function assetUrl($path, array $options = [])
 {
     if (is_array($path)) {
         return $this->build($path, !empty($options['fullBase']));
     }
     if (strpos($path, '://') !== false) {
         return $path;
     }
     if (!array_key_exists('plugin', $options) || $options['plugin'] !== false) {
         list($plugin, $path) = $this->_View->pluginSplit($path, false);
     }
     if (!empty($options['pathPrefix']) && $path[0] !== '/') {
         $path = $options['pathPrefix'] . $path;
     }
     if (!empty($options['ext']) && strpos($path, '?') === false && substr($path, -strlen($options['ext'])) !== $options['ext']) {
         $path .= $options['ext'];
     }
     if (preg_match('|^([a-z0-9]+:)?//|', $path)) {
         return $path;
     }
     if (isset($plugin)) {
         $path = Inflector::underscore($plugin) . '/' . $path;
     }
     $path = $this->_encodeUrl($this->assetTimestamp($this->webroot($path)));
     if (!empty($options['fullBase'])) {
         $path = rtrim(Router::fullBaseUrl(), '/') . '/' . ltrim($path, '/');
     }
     return $path;
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:41,代码来源:UrlHelper.php

示例3: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->Users);
     Router::fullBaseUrl($this->fullBaseBackup);
     Email::drop('default');
     Email::dropTransport('test');
     Email::config('default', $this->configEmail);
     parent::tearDown();
 }
开发者ID:drmonkeyninja,项目名称:users,代码行数:14,代码来源:UsersTableTest.php

示例4: setUp

 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->EmailSender = $this->getMockBuilder('CakeDC\\Users\\Email\\EmailSender')->setMethods(['_getEmailInstance', 'getMailer'])->getMock();
     $this->UserMailer = $this->getMockBuilder('CakeDC\\Users\\Mailer\\UserMailer')->setMethods(['send'])->getMock();
     $this->fullBaseBackup = Router::fullBaseUrl();
     Router::fullBaseUrl('http://users.test');
     Email::configTransport('test', ['className' => 'Debug']);
 }
开发者ID:OrigamiStructures,项目名称:users,代码行数:14,代码来源:EmailSenderTest.php

示例5: _getList

 /**
  * Replace array keys in macros key.
  *
  * @param array $list
  * @return array
  */
 protected function _getList(array $list = [])
 {
     $result = [];
     $list['base_url'] = Router::fullBaseUrl();
     foreach ($list as $key => $value) {
         $key = '{' . $key . '}';
         $result[$key] = $value;
     }
     return $result;
 }
开发者ID:Cheren,项目名称:union,代码行数:16,代码来源:Macros.php

示例6: testSetGet

 /**
  * @return void
  */
 public function testSetGet()
 {
     $macros = new Macros();
     $this->assertSame(['base_url' => Router::fullBaseUrl()], $macros->get());
     $macros->set('test_1', 'Test 1')->set('test_2', 'Test 2')->set('test_3', 'Test 3');
     $this->assertSame(['test_3' => 'Test 3', 'test_2' => 'Test 2', 'test_1' => 'Test 1', 'base_url' => Router::fullBaseUrl()], $macros->get());
     $this->assertSame('Test 3', $macros->get('test_3'));
     $entity = new Entity(['status' => 'Publish']);
     $macros = new Macros($entity);
     $this->assertSame(['base_url' => 'http://localhost', 'status' => 'Publish'], $macros->get());
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:14,代码来源:MacrosTest.php

示例7: afterForgot

 public function afterForgot($event, $user)
 {
     $email = new Email('default');
     $email->viewVars(['user' => $user, 'resetUrl' => Router::fullBaseUrl() . Router::url(['prefix' => false, 'plugin' => 'Users', 'controller' => 'Users', 'action' => 'reset', $user['email'], $user['request_key']]), 'baseUrl' => Router::fullBaseUrl(), 'loginUrl' => Router::fullBaseUrl() . '/login']);
     $email->from(Configure::read('Users.email.from'));
     $email->subject(Configure::read('Users.email.afterForgot.subject'));
     $email->emailFormat('both');
     $email->transport(Configure::read('Users.email.transport'));
     $email->template('Users.afterForgot', 'Users.default');
     $email->to($user['email']);
     $email->send();
 }
开发者ID:hareshpatel1990,项目名称:cakephp-users,代码行数:12,代码来源:UsersMailer.php

示例8: read

 public function read($path)
 {
     $dir = new Folder($path);
     $read = $dir->read();
     $result = [];
     foreach ($read[0] as $folder) {
         $info = new Folder($path . DS . $folder);
         $reference = Router::fullBaseUrl() . '/' . $this->toRelative($path . '/' . $folder);
         $data = ['name' => $folder, 'type' => 'folder', 'path' => $path . DS . $folder, 'reference' => $reference, 'extension' => 'folder', 'size' => $info->dirsize()];
         $result[] = $data;
     }
     foreach ($read[1] as $file) {
         $info = new File($path . DS . $file, false);
         $reference = Router::fullBaseUrl() . '/' . $this->toRelative($path . '/' . $file);
         $data = ['name' => $info->info()['basename'], 'type' => 'file', 'path' => $path, 'reference' => $reference, 'extension' => $info->info()['extension'], 'size' => $info->info()['filesize']];
         $result[] = $data;
     }
     return $result;
 }
开发者ID:cakemanager,项目名称:cakeadmin-filemanager,代码行数:19,代码来源:FileManagerComponent.php

示例9: getUser

 /**
  * {@inheritDoc}
  */
 public function getUser(Request $request)
 {
     $auth = $request->header('Authorization');
     if (empty($auth) && function_exists('apache_request_headers')) {
         $headers = apache_request_headers();
         $auth = empty($headers['Authorization']) ? null : $headers['Authorization'];
     }
     if (empty($auth)) {
         return false;
     }
     if (strpos($auth, ' ') === false) {
         return false;
     }
     list($authType, $authString) = explode(' ', $auth, 2);
     $authParams = explode(',', $authString);
     if (count($authParams) < 3) {
         return false;
     }
     switch (strtolower($authType)) {
         case 'url-encoded-api-key':
             $postFields = ['messageDigest' => $authParams[1], 'timestamp' => $authParams[2], 'message' => Router::fullBaseUrl() . $request->here()];
             break;
         case 'nonce-encoded-api-key':
         case 'nonce-encoded-wssession-key':
             $postFields = ['nonceKey' => $authParams[1], 'messageDigest' => $authParams[2]];
             break;
         default:
             //unknown auth type
             return false;
     }
     $postFields['wsId'] = $authParams[0];
     $result = $this->client()->post("https://ws.byu.edu/authentication/services/rest/v1/provider/{$authType}/validate", $postFields);
     if (!$result || !$result->isOk()) {
         return false;
     }
     $response = json_decode($result->body(), true);
     if (empty($response['netId'])) {
         return false;
     }
     $response['username'] = $response['netId'];
     return $response;
 }
开发者ID:byu-oit-appdev,项目名称:byusa-clubs,代码行数:45,代码来源:ByuApiAuthenticate.php

示例10: assetUrl

 /**
  * Generates URL for given asset file.
  *
  * @param array|string $path
  * @param array $options
  * @return array|null|string
  */
 public function assetUrl($path, array $options = [])
 {
     if (is_array($path)) {
         return $this->build($path, !empty($options['fullBase']));
     }
     if (empty(FS::ext($path))) {
         $path .= '.' . $options['ext'];
     }
     $Path = $this->_View->getPath();
     $relative = $Path->isVirtual($path) ? $Path->get($path) : $Path->get('root:' . $path);
     if (strpos($path, '://') !== false) {
         return $path;
     }
     if ($relative !== null) {
         $path = $Path->url($this->_encodeUrl($this->assetTimestamp($relative)), false);
         if (!empty($options['fullBase'])) {
             $path = rtrim(Router::fullBaseUrl(), '/') . '/' . ltrim($path, '/');
         }
         return $path;
     }
     return null;
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:29,代码来源:UrlHelper.php

示例11: testImage

 /**
  * test image()
  *
  * @return void
  */
 public function testImage()
 {
     $result = $this->Helper->image('foo.jpg');
     $this->assertEquals('img/foo.jpg', $result);
     $result = $this->Helper->image('foo.jpg', ['fullBase' => true]);
     $this->assertEquals(Router::fullBaseUrl() . '/img/foo.jpg', $result);
     $result = $this->Helper->image('dir/sub dir/my image.jpg');
     $this->assertEquals('img/dir/sub%20dir/my%20image.jpg', $result);
     $result = $this->Helper->image('foo.jpg?one=two&three=four');
     $this->assertEquals('img/foo.jpg?one=two&amp;three=four', $result);
     $result = $this->Helper->image('dir/big+tall/image.jpg');
     $this->assertEquals('img/dir/big%2Btall/image.jpg', $result);
     $result = $this->Helper->image('cid:foo.jpg');
     $this->assertEquals('cid:foo.jpg', $result);
     $result = $this->Helper->image('CID:foo.jpg');
     $this->assertEquals('CID:foo.jpg', $result);
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:22,代码来源:UrlHelperTest.php

示例12: testAssetUrl

 /**
  * test assetUrl application
  *
  * @return void
  */
 public function testAssetUrl()
 {
     Router::connect('/:controller/:action/*');
     $this->Helper->webroot = '';
     $result = $this->Helper->assetUrl(array('controller' => 'js', 'action' => 'post', 'ext' => 'js'), array('fullBase' => true));
     $this->assertEquals(Router::fullBaseUrl() . '/js/post.js', $result);
     $result = $this->Helper->assetUrl('foo.jpg', array('pathPrefix' => 'img/'));
     $this->assertEquals('img/foo.jpg', $result);
     $result = $this->Helper->assetUrl('foo.jpg', array('fullBase' => true));
     $this->assertEquals(Router::fullBaseUrl() . '/foo.jpg', $result);
     $result = $this->Helper->assetUrl('style', array('ext' => '.css'));
     $this->assertEquals('style.css', $result);
     $result = $this->Helper->assetUrl('dir/sub dir/my image', array('ext' => '.jpg'));
     $this->assertEquals('dir/sub%20dir/my%20image.jpg', $result);
     $result = $this->Helper->assetUrl('foo.jpg?one=two&three=four');
     $this->assertEquals('foo.jpg?one=two&amp;three=four', $result);
     $result = $this->Helper->assetUrl('dir/big+tall/image', array('ext' => '.jpg'));
     $this->assertEquals('dir/big%2Btall/image.jpg', $result);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:24,代码来源:HelperTest.php

示例13: testSetCanonical

 /**
  * Set Canonical based on configuration array
  */
 public function testSetCanonical()
 {
     $expected = ['canonical' => Router::fullBaseUrl() . '/articles/view?slug=test-title-one', 'active' => true];
     $actual = $this->Articles->setCanonical($this->defaultEntity, '/articles/view?slug=test-title-one', $this->defaultConfig['urls'][0]);
     $this->assertEquals($expected, $actual);
     $actual = $this->Articles->setCanonical($this->defaultEntity, '/articles/view?slug=test-title-one', []);
     $this->assertFalse($actual);
 }
开发者ID:orgasmicnightmare,项目名称:cakephp-seo,代码行数:11,代码来源:SeoBehaviorTest.php

示例14: url

 /**
  * Get the URL for a given asset name.
  *
  * Takes an build filename, and returns the URL
  * to that build file.
  *
  * @param string $file The build file that you want a URL for.
  * @param bool|array $full Whether or not the URL should have the full base path.
  * @return string The generated URL.
  * @throws RuntimeException when the build file does not exist.
  */
 public function url($file = null, $full = false)
 {
     $collection = $this->collection();
     if (!$collection->contains($file)) {
         throw new RuntimeException('Cannot get URL for build file that does not exist.');
     }
     $options = $full;
     if (!is_array($full)) {
         $options = ['full' => $full];
     }
     $options += ['full' => false];
     $target = $collection->get($file);
     $type = $target->ext();
     $config = $this->assetConfig();
     $baseUrl = $config->get($type . '.baseUrl');
     $devMode = Configure::read('debug');
     // CDN routes.
     if ($baseUrl && !$devMode) {
         return $baseUrl . $this->_getBuildName($target);
     }
     $root = str_replace('\\', '/', WWW_ROOT);
     $path = str_replace('\\', '/', $target->outputDir());
     $path = str_replace($root, '/', $path);
     if (!$devMode) {
         $path = rtrim($path, '/') . '/';
         $route = $path . $this->_getBuildName($target);
     }
     if ($devMode || $config->general('alwaysEnableController')) {
         $route = $this->_getRoute($target, $path);
     }
     if (DS === '\\') {
         $route = str_replace(DS, '/', $route);
     }
     if ($options['full']) {
         $base = Router::fullBaseUrl();
         return $base . $route;
     }
     return $route;
 }
开发者ID:clthck,项目名称:asset-compress-improved,代码行数:50,代码来源:AssetCompressHelper.php

示例15: getUrl

 /**
  * Get the url for the given page.
  *
  * @param int $page
  *
  * @return string
  */
 public function getUrl($page)
 {
     $url = Router::parse(Router::url());
     $url['page'] = $page;
     return Router::fullBaseUrl() . Router::url($url);
 }
开发者ID:cakeplugins,项目名称:api,代码行数:13,代码来源:CakePaginatorAdapter.php


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