------------------------------------------------------------
revno: 903
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Thu 2011-10-06 21:46:12 +0200
message:
  is_debug_on added
modified:
  src/libs/config.php
  src/style.php


--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk

Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to 
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'src/libs/config.php'
--- src/libs/config.php	2011-09-29 21:22:02 +0000
+++ src/libs/config.php	2011-10-06 19:46:12 +0000
@@ -336,3 +336,23 @@
 	 global $aiki;
 	 return $aiki->config->set($setting, $value, $selector="CURRENT");
  }
+
+
+function is_debug_on(){
+	global $aiki;
+	$debug= $aiki->config->get("debug",false);
+	
+	if ( $debug=== false || $debug === true ){
+		// boolean. Backwark compatibility
+		return $debug;
+	}
+	
+	if ( $debug == 1 ||
+		($debug ==2 &&  isset($aiki->membership) &&
+			     ( $aiki->membership->permissions =="SystemGOD" ||
+			       $aiki->membership->permissions =="ModulesGOD" ))	){					   
+		return true;
+	}
+	return false;
+		
+}

=== modified file 'src/style.php'
--- src/style.php	2011-10-05 21:45:42 +0000
+++ src/style.php	2011-10-06 19:46:12 +0000
@@ -52,15 +52,12 @@
 
 	if ($get_widgets)
     {
-        
+        $debugOn = is_debug_on();
         $style="";
 		foreach ( $get_widgets as $widget )
 		{
-            /**
-             * @todo need to be able to disable all output, if not in debug
-             */
-            if ( $widget->css != "" ) {
-                $style .="\n/*CSS for the widget {$widget->widget_name} (id {$widget->id}) */\n".
+            if (  $widget->css != "" ) {
+                $style .= ( $debugOn ? "\n/*CSS for the widget {$widget->widget_name} (id {$widget->id}) */\n" : "") .
                           stripcslashes($aiki->languages->L10n($widget->css));
             }                                  
 		}

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to