Index: branches/unlabeled/unlabeled-1.21.2/core/kernel/globals.php
===================================================================
diff -u -r4086 -r4178
--- branches/unlabeled/unlabeled-1.21.2/core/kernel/globals.php (.../globals.php) (revision 4086)
+++ branches/unlabeled/unlabeled-1.21.2/core/kernel/globals.php (.../globals.php) (revision 4178)
@@ -37,51 +37,51 @@
return $return;
}
- if (!function_exists('print_pre')) {
- /**
- * Same as print_r, budet designed for viewing in web page
- *
- * @param Array $data
- * @param string $label
- */
- function print_pre($data, $label='')
+ /**
+ * Same as print_r, budet designed for viewing in web page
+ *
+ * @param Array $data
+ * @param string $label
+ */
+ function print_pre($data, $label='')
+ {
+ $is_debug = false;
+ if (class_exists('kApplication')) {
+ $application =& kApplication::Instance();
+ $is_debug = $application->isDebugMode();
+ }
+
+ if ($is_debug) {
+ if ($label) $application->Debugger->appendHTML(''.$label.'');
+ $application->Debugger->dumpVars($data);
+ }
+ else
{
- if( constOn('DEBUG_MODE') )
- {
- global $debugger;
- if($label) $debugger->appendHTML(''.$label.'');
- $debugger->dumpVars($data);
- }
- else
- {
- if($label) echo '',$label,'
';
- echo '
',print_r($data,true),''; - } + if ($label) echo '', $label, '
', print_r($data, true), ''; } } - if (!function_exists('getArrayValue')) { - /** - * Returns array value if key exists - * - * @param Array $array searchable array - * @param int $key array key - * @return string - * @access public - */ - // - function getArrayValue(&$array,$key) - { - $ret = isset($array[$key]) ? $array[$key] : false; - if ($ret && func_num_args() > 2) { - for ($i = 2; $i < func_num_args(); $i++) { - $cur_key = func_get_arg($i); - $ret = getArrayValue( $ret, $cur_key ); - if ($ret === false) break; - } + /** + * Returns array value if key exists + * + * @param Array $array searchable array + * @param int $key array key + * @return string + * @access public + */ + // + function getArrayValue(&$array, $key) + { + $ret = isset($array[$key]) ? $array[$key] : false; + if ($ret && func_num_args() > 2) { + for ($i = 2; $i < func_num_args(); $i++) { + $cur_key = func_get_arg($i); + $ret = getArrayValue( $ret, $cur_key ); + if ($ret === false) break; } - return $ret; } + return $ret; } /** @@ -101,19 +101,16 @@ $array = $new_array; } - if( !function_exists('safeDefine') ) + /** + * Define constant if it was not already defined before + * + * @param string $const_name + * @param string $const_value + * @access public + */ + function safeDefine($const_name, $const_value) { - /** - * Define constant if it was not already defined before - * - * @param string $const_name - * @param string $const_value - * @access public - */ - function safeDefine($const_name, $const_value) - { - if(!defined($const_name)) define($const_name,$const_value); - } + if(!defined($const_name)) define($const_name,$const_value); } if( !function_exists('parse_portal_ini') ) @@ -393,18 +390,15 @@ return $result; } - if( !function_exists('constOn') ) + /** + * Checks if constant is defined and has positive value + * + * @param string $const_name + * @return bool + */ + function constOn($const_name) { - /** - * Checks if constant is defined and has positive value - * - * @param string $const_name - * @return bool - */ - function constOn($const_name) - { - return defined($const_name) && constant($const_name); - } + return defined($const_name) && constant($const_name); } function Kg2Pounds($kg)