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


PHP tao_helpers_File::getRelPath方法代码示例

本文整理汇总了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));
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:11,代码来源:FileHelperTest.php

示例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);
     }
 }
开发者ID:oat-sa,项目名称:extension-tao-devtools,代码行数:24,代码来源:ExtensionCreator.php


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