-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
50 lines (39 loc) · 1.31 KB
/
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
49
50
<?php
// a handy function to "console.log" PHP data
function consoleLog($data, $function)
{
if (is_array($data) || is_object($data)) $data = json_encode($data);
else if (is_string($data)) $data = '"' . $data . '"';
if (!$function) $function = 'log';
echo('<script>console.' . $function . '(' . $data . ');</script>');
}
// let's give a proper name to the function to print the active theme's folder
function theActiveThemeDirectory()
{
$directory = get_template_directory_uri() . '/';
print $directory;
}
function getBowerDirectory()
{
$directory = get_template_directory_uri() . '/bower_components/';
if (!fileExists($directory)) consoleLog("You seem to be missing the 'bower_components' folder", 'error');
else return $directory;
}
function theHTML5BoilerplateDirectory()
{
$directory = getBowerDirectory() . 'html5-boilerplate/dist/';
if (!fileExists($directory)) consoleLog("You seem to be missing the 'html5-boilerplate/dist' folder", 'error');
print $directory;
}
function theSkeletonDirectory()
{
$directory = getBowerDirectory() . 'skeleton-css/';
if (!fileExists($directory)) consoleLog("You seem to be missing the 'skeleton-css' folder", 'error');
print $directory;
}
// from http://php.net/manual/en/function.file-exists.php#103436
function fileExists($path)
{
return (@fopen($path, 'r') == true);
}
?>