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


PHP Director::baseUrl方法代码示例

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


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

示例1: testGetTagWithoutTitleContainingDots

	function testGetTagWithoutTitleContainingDots() {
		$image = $this->objFromFixture('Image', 'imageWithoutTitleContainingDots');
		$expected = '<img src="' . Director::baseUrl() . 'assets/ImageTest/test.image.with.dots.png" alt="test.image.with.dots" />';
		$actual = $image->getTag();
		
		$this->assertEquals($expected, $actual);
	}
开发者ID:redema,项目名称:sapphire,代码行数:7,代码来源:ImageTest.php

示例2: testChangePasswordFromLostPassword

 public function testChangePasswordFromLostPassword()
 {
     $admin = $this->objFromFixture('Member', 'test');
     $admin->FailedLoginCount = 99;
     $admin->LockedOutUntil = SS_Datetime::now()->Format('Y-m-d H:i:s');
     $admin->write();
     $this->assertNull($admin->AutoLoginHash, 'Hash is empty before lost password');
     // Request new password by email
     $response = $this->get('Security/lostpassword');
     $response = $this->post('Security/LostPasswordForm', array('Email' => 'sam@silverstripe.com'));
     $this->assertEmailSent('sam@silverstripe.com');
     // Load password link from email
     $admin = DataObject::get_by_id('Member', $admin->ID);
     $this->assertNotNull($admin->AutoLoginHash, 'Hash has been written after lost password');
     // We don't have access to the token - generate a new token and hash pair.
     $token = $admin->generateAutologinTokenAndStoreHash();
     // Check.
     $response = $this->get('Security/changepassword/?m=' . $admin->ID . '&t=' . $token);
     $this->assertEquals(302, $response->getStatusCode());
     $this->assertEquals(Director::baseUrl() . 'Security/changepassword', $response->getHeader('Location'));
     // Follow redirection to form without hash in GET parameter
     $response = $this->get('Security/changepassword');
     $changedResponse = $this->doTestChangepasswordForm('1nitialPassword', 'changedPassword');
     $this->assertEquals($this->idFromFixture('Member', 'test'), $this->session()->inst_get('loggedInAs'));
     // Check if we can login with the new password
     $goodResponse = $this->doTestLoginForm('sam@silverstripe.com', 'changedPassword');
     $this->assertEquals(302, $goodResponse->getStatusCode());
     $this->assertEquals($this->idFromFixture('Member', 'test'), $this->session()->inst_get('loggedInAs'));
     $admin = DataObject::get_by_id('Member', $admin->ID, false);
     $this->assertNull($admin->LockedOutUntil);
     $this->assertEquals(0, $admin->FailedLoginCount);
 }
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:32,代码来源:SecurityTest.php

示例3: testChangePasswordFromLostPassword

 function testChangePasswordFromLostPassword()
 {
     $admin = $this->objFromFixture('Member', 'test');
     $this->assertNull($admin->AutoLoginHash, 'Hash is empty before lost password');
     // Request new password by email
     $response = $this->get('Security/lostpassword');
     $response = $this->submitForm('MemberLoginForm_LostPasswordForm', null, array('Email' => 'sam@silverstripe.com'));
     $this->assertEmailSent('sam@silverstripe.com');
     // Load password link from email
     $admin = DataObject::get_by_id('Member', $admin->ID);
     $this->assertNotNull($admin->AutoLoginHash, 'Hash has been written after lost password');
     $response = $this->get('Security/changepassword/?h=' . $admin->AutoLoginHash);
     $this->assertEquals(302, $response->getStatusCode());
     $this->assertEquals(Director::baseUrl() . 'Security/changepassword', $response->getHeader('Location'));
     // Follow redirection to form without hash in GET parameter
     $response = $this->get('Security/changepassword');
     $changedResponse = $this->doTestChangepasswordForm('1nitialPassword', 'changedPassword');
     $this->assertEquals($this->idFromFixture('Member', 'test'), $this->session()->inst_get('loggedInAs'));
     // Check if we can login with the new password
     $goodResponse = $this->doTestLoginForm('sam@silverstripe.com', 'changedPassword');
     $this->assertEquals(302, $goodResponse->getStatusCode());
     $this->assertEquals($this->idFromFixture('Member', 'test'), $this->session()->inst_get('loggedInAs'));
 }
开发者ID:eLBirador,项目名称:AllAboutCity,代码行数:23,代码来源:SecurityTest.php

示例4: testGetTagWithoutTitleContainingDots

 public function testGetTagWithoutTitleContainingDots()
 {
     Config::inst()->update('Image', 'force_resample', false);
     $image = $this->objFromFixture('Image', 'imageWithoutTitleContainingDots');
     $expected = '<img src="' . Director::baseUrl() . 'assets/ImageTest/test.image.with.dots.png" alt="test.image.with.dots" />';
     $actual = $image->getTag();
     $this->assertEquals($expected, $actual);
 }
开发者ID:nickbooties,项目名称:silverstripe-framework,代码行数:8,代码来源:ImageTest.php

示例5: buildFormAction

 /**
  * Builds and returns the form action to use.
  * 
  * @return string
  * 
  * @author Sebastian Diel <sdiel@pixeltricks.de>,
  *         Sascha Koehler <skoehler@pixeltricks.de>
  * @since 04.07.2013
  */
 protected function buildFormAction()
 {
     if (is_null($this->customHtmlFormAction)) {
         $formAction = Controller::join_links($this->getFormController($this->controller, $this->basePreferences)->Link(), $this->getSubmitAction());
     } else {
         $formAction = Director::baseUrl() . 'customhtmlformaction/' . $this->customHtmlFormAction;
     }
     return $formAction;
 }
开发者ID:silvercart,项目名称:customhtmlform,代码行数:18,代码来源:CustomHtmlForm.php

示例6: BaseUrl

 /**
  * Returns the base url.
  *
  * @return string
  *
  * @author Sascha Koehler <skoehler@pixeltricks.de>
  * @since 16.05.2012
  */
 public function BaseUrl()
 {
     return Director::baseUrl();
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:12,代码来源:SilvercartLeftAndMainExtension.php

示例7: Link

 public function Link($action = null)
 {
     return Controller::join_links(Director::baseUrl(), 'dev/testsession', $action);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-testsession,代码行数:4,代码来源:TestSessionController.php

示例8: getBaseURLSegment

 /**
  * Returns the base URL segment that's used for inclusion of css and
  * javascript files via Requirements.
  *
  * @return string
  *
  * @author Sascha Koehler <skoehler@pixeltricks.de>
  * @since 16.02.2012
  */
 public static function getBaseURLSegment()
 {
     if (is_null(self::$baseURLSegment)) {
         $baseUrl = Director::baseUrl();
         if ($baseUrl === '/') {
             $baseUrl = '';
         }
         if (!empty($baseUrl) && substr($baseUrl, -1) != '/') {
             $baseUrl .= '/';
         }
         self::$baseURLSegment = $baseUrl;
     }
     return self::$baseURLSegment;
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:23,代码来源:SilvercartTools.php


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