本文整理汇总了PHP中sfConfig::get方法的典型用法代码示例。如果您正苦于以下问题:PHP sfConfig::get方法的具体用法?PHP sfConfig::get怎么用?PHP sfConfig::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfConfig
的用法示例。
在下文中一共展示了sfConfig::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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('rdvz', "Retrieving users...") ;
$ldap = new uapvLdap() ;
$users = Doctrine::getTable('user')->retrieveLdapUsers() ;
$this->logSection('rdvz', "Updating information...") ;
foreach($users as $user)
{
$us = $ldap->searchOne(sfConfig::get('app_profile_var_translation_uid')."=".$user->getLdapId()) ;
$user->setName($us[sfConfig::get('app_profile_var_translation_name')]) ;
$user->setSurname($us[sfConfig::get('app_profile_var_translation_surname')]) ;
$user->setMail($us[sfConfig::get('app_profile_var_translation_mail')]) ;
$user->save();
}
$this->logSection('rdvz', "Done.") ;
}
示例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');
}
}
}
示例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;
}
示例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);
}
示例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;
}
}
示例6: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
parent::execute($arguments, $options);
$projectWebPath = sfConfig::get('sf_web_dir');
$filesystem = new dmFilesystem($this->dispatcher, $this->formatter);
foreach (array('dmAdminPlugin', 'dmFrontPlugin') as $plugin) {
$this->logSection('plugin', 'Configuring plugin - ' . $plugin);
$this->installPluginAssets($plugin, dm::getDir() . '/' . $plugin);
}
// remove useless doctrine assets
if (is_readable($doctrineAssetPath = dmOs::join($projectWebPath, 'sfDoctrinePlugin'))) {
if (!is_link($doctrineAssetPath)) {
$filesystem->deleteDirContent($doctrineAssetPath);
}
$filesystem->remove($doctrineAssetPath);
}
// remove web cache dir
$webCacheDir = sfConfig::get('sf_web_dir') . '/cache';
if (is_link($webCacheDir)) {
$filesystem->remove($webCacheDir);
}
// create web cache dir
$filesystem->mkdir($webCacheDir);
if (!file_exists(dmOs::join($projectWebPath, 'sf'))) {
$filesystem->relativeSymlink(realpath(sfConfig::get('sf_symfony_lib_dir') . '/../data/web/sf'), dmOs::join($projectWebPath, 'sf'), true);
}
}
示例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;
}
示例8: 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();
}
示例9: 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);
}
}
示例10: 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));
}
}
示例11: 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());
}
}
示例12: __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);
}
示例13: getNextHost
public function getNextHost()
{
if (self::$aHostNumber >= self::$aHostCount) {
self::$aHostNumber = 0;
}
return self::$aHosts[self::$aHostNumber++] . "/" . sfConfig::get('app_amazons3_bucket');
}
示例14: execute
/**
* Executes this configuration handler.
*
* @param array $configFiles An array of absolute filesystem path to a configuration file
*
* @return string Data to be written to a cache file
*
* @throws sfConfigurationException If a requested configuration file does not exist or is not readable
* @throws sfParseException If a requested configuration file is improperly formatted
*/
public function execute($configFiles)
{
// parse the yaml
$config = self::getConfiguration($configFiles);
// init our data
$data = '';
// let's do our fancy work
foreach ($config as $file) {
if (!is_readable($file)) {
// file doesn't exist
throw new sfParseException(sprintf('Configuration file "%s" specifies nonexistent or unreadable file "%s".', $configFiles[0], $file));
}
$contents = file_get_contents($file);
// strip comments (not in debug mode)
if (!sfConfig::get('sf_debug')) {
$contents = sfToolkit::stripComments($contents);
}
// strip php tags
$contents = sfToolkit::pregtr($contents, array('/^\\s*<\\?(php\\s*)?/m' => '', '/^\\s*\\?>/m' => ''));
// replace windows and mac format with unix format
$contents = str_replace("\r", "\n", $contents);
// replace multiple new lines with a single newline
$contents = preg_replace(array('/\\s+$/Sm', '/\\n+/S'), "\n", $contents);
// append file data
$data .= "\n" . $contents;
}
// compile data
return sprintf("<?php\n" . "// auto-generated by sfCompileConfigHandler\n" . "// date: %s\n" . "%s\n", date('Y/m/d H:i:s'), $data);
}
示例15: _generateNextLink
private function _generateNextLink($application)
{
if ($application === 'backend') {
return sfConfig::get('app_backend_url') . '' . $_SERVER['REQUEST_URI'];
}
return sfConfig::get('app_frontend_url') . '' . $_SERVER['REQUEST_URI'];
}