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


PHP sfToolkit::isPathAbsolute方法代码示例

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


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

示例1: execute

  /**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    $databaseManager = new sfDatabaseManager($this->configuration);

    $filename = $arguments['target'];
    if (null !== $filename && !sfToolkit::isPathAbsolute($filename))
    {
      $dir = sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'fixtures';
      $this->getFilesystem()->mkdirs($dir);
      $filename = $dir.DIRECTORY_SEPARATOR.$filename;

      $this->logSection('propel', sprintf('dumping data to "%s"', $filename));
    }

    $data = new sfPropelData();

    $classes = null === $options['classes'] ? 'all' : explode(',', $options['classes']);

    if (null !== $filename)
    {
      $data->dumpData($filename, $classes, $options['connection']);
    }
    else
    {
      fwrite(STDOUT, sfYaml::dump($data->getData($classes, $options['connection']), 3));
    }
  }
开发者ID:nurhidayatullah,项目名称:inventory,代码行数:30,代码来源:sfPropelDataDumpTask.class.php

示例2: run_alba_dump_data

/**
 * La funcion original en dist/symfony/data/tasks/sfPakePropel.php 
 * NO FUNCIONA
 * porque a la funcion dumpData() no se le pasan los parametros correctos 
 * 
 *
 * Dumps yml database data to fixtures directory.
 *
 * @example symfony dump-data frontend data.yml
 * @example symfony dump-data frontend data.yml dev
 *
 * @param object $task
 * @param array $args
 */
function run_alba_dump_data($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide the app.');
    }
    $app = $args[0];
    if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) {
        throw new Exception('The app "' . $app . '" does not exist.');
    }
    if (!isset($args[1])) {
        throw new Exception('You must provide a filename.');
    }
    $filename = $args[1];
    $env = empty($args[2]) ? 'dev' : $args[2];
    // define constants
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', $app);
    define('SF_ENVIRONMENT', $env);
    define('SF_DEBUG', true);
    // get configuration
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    if (!sfToolkit::isPathAbsolute($filename)) {
        $dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'fixtures';
        pake_mkdirs($dir);
        $filename = $dir . DIRECTORY_SEPARATOR . $filename;
    }
    pake_echo_action('propel', sprintf('dumping data to "%s"', $filename));
    $data = new sfPropelData();
    // FIX de parametros
    $data->dumpData($filename, 'all', 'alba');
}
开发者ID:mediasadc,项目名称:alba,代码行数:47,代码来源:alba.php

示例3: execute

  /**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    $databaseManager = new sfDatabaseManager($this->configuration);
    $config = $this->getCliConfig();

    $args = array(
      'data_fixtures_path' => $config['data_fixtures_path'][0],
    );

    if (!is_dir($args['data_fixtures_path']))
    {
      $this->getFilesystem()->mkdirs($args['data_fixtures_path']);
    }

    if ($arguments['target'])
    {
      $filename = $arguments['target'];

      if (!sfToolkit::isPathAbsolute($filename))
      {
        $filename = $args['data_fixtures_path'].'/'.$filename;
      }

      $this->getFilesystem()->mkdirs(dirname($filename));

      $args['data_fixtures_path'] = $filename;
    }

    $this->logSection('doctrine', sprintf('dumping data to fixtures to "%s"', $args['data_fixtures_path']));
    $this->callDoctrineCli('dump-data', $args);
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:34,代码来源:sfDoctrineDataDumpTask.class.php

示例4: replacePath

 /**
  * Replaces a relative filesystem path with an absolute one.
  *
  * @param string A relative filesystem path
  *
  * @return string The new path
  */
 public static function replacePath($path)
 {
     if (!sfToolkit::isPathAbsolute($path)) {
         // not an absolute path so we'll prepend to it
         $path = sfConfig::get('sf_app_dir') . '/' . $path;
     }
     return $path;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:15,代码来源:sfConfigHandler.class.php

示例5: setTemplate

 /**
  * Sets the template for this view.
  *
  * If the template path is relative, it will be based on the currently
  * executing module's template sub-directory.
  *
  * @param string $template  An absolute or relative filesystem path to a template
  */
 public function setTemplate($template)
 {
     if (sfToolkit::isPathAbsolute($template)) {
         print ">>>1";
         $this->directory = dirname($template);
         $this->template = basename($template);
     } else {
         print ">>>2";
         $this->directory = $this->context->getConfiguration()->getTemplateDir($this->moduleName, $template);
         $this->template = $template;
     }
 }
开发者ID:GustavoAdolfo,项目名称:cmais-frontend-2,代码行数:20,代码来源:myView.class.php

示例6: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $args = array();
     if (isset($arguments['target'])) {
         $filename = $arguments['target'];
         if (!sfToolkit::isPathAbsolute($filename)) {
             $dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'fixtures';
             $filename = $dir . DIRECTORY_SEPARATOR . $filename;
         }
         $args = array('data_fixtures_path' => $filename);
     }
     $this->callDoctrineCli('dump-data', $args);
 }
