From 2514ce1a409a1cd3795879029bd5c973d550a6da Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Fri, 3 Dec 2010 15:07:47 +1300 Subject: [PATCH] ENHANCEMENT: allow the passing of all to set a configuration value on all instances --- code/Commenting.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/code/Commenting.php b/code/Commenting.php index 8b4bfd0..5affa70 100644 --- a/code/Commenting.php +++ b/code/Commenting.php @@ -65,14 +65,25 @@ class Commenting { } /** - * Sets a value of a given config setting + * Sets a value for a class of a given config setting. Passing 'all' as the class + * sets it for everything * - * @param string $class + * @param string $class Class to set the value on. Passing 'all' will set it to all + * active mappings * @param string $key setting to change * @param mixed $value value of the setting */ public static function set_config_value($class, $key, $value = false) { - if(isset(self::$enabled_classes[$class])) { + if($class == "all") { + if($enabledClasses = self::$enabled_classes) { + foreach($enabledClasses as $enabled) { + if(!is_array($enabled)) $enabled = array(); + + $enabled[$key] = $value; + } + } + } + else if(isset(self::$enabled_classes[$class])) { if(!is_array(self::$enabled_classes[$class])) self::$enabled_classes[$class] = array(); self::$enabled_classes[$class][$key] = $value;