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


PHP sfYaml::setSpecVersion方法代码示例

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


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

示例1: setup

 public function setup()
 {
     require_once dirname(__FILE__) . '/../lib/vendor/php-github-api/lib/phpGithubApi.php';
     $this->dispatcher->connect('component.method_not_found', array('sfActionExtra', 'observeMethodNotFound'));
     sfYaml::setSpecVersion('1.1');
     $this->enablePlugins(array('sfDoctrinePlugin', 'csAdminGeneratorPlugin', 'csDoctrineActAsAttachablePlugin', 'csDoctrineActAsSortablePlugin', 'csDoctrineMarkdownPlugin', 'csFormTransformPlugin', 'csNavigationPlugin', 'csSEOToolkitPlugin', 'csThumbnailPlugin', 'sfCommentsPlugin', 'sfDoctrineGuardPlugin', 'sfDoctrineSettingsPlugin', 'sfFormExtraPlugin', 'sfGoogleAnalyticsPlugin', 'sfGravatarPlugin', 'sfJqueryReloadedPlugin', 'sfLucenePlugin', 'sfTaskExtraPlugin'));
 }
开发者ID:bshaffer,项目名称:Symplist,代码行数:7,代码来源:ProjectConfiguration.class.php

示例2: setup

 public function setup()
 {
     $this->dispatcher->connect('component.method_not_found', array('sfActionExtra', 'observeMethodNotFound'));
     sfYaml::setSpecVersion('1.1');
     // for compatibility / remove and enable only the plugins you want
     $this->enablePlugins(array('sfDoctrinePlugin', 'sfDoctrineGuardPlugin', 'sfFormExtraPlugin', 'sfGoogleAnalyticsPlugin', 'sfTaskExtraPlugin', 'csDoctrineActAsSortablePlugin', 'sfThemeGeneratorPlugin', 'sfHadoriThemePlugin'));
 }
开发者ID:robertsergio,项目名称:Hadori-Demo,代码行数:7,代码来源:ProjectConfiguration.class.php

示例3: emitFile

 public static function emitFile($data, $file)
 {
     if (file_exists($file) and !is_writable($file)) {
         throw new pakeException('Not enough rights to overwrite "' . $file . '"');
     }
     $dir = dirname($file);
     pake_mkdirs($dir);
     if (!is_writable($dir)) {
         throw new pakeException('Not enough rights to create file in "' . $dir . '"');
     }
     if (extension_loaded('yaml')) {
         // not yet implemented:
         // yaml_emit_file($file, $data);
         // so using this instead:
         if (false === file_put_contents($file, yaml_emit($data))) {
             throw new pakeException("Couldn't create file");
         }
     } else {
         sfYaml::setSpecVersion('1.1');
         // more compatible
         $dumper = new sfYamlDumper();
         if (false === file_put_contents($file, $dumper->dump($data, 1))) {
             throw new pakeException("Couldn't create file");
         }
     }
     pake_echo_action('file+', $file);
 }
开发者ID:piotras,项目名称:pake,代码行数:27,代码来源:pakeYaml.class.php

示例4: setup

 public function setup()
 {
     sfYaml::setSpecVersion('1.1');
     $this->enableAllPluginsExcept(array('sfPropelPlugin'));
     $this->enablePlugins('sfFormExtraPlugin');
     $this->enablePlugins('sfDoctrineJCroppablePlugin');
     $this->enablePlugins('sfThumbnailPlugin');
 }
开发者ID:robinkanters,项目名称:dnsleergemeenschap,代码行数:8,代码来源:ProjectConfiguration.class.php

示例5: setup

 public function setup()
 {
     sfYaml::setSpecVersion('1.1');
     require_once sfConfig::get('sf_plugins_dir') . '/sfSympalPlugin/config/sfSympalPluginConfiguration.class.php';
     sfSympalPluginConfiguration::enableSympalPlugins($this);
     $configPath = dirname(__FILE__) . '/server_config.php';
     if (file_exists($configPath)) {
         require $configPath;
     }
 }
开发者ID:sympal,项目名称:sympalphp.org,代码行数:10,代码来源:ProjectConfiguration.class.php

