1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
<!DOCTYPE html>
<meta charset=utf-8>
<title>Syntax Highlighting</title>
<link href="../themes/css/blackboard.css" rel="stylesheet" type="text/css" media="screen">
<body>
<pre>
<code data-language="php">// this is some sample php code
$i = 0;
for ($i = 0; $i < 25; ++$i) {
echo $i;
}
# comment like this
function customFunction()
{
return mt_rand(1, 100);
}
while ($test) {
echo 'blah' . "\n";
};
$fruits = array('banana', 'strawberry', 'blueberry', 'apple', 'blackberry');
asort($fruits);
foreach ($fruits as $key => $value) {
echo $value;
}</code>
</pre>
<pre>
<code data-language="php"><?php
namespace Sonic;
/**
* Util
*
* @category Sonic
* @package Util
* @author Craig Campbell
*/
class Util
{
/**
* deletes a directory recursively
*
* php's native rmdir() function only removes a directory if there is nothing in it
*
* @param string $path
* @return void
*/
public static function removeDir($path)
{
if (is_link($path)) {
return unlink($path);
}
$files = new \RecursiveDirectoryIterator($path);
foreach ($files as $file) {
if (in_array($file->getFilename(), array('.', '..'))) {
continue;
}
if ($file->isLink()) {
unlink($file->getPathName());
continue;
}
if ($file->isFile()) {
unlink($file->getRealPath());
continue;
}
if ($file->isDir()) {
self::removeDir($file->getRealPath());
}
}
return rmdir($path);
}
}
</code>
</pre>
<script src="../dist/rainbow.js"></script>
<script src="../src/language/generic.js"></script>
<script src="../src/language/php.js"></script>
</body>
|