本文整理汇总了PHP中sfConfig::has方法的典型用法代码示例。如果您正苦于以下问题:PHP sfConfig::has方法的具体用法?PHP sfConfig::has怎么用?PHP sfConfig::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfConfig
的用法示例。
在下文中一共展示了sfConfig::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleAction
protected function handleAction($filterChain, $actionInstance)
{
$moduleName = $actionInstance->getModuleName();
$actionName = $actionInstance->getActionName();
$request = $actionInstance->getRequest();
if ($request->needToRedirectToSoftBankGateway()) {
$request->redirectToSoftBankGateway();
}
$this->handleSsl($actionInstance);
$dispatcher = sfContext::getInstance()->getEventDispatcher();
// sfDoctrinePlugin needs to notify this event for enabling i18n
$dispatcher->notify(new sfEvent($this, 'user.change_culture', array('culture' => sfContext::getInstance()->getUser()->getCulture())));
self::notifyPreExecuteActionEvent($this, $dispatcher, $actionInstance);
Doctrine::getTable('SnsTerm')->configure(sfContext::getInstance()->getUser()->getCulture(), sfConfig::get('sf_app'));
if (sfConfig::has('op_is_use_captcha')) {
sfConfig::set('op_is_use_captcha', opConfig::get('is_use_captcha'));
}
try {
$result = parent::handleAction($filterChain, $actionInstance);
} catch (opRuntimeException $e) {
$this->forwardToErrorAction();
} catch (sfValidatorErrorSchema $e) {
if (isset($e['_csrf_token'])) {
$this->forwardToCSRFErrorAction();
}
throw $e;
}
self::notifyPostExecuteActionEvent($this, $dispatcher, $actionInstance, $result);
return $result;
}
示例2: initialize
/**
* @see sfPluginConfiguration
*/
public function initialize()
{
sfConfig::set('sf_orm', 'doctrine');
if (!sfConfig::get('sf_admin_module_web_dir')) {
sfConfig::set('sf_admin_module_web_dir', '/sfDoctrinePlugin');
}
if (sfConfig::get('sf_web_debug')) {
require_once dirname(__FILE__) . '/../lib/debug/sfWebDebugPanelDoctrine.class.php';
$this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelDoctrine', 'listenToAddPanelEvent'));
}
if (!sfConfig::has('sf_doctrine_dir')) {
// for BC
if (sfConfig::has('sfDoctrinePlugin_doctrine_lib_path')) {
sfConfig::set('sf_doctrine_dir', realpath(dirname(sfConfig::get('sfDoctrinePlugin_doctrine_lib_path'))));
} else {
sfConfig::set('sf_doctrine_dir', realpath(dirname(__FILE__) . '/../lib/vendor/doctrine'));
}
}
require_once sfConfig::get('sf_doctrine_dir') . '/Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL);
$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE);
$manager->setAttribute(Doctrine::ATTR_RECURSIVE_MERGE_FIXTURES, true);
$manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
$manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true);
// apply default attributes
$manager->setDefaultAttributes();
if (method_exists($this->configuration, 'configureDoctrine')) {
$this->configuration->configureDoctrine($manager);
}
$this->dispatcher->notify(new sfEvent($manager, 'doctrine.configure'));
}
示例3: __construct
/**
* Contructeur
* @param array $conf Paramètres de connection à l'annuaire. Les paramètres
* possibles sont : "host", "port", "options", "dn"
* "password", "basedn"
*/
public function __construct($conf = null)
{
if (!is_array($conf)) {
$conf = array();
if (sfConfig::has('app_ldap_server_host')) {
$conf['host'] = sfConfig::get('app_ldap_server_host');
}
if (sfConfig::has('app_ldap_server_port')) {
$conf['port'] = sfConfig::get('app_ldap_server_port');
}
if (sfConfig::has('app_ldap_server_dn')) {
$conf['dn'] = sfConfig::get('app_ldap_server_dn');
}
if (sfConfig::has('app_ldap_server_password')) {
$conf['password'] = sfConfig::get('app_ldap_server_password');
}
if (sfConfig::has('app_ldap_server_basedn')) {
$conf['basedn'] = sfConfig::get('app_ldap_server_basedn');
}
if (sfConfig::has('app_ldap_server_options')) {
$conf['options'] = sfConfig::get('app_ldap_server_options');
}
}
$this->config = $conf;
}
示例4: _getAmfEndPoint
/**
* A url where to send amf requests.
*
* @abstract
*
* @return string
*/
protected function _getAmfEndPoint($key = 'app_amf_endpoint')
{
if (!sfConfig::has($key)) {
throw new Exception('The gateway url for testing amf services must be set in app.yml config file. The app.yml option should have a name `' . $key . '`');
}
return sfConfig::get($key);
}
示例5: analytics
/**
* Returns the Analytics integration code snippet.
*
* See: http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html
*
* @package Reditype
* @subpackage helper
* @author Piers Warmers <piers@wranglers.com.au>
* @param string $web_property_id
* @return string
*/
function analytics($web_property_id = null)
{
if (is_null($web_property_id) && !sfConfig::has('app_rt_analytics_web_property_id')) {
return '';
}
$web_property_id = is_null($web_property_id) ? sfConfig::get('app_rt_analytics_web_property_id') : $web_property_id;
$domain = '';
if (sfConfig::has('app_rt_analytics_web_property_domain')) {
$domain = "_gaq.push(['_setDomainName', '" . sfConfig::get('app_rt_analytics_web_property_domain') . "']);";
}
$string = <<<EOS
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{$web_property_id}']);
{$domain}
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
EOS;
return $string;
}
示例6: grantApiAccess
/**
* Authenticate API access
*
* @param String $key
* @return Boolean True for access granted
*/
public static function grantApiAccess($key)
{
if (!sfConfig::has('app_rt_api_key') || $key !== sfConfig::get('app_rt_api_key')) {
return false;
}
return true;
}
示例7: createSlug
/**
* Returns the appropiate slug to save
*
* @param BaseObject $node
* @param string $from Column from which slug is generated
*/
public function createSlug(BaseObject $node)
{
$peer_name = get_class($node->getPeer());
$node_class = get_class($node);
$getter = self::forgeMethodName($node, 'get', 'from');
$column = self::getColumnConstant($node_class, 'to');
$conf_separator = sprintf('propel_behavior_sfPropelActAsSluggableBehavior_%s_separator', $node_class);
$separator = sfConfig::has($conf_separator) ? sfConfig::get($conf_separator) : $this->default_separator;
$slug = sfPropelActAsSluggableBehaviorUtils::stripText($node->{$getter}(), $separator);
$ret = $slug;
$i = 0;
$conf_scope = sprintf('propel_behavior_sfPropelActAsSluggableBehavior_%s_scope', $node_class);
$scope = sfConfig::has($conf_scope) ? sfConfig::get($conf_scope) : array();
$scope_criteria = new Criteria();
foreach ($scope as $my_col) {
$getter = 'get' . call_user_func(array($peer_name, 'translateFieldName'), $column, BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
$scope_criteria->add($column, $node->{$getter}());
}
while (1) {
$c = clone $scope_criteria;
$c->add($column, $ret);
$entry = call_user_func(array($peer_name, 'doSelectOne'), $c);
if ($entry && !$entry->equals($node)) {
$i++;
$ret = $slug . $separator . $i;
} else {
return $ret;
}
}
}
示例8: initialize
/**
* @see sfPluginConfiguration
*/
public function initialize()
{
if (!sfConfig::has('app_tmcTwitterBootstrapPlugin_header')) {
// throw new sfException('Make sure you copy app.yml to your application and set plugin configuration values.');
}
if (!in_array('tmcTwitterBootstrap', sfConfig::get('sf_enabled_modules', array()))) {
// throw new sfException('Make sure you enable the tmcTwitterBootstrap module in your application settings.');
}
}
示例9: configure
public function configure()
{
// TODO: They must be managed by an original config handler
$colors = array('core_color_1' => '#FFFFFF', 'core_color_2' => '#0D6DDF', 'core_color_3' => '#DDDDDD', 'core_color_4' => '#EEEEFF', 'core_color_5' => '#7DDADF', 'core_color_6' => '#E0EAEF', 'core_color_7' => '#FFFFFF', 'core_color_8' => '#C49FFF', 'core_color_9' => '#DCD1EF', 'core_color_10' => '#FFFFFF', 'core_color_11' => '#0D6DDF', 'core_color_12' => '#B3CEEF', 'core_color_13' => '#BFA4EF', 'core_color_14' => '#000000', 'core_color_15' => '#0000FF', 'core_color_23' => '#FFFFFF', 'core_color_17' => '#800080', 'core_color_18' => '#EEEEEE', 'core_color_19' => '#999966', 'core_color_20' => '#0C5F0F', 'core_color_21' => '#C49FFF', 'core_color_22' => '#FF0000', 'core_color_24' => '#000000', 'core_color_25' => '#000000', 'core_color_26' => '#000000', 'core_color_27' => '#DDDDDD', 'core_color_28' => '#000000');
$prefix = 'op_' . sfConfig::get('sf_app') . '_color_config_';
foreach ($colors as $key => $value) {
if (!sfConfig::has($prefix . $key)) {
sfConfig::set($prefix . $key, $value);
}
}
}
示例10: creaateTransform
protected function creaateTransform()
{
if (!defined('IMAGE_TRANSFORM_IM_PATH') && sfConfig::has('op_imagemagick_path')) {
// follow 2.x format (for BC reason)
$path = dirname(sfConfig::get('op_imagemagick_path')) . DIRECTORY_SEPARATOR;
define('IMAGE_TRANSFORM_IM_PATH', $path);
}
$result = Image_Transform::factory('IM');
if (PEAR::isError($result)) {
throw new RuntimeException($result->getMessage());
}
return $result;
}
示例11: get_social_networking_badge
/**
* Return a badge
*
* @package Reditype
* @subpackage helper
* @author Piers Warmers <piers@wranglers.com.au>
* @param array $options
* @return string
*/
function get_social_networking_badge($options = null)
{
if (sfConfig::get('app_rt_social_networking_service') === 'tweetmeme') {
return get_tweetmeme_badge($options);
}
if (!sfConfig::has('app_rt_social_networking_service') || !sfConfig::has('app_rt_social_networking_service_username')) {
return '';
}
if (sfConfig::get('app_rt_social_networking_service') === 'addthis') {
return get_addthis_badge($options);
}
if (sfConfig::get('app_rt_social_networking_service') === 'sharethis') {
return get_sharethis_badge($options);
}
}
示例12: __construct
/**
* Contructeur
*
* @param array $conf Paramètres de connection à la bas. Les paramètres
* obligatoires sont : "host", "pdo", "dbname",
"username", "password"
*/
public function __construct($conf = null)
{
if (!is_array($conf)) {
$conf = array();
$conf['host'] = sfConfig::has('app_bdd_server_host') ? sfConfig::get('app_bdd_server_host') : 'localhost';
$conf['pdo'] = sfConfig::has('app_bdd_server_pdo') ? sfConfig::get('app_bdd_server_pdo') : 'mysql';
$conf['db'] = sfConfig::has('app_bdd_server_dbname') ? sfConfig::get('app_bdd_server_dbname') : 'rdvz';
$conf['user'] = sfConfig::get('app_bdd_server_username');
$conf['pass'] = sfConfig::get('app_bdd_server_password');
$conf['user_tab'] = sfConfig::has('app_bdd_infos_user_table_name') ? sfConfig::get('app_bdd_infos_user_table_name') : 'user';
$conf['user_login'] = sfConfig::has('app_bdd_infos_user_login_field') ? sfConfig::get('app_bdd_infos_user_login_field') : 'login';
$conf['user_pass'] = sfConfig::has('app_bdd_infos_user_pass_field') ? sfConfig::get('app_bdd_infos_user_pass_field') : 'pass';
$conf['pass_crypt'] = sfConfig::has('app_bdd_infos_user_pass_encrypt') ? sfConfig::get('app_bdd_infos_user_pass_encrypt') : 'sha1';
}
$this->config = $conf;
}
示例13: get_nested_set_manager
function get_nested_set_manager($model, $field, $root = 0)
{
if (!sfConfig::has('app_sfJqueryTree_withContextMenu')) {
sfConfig::set('app_sfJqueryTree_withContextMenu', true);
}
sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/jsTree/themes/default/style.css');
sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/css/screen.css');
// by vit
// sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.js');
sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.cookie.js');
sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.tree.min.js');
sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/plugins/jquery.tree.cookie.js');
if (sfConfig::get('app_sfJqueryTree_withContextMenu')) {
sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/plugins/jquery.tree.contextmenu.js');
}
return get_component('sfJqueryTreeDoctrineManager', 'manager', array('model' => $model, 'field' => $field, 'root' => $root));
}
示例14: light_image_activate
function light_image_activate()
{
if (!sfContext::hasInstance()) {
return;
}
//add resources
$response = sfContext::getInstance()->getResponse();
//check if jqueryreloaded plugin is activated
if (sfConfig::has('sf_jquery_web_dir') && sfConfig::has('sf_jquery_core')) {
$response->addJavascript(sfConfig::get('sf_jquery_web_dir') . '/js/' . sfConfig::get('sf_jquery_core'));
} else {
throw new Exception("Theres is no JqueryReloaded plugin !");
}
//JQuery Lightbox specific
$response->addJavascript(sfConfig::get("app_sf_jquery_lightbox_js_dir") . 'jquery.lightbox-0.5.js');
$response->addStylesheet(sfConfig::get("app_sf_jquery_lightbox_css_dir") . 'jquery.lightbox-0.5.css');
$code = "\$(function() {\r\n \$('a.lightbox').lightBox({\r\n imageLoading: '" . sfConfig::get('app_sf_jquery_lightbox_imageLoading') . "',\r\n imageBtnClose: '" . sfConfig::get('app_sf_jquery_lightbox_imageBtnClose') . "',\r\n imageBtnPrev: '" . sfConfig::get('app_sf_jquery_lightbox_imageBtnPrev') . "',\r\n imageBtnNext: '" . sfConfig::get('app_sf_jquery_lightbox_imageBtnNext') . "',\r\n imageBlank: '" . sfConfig::get('app_sf_jquery_lightbox_imageBlank') . "',\r\n txtImage: '" . sfConfig::get('app_sf_jquery_lightbox_txtImage') . "',\r\n txtOf: '" . sfConfig::get('app_sf_jquery_lightbox_txtOf') . "' });\r\n });";
echo javascript_tag($code);
}
示例15: initialize
public function initialize($options)
{
if (isset($options['filename'])) {
$class = self::getStorageClassName();
$this->storage = call_user_func(array($class, 'find'), $options['filename'], $class);
}
if (!sfConfig::has('op_image_generator_name')) {
$isMagick = sfConfig::get('op_use_imagemagick', 0);
if (2 == $isMagick || 1 == $isMagick && 'gif' === $options['format']) {
sfConfig::set('op_image_generator_name', 'IM');
} else {
sfConfig::set('op_image_generator_name', 'GD');
}
}
$className = 'sfImageGenerator' . sfConfig::get('op_image_generator_name');
if (!class_exists($className)) {
throw new RuntimeException(sprintf('The specified image handler, %s is not found', $className));
}
$this->generator = new $className($options);
$this->options = $options;
}