Thread: [Cs-content-commits] SF.net SVN: cs-content:[370] trunk/1.0/cs_globalFunctions.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-03-27 14:56:13
|
Revision: 370 http://cs-content.svn.sourceforge.net/cs-content/?rev=370&view=rev Author: crazedsanity Date: 2009-03-27 14:56:04 +0000 (Fri, 27 Mar 2009) Log Message: ----------- Minor additional method for debugging. /cs_globalFunctions.class.php: * debug_var_dump() [NEW]: -- similar to debug_print(), except it uses var_dump() instead of print_r() to display information. Allows for easy viewing of what data is in a variable in a web-centric sort of way (for live debugging). Modified Paths: -------------- trunk/1.0/cs_globalFunctions.class.php Modified: trunk/1.0/cs_globalFunctions.class.php =================================================================== --- trunk/1.0/cs_globalFunctions.class.php 2009-03-03 19:07:51 UTC (rev 369) +++ trunk/1.0/cs_globalFunctions.class.php 2009-03-27 14:56:04 UTC (rev 370) @@ -838,6 +838,19 @@ return($realVals[$index]); }//end interpret_bool() //########################################################################## + + + //########################################################################## + public function debug_var_dump($data, $printItForMe=null, $removeHr=null) { + + ob_start(); + var_dump($data); + $printThis = ob_get_contents(); + ob_end_clean(); + + return($this->debug_print($printThis, $printItForMe, $removeHr)); + }//end debug_var_dump() + //########################################################################## }//end cs_globalFunctions{} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-06-04 15:11:26
|
Revision: 387 http://cs-content.svn.sourceforge.net/cs-content/?rev=387&view=rev Author: crazedsanity Date: 2009-06-04 15:11:11 +0000 (Thu, 04 Jun 2009) Log Message: ----------- Fix cs_globalFunctions::debug_print() so GLOBALS settings override constants. /cs_globalFunctions.class.php: * __construct(): -- reset internal debugRemoveHr and debugPrintOpt to GLOBAL values if present, even when CONSTANT values were previously used. Modified Paths: -------------- trunk/1.0/cs_globalFunctions.class.php Modified: trunk/1.0/cs_globalFunctions.class.php =================================================================== --- trunk/1.0/cs_globalFunctions.class.php 2009-06-01 14:49:57 UTC (rev 386) +++ trunk/1.0/cs_globalFunctions.class.php 2009-06-04 15:11:11 UTC (rev 387) @@ -20,14 +20,14 @@ if(defined('DEBUGREMOVEHR')) { $this->debugRemoveHr = constant('DEBUGREMOVEHR'); } - elseif(isset($GLOBALS['DEBUGREMOVEHR'])) { + if(isset($GLOBALS['DEBUGREMOVEHR'])) { $this->debugRemoveHr = $GLOBALS['DEBUGREMOVEHR']; } if(defined('DEBUGPRINTOPT')) { $this->debugPrintOpt = constant('DEBUGPRINTOPT'); } - elseif(isset($GLOBALS['DEBUGPRINTOPT'])) { + if(isset($GLOBALS['DEBUGPRINTOPT'])) { $this->debugPrintOpt = $GLOBALS['DEBUGPRINTOPT']; } $this->set_version_file_location(dirname(__FILE__) . '/VERSION'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-07-22 04:54:50
|
Revision: 411 http://cs-content.svn.sourceforge.net/cs-content/?rev=411&view=rev Author: crazedsanity Date: 2009-07-22 04:54:48 +0000 (Wed, 22 Jul 2009) Log Message: ----------- Fix a bad quoting issue. /cs_globalFunctions.class.php: * string_from_array(): -- (style=select) don't pass the forceSqlQuotes to create_list(). Modified Paths: -------------- trunk/1.0/cs_globalFunctions.class.php Modified: trunk/1.0/cs_globalFunctions.class.php =================================================================== --- trunk/1.0/cs_globalFunctions.class.php 2009-07-21 03:21:21 UTC (rev 410) +++ trunk/1.0/cs_globalFunctions.class.php 2009-07-22 04:54:48 UTC (rev 411) @@ -282,7 +282,7 @@ if(!is_numeric($value) && isset($separator)) { $value = "'". $value ."'"; } - $retval = $this->create_list($retval, $field . $separator . $value, " $delimiter ", $this->forceSqlQuotes); + $retval = $this->create_list($retval, $field . $separator . $value, " $delimiter "); } } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2010-09-01 14:03:09
|
Revision: 484 http://cs-content.svn.sourceforge.net/cs-content/?rev=484&view=rev Author: crazedsanity Date: 2010-09-01 14:03:03 +0000 (Wed, 01 Sep 2010) Log Message: ----------- Minor feature addition + exception on invalid data. /cs_globalFunctions.class.php: * debug_print(): -- ARG CHANGE: NEW ARG: #4 ($usePreTags=true) -- don't wrap the output with "<pre></pre>" if $usePreTags is false; set default value as true to keep normal behaviour if not specified. * mini_parser(): -- throw an exception if no array was passed. Modified Paths: -------------- trunk/1.0/cs_globalFunctions.class.php Modified: trunk/1.0/cs_globalFunctions.class.php =================================================================== --- trunk/1.0/cs_globalFunctions.class.php 2010-08-12 15:10:22 UTC (rev 483) +++ trunk/1.0/cs_globalFunctions.class.php 2010-09-01 14:03:03 UTC (rev 484) @@ -617,7 +617,7 @@ * * @return (string) printed data. */ - public function debug_print($input=NULL, $printItForMe=NULL, $removeHR=NULL) { + public function debug_print($input=NULL, $printItForMe=NULL, $removeHR=NULL, $usePreTags=true) { if(!is_numeric($removeHR)) { $removeHR = $this->debugRemoveHr; } @@ -630,9 +630,11 @@ print_r($input); $output = ob_get_contents(); ob_end_clean(); - - $output = "<pre>$output</pre>"; + if($usePreTags === true) { + $output = "<pre>$output</pre>"; + } + if(!isset($_SERVER['SERVER_PROTOCOL']) || !$_SERVER['SERVER_PROTOCOL']) { $output = strip_tags($output); $hrString = "\n***************************************************************\n"; @@ -690,12 +692,18 @@ $b="{"; $e="}"; } - - foreach($repArr as $key=>$value) { - //run the replacements. - $key = "$b" . $key . "$e"; - $template = str_replace("$key", $value, $template); + + if(is_array($repArr)) { + foreach($repArr as $key=>$value) { + //run the replacements. + $key = "$b" . $key . "$e"; + $template = str_replace("$key", $value, $template); + } } + else { + cs_debug_backtrace(1); + throw new exception(__METHOD__ .": no replacement array passed, or array was empty"); + } return($template); }//end mini_parser() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2011-03-26 00:58:28
|
Revision: 494 http://cs-content.svn.sourceforge.net/cs-content/?rev=494&view=rev Author: crazedsanity Date: 2011-03-26 00:58:22 +0000 (Sat, 26 Mar 2011) Log Message: ----------- Make "text" a synonym for "varchar" in cleanString(). Modified Paths: -------------- trunk/1.0/cs_globalFunctions.class.php Modified: trunk/1.0/cs_globalFunctions.class.php =================================================================== --- trunk/1.0/cs_globalFunctions.class.php 2011-02-04 21:21:14 UTC (rev 493) +++ trunk/1.0/cs_globalFunctions.class.php 2011-03-26 00:58:22 UTC (rev 494) @@ -550,6 +550,7 @@ $cleanThis = $this->interpret_bool($cleanThis, array('f', 't')); break; + case "text": case "varchar": $cleanThis=$this->cleanString($cleanThis,"query"); $cleanThis="'" . $cleanThis . "'"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2011-05-10 23:44:39
|
Revision: 495 http://cs-content.svn.sourceforge.net/cs-content/?rev=495&view=rev Author: crazedsanity Date: 2011-05-10 23:44:33 +0000 (Tue, 10 May 2011) Log Message: ----------- the "text" and "varchar" cleaning styles are now just like "sql_insert". Modified Paths: -------------- trunk/1.0/cs_globalFunctions.class.php Modified: trunk/1.0/cs_globalFunctions.class.php =================================================================== --- trunk/1.0/cs_globalFunctions.class.php 2011-03-26 00:58:22 UTC (rev 494) +++ trunk/1.0/cs_globalFunctions.class.php 2011-05-10 23:44:33 UTC (rev 495) @@ -403,6 +403,8 @@ break; + case "varchar": + case "text": case "sql_insert": /* * This is for descriptive fields, where double quotes don't need to be escaped: in these @@ -550,15 +552,6 @@ $cleanThis = $this->interpret_bool($cleanThis, array('f', 't')); break; - case "text": - case "varchar": - $cleanThis=$this->cleanString($cleanThis,"query"); - $cleanThis="'" . $cleanThis . "'"; - if($cleanThis == "''") { - $cleanThis="NULL"; - } - break; - case "date": $cleanThis = preg_replace("/[^0-9\-]/","",$cleanThis); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |