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


PHP sfConfig::getAll方法代码示例

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


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

示例1: __construct

  /**
   * Constructor.
   *
   * @param string            $environment    The environment name
   * @param Boolean           $debug          true to enable debug mode
   * @param string            $rootDir        The project root directory
   * @param sfEventDispatcher $dispatcher     An event dispatcher
   */
  public function __construct($environment, $debug, $rootDir = null, sfEventDispatcher $dispatcher = null)
  {
    $this->environment = $environment;
    $this->debug       = (boolean) $debug;
    $this->application = str_replace('Configuration', '', get_class($this));

    parent::__construct($rootDir, $dispatcher);

    $this->configure();

    $this->initConfiguration();

    if (sfConfig::get('sf_check_lock'))
    {
      $this->checkLock();
    }

    if (file_exists($file = sfConfig::get('sf_app_cache_dir').'/config/configuration.php'))
    {
      $this->cache = require $file;
    }

    $this->initialize();

    // store current sfConfig values
    $this->config = sfConfig::getAll();
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:35,代码来源:sfApplicationConfiguration.class.php

示例2: getContext

 /**
  * Returns the current application context.
  *
  * @param  bool $forceReload  true to force context reload, false otherwise
  *
  * @return sfContext
  */
 public function getContext($forceReload = false)
 {
     if (null === $this->context || $forceReload) {
         $isContextEmpty = null === $this->context;
         $context = $isContextEmpty ? sfContext::getInstance() : $this->context;
         // create configuration
         $currentConfiguration = $context->getConfiguration();
         $configuration = ProjectConfiguration::getApplicationConfiguration($currentConfiguration->getApplication(), $currentConfiguration->getEnvironment(), $currentConfiguration->isDebug());
         // connect listeners
         $configuration->getEventDispatcher()->connect('application.throw_exception', array($this, 'listenToException'));
         foreach ($this->listeners as $name => $listener) {
             $configuration->getEventDispatcher()->connect($name, $listener);
         }
         // create context
         $this->context = sfContext::createInstance($configuration);
         unset($currentConfiguration);
         if (!$isContextEmpty) {
             sfConfig::clear();
             sfConfig::add($this->rawConfiguration);
         } else {
             $this->rawConfiguration = sfConfig::getAll();
         }
     }
     return $this->context;
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:32,代码来源:sfBrowser.class.php

示例3: remove

 /**
  * Removes a key from symfony config
  */
 public function remove($key)
 {
     $all = sfConfig::getAll();
     unset($all[$key]);
     sfConfig::clear();
     sfConfig::add($all);
     return $this;
 }
开发者ID:palcoprincipal,项目名称:sfLucenePlugin,代码行数:11,代码来源:limeade_sf_config.php

示例4: execute

 protected function execute($arguments = array(), $options = array())
 {
     parent::execute($arguments, $options);
     $this->mailLog('starting openpne:send-birthday-mail-lite task');
     // load templates
     list($pcTitleTpl, $pcTpl) = $this->getTwigTemplate('pc', 'birthday_lite');
     $birthday = $this->fetchRow('SELECT id, is_edit_public_flag, default_public_flag FROM ' . $this->getTableName('Profile') . ' WHERE name = ?', array('op_preset_birthday'));
     if (!$birthday) {
         throw new sfException('This project doesn\'t have the op_preset_birthday profile item.');
     }
     if (!$birthday['is_edit_public_flag'] && ProfileTable::PUBLIC_FLAG_PRIVATE == $birthday['default_public_flag']) {
         throw new sfException('all user\'s op_preset_birthday public_flag is hidden from backend');
     }
     $birthDatetime = new DateTime();
     $birthDatetime->modify('+ 1 week');
     $query = 'SELECT member_id FROM ' . $this->getTableName('MemberProfile') . ' WHERE profile_id = ? AND DATE_FORMAT(value_datetime, ?) = ?';
     $params = array($birthday['id'], '%m-%d', $birthDatetime->format('m-d'));
     if ($birthday['is_edit_public_flag']) {
         $query .= ' AND public_flag <> ?';
         $params[] = ProfileTable::PUBLIC_FLAG_PRIVATE;
     }
     if (null !== $options['start-member-id'] && is_numeric($options['start-member-id'])) {
         $query .= ' AND member_id >= ?';
         $params[] = $options['start-member-id'];
     }
     if (null !== $options['end-member-id'] && is_numeric($options['end-member-id'])) {
         $query .= ' AND member_id <= ?';
         $params[] = $options['end-member-id'];
     }
     $memberProfilesStmt = $this->executeQuery($query, $params);
     if ($memberProfilesStmt instanceof PDOStatement) {
         $sf_config = sfConfig::getAll();
         $op_config = new opConfig();
         while ($memberProfile = $memberProfilesStmt->fetch(Doctrine::FETCH_NUM)) {
             $birthMember = $this->getMember($memberProfile[0]);
             $birthMember['birthday'] = $birthDatetime->format('U');
             $ids = $this->getFriendIds($memberProfile[0]);
             foreach ($ids as $id) {
                 $member = $this->getMember($id);
                 $pcAddress = $this->getMemberPcEmailAddress($id);
                 if (!$pcAddress) {
                     continue;
                 }
                 $params = array('member' => $member, 'birthMember' => $birthMember, 'op_config' => $op_config, 'sf_config' => $sf_config);
                 $subject = $pcTitleTpl->render($params);
                 $body = $pcTpl->render($params);
                 try {
                     $this->sendMail($subject, $pcAddress, $this->adminMailAddress, $body);
                     $this->mailLog(sprintf("sent member %d birthday notification mail to member %d (usage memory:%s bytes)", $birthMember['id'], $member['id'], number_format(memory_get_usage())));
                 } catch (Zend_Mail_Transport_Exception $e) {
                     $this->mailLog(sprintf("%s (about member %d birthday to member %d)", $e->getMessage(), $birthMember['id'], $member['id']));
                 }
             }
         }
     }
     $this->mailLog('end openpne:send-birthday-mail-lite task');
 }
开发者ID:kawahara,项目名称:opLiteMailTaskPlugin,代码行数:57,代码来源:openpneSendBirthdayMailLiteTask.class.php

示例5: flushConfigs

 /** Restores all sfConfig values to their state before the current test was
  *   run.
  *
  * @return static
  */
 public function flushConfigs()
 {
     if (isset(self::$_configs)) {
         sfConfig::clear();
         sfConfig::add(self::$_configs);
     } else {
         self::$_configs = sfConfig::getAll();
     }
     return $this;
 }
开发者ID:todofixthis,项目名称:sfJwtPhpUnitPlugin,代码行数:15,代码来源:State.class.php

示例6: clearAll

 /**
  * Clear conf for a given key
  */
 public static function clearAll()
 {
     foreach (sfConfig::getAll() as $key => $value) {
         if (preg_match('/^' . self::prefix() . '/', $key, $matches)) {
             if (isset($matches[0][1])) {
                 self::clear($matches[0][1]);
             }
         }
     }
 }
开发者ID:noreiller,项目名称:sfPlopPlugin,代码行数:13,代码来源:sfPlop.class.php

示例7: execute

 public function execute($request)
 {
     // loop through application settings and extract enabled i18n languages
     foreach (sfConfig::getAll() as $setting => $value) {
         if (0 === strpos($setting, 'app_i18n_languages')) {
             $enabledI18nLanguages[$value] = format_language($value, $value);
         }
     }
     // sort languages by alpha code to look pretty
     ksort($enabledI18nLanguages);
     $this->enabledI18nLanguages = $enabledI18nLanguages;
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:12,代码来源:changeLanguageSelectboxComponent.class.php

示例8: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     //    $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $cfg = sfConfig::getAll();
     if (!isset($options['application'])) {
         echo ' NOTICE: set --application if you want the application config displayed.' . PHP_EOL;
     }
     if (!isset($options['env'])) {
         echo ' NOTICE: set --env if you want the application config displayed.' . PHP_EOL;
     }
     echo 'Configuration for env = ' . $options['env'] . ', application = ' . $options['application'] . PHP_EOL . PHP_EOL;
     print_r($cfg);
 }
开发者ID:hglattergotz,项目名称:uUtilitiesPlugin,代码行数:15,代码来源:uShownConfigTask.class.php

示例9: execute

 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $config = sfConfig::getAll();
     $host = sfContext::getInstance()->getRequest()->getHost();
     foreach ($config as $key => $value) {
         if ($key == 'dm_' . $host) {
             foreach ($value as $subkey => $subval) {
                 $config['dm_' . $subkey] = $subval;
             }
         }
     }
     sfConfig::clear();
     sfConfig::add($config);
     $filterChain->execute();
 }
开发者ID:pycmam,项目名称:neskuchaik.ru,代码行数:20,代码来源:myDomainConfigFilter.class.php

示例10: executeIndex

 /**
  * Executes index action
  *
  * @param      sfRequest $request A request object
  * @author     uechoco
  * @see        sfOpenPNEMailSend::getMailTemplate()
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->getResponse()->setTitle($this->freepage->getTitle());
     $context = sfContext::getInstance();
     $params['sf_config'] = sfConfig::getAll();
     // The renderer name is twig.
     // The template name ,which is the first argument of opFreepageTemplateLoaderDoctrine::doLoad(), is Freepage::id.
     $view = new sfTemplatingComponentPartialView($context, 'freepage', 'twig:' . $this->freepage->getId(), '');
     $context->set('view_instance', $view);
     $view->setPartialVars($params);
     $view->setAttribute('renderer_config', array('twig' => 'opTemplateRendererTwig'));
     $view->setAttribute('rule_config', array('twig' => array(array('loader' => 'opFreepageTemplateLoaderDoctrine', 'renderer' => 'twig', 'model' => 'Freepage'))));
     $view->execute();
     $this->body = $view->render();
 }
开发者ID:uechoco,项目名称:opFreepagePlugin,代码行数:22,代码来源:opFreepagePluginActions.class.php

示例11: getXCSSConfiguration

 /**
  * Parses the given configuration from the app.yml into an xCSS config array.
  *
  * @param bool $force If true, loads the configuration again, otherwise returns cached config, if any.
  *
  * @return array
  */
 public static function getXCSSConfiguration($force = false)
 {
     static $xCSSConfiguration = array();
     if ($force || empty($xCSSConfiguration)) {
         $configPrefix = 'app_xcssplugin_';
         foreach (sfConfig::getAll() as $entry => $value) {
             if (strstr($entry, $configPrefix) !== false) {
                 $xCSSConfiguration[str_replace($configPrefix, '', $entry)] = $value;
             }
         }
         // set default config items, if not set by user
         $xCSSConfiguration = array_merge(self::getDefaultXCSSConfiguration(), $xCSSConfiguration);
     }
     return $xCSSConfiguration;
 }
开发者ID:havvg,项目名称:sfXCSSPlugin,代码行数:22,代码来源:sfXCSSPluginConfiguration.class.php

示例12: buildUrl

 /**
  * Génération brute de l'url cross app, passer par la fonction genUrl de préference (gestion du cache)
  *
  * @static
  * @throws Exception
  * @param string $app
  * @param string $url
  * @param bool $absolute
  * @param string $env
  * @param string $initialInstanceName for test purpose
  * @return mixed
  */
 public static function buildUrl($app, $url, $absolute = false, $env = null, $initialInstanceName = null)
 {
     $initialApp = sfConfig::get('sf_app');
     if ($initialInstanceName == null) {
         $initialInstanceName = $initialApp;
     }
     $initialScriptName = $_SERVER['SCRIPT_NAME'];
     $initialFrontController = basename($initialScriptName);
     $initialConfig = sfConfig::getAll();
     $debug = sfConfig::get('sf_debug');
     //environnement par défaut
     if ($env == null) {
         $env = $initialConfig['sf_environment'];
     }
     //création du contexte
     if (!sfContext::hasInstance($app)) {
         sfConfig::set('sf_factory_storage', 'sfNoStorage');
         // la config de base est restaurée à la fin de la fonction
         sfConfig::set('sf_use_database', false);
         $configuration = ProjectConfiguration::getApplicationConfiguration($app, $env, $debug);
         $context = sfContext::createInstance($configuration, $app);
         unset($configuration);
     } else {
         $context = sfContext::getInstance($app);
     }
     //détermination du front controller
     $finalFrontController = $app;
     if ($env != 'prod') {
         $finalFrontController .= '_' . $env;
     }
     $finalFrontController .= '.php';
     $crossUrl = $context->getController()->genUrl($url, $absolute);
     unset($context);
     //vérrification de l'existence du front controller
     if (!file_exists(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $finalFrontController)) {
         throw new Exception('Le front controller ' . $finalFrontController . ' est introuvable.');
     }
     $crossUrl = str_replace($initialFrontController, $finalFrontController, $crossUrl);
     //retour au context initial
     if ($app !== $initialInstanceName) {
         sfContext::switchTo($initialInstanceName);
         sfConfig::clear();
         sfConfig::add($initialConfig);
     }
     return $crossUrl;
 }
开发者ID:ratibus,项目名称:Crew,代码行数:58,代码来源:crossAppRouting.class.php

示例13: executeDailyNews

 public function executeDailyNews()
 {
     $env = 'mobile_frontend' == sfConfig::get('sf_app') ? 'mobile' : 'pc';
     $twigEnvironment = new Twig_Environment(new Twig_Loader_String());
     $valueTpl = $twigEnvironment->loadTemplate(opDiaryPluginToolkit::getMailTemplate($env, 'diaryGagdet'));
     $diaries = Doctrine::getTable('Diary')->getFriendDiaryList($member['id'], 5);
     if (!count($diaries)) {
         return sfView::NONE;
     }
     $result = array();
     foreach ($diaries as $key => $diary) {
         $result[$key]['Member'] = $diary->Member;
         $result[$key]['title'] = $diary->title;
         $result[$key]['id'] = $diary->id;
     }
     $params = array('diaries' => $result, 'count' => count($diaries), 'sf_config' => sfConfig::getAll());
     $this->value = $valueTpl->render($params);
 }
开发者ID:nothan,项目名称:opDiaryPlugin,代码行数:18,代码来源:opDiaryPluginDiaryComponents.class.php

示例14: __construct

 /**
  * Constructor.
  *
  * @param string            $environment    The environment name
  * @param Boolean           $debug          true to enable debug mode
  * @param string            $rootDir        The project root directory
  * @param sfEventDispatcher $dispatcher     An event dispatcher
  */
 public function __construct($environment, $debug, $rootDir = null, sfEventDispatcher $dispatcher = null)
 {
     $this->environment = $environment;
     $this->debug = (bool) $debug;
     $this->application = str_replace('Configuration', '', get_class($this));
     parent::__construct($rootDir, $dispatcher);
     $this->configure();
     $this->initConfiguration();
     if (sfConfig::get('sf_check_lock')) {
         $this->checkLock();
     }
     if (sfConfig::get('sf_check_symfony_version')) {
         $this->checkSymfonyVersion();
     }
     $this->initialize();
     // store current sfConfig values
     $this->config = sfConfig::getAll();
 }
开发者ID:angoenka,项目名称:www,代码行数:26,代码来源:sfApplicationConfiguration.class.php

示例15: getMailTemplate

 public static function getMailTemplate($template, $target = 'pc', $params = array(), $isOptional = true, $context = null)
 {
     if (!$context) {
         $context = sfContext::getInstance();
     }
     $params['sf_config'] = sfConfig::getAll();
     $view = new sfTemplatingComponentPartialView($context, 'superGlobal', 'notify_mail:' . $target . '_' . $template, '');
     $context->set('view_instance', $view);
     $view->setPartialVars($params);
     $view->setAttribute('renderer_config', array('twig' => 'opTemplateRendererTwig'));
     $view->setAttribute('rule_config', array('notify_mail' => array(array('loader' => 'sfTemplateSwitchableLoaderDoctrine', 'renderer' => 'twig', 'model' => 'NotificationMail'), array('loader' => 'opNotificationMailTemplateLoaderConfigSample', 'renderer' => 'twig'), array('loader' => 'opNotificationMailTemplateLoaderFilesystem', 'renderer' => 'php'))));
     $view->execute();
     try {
         return $view->render();
     } catch (InvalidArgumentException $e) {
         if ($isOptional) {
             return '';
         }
         throw $e;
     }
 }
开发者ID:shotaatago,项目名称:OpenPNE3,代码行数:21,代码来源:opMailSend.class.php


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