本文整理汇总了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;
}