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


PHP sfConfig类代码示例

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


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

示例1: getNextHost

 public function getNextHost()
 {
     if (self::$aHostNumber >= self::$aHostCount) {
         self::$aHostNumber = 0;
     }
     return self::$aHosts[self::$aHostNumber++] . "/" . sfConfig::get('app_amazons3_bucket');
 }
开发者ID:42medien,项目名称:spreadly,代码行数:7,代码来源:CdnSingleton.php

示例2: execute

 /**
  * Executes this filter.
  *
  * @param sfFilterChain A sfFilterChain instance.
  */
 public function execute($filterChain)
 {
     $context = $this->getContext();
     $userAttributeHolder = $context->getUser()->getAttributeHolder();
     // execute this filter only once
     if ($this->isFirstCall()) {
         // flag current flash to be removed after the execution filter
         $names = $userAttributeHolder->getNames('symfony/flash');
         if ($names) {
             if (sfConfig::get('sf_logging_enabled')) {
                 $context->getLogger()->info('{sfFilter} flag old flash messages ("' . implode('", "', $names) . '")');
             }
             foreach ($names as $name) {
                 $userAttributeHolder->set($name, true, 'symfony/flash/remove');
             }
         }
     }
     // execute next filter
     $filterChain->execute();
     // remove flash that are tagged to be removed
     $names = $userAttributeHolder->getNames('symfony/flash/remove');
     if ($names) {
         if (sfConfig::get('sf_logging_enabled')) {
             $context->getLogger()->info('{sfFilter} remove old flash messages ("' . implode('", "', $names) . '")');
         }
         foreach ($names as $name) {
             $userAttributeHolder->remove($name, 'symfony/flash');
             $userAttributeHolder->remove($name, 'symfony/flash/remove');
         }
     }
 }
开发者ID:taryono,项目名称:school,代码行数:36,代码来源:sfFlashFilter.class.php

示例3: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     require_once dirname(__FILE__) . '/sfLimeHarness.class.php';
     $h = new sfLimeHarness(array('force_colors' => isset($options['color']) && $options['color'], 'verbose' => isset($options['trace']) && $options['trace']));
     $h->addPlugins(array_map(array($this->configuration, 'getPluginConfiguration'), $this->configuration->getPlugins()));
     $h->base_dir = sfConfig::get('sf_test_dir');
     $status = false;
     $statusFile = sfConfig::get('sf_cache_dir') . '/.test_all_status';
     if ($options['only-failed']) {
         if (file_exists($statusFile)) {
             $status = unserialize(file_get_contents($statusFile));
         }
     }
     if ($status) {
         foreach ($status as $file) {
             $h->register($file);
         }
     } else {
         // filter and register all tests
         $finder = sfFinder::type('file')->follow_link()->name('*Test.php');
         $h->register($this->filterTestFiles($finder->in($h->base_dir), $arguments, $options));
     }
     $ret = $h->run() ? 0 : 1;
     file_put_contents($statusFile, serialize($h->get_failed_files()));
     if ($options['xml']) {
         file_put_contents($options['xml'], $h->to_xml());
     }
     return $ret;
 }
开发者ID:sensorsix,项目名称:app,代码行数:32,代码来源:sfTestAllTask.class.php

示例4: setPerformanceTrackList

 public function setPerformanceTrackList()
 {
     $auth = Auth::instance();
     $loggedInEmpNumber = $auth->getEmployeeNumber();
     $searchParameter = array('page' => $this->getPageNumber(), 'limit' => sfConfig::get('app_items_per_page'), 'employeeId' => $loggedInEmpNumber);
     $this->performanceTrackList = $this->getPerformanceTrackerService()->getPerformanceTrackerByEmployee($searchParameter);
 }
开发者ID:adwalk,项目名称:juming,代码行数:7,代码来源:viewMyPerformanceTrackerListAction.class.php

