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


PHP sfSympalConfig::set方法代码示例

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


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

示例1: _prepareParams

 /**
  * Sets the $_params array as sfConfig variables
  */
 protected function _prepareParams()
 {
     foreach ($this->_params as $key => $value) {
         if ($value) {
             sfSympalConfig::set('sympal_install_admin_' . $key, $value);
         }
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:11,代码来源:sfSympalInstall.class.php

示例2: execute

 protected function execute($arguments = array(), $options = array())
 {
     if (!$options['no-confirmation'] && !$this->askConfirmation(array(sprintf('You are about to create a new site named "%s"', $arguments['site']), 'Are you sure you want to proceed? (y/N)'), 'QUESTION_LARGE', false)) {
         $this->logSection('sympal', 'Install task aborted');
         return 1;
     }
     if (isset($options['interactive']) && $options['interactive']) {
         sfSympalConfig::set('sympal_install_admin_email_address', $this->askAndValidate('Enter E-Mail Address:', new sfValidatorString()));
         sfSympalConfig::set('sympal_install_admin_first_name', $this->askAndValidate('Enter First Name:', new sfValidatorString()));
         sfSympalConfig::set('sympal_install_admin_last_name', $this->askAndValidate('Enter Last Name:', new sfValidatorString()));
         sfSympalConfig::set('sympal_install_admin_username', $this->askAndValidate('Enter Username:', new sfValidatorString()));
         sfSympalConfig::set('sympal_install_admin_password', $this->askAndValidate('Enter Password:', new sfValidatorString()));
     }
     $this->_generateApplication($arguments['site']);
     $this->_prepareApplication($arguments['site']);
     $databaseManager = new sfDatabaseManager($this->configuration);
     $site = $this->_getOrCreateSite($arguments, $options);
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:18,代码来源:sfSympalCreateSiteTask.class.php

示例3: writeSetting

 /**
  * Write a setting to the config/app.yml. The api of this is the same as set()
  *
  * @see sfSympalConfig::set()
  * @param string $group 
  * @param string $name 
  * @param string $value 
  * @param string $application Whether or not to write this setting to the app config file
  * @return void
  */
 public static function writeSetting($group, $name, $value = null, $application = false)
 {
     if ($application) {
         $path = sfConfig::get('sf_app_dir') . '/config/app.yml';
     } else {
         $path = sfConfig::get('sf_config_dir') . '/app.yml';
     }
     if (!file_exists($path)) {
         touch($path);
     }
     $array = (array) sfYaml::load(file_get_contents($path));
     if ($value === null) {
         $array['all']['sympal_config'][$group] = $name;
     } else {
         $array['all']['sympal_config'][$group][$name] = $value;
     }
     sfSympalConfig::set($group, $name, $value);
     file_put_contents($path, sfYaml::dump($array, 4));
 }
开发者ID:sympal,项目名称:sympal,代码行数:29,代码来源:sfSympalConfig.class.php

示例4: dirname

<?php

$app = 'sympal';
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(6);
sfSympalConfig::set('test', true);
$t->is(sfSympalConfig::get('test'), true, '->get() works with just one argument');
sfSympalConfig::set('group', 'test', true);
$t->is(sfSympalConfig::get('group', 'test'), true, '->get() works using the group arugment');
$t->is(sfSympalConfig::get('doesnt_exists', null, 'default_value'), 'default_value', '->get() returns a default value if the key does not exist');
sfSympalConfig::writeSetting('test_write_value', 1);
$path = sfConfig::get('sf_config_dir') . '/app.yml';
$array = (array) sfYaml::load(file_get_contents($path));
$t->is(isset($array['all']['sympal_config']['test_write_value']), true, '->writeSetting() writes out correctly to the config/app.yml file');
$t->is(sfSympalConfig::isI18nEnabled(), false, '->isI18nEnabled() correctly returns false');
$t->is(sfSympalConfig::isI18nEnabled('sfSympalContent'), false, '->isI18nEnabled($modelName) correctly returns false');
开发者ID:sympal,项目名称:sympal,代码行数:16,代码来源:sfSympalConfigTest.php

示例5: catch

try {
    $transformer->getTransformerCallbacksTest();
    $t->fail('Exception not thrown');
} catch (sfException $e) {
    $t->pass('Exception thrown');
}
/*
 * Test the transformation process
 */
$t->info('2 - Test the transformation process');
$t->info('  2.1 - Setup a unit_test transformer');
$markdownConfig['transformers'] = array('unit_test');
sfSympalConfig::set('content_slot_types', 'Markdown', $markdownConfig);
$t->info('  2.2 - First transformer should always return static text "testing"');
sfSympalConfig::set('slot_transformers', 'unit_test', array('myUnitTestTransformer', 'transform1'));
test_transformer_return($t, $transformer, 'testing', array(), 'testing');
$t->info('  2.3 - Transformer will change "Markdown" to "Markup"');
sfSympalConfig::set('slot_transformers', 'unit_test', array('myUnitTestTransformer', 'transform2'));
test_transformer_return($t, $transformer, '__Some Markup Content__', array(), '__Some Markup Content__');
$t->info('  2.4 - Transformer will include a callback wildcard');
sfSympalConfig::set('slot_transformers', 'unit_test', array('myUnitTestTransformer', 'transform3'));
$tokenCallbacks = array('%language%' => array('callback' => array('myUnitTestTransformer', 'languageCallback'), 'args' => array('HT', 'ML')));
test_transformer_return($t, $transformer, '__Some %language% Content__', $tokenCallbacks, '__Some HTML Content__');
// tests the return values of a run in the transformer
function test_transformer_return(lime_test $t, sfSympalContentSlotTransformerTest $transformer, $transformedContent, $tokenCallbacks, $result)
{
    $transformerResult = $transformer->render();
    $t->is($transformer->getProp('_transformedContent'), $transformedContent, sprintf('->_transformedContent set to "%s"', $transformedContent));
    $t->is($transformer->getProp('_tokenCallbacks'), $tokenCallbacks, '->_tokenCallbacks matches');
    $t->is($transformerResult, $result, sprintf('The end result is "%s"', $result));
}
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:31,代码来源:SlotTransformerTest.php


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