开发者ID:silky,项目名称:littlesis,代码行数:17,代码来源:sfDoctrineDataDumpTask.class.php

示例7: setSubversionProperty

 /**
  * Sets a Subversion property on a path.
  *
  * @param string       $property
  * @param string|array $value
  * @param string|array $path
  */
 protected function setSubversionProperty($property, $value, $path)
 {
     if (!is_array($value)) {
         $value = array($value);
     }
     if (!is_array($path)) {
         $path = array($path);
     }
     $file = tempnam(sys_get_temp_dir(), 'sf_');
     $this->logSection('file+', $file);
     file_put_contents($file, implode(PHP_EOL, $value));
     foreach ($path as $p) {
         $this->getFilesystem()->execute(vsprintf('%s propset %s -F %s %s', array($this->subversionBinary, $property, escapeshellarg($file), escapeshellarg(!sfToolkit::isPathAbsolute($p) ? sfConfig::get('sf_root_dir') . '/' . $p : $p))));
     }
     $this->getFilesystem()->remove($file);
 }
开发者ID:real-chocopanda,项目名称:sfTaskExtraPlugin,代码行数:23,代码来源:sfTaskExtraSubversionBaseTask.class.php

示例8: _findLayoutPath

 protected function _findLayoutPath($layout = null)
 {
     if ($layout === null) {
         $layout = $this->getName();
     }
     $sympalConfiguration = sfSympalContext::getInstance()->getSympalConfiguration();
     $layouts = $sympalConfiguration->getLayouts();
     $path = array_search($layout, $layouts);
     if (!$path) {
         throw new InvalidArgumentException(sprintf('Could not find layout path for theme "%s"', $layout));
     }
     if (!sfToolkit::isPathAbsolute($path)) {
         $path = sfConfig::get('sf_root_dir') . '/' . $path;
     }
     return $path;
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:16,代码来源:sfSympalThemeConfiguration.class.php

示例9: setSubversionProperty

 /**
  * Sets a Subversion property on a path.
  * 
  * @param string       $property
  * @param string|array $value
  * @param string|array $path
  */
 protected function setSubversionProperty($property, $value, $path)
 {
     if (!is_array($value)) {
         $value = array($value);
     }
     if (!is_array($path)) {
         $path = array($path);
     }
     $file = sys_get_temp_dir() . 'sf_' . md5(rand(11111, 99999));
     $this->getFilesystem()->touch($file);
     file_put_contents($file, join(PHP_EOL, $value));
     foreach ($path as $p) {
         $this->getFilesystem()->sh(vsprintf('%s propset %s -F %s %s', array($this->subversionBinary, $property, escapeshellarg($file), escapeshellarg(!sfToolkit::isPathAbsolute($p) ? sfConfig::get('sf_root_dir') . '/' . $p : $p))));
     }
     $this->getFilesystem()->remove($file);
 }
开发者ID:bshaffer,项目名称:Symplist,代码行数:23,代码来源:sfTaskExtraSubversionBaseTask.class.php

示例10: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $config = $this->getCliConfig();
     $dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'fixtures';
     Doctrine_Lib::makeDirectories($dir);
     $args = array();
     if (isset($arguments['target'])) {
         $filename = $arguments['target'];
         if (!sfToolkit::isPathAbsolute($filename)) {
             $filename = $dir . DIRECTORY_SEPARATOR . $filename;
         }
         Doctrine_Lib::makeDirectories(dirname($filename));
         $args = array('data_fixtures_path' => array($filename));
         $this->logSection('doctrine', sprintf('dumping data to fixtures to "%s"', $filename));
     } else {
         $this->logSection('doctrine', sprintf('dumping data to fixtures to "%s"', $config['data_fixtures_path'][0]));
     }
     $this->callDoctrineCli('dump-data', $args);
 }