示例6: upgrade

 public function upgrade()
 {
     $specVersion = sfYaml::getSpecVersion();
     $queue = array();
     $success = true;
     $finder = sfFinder::type('file')->name('*.yml')->prune('vendor');
     foreach ($finder->in(sfConfig::get('sf_root_dir')) as $file) {
         // attempt to upgrade booleans
         $original = file_get_contents($file);
         $upgraded = sfToolkit::pregtr($original, array('/^([^:]+: +)(?:on|y(?:es)?|\\+)(\\s*(#.*)?)$/im' => '\\1true\\2', '/^([^:]+: +)(?:off|no?|-)(\\s*(#.*)?)$/im' => '\\1false\\2'));
         try {
             sfYaml::setSpecVersion('1.1');
             $yaml11 = sfYaml::load($original);
             sfYaml::setSpecVersion('1.2');
             $yaml12 = sfYaml::load($upgraded);
         } catch (Exception $e) {
             // unable to load the YAML
             $yaml11 = 'foo';
             $yaml12 = 'bar';
         }
         if ($yaml11 == $yaml12) {
             if ($original != $upgraded) {
                 $this->getFilesystem()->touch($file);
                 file_put_contents($file, $upgraded);
             }
         } else {
             $this->logSection('yaml', 'Unable to upgrade ' . sfDebug::shortenFilePath($file), null, 'ERROR');
             // force project to use YAML 1.1 spec
             if ('1.1' != $specVersion) {
                 $specVersion = '1.1';
                 $class = sfClassManipulator::fromFile(sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php');
                 $original = $class->getCode();
                 $modified = $class->wrapMethod('setup', 'sfYaml::setSpecVersion(\'1.1\');');
                 if ($original != $modified && $this->askConfirmation(array('Unable to convert YAML file:', sfDebug::shortenFilePath($file), '', 'Would you like to force YAML to be parsed with the 1.1 specification? (Y/n)'), 'QUESTION_LARGE')) {
                     $this->logSection('yaml', 'Forcing YAML 1.1 spec');
                     $this->getFilesystem()->touch($class->getFile());
                     $class->save();
                 } else {
                     $this->logBlock(array('Unable to either upgrade YAML files or force 1.1 spec.', '(see UPGRADE_TO_1_3 file for more information)'), 'ERROR_LARGE');
                 }
             }
             $success = false;
         }
     }
     if ($success && '1.1' == $specVersion) {
         $file = sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php';
         $original = file_get_contents($file);
         $modified = preg_replace('/^\\s*sfYaml::setSpecVersion\\(\'1\\.1\'\\);\\n/im', '', $original);
         if ($original != $modified) {
             $this->logSection('yaml', 'Removing setting of YAML 1.1 spec');
             $this->getFilesystem()->touch($file);
             file_put_contents($file, $modified);
         }
     }
 }
开发者ID:souravmondal-cn,项目名称:symfonyweather,代码行数:55,代码来源:sfYamlUpgrade.class.php

示例7: __construct

 public function __construct($data)
 {
     try {
         $version = sfYaml::getSpecVersion();
         sfYaml::setSpecVersion('1.2');
         $this->data = $this->parse($data);
         sfYaml::setSpecVersion($version);
     } catch (InvalidArgumentException $e) {
         $this->errors[] = $e->getMessage();
     }
 }
开发者ID:pkdevbox,项目名称:mootools-forge,代码行数:11,代码来源:ForgeYamlParser.class.php

示例8: getYaml

 public function getYaml($entities, $locale)
 {
     // Use the Zend copy of this script to prevent class conflicts when RailsYaml is included
     require_once 'thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib' . '/sfYamlDumper.php';
     // Unflatten array
     $entitiesNested = array();
     foreach ($entities as $entity => $spec) {
         // Legacy support: Don't count *.ss as namespace
         $entity = preg_replace('/\\.ss\\./', '___ss.', $entity);
         $parts = explode('.', $entity);
         $currLevel =& $entitiesNested;
         while ($part = array_shift($parts)) {
             $part = str_replace('___ss', '.ss', $part);
             if (!isset($currLevel[$part])) {
                 $currLevel[$part] = array();
             }
             $currLevel =& $currLevel[$part];
         }
         $currLevel = $spec[0];
     }
     // Write YAML
     $oldVersion = sfYaml::getSpecVersion();
     sfYaml::setSpecVersion('1.1');
     $yamlHandler = new sfYaml();
     // TODO Dumper can't handle YAML comments, so the context information is currently discarded
     $result = $yamlHandler->dump(array($locale => $entitiesNested), 99);
     sfYaml::setSpecVersion($oldVersion);
     return $result;
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:29,代码来源:i18nTextCollector.php

示例9: sfYamlParser

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../bootstrap/unit.php';
sfYaml::setSpecVersion('1.1');
$t = new lime_test(150);
$parser = new sfYamlParser();
$path = __DIR__ . '/fixtures';
$files = $parser->parse(file_get_contents($path . '/index.yml'));
foreach ($files as $file) {
    $t->diag($file);
    $yamls = file_get_contents($path . '/' . $file . '.yml');
    // split YAMLs documents
    foreach (preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) {
        if (!$yaml) {
            continue;
        }
        $test = $parser->parse($yaml);
        if (isset($test['todo']) && $test['todo']) {
            $t->todo($test['test']);
        } else {
            $expected = var_export(eval('return ' . trim($test['php']) . ';'), true);
            $t->is(var_export($parser->parse($test['yaml']), true), $expected, $test['test']);
        }
    }
开发者ID:Phennim,项目名称:symfony1,代码行数:31,代码来源:sfYamlParserTest.php

示例10: setup

 public function setup()
 {
     sfYaml::setSpecVersion('1.1');
     // for compatibility / remove and enable only the plugins you want
     $this->enableAllPluginsExcept('sfPropelPlugin');
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:6,代码来源:ProjectConfiguration.class.php

示例11: setup

 public function setup()
 {
     sfYaml::setSpecVersion('1.1');
     // for compatibility / remove and enable only the plugins you want
     $this->enablePlugins(array('sfDoctrinePlugin', 'sfDoctrineGuardPlugin', 'csDoctrineActAsSortablePlugin', 'sfFormExtraPlugin', 'sfGoogleAnalyticsPlugin', 'sfLucenePlugin', 'sfTaskExtraPlugin', 'sfPhpExcelPlugin', 'csBackupPlugin'));
 }
开发者ID:bshaffer,项目名称:Donate-Nashville,代码行数:6,代码来源:ProjectConfiguration.class.php


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