-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathUtil.php
More file actions
55 lines (45 loc) · 1.3 KB
/
Util.php
File metadata and controls
55 lines (45 loc) · 1.3 KB
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
<?php
/*!
* Util Class
*
* Copyright (c) 2014 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license
*
* Generic utilities for Pattern Lab
*
*/
namespace PatternLab;
use \PatternLab\Config;
use \PatternLab\Console;
use \PatternLab\Timer;
class Util {
/**
* Lowercase the given string. Used in the array_walk() function in __construct as a sanity check
* @param {String} an entry from one of the list-based config entries
*
* @return {String} lowercased version of the given $v var
*/
public static function strtolower(&$v) {
$v = strtolower($v);
}
/**
* Trim a given string. Used in the array_walk() function in __construct as a sanity check
* @param {String} an entry from one of the list-based config entries
*
* @return {String} trimmed version of the given $v var
*/
public static function trim(&$v) {
$v = trim($v);
}
/**
* Write out the time tracking file so the content sync service will work. A holdover
* from how I put together the original AJAX polling set-up.
*/
public static function updateChangeTime() {
if (is_dir(Config::getOption("publicDir"))) {
file_put_contents(Config::getOption("publicDir")."/latest-change.txt",time());
} else {
Console::writeError("the public directory for Pattern Lab doesn't exist...");
}
}
}