當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。