示例5: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     if (count($arguments['name'])) {
         $files = array();
         foreach ($arguments['name'] as $name) {
             $finder = sfFinder::type('file')->follow_link()->name(basename($name) . 'Test.php');
             $files = array_merge($files, $finder->in(sfConfig::get('sf_test_dir') . '/unit/' . dirname($name)));
         }
         if ($allFiles = $this->filterTestFiles($files, $arguments, $options)) {
             foreach ($allFiles as $file) {
                 include $file;
             }
         } else {
             $this->logSection('test', 'no tests found', null, 'ERROR');
         }
     } else {
         require_once __DIR__ . '/sfLimeHarness.class.php';
         $h = new sfLimeHarness(array('force_colors' => isset($options['color']) && $options['color'], 'verbose' => isset($options['trace']) && $options['trace'], 'test_path' => sfConfig::get('sf_cache_dir') . '/lime'));
         $h->addPlugins(array_map(array($this->configuration, 'getPluginConfiguration'), $this->configuration->getPlugins()));
         $h->base_dir = sfConfig::get('sf_test_dir') . '/unit';
         // filter and register unit tests
         $finder = sfFinder::type('file')->follow_link()->name('*Test.php');
         $h->register($this->filterTestFiles($finder->in($h->base_dir), $arguments, $options));
         $ret = $h->run() ? 0 : 1;
         if ($options['xml']) {
             file_put_contents($options['xml'], $h->to_xml());
         }
         return $ret;
     }
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:33,代码来源:sfTestUnitTask.class.php

示例6: add

 public static function add($class, $behaviors)
 {
     foreach ($behaviors as $name => $parameters) {
         if (is_int($name)) {
             // no parameters
             $name = $parameters;
         } else {
             // register parameters
             foreach ($parameters as $key => $value) {
                 sfConfig::set('propel_behavior_' . $name . '_' . $class . '_' . $key, $value);
             }
         }
         if (!isset(self::$behaviors[$name])) {
             throw new sfConfigurationException(sprintf('Propel behavior "%s" is not registered', $name));
         }
         // register hooks
         foreach (self::$behaviors[$name]['hooks'] as $hook => $callables) {
             foreach ($callables as $callable) {
                 sfMixer::register('Base' . $class . $hook, $callable);
             }
         }
         // register new methods
         foreach (self::$behaviors[$name]['methods'] as $callable) {
             sfMixer::register('Base' . $class, $callable);
         }
     }
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:27,代码来源:sfPropelBehavior.class.php

示例7: forum_breadcrumb

function forum_breadcrumb($params, $options = array())
{
    if (!$params) {
        return;
    }
    $first = true;
    $title = '';
    $id = isset($options['id']) ? $options['id'] : 'forum_navigation';
    $html = '<ul id="' . $id . '">';
    foreach ($params as $step) {
        $separator = $first ? '' : sfConfig::get('app_sfSimpleForumPlugin_breadcrumb_separator', ' » ');
        $first = false;
        $html .= '<li>' . $separator;
        $title .= $separator;
        if (is_array($step)) {
            $html .= link_to($step[0], $step[1]);
            $title .= $step[0];
        } else {
            $html .= $step;
            $title .= $step;
        }
        $html .= '</li>';
    }
    $html .= '</ul>';
    sfContext::getInstance()->getResponse()->setTitle($title);
    return $html;
}
开发者ID:kriswallsmith,项目名称:sfSimpleForumPlugin,代码行数:27,代码来源:sfSimpleForumHelper.php

示例8: dispatch

 /**
  * Dispatches a request.
  *
  * This will determine which module and action to use by request parameters specified by the user.
  */
 public function dispatch()
 {
     try {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->getContext()->getLogger()->info('{sfController} dispatch request');
         }
         // reinitialize filters (needed for unit and functional tests)
         sfFilter::$filterCalled = array();
         // determine our module and action
         $request = $this->getContext()->getRequest();
         $moduleName = $request->getParameter('module');
         $actionName = $request->getParameter('action');
         // make the first request
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         $e->printStackTrace();
     } catch (Exception $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         try {
             // wrap non symfony exceptions
             $sfException = new sfException();
             $sfException->printStackTrace($e);
         } catch (Exception $e) {
             header('HTTP/1.0 500 Internal Server Error');
         }
     }
 }
开发者ID:taryono,项目名称:school,代码行数:37,代码来源:sfFrontWebController.class.php

