Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

global_functions.php
Go to the documentation of this file.
1 <?php
17 function eZDisplayDebug()
18 {
19 $ini = eZINI::instance();
20
21 if ( $ini->variable( 'DebugSettings', 'DebugOutput' ) != 'enabled' )
22 return null;
23
24 $scriptStopTime = microtime( true );
25
26 $type = $ini->variable( "DebugSettings", "Debug" );
27 //eZDebug::setHandleType( eZDebug::HANDLE_NONE );
28 if ( $type == "inline" or $type == "popup" )
29 {
30 $asHtml = true;
31
32 if ( $ini->variable( "DebugSettings", "DebugToolbar" ) == 'enabled' &&
33 $ini->variable( "SiteAccessSettings", "CheckValidity" ) !== 'true' &&
34 $asHtml == true &&
35 !$GLOBALS['eZRedirection'] )
36
37 {
38 $tpl = eZTemplate::factory();
39 $result = "<tr><td colspan='2'>" . $tpl->fetch( 'design:setup/debug_toolbar.tpl' ) . "</td></tr>";
40 eZDebug::appendTopReport( "Debug toolbar", $result );
41 }
42
43 eZDebug::appendBottomReport( 'Template Usage Statistics', eZTemplatesStatisticsReporter::generateStatistics( $asHtml ) );
44
45 eZDebug::setScriptStop( $scriptStopTime );
46 return eZDebug::printReport( $type == "popup", $asHtml, true, false, true,
47 true, $ini->variable( "DebugSettings", "DisplayIncludedFiles" ) == 'enabled' );
48 }
49 return null;
50 }
51
56 function eZDisplayResult( $templateResult )
57 {
58 ob_start();
59 if ( $templateResult !== null )
60 {
61 $templateResult = ezpEvent::getInstance()->filter( 'response/preoutput', $templateResult );
62 $debugMarker = '<!--DEBUG_REPORT-->';
63 $pos = strpos( $templateResult, $debugMarker );
64 if ( $pos !== false )
65 {
66 $debugMarkerLength = strlen( $debugMarker );
67 echo substr( $templateResult, 0, $pos );
68 eZDisplayDebug();
69 echo substr( $templateResult, $pos + $debugMarkerLength );
70 }
71 else
72 {
73 echo $templateResult, eZDisplayDebug();
74 }
75 }
76 else
77 {
78 eZDisplayDebug();
79 }
80 echo ezpEvent::getInstance()->filter( 'response/output', ob_get_clean() );
81 }
82
88 function eZUpdateDebugSettings()
89 {
90 $settings = array();
91 list( $settings['debug-enabled'], $settings['debug-by-ip'], $settings['log-only'], $settings['debug-by-user'], $settings['debug-ip-list'], $logList, $settings['debug-user-list'] ) =
92 eZINI::instance()->variableMulti(
93 'DebugSettings',
94 array( 'DebugOutput', 'DebugByIP', 'DebugLogOnly', 'DebugByUser', 'DebugIPList', 'AlwaysLog', 'DebugUserIDList' ),
95 array( 'enabled', 'enabled', 'disabled', 'enabled' )
96 );
97 $settings['always-log'] = array();
98 foreach (
99 array(
100 'notice' => eZDebug::LEVEL_NOTICE,
101 'warning' => eZDebug::LEVEL_WARNING,
102 'error' => eZDebug::LEVEL_ERROR,
103 'debug' => eZDebug::LEVEL_DEBUG,
104 'strict' => eZDebug::LEVEL_STRICT
105 ) as $name => $level )
106 {
107 $settings['always-log'][$level] = $logList !== null && in_array( $name, $logList );
108 }
109 eZDebug::updateSettings( $settings );
110 }
111
119 function eZAppendWarningItem( $parameters = array() )
120 {
121 global $warningList;
122 $parameters += array(
123 'error' => false,
124 'text' => false,
125 'identifier' => false
126 );
127 $warningList[] = array(
128 'error' => $parameters['error'],
129 'text' => $parameters['text'],
130 'identifier' => $parameters['identifier'],
131 );
132 }
133
144 function fetchModule( eZURI $uri, $check, &$module, &$moduleName, &$functionName, &$params )
145 {
146 $moduleName = $uri->element();
147 if ( $check !== null && isset( $check["module"] ) )
148 $moduleName = $check["module"];
149
150 // Try to fetch the module object
151 $module = eZModule::exists( $moduleName );
152 if ( !( $module instanceof eZModule ) )
153 {
154 return false;
155 }
156
157 $uri->increase();
158 $functionName = "";
159 if ( !$module->singleFunction() )
160 {
161 $functionName = $uri->element();
162 $uri->increase();
163 }
164 // Override it if required
165 if ( $check !== null && isset( $check["function"] ) )
166 $functionName = $check["function"];
167
168 $params = $uri->elements( false );
169 return true;
170 }
$uri
$uri
Definition: activate.php:71
$level
$level
Definition: admin/message.php:106
$logList
$logList
Definition: bugpreview.php:124
eZDebug\LEVEL_ERROR
const LEVEL_ERROR
Definition: ezdebug.php:62
eZDebug\printReport
static printReport( $newWindow=false, $as_html=true, $returnReport=false, $allowedDebugLevels=false, $useAccumulators=true, $useTiming=true, $useIncludedFiles=false)
Definition: ezdebug.php:1225
eZDebug\setScriptStop
static setScriptStop( $time=false)
Definition: ezdebug.php:1303
eZDebug\LEVEL_STRICT
const LEVEL_STRICT
Definition: ezdebug.php:65
eZDebug\LEVEL_WARNING
const LEVEL_WARNING
Definition: ezdebug.php:61
eZDebug\updateSettings
static updateSettings( $settings)
Definition: ezdebug.php:1133
eZDebug\appendTopReport
static appendTopReport( $reportName, $reportContent)
Definition: ezdebug.php:1854
eZDebug\appendBottomReport
static appendBottomReport( $reportName, $reportContent)
Definition: ezdebug.php:1876
eZDebug\LEVEL_NOTICE
const LEVEL_NOTICE
Definition: ezdebug.php:60
eZDebug\LEVEL_DEBUG
const LEVEL_DEBUG
Definition: ezdebug.php:64
eZModule
Definition: ezmodule.php:54
eZModule\exists
exists( $name)
Definition: ezmodule.php:214
eZURI
Definition: ezuri.php:29
$ini
$ini
Definition: classes/admin/linklist.php:64
$type
$type
Definition: classes/admin/linkselect.php:220
$module
$module
Definition: classes/admin/linkselect.php:219
ezpEvent\getInstance
static getInstance()
Definition: ezpevent.php:176
$result
$result
Definition: companysearch.php:94
$name
$name
Definition: companytypelist.php:194
eZDisplayResult
eZDisplayResult( $templateResult)
Definition: global_functions.php:56
eZDisplayDebug
eZDisplayDebug()
Definition: global_functions.php:17
eZUpdateDebugSettings
eZUpdateDebugSettings()
Definition: global_functions.php:88
fetchModule
fetchModule(eZURI $uri, $check, &$module, &$moduleName, &$functionName, &$params)
Definition: global_functions.php:144
eZAppendWarningItem
eZAppendWarningItem( $parameters=array())
Definition: global_functions.php:119
$tpl
$tpl
Definition: mailtofriend.php:58
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.