本文整理匯總了PHP中Site::getPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Site::getPath方法的具體用法?PHP Site::getPath怎麽用?PHP Site::getPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Site
的用法示例。
在下文中一共展示了Site::getPath方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPath
/**
* Returns the full path to the views directory being used. This will change based on the
* current site directory or if another module modifies the path via View::setPath.
*
* @return string Full path to current views directory
*/
public static function getPath()
{
if (is_null(self::$_path)) {
self::$_path = Site::getPath() . Config::get('view.dir');
}
return self::$_path;
}
示例2: testSetPath
/**
* @covers Site::setPath
*/
public function testSetPath()
{
$site = new Site();
$path = 'TestPath/$1';
$site->setPath('foo', $path);
$this->assertEquals($path, $site->getPath('foo'));
}
示例3: testSetAndRemovePath
/**
* @dataProvider instanceProvider
* @param Site $site
*/
public function testSetAndRemovePath(Site $site)
{
$count = count($site->getAllPaths());
$site->setPath('spam', 'http://www.wikidata.org/$1');
$site->setPath('spam', 'http://www.wikidata.org/foo/$1');
$site->setPath('foobar', 'http://www.wikidata.org/bar/$1');
$this->assertEquals($count + 2, count($site->getAllPaths()));
$this->assertInternalType('string', $site->getPath('foobar'));
$this->assertEquals('http://www.wikidata.org/foo/$1', $site->getPath('spam'));
$site->removePath('spam');
$site->removePath('foobar');
$this->assertEquals($count, count($site->getAllPaths()));
$this->assertFalse($site->getPath('foobar'));
$this->assertFalse($site->getPath('spam'));
}
示例4: getModulePaths
/**
* Returns an array of paths to be searched for modules. This also determines where
* modules are loaded from.
*/
public static function getModulePaths()
{
if (!self::$_modulePaths) {
self::$_modulePaths = array(ROOT . 'modules/', ROOT . 'core/');
$sitePath = Site::getPath() . 'modules/';
if (file_exists($sitePath)) {
array_unshift(self::$_modulePaths, $sitePath);
}
}
return self::$_modulePaths;
}