Changeset 10025
- Timestamp:
- Jan 7, 2009, 9:10:00 PM (12 years ago)
- Location:
- OpenPNE3/trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE3/trunk/lib/config/opConfig.class.php
r10020 r10025 16 16 * @author Kousuke Ebihara <ebihara@tejimaya.com> 17 17 */ 18 class opConfig extends sfConfig 18 class opConfig extends sfConfig implements ArrayAccess 19 19 { 20 21 22 23 24 25 26 27 20 /** 21 * Retrieves a config parameter. 22 * 23 * @param string $name A config parameter name 24 * @param mixed $default A default config parameter value 25 * 26 * @return mixed A config parameter value 27 */ 28 28 public static function get($name, $default = null) 29 29 { … … 40 40 } 41 41 42 return $result; 42 sfContext::getInstance()->getConfiguration()->loadHelpers('Escaping'); 43 return sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $result); 44 } 45 46 /** 47 * Returns if the offset exists 48 * 49 * @see ArrayAccess::offsetExists() 50 */ 51 public function offsetExists($offset) 52 { 53 return(is_null(self::get($offset))); 54 } 55 56 /** 57 * Returns value at given offset 58 * 59 * @see ArrayAccess::offsetGet() 60 */ 61 public function offsetGet($offset) 62 { 63 return self::get($offset); 64 } 65 66 /** 67 * @see ArrayAccess::offsetSet() 68 */ 69 public function offsetSet($offset, $value) 70 { 71 // Nothing to do. 72 // This class is a read-only. 73 } 74 75 /** 76 * @see ArrayAccess::offsetUnSet() 77 */ 78 public function offsetUnSet($offset) 79 { 80 // Nothing to do. 81 // This class is a read-only. 43 82 } 44 83 } -
OpenPNE3/trunk/lib/config/sfOpenPNEApplicationConfiguration.class.php
r10003 r10025 23 23 { 24 24 $this->dispatcher->connect('task.cache.clear', array($this, 'clearPluginCache')); 25 $this->dispatcher->connect('template.filter_parameters', array($this, 'filterTemplateParameters')); 25 26 26 27 $this->setConfigHandlers(); … … 124 125 $filesystem->remove(sfFinder::type('any')->discard('.sf')->in($subDir)); 125 126 } 127 } 128 129 /** 130 * Listens to the template.filter_parameters event. 131 * 132 * @param sfEvent $event An sfEvent instance 133 * @param array $parameters An array of template parameters to filter 134 * 135 * @return array The filtered parameters array 136 */ 137 public function filterTemplateParameters(sfEvent $event, $parameters) 138 { 139 $parameters['op_config'] = new opConfig(); 140 sfOutputEscaper::markClassAsSafe('opConfig'); 141 return $parameters; 126 142 } 127 143 -
OpenPNE3/trunk/lib/form/SnsConfigForm.class.php
r10020 r10025 25 25 $defaults = array(); 26 26 27 foreach (sfConfig::get('openpne_sns_config') as $key => $value) { 28 $default = $value['default']; 29 $config = SnsConfigPeer::retrieveByName($key); 30 if ($config) { 31 $default = $config->getValue(); 32 } 33 27 foreach (sfConfig::get('openpne_sns_config') as $key => $value) 28 { 34 29 $widgets[$key] = $this->generateWidget($value); 35 30 $validators[$key] = $this->generateValidator($value); 36 31 $labels[$key] = $value['caption']; 37 $defaults[$key] = opConfig::get($key , 'sns', $default);32 $defaults[$key] = opConfig::get($key); 38 33 } 39 34
Note: See TracChangeset
for help on using the changeset viewer.