0
- * Shortcut to the print_r function.
0
- * Wraps the output in <pre> and </pre> for easy reading
0
-function pr($var, $exit = 1)
0
- * Simple template parser
0
-function parse_template($template, $tpl_array, $warn=0)
0
- while ( list ($key,$val) = each ($tpl_array) )
0
- if(gettype($val) != "string")
0
- settype($val,"string");
0
- $template = eregi_replace('\{' . $key . '\}',$val,$template);
0
- // Silently remove anything not already found
0
- $template = ereg_replace('\{[A-Z0-9_]+\}', "", $template);
0
- // Warn about unresolved template variables
0
- if (ereg('\{[A-Z0-9_]+\}',$template))
0
- $unknown = split("\n",$template);
0
- while (list ($Element,$Line) = each($unknown) )
0
- $this->show_unknowns($UnkVar);
0
-} // end parse_template();
0
-function cms_html_entities($string, $param=ENT_QUOTES, $charset="UTF-8")
0
- #$result = htmlentities($string, $param, $charset);
0
- $result = my_htmlentities($string);
0
-function cms_htmlentities($string, $param=ENT_QUOTES, $charset="UTF-8")
0
- return cms_html_entities($string, $param, $charset);
0
* Enter description here...
0
@@ -112,215 +36,27 @@ function cms_htmlentities($string, $param=ENT_QUOTES, $charset="UTF-8")
0
* ENT_QUOTES : Will convert both double and single quotes.
0
* ENT_NOQUOTES : Will leave both double and single quotes unconverted.
0
-function my_htmlentities($val)
0
+function cms_htmlentities($val, $param=ENT_QUOTES, $charset="UTF-8")
0
$val = str_replace( " ", " ", $val );
0
- //Remove sneaky spaces
0
- // $val = str_replace( chr(0xCA), "", $val );
0
$val = str_replace( "&" , "&" , $val );
0
$val = str_replace( "<!--" , "<!--" , $val );
0
$val = str_replace( "-->" , "-->" , $val );
0
$val = preg_replace( "/<script/i" , "<script" , $val );
0
$val = str_replace( ">" , ">" , $val );
0
$val = str_replace( "<" , "<" , $val );
0
$val = str_replace( "\"" , """ , $val );
0
- // Uncomment it if you need to convert literal newlines
0
- //$val = preg_replace( "/\n/" , "<br>" , $val );
0
$val = preg_replace( "/\\$/" , "$" , $val );
0
- // Uncomment it if you need to remove literal carriage returns
0
- //$val = preg_replace( "/\r/" , "" , $val );
0
$val = str_replace( "!" , "!" , $val );
0
$val = str_replace( "'" , "'" , $val );
0
- // Uncomment if you need to convert unicode chars
0
- //$val = preg_replace("/&#([0-9]+);/s", "&#\1;", $val );
0
- // Strip slashes if not already done so.
0
- //if ( get_magic_quotes_gpc() )
0
- // $val = stripslashes($val);
0
- // Swop user inputted backslashes
0
- //$val = preg_replace( "/\(?!&#|?#)/", "\", $val );
0
- * Enter description here...
0
-function cms_utf8_entities($val)
0
- $val = str_replace( " ", " ", $val );
0
- //Remove sneaky spaces
0
- // $val = str_replace( chr(0xCA), "", $val );
0
- $val = str_replace( "&" , "\u0026" , $val );
0
-# $val = str_replace( "<!--" , "<!--" , $val );
0
-# $val = str_replace( "-->" , "-->" , $val );
0
-# $val = preg_replace( "/<script/i" , "<script" , $val );
0
- $val = str_replace( ">" , "\u003E" , $val );
0
- $val = str_replace( "<" , "\u003C" , $val );
0
- $val = str_replace( "\"" , "\u0022" , $val );
0
- // Uncomment it if you need to convert literal newlines
0
- //$val = preg_replace( "/\n/" , "<br>" , $val );
0
- #$val = preg_replace( "/\\$/" , "$" , $val );
0
- // Uncomment it if you need to remove literal carriage returns
0
- //$val = preg_replace( "/\r/" , "" , $val );
0
- $val = str_replace( "!" , "\u0021" , $val );
0
- $val = str_replace( "'" , "\u0027" , $val );
0
- // Uncomment if you need to convert unicode chars
0
- //$val = preg_replace("/&#([0-9]+);/s", "&#\1;", $val );
0
- // Strip slashes if not already done so.
0
- //if ( get_magic_quotes_gpc() )
0
- // $val = stripslashes($val);
0
- // Swop user inputted backslashes
0
- //$val = preg_replace( "/\(?!&#|?#)/", "\", $val );
0
-function cms_utf8entities($val)
0
- return cms_utf8_entities($val);
0
-//Taken from http://www.webmasterworld.com/forum88/164.htm
0
-function nl2pnbr( $text )
0
- // Use \n for newline on all systems
0
- $text = preg_replace("/(\r\n|\n|\r)/", "\n", $text);
0
- // Only allow two newlines in a row.
0
- $text = preg_replace("/\n\n+/", "\n\n", $text);
0
- // Put <p>..</p> around paragraphs
0
- $text = preg_replace('/\n?(.+?)(\n\n|\z)/s', "<p>$1</p>", $text);
0
- // Convert newlines not preceded by </p> to a <br /> tag
0
- $text = preg_replace('|(?<!</p>)\s*\n|', "<br />", $text);
0
-* Debug function to display $var nicely in html.
0
-* @param string $title (optional)
0
-* @param boolean $echo_to_screen (optional)
0
-function debug_display($var, $title="", $echo_to_screen = true, $use_html = true)
0
- $variables =& $gCms->variables;
0
- $starttime = microtime();
0
- if (isset($variables['starttime']))
0
- $starttime = $variables['starttime'];
0
- $variables['starttime'] = $starttime;
0
- $titleText = "Debug: ";
0
- $titleText = "Debug display of '$title':";
0
- //$titleText .= '(' . microtime_diff($starttime,microtime()) . ')';
0
- if (function_exists('memory_get_usage'))
0
- $titleText .= ' - ('.memory_get_usage().')';
0
- echo "<div><b>$titleText</b>\n";
0
- if(FALSE == empty($var))
0
- echo "Number of elements: " . count($var) . "\n";
0
- elseif(is_object($var))
0
- elseif(is_string($var))
0
- print_r(htmlentities(str_replace("\t", ' ', $var)));
0
- echo $var === true ? 'true' : 'false';
0
- $output = ob_get_contents();
0
* Display $var nicely to the $gCms->errors array if $config['debug'] is set
0
@@ -329,50 +65,7 @@ function debug_display($var, $title="", $echo_to_screen = true, $use_html = true
0
function debug_buffer($var, $title="")
0
- $config = cms_config();
0
- //debug_to_log($var, $title='');
0
- if($config["debug"] == true)
0
- $gCms->errors[] = debug_display($var, $title, false, true);
0
-function debug_sql($str, $newline)
0
- $config =& $gCms->GetConfig();
0
- if($config["debug"] == true)
0
- $gCms->errors[] = debug_display($str, '', false, true);
0
-function create_encoding_dropdown($name = 'encoding', $selected = '')
0
- $encodings = array(''=>'Default','UTF-8'=>'Unicode','ISO-8859-1'=>'Latin 1/West European','ISO-8859-2'=>'Latin 2/Central European','ISO-8859-3'=>'Latin 3/South European','ISO-8859-4'=>'Latin 4/North European','ISO-8859-5'=>'Cyrilic','ISO-8859-6'=>'Arabic','ISO-8859-7'=>'Greek','ISO-8859-8'=>'Hebrew','ISO-8859-9'=>'Latin 5/Turkish','ISO-8859-11'=>'TIS-620/Thai','ISO-8859-14'=>'Latin 8','ISO-8859-15'=>'Latin 9','Big5'=>'Taiwanese','GB2312'=>'Chinese','EUC-JP'=>'Japanese','EUC-KR'=>'Korean','KOI8-R'=>'Russian','Windows-1250'=>'Central Europe','Windows-1251'=>'Cyrilic','Windows-1252'=>'Latin 1','Windows-1253'=>'Greek','Windows-1254'=>'Turkish','Windows-1255'=>'Hebrew','Windows-1256'=>'Arabic','Windows-1257'=>'Baltic','Windows-1258'=>'Vietnam');
0
- $result .= '<select name="'.$name.'">';
0
- foreach ($encodings as $key=>$value)
0
- $result .= '<option value="'.$key.'"';
0
- if ($selected == $key)
0
- $result .= ' selected="selected"';
0
- $result .= '>'.$key.($key!=''?' - ':'').$value.'</option>';
0
- $result .= '</select>';
0
+ CmsProfiler::get_instance()->mark(print_r($var));
0
function filespec_is_excluded( $file, $excludes )
Comments
No one has commented yet.