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


PHP sfYaml::dump方法代码示例

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


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

示例1: execute

 protected function execute($arguments = array(), $options = array())
 {
     $file = sfConfig::get('sf_apps_dir') . '/' . $options['app'] . '/config/app.yml';
     $config = file_exists($file) ? sfYaml::load($file) : array();
     $config = $this->switchConfig($config, strtolower($options['option']), strtolower($options['status']));
     file_put_contents($file, sfYaml::dump($config, 4));
 }
开发者ID:noreiller,项目名称:sfPlopPlugin,代码行数:7,代码来源:sfPlopSwitchOptionTask.class.php

示例2: dump

 /**
  * Dumps a collection to a YAML file.
  *
  * By convention, each collection is dumped to its own YAML file,
  * named collection.yml. Any existing file with this name will be crushed
  * without notice.
  *
  * @param  string    $collection   The collection name
  * @param  integer   $inline       The level where you switch to inline YAML
  * @return MongoYaml 
  */
 public function dump($collection, $inline = 10)
 {
     $data = iterator_to_array($this->database->{$collection}->find());
     $yaml = sfYaml::dump(array($collection => $data), $inline);
     file_put_contents($collection . '.yml', $yaml);
     return $this;
 }
开发者ID:agolp,项目名称:mongoyaml,代码行数:18,代码来源:MongoYaml.php

示例3: addParameters

 protected function addParameters()
 {
     if (!$this->container->getParameters()) {
         return '';
     }
     return sfYaml::dump(array('parameters' => $this->prepareParameters($this->container->getParameters())), 2);
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:7,代码来源:Yaml.php

示例4: saveCurrentParametersConnection

 /**
  * ESCRIBE EN EL FICHERO lastConnection.yml LOS DATOS DE LA
  * ULTIMA CONEXIÓN QUE ESTAN EN $_POST
  */
 public function saveCurrentParametersConnection()
 {
     $texto = sfYaml::dump($this->connection);
     $archivo = new Archivo("lastConnection.yml");
     $archivo->write($texto);
     unset($archivo);
 }
开发者ID:albatronic,项目名称:agentescloud,代码行数:11,代码来源:Schema.class.php

示例5: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     // update databases.yml
     if (!is_null($options['app'])) {
         $file = sfConfig::get('sf_apps_dir') . '/' . $options['app'] . '/config/databases.yml';
     } else {
         $file = sfConfig::get('sf_config_dir') . '/databases.yml';
     }
     $config = file_exists($file) ? sfYaml::load($file) : array();
     $config[$options['env']][$options['name']] = array('class' => $options['class'], 'param' => array_merge(isset($config[$options['env']][$options['name']]['param']) ? $config[$options['env']][$options['name']]['param'] : array(), array('dsn' => $arguments['dsn'], 'username' => $arguments['username'], 'password' => $arguments['password'])));
     file_put_contents($file, sfYaml::dump($config, 4));
     // update propel.ini
     if (is_null($options['app']) && false !== strpos($options['class'], 'Propel') && 'all' == $options['env']) {
         $propelini = sfConfig::get('sf_config_dir') . '/propel.ini';
         if (file_exists($propelini)) {
             $content = file_get_contents($propelini);
             if (preg_match('/^(.+?):/', $arguments['dsn'], $match)) {
                 $content = preg_replace('/^propel\\.database(\\s*)=(\\s*)(.+?)$/m', 'propel.database$1=${2}' . $match[1], $content);
                 $content = preg_replace('/^propel\\.database.driver(\\s*)=(\\s*)(.+?)$/m', 'propel.database.driver$1=${2}' . $match[1], $content);
                 $content = preg_replace('/^propel\\.database\\.createUrl(\\s*)=(\\s*)(.+?)$/m', 'propel.database.createUrl$1=${2}' . $arguments['dsn'], $content);
                 $content = preg_replace('/^propel\\.database\\.url(\\s*)=(\\s*)(.+?)$/m', 'propel.database.url$1=${2}' . $arguments['dsn'], $content);
                 $content = preg_replace('/^propel\\.database\\.user(\\s*)=(\\s*)(.+?)$/m', 'propel.database.user$1=${2}' . $arguments['username'], $content);
                 $content = preg_replace('/^propel\\.database\\.password(\\s*)=(\\s*)(.+?)$/m', 'propel.database.password$1=${2}' . $arguments['password'], $content);
                 file_put_contents($propelini, $content);
             }
         }
     }
 }
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:31,代码来源:sfConfigureDatabaseTask.class.php

示例6: execute

 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     // disable security on login and secure actions
     if (sfConfig::get('sf_login_module') == $this->context->getModuleName() && sfConfig::get('sf_login_action') == $this->context->getActionName() || sfConfig::get('sf_secure_module') == $this->context->getModuleName() && sfConfig::get('sf_secure_action') == $this->context->getActionName()) {
         $filterChain->execute();
         return;
     }
     // NOTE: the nice thing about the Action class is that getCredential()
     //       is vague enough to describe any level of security and can be
     //       used to retrieve such data and should never have to be altered
     if (!$this->context->getUser()->isAuthenticated()) {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Action "%s/%s" requires authentication, forwarding to "%s/%s"', $this->context->getModuleName(), $this->context->getActionName(), sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action')))));
         }
         // the user is not authenticated
         $this->forwardToLoginAction();
     }
     // the user is authenticated
     $credential = $this->getUserCredential();
     if (null !== $credential && !$this->context->getUser()->hasCredential($credential)) {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Action "%s/%s" requires credentials "%s", forwarding to "%s/%s"', $this->context->getModuleName(), $this->context->getActionName(), sfYaml::dump($credential, 0), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')))));
         }
         // the user doesn't have access
         $this->forwardToSecureAction();
     }
     // the user has access, continue
     $filterChain->execute();
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:34,代码来源:sfBasicSecurityFilter.class.php

示例7: getTransformed

 public function getTransformed($generator)
 {
     $yaml = sfYaml::load($generator);
     $yaml['generator']['param']['config'] = $this->getConfig();
     $transformed = sfYaml::dump($yaml, 6, 0);
     $transformed = preg_replace("|('~')|um", "~", $transformed);
     return $transformed;
 }
开发者ID:vjousse,项目名称:diem,代码行数:8,代码来源:dmAdminGeneratorBuilder.php

示例8: dump

 /**
  * Dumps a PHP array to a YAML string.
  *
  * The dump method, when supplied with an array, will do its best
  * to convert the array into friendly YAML.
  *
  * @param array   $array PHP array
  * @param string  $file YAML file path
  * @param integer $inline The level where you switch to inline YAML
  * @return mixed string when sucess or false when fail
  */
 public static function dump($data, $file = null, $inline = 2)
 {
     $yaml = sfYaml::dump($data, $inline);
     if (empty($file) || file_put_contents($yaml, $file)) {
         return $yaml;
     }
     return false;
 }
开发者ID:GavinLai,项目名称:SimMatch,代码行数:19,代码来源:class.Yaml.php

示例9: formatArrayAsHtml

 /**
  * Converts an array to HTML.
  *
  * @param string $id      The identifier to use
  * @param array  $values  The array of values
  *
  * @return string An HTML string
  */
 protected function formatArrayAsHtml($id, $values)
 {
     $id = ucfirst(strtolower($id));
     return '
 <h2>' . $id . ' <a href="#" onclick="sfWebDebugToggle(\'sfWebDebug' . $id . '\'); return false;"><img src="' . $this->webDebug->getOption('image_root_path') . '/toggle.gif" /></a></h2>
 <div id="sfWebDebug' . $id . '" style="display: none"><pre>' . htmlspecialchars(sfYaml::dump(self::removeObjects($values)), ENT_QUOTES, sfConfig::get('sf_charset')) . '</pre></div>
 ';
 }
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:16,代码来源:sfWebDebugPanelConfig.class.php

示例10: dump

 public function dump($array)
 {
     try {
         return sfYaml::dump($array);
     } catch (Exception $e) {
         throw new YamlParserException($e->getMessage(), $e->getCode(), $e);
     }
 }
开发者ID:shruti927,项目名称:findhooks,代码行数:8,代码来源:findHooks.php

示例11: formatArrayAsHtml

 /**
  * Converts an array to HTML.
  *
  * @param string $id     The identifier to use
  * @param array  $values The array of values
  *
  * @return string An HTML string
  */
 protected function formatArrayAsHtml($id, $values)
 {
     $id = ucfirst(strtolower($id));
     return '
 <h2>' . $id . ' ' . $this->getToggler('sfWebDebug' . $id) . '</h2>
 <div id="sfWebDebug' . $id . '" style="display: none"><pre>' . htmlspecialchars(sfYaml::dump(sfDebug::removeObjects($values)), ENT_QUOTES, sfConfig::get('sf_charset')) . '</pre></div>
 ';
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:16,代码来源:sfWebDebugPanelConfig.class.php

示例12: dump

 public static function dump($object)
 {
     // using the slow (but very compatible) symfony YAML dumper
     $ret = sfYaml::dump($object, 999);
     if (substr($string, 0, 3) == '---') {
         return substr($ret, 4);
     }
     return $ret;
 }
开发者ID:jbzdak,项目名称:wikidot,代码行数:9,代码来源:Yaml.php

示例13: updateAppYaml

function updateAppYaml(array $app)
{
    $appYaml = sfYaml::load(sfConfig::get('sf_app_config_dir') . '/app.yml');
    if (null == $appYaml) {
        $appYaml = array();
    }
    $appYaml = array_merge($appYaml, $app);
    file_put_contents(sfConfig::get('sf_app_config_dir') . '/app.yml', sfYaml::dump($appYaml, 15));
}
开发者ID:JoshuaEstes,项目名称:symfony_custom_installer,代码行数:9,代码来源:default.php

示例14: save

 public function save()
 {
     $array = $this->_buildArrayToWrite();
     $this->_path = sfConfig::get('sf_app_dir') . '/config/app.yml';
     file_put_contents($this->_path, sfYaml::dump($array, 4));
     chdir(sfConfig::get('sf_root_dir'));
     $task = new sfCacheClearTask(sfApplicationConfiguration::getActive()->getEventDispatcher(), new sfFormatter());
     $task->run(array(), array('type' => 'config'));
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:9,代码来源:sfSympalConfigForm.class.php

示例15: getSlotValueFromRequest

 public function getSlotValueFromRequest($request)
 {
     $params = array();
     $params['src'] = $request->getParameter('src');
     $params['width'] = $request->getParameter('width');
     $params['height'] = $request->getParameter('height');
     $params['legend'] = $request->getParameter('legend');
     $params['url'] = $request->getParameter('url');
     return sfYaml::dump($params);
 }
开发者ID:net7,项目名称:Talia-CMS,代码行数:10,代码来源:sfSimpleCMSSlotImage.class.php


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