├── README.md └── helper.php /README.md: -------------------------------------------------------------------------------- 1 | # PHP Helper Class 2 | -------------------------------------------------------------------------------- /helper.php: -------------------------------------------------------------------------------- 1 | \n", '] = ', $content); 153 | $content = preg_replace('/= {2,}/', '= ', $content); 154 | $content = preg_replace("/\[\"(.*?)\"\] = /i", "[$1] = ", $content); 155 | $content = preg_replace('/ /', " ", $content); 156 | $content = preg_replace("/\"\"(.*?)\"/i", "\"$1\"", $content); 157 | $content = preg_replace("/(int|float)\(([0-9\.]+)\)/i", "$1() $2", $content); 158 | $content = preg_replace("/(\[[\w ]+\] = string\([0-9]+\) )\"(.*?)/sim", "$1\"", $content); 159 | $content = preg_replace("/(\"\n{1,})( {0,}\})/sim", "$1$2", $content); 160 | $content = preg_replace("/(\"\n{1,})( {0,}\[)/sim", "$1$2", $content); 161 | $content = preg_replace("/(string\([0-9]+\) )\"(.*?)\"\n/sim", "$1\"$2\"\n", $content); 162 | $regex = array( 163 | 'numbers' => array('/(^|] = )(array|float|int|string|resource|object\(.*\)|\&object\(.*\))\(([0-9\.]+)\)/i', '$1$2($3)'), 164 | 'null' => array('/(^|] = )(null)/i', '$1$2'), 165 | 'bool' => array('/(bool)\((true|false)\)/i', '$1($2)'), 166 | 'types' => array('/(of type )\((.*)\)/i', '$1($2)'), 167 | 'object' => array('/(object|\&object)\(([\w]+)\)/i', '$1($2)'), 168 | 'function' => array('/(^|] = )(array|string|int|float|bool|resource|object|\&object)\(/i', '$1$2('), 169 | ); 170 | 171 | foreach ($regex as $x) { 172 | $content = preg_replace($x[0], $x[1], $content); 173 | } 174 | 175 | $style = " 176 | .dumpr { 177 | margin: 2px; 178 | padding: 2px; 179 | background-color: #fbfbfb; 180 | float: left; 181 | clear: both; 182 | } 183 | .dumpr pre { 184 | background-color: #2d2d2d; 185 | color: white; 186 | font-weight:bold !important; 187 | font-size: 9pt; 188 | border-radius: 10px; 189 | font-family: 'Rubik'; 190 | margin: 0px; 191 | padding-top: 5px; 192 | padding-bottom: 7px; 193 | padding-left: 9px; 194 | padding-right: 9px; 195 | width: 100% !important; 196 | } 197 | .dumpr div { 198 | background-color: #fcfcfc; 199 | 200 | float: left; 201 | clear: both; 202 | } 203 | .dumpr span.string {color: #FF8400; font-weight:bold;} 204 | .dumpr span.number {color: #FF8400; font-weight:bold;} 205 | .dumpr span.keyword {color: #FF8400; font-weight:bold;} 206 | .dumpr span.function {color: #1299DA; font-weight:bold;} 207 | .dumpr span.object {color: #ac00ac;} 208 | .dumpr span.type {color: #0072c4;} 209 | "; 210 | 211 | $style = preg_replace("/ {2,}/", "", $style); 212 | $style = preg_replace("/\t|\r\n|\r|\n/", "", $style); 213 | $style = preg_replace("/\/\*.*?\*\//i", '', $style); 214 | $style = str_replace('}', '} ', $style); 215 | $style = str_replace(' {', '{', $style); 216 | $style = trim($style); 217 | 218 | $content = trim($content); 219 | $content = preg_replace("/\n<\/span>/", "\n", $content); 220 | 221 | $out = "\n\n" . 222 | "\n" . 223 | "
224 |
$callingFile : $callingFileLine \n$content\n
 
" . 225 | "\n\n"; 226 | echo $out . ' 227 | 228 | 229 | '; 230 | exit; 231 | } 232 | } 233 | --------------------------------------------------------------------------------