소스 검색

#171 Profiler: disable debug panel by default, don't include css/js files if debug panel isn't shown

Alex Trofimov 11 년 전
부모
커밋
48e9fba866
2개의 변경된 파일과 20개의 추가작업 그리고 20개의 파일을 삭제
  1. 19 19
      modules/boonex/profiler/classes/BxProfiler.php
  2. 1 1
      modules/boonex/profiler/install/sql/enable.sql

+ 19 - 19
modules/boonex/profiler/classes/BxProfiler.php

@@ -58,25 +58,6 @@ class BxProfiler extends BxDol
         $this->oTemplate = new BxProfilerTemplate ($this->oConfig);
         $this->oTemplateAdmin = BxDolStudioTemplate::getInstance();
 
-        $aCss = array (
-			'profiler.css',
-            BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'jush/|jush.css',
-        );
-        $aJs = array (
-            'jquery.tablesorter.min.js',
-            'profiler.js',
-            'jush/jush.js',
-        );
-
-        foreach ($aCss as $sCssUrl) {
-            $this->oTemplate->addCss($sCssUrl);
-            $this->oTemplateAdmin->addCss($sCssUrl);
-        }
-        foreach ($aJs as $sJsUrl) {
-            $this->oTemplate->addJs($sJsUrl);
-            $this->oTemplateAdmin->addJs($sJsUrl);
-        }
-
         if (getParam ('bx_profiler_long_sql_queries_log'))
             $this->aConf['long_query'] = getParam ('bx_profiler_long_sql_queries_time');
         if (getParam ('bx_profiler_long_module_query_log'))
@@ -106,6 +87,25 @@ class BxProfiler extends BxDol
             return;
         }
 
+        $aCss = array (
+			'profiler.css',
+            BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'jush/|jush.css',
+        );
+        $aJs = array (
+            'jquery.tablesorter.min.js',
+            'profiler.js',
+            'jush/jush.js',
+        );
+
+        foreach ($aCss as $sCssUrl) {
+            $this->oTemplate->addCss($sCssUrl);
+            $this->oTemplateAdmin->addCss($sCssUrl);
+        }
+        foreach ($aJs as $sJsUrl) {
+            $this->oTemplate->addJs($sJsUrl);
+            $this->oTemplateAdmin->addJs($sJsUrl);
+        }
+
         $sContentType = $this->_getHeaderContentType();
         if ('text/html' == $sContentType) {
             echo $this->_plankMain ();

+ 1 - 1
modules/boonex/profiler/install/sql/enable.sql

@@ -9,7 +9,7 @@ INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `order` )
 VALUES (@iTypeId, 'bx_profiler', 'Debug Panel', 1);
 SET @iCategoryId = LAST_INSERT_ID();
 INSERT INTO `sys_options` (`category_id`, `name`, `value`, `caption`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
-(@iCategoryId, 'bx_profiler_show_debug_panel', 'admins', 'Show debug panel below the page for', 'select', 'none,admins,all', '', '', 1);
+(@iCategoryId, 'bx_profiler_show_debug_panel', 'none', 'Show debug panel below the page for', 'select', 'none,admins,all', '', '', 1);
 
 
 INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `order` )