本文整理汇总了PHP中tao_helpers_File::getRelPath方法的典型用法代码示例。如果您正苦于以下问题:PHP tao_helpers_File::getRelPath方法的具体用法?PHP tao_helpers_File::getRelPath怎么用?PHP tao_helpers_File::getRelPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tao_helpers_File
的用法示例。
在下文中一共展示了tao_helpers_File::getRelPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRelPath
public function testRelPath()
{
$testDir = tao_helpers_File::createTempDir();
$this->assertTrue(mkdir($testDir . 'sub' . DIRECTORY_SEPARATOR));
$path = $testDir . 'sub';
$this->assertEquals('sub', \tao_helpers_File::getRelPath($testDir, $path));
$path = $testDir . 'sub' . DIRECTORY_SEPARATOR;
$this->assertEquals('..' . DIRECTORY_SEPARATOR, \tao_helpers_File::getRelPath($path, $testDir));
$this->assertTrue(tao_helpers_File::delTree($testDir));
$this->assertFalse(is_dir($testDir));
}
示例2: addSampleTheme
/**
* Adds sample code for theme support
*/
protected function addSampleTheme()
{
// replacements
$values = array('{themeLabel}' => $this->label . ' default theme', '{themeId}' => StringUtils::camelize($this->label . ' default theme'), '{platformTheme}' => StringUtils::camelize($this->label . ' default theme', true));
$pathValues = array();
foreach ($values as $key => $value) {
$pathValues[trim($key, '{}')] = $value;
}
// copy templates
$samplePath = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDevTools')->getDir() . 'models' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
$paths = array(array('model', 'theme', '*.sample'), array('scripts', 'install', '*.sample'), array('views', 'templates', 'themes', 'platform', 'themeId', '*.sample'), array('views', 'scss', 'themes', 'items', '*.sample'), array('views', 'scss', 'themes', 'platform', 'themeId', '*.sample'));
$templates = array();
foreach ($paths as $path) {
$templates = array_merge($templates, glob($samplePath . implode(DIRECTORY_SEPARATOR, $path)));
}
foreach ($templates as $template) {
$template = \tao_helpers_File::getRelPath($samplePath, $template);
$template = substr($template, 0, strrpos($template, '.'));
$this->copyFile($template, str_replace(array_keys($pathValues), $pathValues, $template), $values);
}
}