开发者ID:yasirgit,项目名称:afids,代码行数:23,代码来源:sfDoctrineDataDumpTask.class.php

示例11: getBackupPath

 /**
  * Get the path to the file to backup
  *
  * @param   array   $arguments          Arguments for this task
  * @param   array   $options            Options for this task
  * @param   string  $filenameSuffix     (Optional) A suffix for the end of the
  *                                      filename
  * @param   string  $databaseName       (Optional) The database connection name
  * @param   boolean $multipleDatabases  (Optional) Whether there are multiple
  *                                      databases
  * 
  * @return  string
  */
 protected function getBackupPath(array $arguments, array $options, $filenameSuffix = '', $databaseName = '', $multipleDatabases = false)
 {
     $config = $this->getCliConfig();
     $sqlPath = $config['sql_path'];
     if (!is_dir($sqlPath)) {
         $this->getFilesystem()->mkdirs($sqlPath);
     }
     $path = $sqlPath;
     if ($arguments['target']) {
         $filename = $arguments['target'];
         if (!sfToolkit::isPathAbsolute($filename)) {
             $filename = $sqlPath . '/' . $filename;
         }
         $this->getFilesystem()->mkdirs(dirname($filename));
         $path = $filename;
     }
     if (is_dir($path)) {
         // create filename for backup
         $path = rtrim($path, '/') . '/' . date(sfConfig::get('app_sfDoctrineMysqlSafeMigratePlugin_dump_date_format', 'U')) . ($filenameSuffix ? '_' . $filenameSuffix : '') . ($multipleDatabases ? '_' . $databaseName : '') . '.sql';
     }
     return $path;
 }
开发者ID:kevindew,项目名称:sfDoctrineMysqlSafeMigratePlugin,代码行数:35,代码来源:sfDoctrineMysqlSqlDumpTask.class.php