示例9: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $this->logSection('Create directory', "Visiteur");
     $q = Doctrine_Query::create()->from('Visiteur v');
     $visiteurs = $q->execute();
     foreach ($visiteurs as $visiteur) {
         $visiteur->createDataFolder();
     }
     $this->logSection('Create directory', "Interactif");
     $q = Doctrine_Query::create()->from('Interactif i');
     $interactifs = $q->execute();
     foreach ($interactifs as $interactif) {
         $interactif->createDataFolder();
     }
     $this->logSection('Create directory', "Exposition");
     $q = Doctrine_Query::create()->from('Exposition v');
     $expositions = $q->execute();
     foreach ($expositions as $exposition) {
         $exposition->createDataFolder();
     }
     $this->logSection('Create directory', "Medaille");
     $fileSystem = new sfFilesystem();
     $fileSystem->mkdirs(sfConfig::get('sf_web_dir') . "/medaille");
     $this->logSection('Create directory', "MedailleType");
     $fileSystem = new sfFilesystem();
     $fileSystem->mkdirs(sfConfig::get('sf_web_dir') . "/medaille_type");
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:30,代码来源:createUserMediaTask.class.php

示例10: setup

 public function setup()
 {
     parent::setup();
     $this->widgetSchema['image'] = new sfWidgetFormInputFileEditable(array('file_src' => '/uploads/' . sfConfig::get('app_sfSimpleForumPlugin_upload_dir', '') . $this->getObject()->getImage(), 'is_image' => true, 'edit_mode' => !$this->isNew(), 'with_delete' => true));
     $this->validatorSchema['image'] = new sfValidatorFile(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_sfSimpleForumPlugin_upload_dir', ''), 'mime_types' => 'web_images'));
     $this->validatorSchema['image_delete'] = new sfValidatorBoolean();
 }
开发者ID:j0k3r,项目名称:sfDoctrineSimpleForumPlugin,代码行数:7,代码来源:PluginsfSimpleForumRankForm.class.php

示例11: initializeSympal

 /**
  * Methods used by unit.php and functional.php bootstrap files
  */
 public function initializeSympal()
 {
     copy(sfConfig::get('sf_data_dir') . '/fresh_test_db.sqlite', sfConfig::get('sf_data_dir') . '/test.sqlite');
     if (isset($this->pluginConfigurations['sfSympalPlugin'])) {
         $this->pluginConfigurations['sfSympalPlugin']->getSympalConfiguration()->getCache()->primeCache(true);
     }
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:10,代码来源:ProjectConfiguration.class.php

示例12: save

 public function save(Doctrine_Connection $conn = null)
 {
     try {
         $this->setIsTosync(1);
         parent::save($conn);
         if ($this->getGainId() != null) {
             $send_email_visiteur_template_id = $this->getGain()->getSendEmailVisiteurTemplateId();
             $send_email_admin_template_id = $this->getGain()->getSendEmailAdminTemplateId();
             if ($send_email_visiteur_template_id || $send_email_admin_template_id) {
                 $visiteur = Doctrine_Core::getTable('Visiteur')->findOneBy('guid', $this->getVisiteurId());
                 $gain = $this->getGain();
                 $univers_status = $this->getUniversStatus();
                 $visiteur_email = $visiteur->getEmail();
                 $admin_email = sfConfig::get('app_gain_admin_email', null);
                 $array_replace = array('$visiteur_pseudo' => $visiteur->getPseudoSon(), '$visiteur_nom' => $visiteur->getNom(), '$visiteur_prenom' => $visiteur->getPrenom(), '$visiteur_adresse1' => $visiteur->getAdresse(), '$visiteur_adresse2' => $visiteur->getAdresse2(), '$visiteur_cp' => $visiteur->getCodePostal(), '$visiteur_ville' => $visiteur->getVille(), '$visiteur_num_mobile' => $visiteur->getNumMobile(), '$visiteur_email' => $visiteur->getEmail(), '$host_image_src' => sfConfig::get('app_host_image_src'), '$gain_libelle' => $gain->getLibelle(), '$gain_image' => $gain->getImage(), '$gain_description' => $gain->getDescription(), '$gain_start_at' => $gain->getStartAt(), '$gain_end_at' => $gain->getEndAt(), '$univers_status_level' => $univers_status->getLevel(), '$univers_status_level_name' => $univers_status->getLevelName(), '$univers_status_description' => $univers_status->getDescription(), '$univers_status_libelle' => $univers_status->getLibelle());
             }
             // envoi d'un email au visiteur
             if ($send_email_visiteur_template_id && $visiteur_email) {
                 $template = Doctrine_Query::create()->from('TemplateMail t')->where('t.guid = ?', $send_email_visiteur_template_id)->fetchOne();
                 if ($template !== false) {
                     $template->sendEmail($visiteur_email, $array_replace);
                 }
             }
             // envoi d'un email a l'admin
             if ($send_email_admin_template_id && $admin_email) {
                 $template = Doctrine_Query::create()->from('TemplateMail t')->where('t.guid = ?', $send_email_admin_template_id)->fetchOne();
                 if ($template !== false) {
                     $template->sendEmail($admin_email, $array_replace);
                 }
             }
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:35,代码来源:VisiteurUniversStatusGain.class.php

示例13: setDynamicRules

 public function setDynamicRules()
 {
     $context = $this->getContext();
     $user = $context->getUser();
     $request = $context->getRequest();
     $module = $request->getParameter('module');
     $action = $request->getParameter('action');
     $cache = false;
     $lifetime = 0;
     $withLayout = false;
     //the following actions will not be hard cached when access is restricted to admins only
     $nuclearCachingExceptions = array('sfGuardAuth' => array('signin' => true), 'home' => array('contact' => true, 'join' => true, 'confirmed' => true, 'requested' => true, 'joined' => true, 'confirmEmail' => true, 'chat' => true));
     //if access is restricted to admins only, pages not in the home module will be cached for a week
     if (sfConfig::get('app_login_admin_only') == 'on' && (!$user->isAuthenticated() || !sfGuardUserTable::isAdmin($user->getGuardUser()->id)) && !isset($nuclearCachingExceptions[$module][$action])) {
         $cache = true;
         $withLayout = true;
         $lifetime = self::WEEK_LIFETIME;
     } elseif ($lifetime = self::$alwaysCached[$module][$action]) {
         $cache = true;
         $withLayout = $request->isXmlHttpRequest() || !$user->isAuthenticated();
     } elseif (!$user->isAuthenticated() && ($lifetime = self::$outsideCached[$module][$action])) {
         $cache = true;
         $withLayout = true;
     } elseif ($user->isAuthenticated() && ($lifetime = self::$insideCached[$module][$action])) {
         $cache = true;
         $withLayout = false;
     }
     if ($cache) {
         $context->getViewCacheManager()->addCache($module, $action, array('withLayout' => $withLayout, 'lifeTime' => $lifetime));
     }
 }
开发者ID:silky,项目名称:littlesis,代码行数:31,代码来源:LsCacheFilter.class.php

示例14: __construct

 /**
  * Constructor
  * @param object         $class
  * @param integer        $maxPerPage
  * @param sfSphinxClient $sphinx
  */
 public function __construct($class, $maxPerPage = 10, sfSphinxClient $sphinx)
 {
     if (sfConfig::get('sf_logging_enabled')) {
         sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent(null, 'application.log', array('Class ' . __CLASS__ . ' is deprecated in favor of sfSphinxPropelPager.', 'priority' => sfLogger::ERR)));
     }
     parent::__construct($class, $maxPerPage, $sphinx);
 }
开发者ID:pkdevbox,项目名称:mootools-forge,代码行数:13,代码来源:sfSphinxPager.class.php

示例15: sendNotification

 public static function sendNotification($c, $projects, $send_to, $sf_user)
 {
     foreach ($send_to as $type => $users) {
         switch ($type) {
             case 'status':
                 $subject = t::__('Project Status Updated');
                 break;
             default:
                 $subject = t::__('New Project');
                 break;
         }
         $to = array();
         foreach ($users as $v) {
             if ($u = Doctrine_Core::getTable('Users')->find($v)) {
                 $to[$u->getEmail()] = $u->getName();
             }
         }
         $user = $sf_user->getAttribute('user');
         $from[$user->getEmail()] = $user->getName();
         $to[$projects->getUsers()->getEmail()] = $projects->getUsers()->getName();
         $to[$user->getEmail()] = $user->getName();
         if (sfConfig::get('app_send_email_to_owner') == 'off') {
             unset($to[$user->getEmail()]);
         }
         $subject .= ': ' . $projects->getName() . ($projects->getProjectsStatusId() > 0 ? ' [' . $projects->getProjectsStatus()->getName() . ']' : '');
         $body = $c->getComponent('projects', 'emailBody', array('projects' => $projects));
         Users::sendEmail($from, $to, $subject, $body, $sf_user);
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:29,代码来源:Projects.class.php


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