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


PHP Director::is_absolute方法代码示例

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


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

示例1: testIsAbsolute

 /**
  * Tests that {@link Director::is_absolute()} works under different environment types
  */
 public function testIsAbsolute()
 {
     $expected = array('C:/something' => true, 'd:\\' => true, 'e/' => false, 's:/directory' => true, '/var/www' => true, '\\Something' => true, 'something/c:' => false, 'folder' => false, 'a/c:/' => false);
     foreach ($expected as $path => $result) {
         $this->assertEquals(Director::is_absolute($path), $result, "Test result for {$path}");
     }
 }
开发者ID:normann,项目名称:sapphire,代码行数:10,代码来源:DirectorTest.php

示例2: requireDefaultRecords

 /**
  * Adds the default languages if they are missing
  */
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $defaultLangs = array_keys($this->defaultLanguages);
     $dbLangCount = SnippetLanguage::get()->filter('Name', $defaultLangs)->filter('UserLanguage', 0)->Count();
     if ($dbLangCount < count($defaultLangs)) {
         foreach ($this->defaultLanguages as $name => $data) {
             if (!SnippetLanguage::get()->find('Name', $name)) {
                 $lang = new SnippetLanguage();
                 $lang->Name = $name;
                 $lang->FileExtension = $data['Extension'];
                 $lang->HighlightCode = $data['HighlightCode'];
                 $lang->UserLanguage = false;
                 $lang->write();
                 DB::alteration_message('Created snippet language "' . $name . '"', 'created');
             }
         }
     }
     //Look for config languages
     $configLanguages = CodeBank::config()->extra_languages;
     if (!empty($configLanguages)) {
         foreach ($configLanguages as $language) {
             //Validate languages
             if (empty($language['Name']) || empty($language['FileName']) || empty($language['HighlightCode']) || empty($language['Brush'])) {
                 user_error('Invalid snippet user language found in config, user languages defined in config must contain a Name, FileName, HighlightCode and Brush file path', E_USER_WARNING);
                 continue;
             }
             $lang = SnippetLanguage::get()->filter('Name', Convert::raw2sql($language['Name']))->filter('HighlightCode', Convert::raw2sql($language['HighlightCode']))->filter('UserLanguage', true)->first();
             if (empty($lang) || $lang === false || $lang->ID <= 0) {
                 if (Director::is_absolute($language['Brush']) || Director::is_absolute_url($language['Brush'])) {
                     user_error('Invalid snippet user language found in config, user languages defined in config must contain a path to the brush relative to the SilverStripe base (' . Director::baseFolder() . ')', E_USER_WARNING);
                     continue;
                 }
                 if (preg_match('/\\.js$/', $language['Brush']) == 0) {
                     user_error('Invalid snippet user language found in config, user languages defined in config must be javascript files', E_USER_WARNING);
                     continue;
                 }
                 //Add language
                 $lang = new SnippetLanguage();
                 $lang->Name = $language['Name'];
                 $lang->FileExtension = $language['FileName'];
                 $lang->HighlightCode = $language['HighlightCode'];
                 $lang->BrushFile = $language['Brush'];
                 $lang->UserLanguage = true;
                 $lang->write();
                 DB::alteration_message('Created snippet user language "' . $language['Name'] . '"', 'created');
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-codebank,代码行数:53,代码来源:SnippetLanguage.php

示例3: __construct

	/**
	 * @param String Absolute file path, or relative path to {@link Director::baseFolder()}
	 */
	function __construct($fixtureFile) {
		if(!Director::is_absolute($fixtureFile)) $fixtureFile = Director::baseFolder().'/'. $fixtureFile;
		
		if(!file_exists($fixtureFile)) {
			throw new InvalidArgumentException('YamlFixture::__construct(): Fixture path "' . $fixtureFile . '" not found');
		}
		
		$this->fixtureFile = $fixtureFile;
		
		parent::__construct();
	}
开发者ID:redema,项目名称:sapphire,代码行数:14,代码来源:YamlFixture.php

示例4: __construct

 /**
  * @param String Absolute file path, or relative path to {@link Director::baseFolder()}
  */
 public function __construct($fixture)
 {
     if (false !== strpos($fixture, "\n")) {
         $this->fixtureString = $fixture;
     } else {
         if (!Director::is_absolute($fixture)) {
             $fixture = Director::baseFolder() . '/' . $fixture;
         }
         if (!file_exists($fixture)) {
             throw new InvalidArgumentException('YamlFixture::__construct(): Fixture path "' . $fixture . '" not found');
         }
         $this->fixtureFile = $fixture;
     }
     parent::__construct();
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:18,代码来源:YamlFixture.php

示例5: getDatabaseTemplates

 /**
  * Get all *.sql database files located in a specific path,
  * keyed by their file name.
  *
  * @param  String $path Absolute folder path
  * @return array
  */
 protected function getDatabaseTemplates($path = null)
 {
     $templates = array();
     if (!$path) {
         $path = $this->config()->database_templates_path;
     }
     // TODO Remove once we can set BASE_PATH through the config layer
     if ($path && !Director::is_absolute($path)) {
         $path = BASE_PATH . '/' . $path;
     }
     if ($path && file_exists($path)) {
         $it = new FilesystemIterator($path);
         foreach ($it as $fileinfo) {
             if ($fileinfo->getExtension() != 'sql') {
                 continue;
             }
             $templates[$fileinfo->getRealPath()] = $fileinfo->getFilename();
         }
     }
     return $templates;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-testsession,代码行数:28,代码来源:TestSessionController.php


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