-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
48 lines (37 loc) · 897 Bytes
/
functions.php
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
<?php
function enableErrorReporting() {
error_reporting(E_ALL);
ini_set('display_errors', '1');
}
enableErrorReporting();
function formatCode($code) {
echo "<code class='show-code'>";
echo '<pre>';
print_r($code);
echo '</pre>';
echo '</code>';
}
function queryString() {
return $_SERVER['QUERY_STRING'];
}
function styleGuideDetailLink($type, $page) {
if ($page == "style-guide") {
$link = "style-guide/modules/$type";
echo "<a href='$link' target='$type'>LINK</a>";
}
}
function pageClass($page) {
return "$page-page";
}
function pageTemplateClass($pageData) {
if ( isset($pageData["template"]) ) {
return "$pageData[template]-template";
} else {
return "default-template";
}
}
function magic_code_tm($code) {
$patterns = ["/<(?!\/?mark\b[^>]*>)/", "/[\$]/"];
$replacements = ['<', "$"];
return preg_replace($patterns, $replacements, $code);
}