@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = dirname($vendorDir); |
7 | 7 | |
8 | 8 | return array( |
9 | - '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', |
|
9 | + '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir.'/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', |
|
10 | 10 | ); |
@@ -13,7 +13,9 @@ |
||
13 | 13 | |
14 | 14 | public function __construct($proc = false) |
15 | 15 | { |
16 | - if ($proc === false) $proc = new XSLTProcessor(); |
|
16 | + if ($proc === false) { |
|
17 | + $proc = new XSLTProcessor(); |
|
18 | + } |
|
17 | 19 | $this->xsltProcessor = $proc; |
18 | 20 | } |
19 | 21 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | ) return false; |
24 | 24 | // Custom implementations can go here |
25 | 25 | // Standard implementation: |
26 | - return str_replace('_', '/', $class) . '.php'; |
|
26 | + return str_replace('_', '/', $class).'.php'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | } |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | public static function autoload($class) |
11 | 11 | { |
12 | 12 | $path = HTMLPurifierExtras::getPath($class); |
13 | - if (!$path) return false; |
|
13 | + if (!$path) { |
|
14 | + return false; |
|
15 | + } |
|
14 | 16 | require $path; |
15 | 17 | return true; |
16 | 18 | } |
@@ -20,7 +22,9 @@ discard block |
||
20 | 22 | if ( |
21 | 23 | strncmp('FSTools', $class, 7) !== 0 && |
22 | 24 | strncmp('ConfigDoc', $class, 9) !== 0 |
23 | - ) return false; |
|
25 | + ) { |
|
26 | + return false; |
|
27 | + } |
|
24 | 28 | // Custom implementations can go here |
25 | 29 | // Standard implementation: |
26 | 30 | return str_replace('_', '/', $class) . '.php'; |
@@ -30,10 +30,10 @@ |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | /** Returns the filename of the file. */ |
33 | - public function getName() {return $this->name;} |
|
33 | + public function getName() {return $this->name; } |
|
34 | 34 | |
35 | 35 | /** Returns directory of the file without trailing slash */ |
36 | - public function getDirectory() {return $this->fs->dirname($this->name);} |
|
36 | + public function getDirectory() {return $this->fs->dirname($this->name); } |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Retrieves the contents of a file |
@@ -81,7 +81,9 @@ discard block |
||
81 | 81 | /** Opens file's handle */ |
82 | 82 | public function open($mode) |
83 | 83 | { |
84 | - if ($this->handle) $this->close(); |
|
84 | + if ($this->handle) { |
|
85 | + $this->close(); |
|
86 | + } |
|
85 | 87 | $this->handle = $this->fs->fopen($this->name, $mode); |
86 | 88 | return true; |
87 | 89 | } |
@@ -89,7 +91,9 @@ discard block |
||
89 | 91 | /** Closes file's handle */ |
90 | 92 | public function close() |
91 | 93 | { |
92 | - if (!$this->handle) return false; |
|
94 | + if (!$this->handle) { |
|
95 | + return false; |
|
96 | + } |
|
93 | 97 | $status = $this->fs->fclose($this->handle); |
94 | 98 | $this->handle = false; |
95 | 99 | return $status; |
@@ -98,42 +102,57 @@ discard block |
||
98 | 102 | /** Retrieves a line from an open file, with optional max length $length */ |
99 | 103 | public function getLine($length = null) |
100 | 104 | { |
101 | - if (!$this->handle) $this->open('r'); |
|
102 | - if ($length === null) return $this->fs->fgets($this->handle); |
|
103 | - else return $this->fs->fgets($this->handle, $length); |
|
105 | + if (!$this->handle) { |
|
106 | + $this->open('r'); |
|
107 | + } |
|
108 | + if ($length === null) { |
|
109 | + return $this->fs->fgets($this->handle); |
|
110 | + } else { |
|
111 | + return $this->fs->fgets($this->handle, $length); |
|
112 | + } |
|
104 | 113 | } |
105 | 114 | |
106 | 115 | /** Retrieves a character from an open file */ |
107 | 116 | public function getChar() |
108 | 117 | { |
109 | - if (!$this->handle) $this->open('r'); |
|
118 | + if (!$this->handle) { |
|
119 | + $this->open('r'); |
|
120 | + } |
|
110 | 121 | return $this->fs->fgetc($this->handle); |
111 | 122 | } |
112 | 123 | |
113 | 124 | /** Retrieves an $length bytes of data from an open data */ |
114 | 125 | public function read($length) |
115 | 126 | { |
116 | - if (!$this->handle) $this->open('r'); |
|
127 | + if (!$this->handle) { |
|
128 | + $this->open('r'); |
|
129 | + } |
|
117 | 130 | return $this->fs->fread($this->handle, $length); |
118 | 131 | } |
119 | 132 | |
120 | 133 | /** Writes to an open file */ |
121 | 134 | public function put($string) |
122 | 135 | { |
123 | - if (!$this->handle) $this->open('a'); |
|
136 | + if (!$this->handle) { |
|
137 | + $this->open('a'); |
|
138 | + } |
|
124 | 139 | return $this->fs->fwrite($this->handle, $string); |
125 | 140 | } |
126 | 141 | |
127 | 142 | /** Returns TRUE if the end of the file has been reached */ |
128 | 143 | public function eof() |
129 | 144 | { |
130 | - if (!$this->handle) return true; |
|
145 | + if (!$this->handle) { |
|
146 | + return true; |
|
147 | + } |
|
131 | 148 | return $this->fs->feof($this->handle); |
132 | 149 | } |
133 | 150 | |
134 | 151 | public function __destruct() |
135 | 152 | { |
136 | - if ($this->handle) $this->close(); |
|
153 | + if ($this->handle) { |
|
154 | + $this->close(); |
|
155 | + } |
|
137 | 156 | } |
138 | 157 | |
139 | 158 | } |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | { |
40 | 40 | $folders = preg_split("#[\\\\/]#", $folder); |
41 | 41 | $base = ''; |
42 | - for($i = 0, $c = count($folders); $i < $c; $i++) { |
|
43 | - if(empty($folders[$i])) { |
|
42 | + for ($i = 0, $c = count($folders); $i < $c; $i++) { |
|
43 | + if (empty($folders[ $i ])) { |
|
44 | 44 | if (!$i) { |
45 | 45 | // special case for root level |
46 | 46 | $base .= DIRECTORY_SEPARATOR; |
47 | 47 | } |
48 | 48 | continue; |
49 | 49 | } |
50 | - $base .= $folders[$i]; |
|
51 | - if(!is_dir($base)){ |
|
50 | + $base .= $folders[ $i ]; |
|
51 | + if (!is_dir($base)) { |
|
52 | 52 | $this->mkdir($base); |
53 | 53 | } |
54 | 54 | $base .= DIRECTORY_SEPARATOR; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | // Loop through the folder |
74 | 74 | $dir = $this->dir($source); |
75 | - while ( false !== ($entry = $dir->read()) ) { |
|
75 | + while (false !== ($entry = $dir->read())) { |
|
76 | 76 | // Skip pointers |
77 | 77 | if ($entry == '.' || $entry == '..') { |
78 | 78 | continue; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | continue; |
126 | 126 | } |
127 | 127 | // Recurse |
128 | - $this->rmdirr($dirname . DIRECTORY_SEPARATOR . $entry); |
|
128 | + $this->rmdirr($dirname.DIRECTORY_SEPARATOR.$entry); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Clean up |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public static function singleton() |
19 | 19 | { |
20 | - if (empty(FSTools::$singleton)) FSTools::$singleton = new FSTools(); |
|
20 | + if (empty(FSTools::$singleton)) { |
|
21 | + FSTools::$singleton = new FSTools(); |
|
22 | + } |
|
21 | 23 | return FSTools::$singleton; |
22 | 24 | } |
23 | 25 | |
@@ -139,9 +141,13 @@ discard block |
||
139 | 141 | public function globr($dir, $pattern, $flags = NULL) |
140 | 142 | { |
141 | 143 | $files = $this->glob("$dir/$pattern", $flags); |
142 | - if ($files === false) $files = array(); |
|
144 | + if ($files === false) { |
|
145 | + $files = array(); |
|
146 | + } |
|
143 | 147 | $sub_dirs = $this->glob("$dir/*", GLOB_ONLYDIR); |
144 | - if ($sub_dirs === false) $sub_dirs = array(); |
|
148 | + if ($sub_dirs === false) { |
|
149 | + $sub_dirs = array(); |
|
150 | + } |
|
145 | 151 | foreach ($sub_dirs as $sub_dir) { |
146 | 152 | $sub_files = $this->globr($sub_dir, $pattern, $flags); |
147 | 153 | $files = array_merge($files, $sub_files); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | array( |
12 | 12 | 'baseinstalldir' => '/', |
13 | 13 | 'packagefile' => 'package.xml', |
14 | - 'packagedirectory' => realpath(dirname(__FILE__) . '/library'), |
|
14 | + 'packagedirectory' => realpath(dirname(__FILE__).'/library'), |
|
15 | 15 | 'filelistgenerator' => 'file', |
16 | 16 | 'include' => array('*'), |
17 | 17 | 'dir_roles' => array('/' => 'php'), // hack to put *.ser files in the right place |
@@ -25,21 +25,21 @@ |
||
25 | 25 | |
26 | 26 | // ...in NEWS |
27 | 27 | if ($is_dev = (strpos($version, 'dev') === false)) { |
28 | - $date = date('Y-m-d'); |
|
29 | - $news_c = str_replace( |
|
30 | - $l = "$version, unknown release date", |
|
31 | - "$version, released $date", |
|
32 | - file_get_contents('NEWS'), |
|
33 | - $c |
|
34 | - ); |
|
35 | - if (!$c) { |
|
36 | - echo 'Could not update NEWS, missing ' . $l . PHP_EOL; |
|
37 | - exit; |
|
38 | - } elseif ($c > 1) { |
|
39 | - echo 'More than one release declaration in NEWS replaced' . PHP_EOL; |
|
40 | - exit; |
|
41 | - } |
|
42 | - file_put_contents('NEWS', $news_c); |
|
28 | + $date = date('Y-m-d'); |
|
29 | + $news_c = str_replace( |
|
30 | + $l = "$version, unknown release date", |
|
31 | + "$version, released $date", |
|
32 | + file_get_contents('NEWS'), |
|
33 | + $c |
|
34 | + ); |
|
35 | + if (!$c) { |
|
36 | + echo 'Could not update NEWS, missing ' . $l . PHP_EOL; |
|
37 | + exit; |
|
38 | + } elseif ($c > 1) { |
|
39 | + echo 'More than one release declaration in NEWS replaced' . PHP_EOL; |
|
40 | + exit; |
|
41 | + } |
|
42 | + file_put_contents('NEWS', $news_c); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // ...in Doxyfile |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | exit; |
9 | 9 | } |
10 | 10 | |
11 | -if (!isset($argv[1])) { |
|
11 | +if (!isset($argv[ 1 ])) { |
|
12 | 12 | echo |
13 | 13 | 'php release.php [version] |
14 | 14 | HTML Purifier release script |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -$version = trim($argv[1]); |
|
19 | +$version = trim($argv[ 1 ]); |
|
20 | 20 | |
21 | 21 | // Bump version numbers: |
22 | 22 | |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | $c |
34 | 34 | ); |
35 | 35 | if (!$c) { |
36 | - echo 'Could not update NEWS, missing ' . $l . PHP_EOL; |
|
36 | + echo 'Could not update NEWS, missing '.$l.PHP_EOL; |
|
37 | 37 | exit; |
38 | 38 | } elseif ($c > 1) { |
39 | - echo 'More than one release declaration in NEWS replaced' . PHP_EOL; |
|
39 | + echo 'More than one release declaration in NEWS replaced'.PHP_EOL; |
|
40 | 40 | exit; |
41 | 41 | } |
42 | 42 | file_put_contents('NEWS', $news_c); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 1, $c |
51 | 51 | ); |
52 | 52 | if (!$c) { |
53 | - echo 'Could not update Doxyfile, missing PROJECT_NUMBER.' . PHP_EOL; |
|
53 | + echo 'Could not update Doxyfile, missing PROJECT_NUMBER.'.PHP_EOL; |
|
54 | 54 | exit; |
55 | 55 | } |
56 | 56 | file_put_contents('Doxyfile', $doxyfile_c); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 1, $c |
65 | 65 | ); |
66 | 66 | if (!$c) { |
67 | - echo 'Could not update HTMLPurifier.php, missing HTML Purifier [version] header.' . PHP_EOL; |
|
67 | + echo 'Could not update HTMLPurifier.php, missing HTML Purifier [version] header.'.PHP_EOL; |
|
68 | 68 | exit; |
69 | 69 | } |
70 | 70 | $htmlpurifier_c = preg_replace( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 1, $c |
75 | 75 | ); |
76 | 76 | if (!$c) { |
77 | - echo 'Could not update HTMLPurifier.php, missing public $version.' . PHP_EOL; |
|
77 | + echo 'Could not update HTMLPurifier.php, missing public $version.'.PHP_EOL; |
|
78 | 78 | exit; |
79 | 79 | } |
80 | 80 | $htmlpurifier_c = preg_replace( |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | 1, $c |
85 | 85 | ); |
86 | 86 | if (!$c) { |
87 | - echo 'Could not update HTMLPurifier.php, missing const $version.' . PHP_EOL; |
|
87 | + echo 'Could not update HTMLPurifier.php, missing const $version.'.PHP_EOL; |
|
88 | 88 | exit; |
89 | 89 | } |
90 | 90 | file_put_contents('library/HTMLPurifier.php', $htmlpurifier_c); |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | 1, $c |
98 | 98 | ); |
99 | 99 | if (!$c) { |
100 | - echo 'Could not update Config.php, missing public $version.' . PHP_EOL; |
|
100 | + echo 'Could not update Config.php, missing public $version.'.PHP_EOL; |
|
101 | 101 | exit; |
102 | 102 | } |
103 | 103 | file_put_contents('library/HTMLPurifier/Config.php', $config_c); |
104 | 104 | |
105 | 105 | passthru('php maintenance/flush.php'); |
106 | 106 | |
107 | -if ($is_dev) echo "Review changes, write something in WHATSNEW and FOCUS, and then commit with log 'Release $version.'" . PHP_EOL; |
|
107 | +if ($is_dev) echo "Review changes, write something in WHATSNEW and FOCUS, and then commit with log 'Release $version.'".PHP_EOL; |
|
108 | 108 | else echo "Numbers updated to dev, no other modifications necessary!"; |
109 | 109 | |
110 | 110 | // vim: et sw=4 sts=4 |
@@ -104,7 +104,10 @@ |
||
104 | 104 | |
105 | 105 | passthru('php maintenance/flush.php'); |
106 | 106 | |
107 | -if ($is_dev) echo "Review changes, write something in WHATSNEW and FOCUS, and then commit with log 'Release $version.'" . PHP_EOL; |
|
108 | -else echo "Numbers updated to dev, no other modifications necessary!"; |
|
107 | +if ($is_dev) { |
|
108 | + echo "Review changes, write something in WHATSNEW and FOCUS, and then commit with log 'Release $version.'" . PHP_EOL; |
|
109 | +} else { |
|
110 | + echo "Numbers updated to dev, no other modifications necessary!"; |
|
111 | +} |
|
109 | 112 | |
110 | 113 | // vim: et sw=4 sts=4 |
@@ -15,9 +15,9 @@ |
||
15 | 15 | * explicitly says, "No, I do not need to migrate." |
16 | 16 | */ |
17 | 17 | |
18 | -if(!defined("PHORUM")) exit; |
|
18 | +if (!defined("PHORUM")) exit; |
|
19 | 19 | |
20 | -require_once(dirname(__FILE__) . "/../bbcode/bbcode.php"); |
|
20 | +require_once(dirname(__FILE__)."/../bbcode/bbcode.php"); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * 'format' hook style function that will be called to convert |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined("PHORUM")) exit; |
|
3 | +if(!defined("PHORUM")) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | // default HTML Purifier configuration settings |
6 | 8 | $config->set('HTML.Allowed', |
@@ -9,22 +9,22 @@ |
||
9 | 9 | { |
10 | 10 | global $PHORUM; |
11 | 11 | $config_exists = phorum_htmlpurifier_config_file_exists(); |
12 | - if ($default || $config_exists || !isset($PHORUM['mod_htmlpurifier']['config'])) { |
|
12 | + if ($default || $config_exists || !isset($PHORUM[ 'mod_htmlpurifier' ][ 'config' ])) { |
|
13 | 13 | $config = HTMLPurifier_Config::createDefault(); |
14 | - include(dirname(__FILE__) . '/config.default.php'); |
|
14 | + include(dirname(__FILE__).'/config.default.php'); |
|
15 | 15 | if ($config_exists) { |
16 | - include(dirname(__FILE__) . '/config.php'); |
|
16 | + include(dirname(__FILE__).'/config.php'); |
|
17 | 17 | } |
18 | - unset($PHORUM['mod_htmlpurifier']['config']); // unnecessary |
|
18 | + unset($PHORUM[ 'mod_htmlpurifier' ][ 'config' ]); // unnecessary |
|
19 | 19 | } else { |
20 | - $config = HTMLPurifier_Config::create($PHORUM['mod_htmlpurifier']['config']); |
|
20 | + $config = HTMLPurifier_Config::create($PHORUM[ 'mod_htmlpurifier' ][ 'config' ]); |
|
21 | 21 | } |
22 | 22 | return $config; |
23 | 23 | } |
24 | 24 | |
25 | 25 | function phorum_htmlpurifier_config_file_exists() |
26 | 26 | { |
27 | - return file_exists(dirname(__FILE__) . '/config.php'); |
|
27 | + return file_exists(dirname(__FILE__).'/config.php'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | // vim: et sw=4 sts=4 |