示例12: setTemplate

 public function setTemplate($template)
 {
     if (sfToolkit::isPathAbsolute($template)) {
         $this->directory = dirname($template);
         $this->template = basename($template);
     } else {
         $this->template = $template;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:9,代码来源:config_core_compile.yml.php

示例13: checkConfig

 /**
  * Checks to see if a configuration file has been modified and if so
  * recompile the cache file associated with it.
  *
  * The recompilation only occurs in a non debug environment.
  *
  * If the configuration file path is relative, symfony will look in directories 
  * defined in the sfConfiguration::getConfigPaths() method.
  *
  * @param string  $configPath A filesystem path to a configuration file
  * @param boolean $optional   If true, config path does not need to exist
  *
  * @return string An absolute filesystem path to the cache filename associated with this specified configuration file
  *
  * @throws <b>sfConfigurationException</b> If a requested configuration file does not exist
  *
  * @see sfConfiguration::getConfigPaths()
  */
 public function checkConfig($configPath, $optional = false)
 {
     if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
         $timer = sfTimerManager::getTimer('Configuration');
     }
     // the cache filename we'll be using
     $cache = $this->getCacheName($configPath);
     if (!sfConfig::get('sf_debug') && !sfConfig::get('sf_test') && is_readable($cache)) {
         return $cache;
     }
     if (!sfToolkit::isPathAbsolute($configPath)) {
         $files = $this->configuration->getConfigPaths($configPath);
     } else {
         $files = is_readable($configPath) ? array($configPath) : array();
     }
     if (!isset($files[0])) {
         if ($optional) {
             return null;
         }
         // configuration does not exist
         throw new sfConfigurationException(sprintf('Configuration "%s" does not exist or is unreadable.', $configPath));
     }
     // find the more recent configuration file last modification time
     $mtime = 0;
     foreach ($files as $file) {
         if (filemtime($file) > $mtime) {
             $mtime = filemtime($file);
         }
     }
     if (!is_readable($cache) || $mtime > filemtime($cache)) {
         // configuration has changed so we need to reparse it
         $this->callHandler($configPath, $files, $cache);
     }
     if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
         $timer->addTime();
     }
     return $cache;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:56,代码来源:sfConfigCache.class.php

示例14:

$t->is(sfToolkit::replaceConstants('%Y/%m/%d %H:%M'), '%Y/%m/%d %H:%M', '::replaceConstantsCallback() does not replace unknown constants');
sfConfig::set('bar', null);
$t->is(sfToolkit::replaceConstants('my value with a %bar% constant'), 'my value with a  constant', '::replaceConstantsCallback() replaces constants enclosed in % even if value is null');
$t->is(sfToolkit::replaceConstants('my value with a %foobar% constant'), 'my value with a %foobar% constant', '::replaceConstantsCallback() returns the original string if the constant is not defined');
$t->is(sfToolkit::replaceConstants('my value with a %foo\'bar% constant'), 'my value with a %foo\'bar% constant', '::replaceConstantsCallback() returns the original string if the constant is not defined');
$t->is(sfToolkit::replaceConstants('my value with a %foo"bar% constant'), 'my value with a %foo"bar% constant', '::replaceConstantsCallback() returns the original string if the constant is not defined');

// ::isPathAbsolute()
$t->diag('::isPathAbsolute()');
$t->is(sfToolkit::isPathAbsolute('/test'), true, '::isPathAbsolute() returns true if path is absolute');
$t->is(sfToolkit::isPathAbsolute('\\test'), true, '::isPathAbsolute() returns true if path is absolute');
$t->is(sfToolkit::isPathAbsolute('C:\\test'), true, '::isPathAbsolute() returns true if path is absolute');
$t->is(sfToolkit::isPathAbsolute('d:/test'), true, '::isPathAbsolute() returns true if path is absolute');
$t->is(sfToolkit::isPathAbsolute('test'), false, '::isPathAbsolute() returns false if path is relative');
$t->is(sfToolkit::isPathAbsolute('../test'), false, '::isPathAbsolute() returns false if path is relative');
$t->is(sfToolkit::isPathAbsolute('..\\test'), false, '::isPathAbsolute() returns false if path is relative');

// ::stripComments()
$t->diag('::stripComments()');

$php = <<<EOF
<?php

# A perl like comment
// Another comment
/* A very long
comment
on several lines
*/

\$i = 1; // A comment on a PHP line
开发者ID:nationalfield,项目名称:symfony,代码行数:31,代码来源:sfToolkitTest.php

示例15: replacePath

 /**
  * Replaces a relative filesystem path with an absolute one.
  *
  * @param string $path A relative filesystem path
  *
  * @return string The new path
  */
 public static function replacePath($path)
 {
     if (is_array($path)) {
         array_walk_recursive($path, create_function('&$path', '$path = sfConfigHandler::replacePath($path);'));
     } else {
         if (!sfToolkit::isPathAbsolute($path)) {
             // not an absolute path so we'll prepend to it
             $path = sfConfig::get('sf_app_dir') . '/' . $path;
         }
     }
     return $path;
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:19,代码来源:sfConfigHandler.class.php


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