QErrorHandler::PrepDataForScript PHP Method

PrepDataForScript() public static method

public static PrepDataForScript ( $strData )
    public static function PrepDataForScript($strData)
    {
        $strData = str_replace("\\", "\\\\", $strData);
        $strData = str_replace("\n", "\\n", $strData);
        $strData = str_replace("\r", "\\r", $strData);
        $strData = str_replace("\"", """, $strData);
        $strData = str_ireplace("</script>", "&lt/script&gt", $strData);
        return $strData;
    }

Usage Example

Example #1
0
foreach ($__exc_ObjVariableArrayKeys as $__exc_Key) {
    if (strpos($__exc_Key, "__exc_") === false && strpos($__exc_Key, "_DATE_") === false && $__exc_Key != "GLOBALS") {
        try {
            if ($__exc_Key == 'HTTP_SESSION_VARS' || $__exc_Key == '_SESSION') {
                $__exc_ObjSessionVarArray = array();
                foreach (${$__exc_Key} as $__exc_StrSessionKey => $__exc_StrSessionValue) {
                    if (strpos($__exc_StrSessionKey, 'qform') !== 0) {
                        $__exc_ObjSessionVarArray[$__exc_StrSessionKey] = $__exc_StrSessionValue;
                    }
                }
                $__exc_StrVarExport = htmlentities(var_export($__exc_ObjSessionVarArray, true));
            } else {
                $__exc_StrVarExport = QErrorHandler::VarExport($__exc_ObjVariableArray[$__exc_Key]);
            }
            $__exc_StrToDisplay .= sprintf("  <a href=\"javascript:RenderPage(%s)\" title=\"%s\">%s</a>\n", $__exc_Key, $__exc_StrVarExport, $__exc_Key);
            $__exc_StrToScript .= sprintf("  %s = \"<pre>%s</pre>\";\n", $__exc_Key, QErrorHandler::PrepDataForScript($__exc_StrVarExport));
        } catch (Exception $__exc_objExcOnVarDump) {
            $__exc_StrToDisplay .= sprintf("  Fatal error:  Nesting level too deep - recursive dependency?\n", $__exc_objExcOnVarDump->Message);
        }
    }
}
_p($__exc_StrToDisplay . '</pre>', false);
printf('<script type="text/javascript">%s</script>', $__exc_StrToScript);
?>
			</div><br />
			<hr width="100%" size="1" color="#dddddd" />
			<center><em>
				<?php 
_p(QErrorHandler::$Type);
?>
 Report Generated:&nbsp;&nbsp;<?php