當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。