Completed
Push — master ( 66e787...f0802c )
by Agel_Nash
03:11
created
assets/lib/APIHelpers.class.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@
 block discarded – undo
125 125
         for ($i = $len; $i > 0; $i--) {
126 126
             switch ($data[rand(0, ($opt - 1))]) {
127 127
                 case 'A':
128
-                	$tmp = rand(65, 90);
128
+                    $tmp = rand(65, 90);
129 129
                     break;
130 130
                 case 'a':
131 131
                     $tmp = rand(97, 122);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         $text = mb_substr($text, 0, $len+1, $encoding);
42 42
         if(mb_substr($text, -1, null, $encoding) == ' '){
43 43
             $out = trim($text);
44
-        }else{
44
+        } else{
45 45
             $out = mb_substr($text, 0, mb_strripos($text, ' ', null, $encoding), $encoding);
46 46
         }
47 47
         return preg_replace("/(([\.,\-:!?;\s])|(&\w+;))+$/ui", "", $out);
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
      * @param string $encoding - кодировка, по-умолчанию UTF-8
9 9
      * @return string
10 10
      */
11
-    public static function mb_lcfirst($str, $encoding='UTF-8'){
12
-        return mb_strtolower(mb_substr($str, 0, 1, $encoding), $encoding).mb_substr($str,1, mb_strlen($str), $encoding);
11
+    public static function mb_lcfirst($str, $encoding = 'UTF-8') {
12
+        return mb_strtolower(mb_substr($str, 0, 1, $encoding), $encoding).mb_substr($str, 1, mb_strlen($str), $encoding);
13 13
     }
14 14
 
15 15
     /**
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      * @param string $encoding - кодировка, по-умолчанию UTF-8
19 19
      * @return string
20 20
      */
21
-    public static function mb_ucfirst($str, $encoding='UTF-8')
21
+    public static function mb_ucfirst($str, $encoding = 'UTF-8')
22 22
     {
23 23
         $str = mb_ereg_replace('^[\ ]+', '', $str);
24 24
         $str = mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding).mb_substr($str, 1, mb_strlen($str), $encoding);
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
      * @param string $encoding кодировка
37 37
      * @return string
38 38
      */
39
-    public static function mb_trim_word($html, $len, $encoding = 'UTF-8'){
39
+    public static function mb_trim_word($html, $len, $encoding = 'UTF-8') {
40 40
         $text = trim(preg_replace('|\s+|', ' ', strip_tags($html)));
41
-        $text = mb_substr($text, 0, $len+1, $encoding);
42
-        if(mb_substr($text, -1, null, $encoding) == ' '){
41
+        $text = mb_substr($text, 0, $len + 1, $encoding);
42
+        if (mb_substr($text, -1, null, $encoding) == ' ') {
43 43
             $out = trim($text);
44
-        }else{
44
+        } else {
45 45
             $out = mb_substr($text, 0, mb_strripos($text, ' ', null, $encoding), $encoding);
46 46
         }
47 47
         return preg_replace("/(([\.,\-:!?;\s])|(&\w+;))+$/ui", "", $out);
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
         '[' => '[', '%5B' => '[', ']' => ']', '%5D' => ']',
217 217
         '{' => '{', '%7B' => '{', '}' => '}', '%7D' => '}',
218 218
         '`' => '`', '%60' => '`'
219
-    )){
220
-        switch(true){
219
+    )) {
220
+        switch (true) {
221 221
             case is_scalar($data):
222 222
                 $out = str_replace(
223 223
                     array_keys($chars),
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 break;
228 228
             case is_array($data):
229 229
                 $out = $data;
230
-                foreach($out as $key => &$val){
230
+                foreach ($out as $key => &$val) {
231 231
                     $val = self::sanitarTag($val, $charset, $chars);
232 232
                 }
233 233
                 break;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         return $out;
238 238
     }
239 239
 
240
-    public static function e($text, $charset = 'UTF-8'){
240
+    public static function e($text, $charset = 'UTF-8') {
241 241
         return is_scalar($text) ? htmlspecialchars($text, ENT_QUOTES, $charset, false) : '';
242 242
     }
243 243
     /**
@@ -319,12 +319,12 @@  discard block
 block discarded – undo
319 319
         if ($prefix == '' && $suffix == '') {
320 320
             $out = $data;
321 321
         } else {
322
-            $InsertPrefix = ($prefix != '') ? ($prefix . $addPS) : '';
323
-            $InsertSuffix = ($suffix != '') ? ($addPS. $suffix) : '';
322
+            $InsertPrefix = ($prefix != '') ? ($prefix.$addPS) : '';
323
+            $InsertSuffix = ($suffix != '') ? ($addPS.$suffix) : '';
324 324
             foreach ($data as $key => $item) {
325
-                $key = $InsertPrefix . $key;
325
+                $key = $InsertPrefix.$key;
326 326
                 $val = null;
327
-                switch(true){
327
+                switch (true) {
328 328
                     case is_scalar($item):
329 329
                         $val = $item;
330 330
                         break;
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
                         $val = '';
335 335
                         break;
336 336
                 }
337
-                $out[$key . $InsertSuffix] = $val;
337
+                $out[$key.$InsertSuffix] = $val;
338 338
             }
339 339
         }
340 340
         return $out;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @license    GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
74 74
      * @param string $email проверяемый email
75 75
      * @param boolean $dns проверять ли DNS записи
76
-     * @return boolean Результат проверки почтового ящика
76
+     * @return false|string Результат проверки почтового ящика
77 77
      * @author Anton Shevchuk
78 78
      */
79 79
     public static function emailValidate($email, $dns = true)
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     }
147 147
 
148 148
     /**
149
-     * @param $data
149
+     * @param string $data
150 150
      * @return bool|false|string
151 151
      */
152 152
     private function _getEnv($data)
Please login to merge, or discard this patch.
assets/lib/Module/Action.php 4 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                     $textMethod = $data['key'].'Text';
60 60
                     if(method_exists($modObj, $textMethod)){
61 61
                         $out['value'] = $modObj->$textMethod();
62
-                    }else{
62
+                    } else{
63 63
                         $out['value'] = $modObj->get($data['key']);
64 64
                     }
65 65
                 }
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
                 ), self::$modx->getFullTableName(self::TABLE()), "id = ".$dataID);
85 85
             if($q){
86 86
                 $data['log'] = $oldValue ? 'Запись с ID '.$dataID.' восстановлена' : 'Запись с ID '.$dataID.' удалена';
87
-            }else{
87
+            } else{
88 88
                 $data['log'] = $oldValue ? 'Не удалось восстановить запись с ID '.$dataID : 'Не удалось удалить запись с ID '.$dataID;
89 89
             }
90
-        }else{
90
+        } else{
91 91
             $data['log'] = '<span class="error">Ошибка</span>. Не удалось определить обновляему запись';
92 92
         }
93 93
         return $data;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     public static $TPL = null;
10 10
     protected static $TABLE = "site_content";
11 11
     protected static $classTable = null;
12
-	protected static $_tplObj = null;
12
+    protected static $_tplObj = null;
13 13
 
14 14
     /**
15 15
      * @param \DocumentParser $modx
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public static function init(\DocumentParser $modx, Template $tpl, \MODxAPI $classTable){
27 27
         self::setMODX($modx);
28 28
         self::$TPL = Template::showLog();
29
-		self::$_tplObj = $tpl;
29
+        self::$_tplObj = $tpl;
30 30
         self::$classTable = $classTable;
31 31
     }
32 32
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @return array
125 125
      */
126 126
     public static function deleted(){
127
-		$data = array();
127
+        $data = array();
128 128
         $dataID = (int)Template::getParam('docId', $_GET);
129 129
         if($dataID>0 && self::_checkObj($dataID)){
130 130
             $oldValue = self::_getValue('deleted_at', $dataID);
@@ -149,6 +149,6 @@  discard block
 block discarded – undo
149 149
      * @return null
150 150
      */
151 151
     public static function getClassTable(){
152
-		return self::$classTable;
153
-	}
152
+        return self::$classTable;
153
+    }
154 154
 }
155 155
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Class Action
5 5
  * @package Module
6 6
  */
7
-abstract class Action{
7
+abstract class Action {
8 8
     protected static $modx = null;
9 9
     public static $TPL = null;
10 10
     protected static $TABLE = "site_content";
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * @param \DocumentParser $modx
16 16
      */
17
-    public static function setMODX(\DocumentParser $modx){
17
+    public static function setMODX(\DocumentParser $modx) {
18 18
         self::$modx = $modx;
19 19
     }
20 20
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param Template $tpl
24 24
      * @param \MODxAPI $classTable
25 25
      */
26
-    public static function init(\DocumentParser $modx, Template $tpl, \MODxAPI $classTable){
26
+    public static function init(\DocumentParser $modx, Template $tpl, \MODxAPI $classTable) {
27 27
         self::setMODX($modx);
28 28
         self::$TPL = Template::showLog();
29 29
 		self::$_tplObj = $tpl;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @return string
35 35
      */
36
-    public static function TABLE(){
36
+    public static function TABLE() {
37 37
         return static::$TABLE;
38 38
     }
39 39
 
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
      * @param $id
42 42
      * @return bool
43 43
      */
44
-    protected static function _checkObj($id){
44
+    protected static function _checkObj($id) {
45 45
         $q = self::$modx->db->select('id', self::$modx->getFullTableName(self::TABLE()), "id = ".$id);
46
-        return (self::$modx->db->getRecordCount($q)==1);
46
+        return (self::$modx->db->getRecordCount($q) == 1);
47 47
     }
48 48
 
49 49
     /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param $id
52 52
      * @return mixed
53 53
      */
54
-    protected static function _getValue($field, $id){
54
+    protected static function _getValue($field, $id) {
55 55
         $q = self::$modx->db->select($field, self::$modx->getFullTableName(self::TABLE()), "id = ".$id);
56 56
         return self::$modx->db->getValue($q);
57 57
     }
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * @return array|mixed
61 61
      */
62
-    public static function listValue(){
63
-        $out = self::_workValue(function($data, $modObj){
62
+    public static function listValue() {
63
+        $out = self::_workValue(function($data, $modObj) {
64 64
             $listFunction = $data['key'].'Lists';
65 65
             $out = method_exists($modObj, $listFunction) ? $modObj->$listFunction() : array();
66
-            $out['selected'] =  $modObj->get($data['key']);
66
+            $out['selected'] = $modObj->get($data['key']);
67 67
             return $out;
68 68
         });
69 69
         self::$TPL = null;
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
      * @param $callback
76 76
      * @return array|mixed
77 77
      */
78
-    protected static function _workValue($callback){
78
+    protected static function _workValue($callback) {
79 79
         self::$TPL = 'ajax/getValue';
80 80
         $data = Helper::jeditable('data');
81 81
         $out = array();
82
-        if(!empty($data)){
82
+        if (!empty($data)) {
83 83
             $modObj = self::$classTable;
84 84
             $modObj->edit($data['id']);
85
-            if($modObj->getID() && ((is_object($callback) && ($callback instanceof \Closure)) || is_callable($callback))){
85
+            if ($modObj->getID() && ((is_object($callback) && ($callback instanceof \Closure)) || is_callable($callback))) {
86 86
                 $out = call_user_func($callback, $data, $modObj);
87 87
             }
88 88
         }
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
     /**
93 93
      * @return array|mixed
94 94
      */
95
-    public static function saveValue(){
96
-        return self::_workValue(function($data, $modObj){
95
+    public static function saveValue() {
96
+        return self::_workValue(function($data, $modObj) {
97 97
             $out = array();
98
-            if(isset($_POST['value']) && is_scalar($_POST['value'])){
99
-                if($modObj->set($data['key'], $_POST['value'])->save()){
98
+            if (isset($_POST['value']) && is_scalar($_POST['value'])) {
99
+                if ($modObj->set($data['key'], $_POST['value'])->save()) {
100 100
                     $textMethod = $data['key'].'Text';
101
-                    if(method_exists($modObj, $textMethod)){
101
+                    if (method_exists($modObj, $textMethod)) {
102 102
                         $out['value'] = $modObj->$textMethod();
103
-                    }else{
103
+                    } else {
104 104
                         $out['value'] = $modObj->get($data['key']);
105 105
                     }
106 106
                 }
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
     /**
113 113
      * @return array|mixed
114 114
      */
115
-    public static function getValue(){
116
-        return self::_workValue(function($data, $modObj){
115
+    public static function getValue() {
116
+        return self::_workValue(function($data, $modObj) {
117 117
             return array(
118 118
                 'value' => $modObj->get($data['key'])
119 119
             );
@@ -123,32 +123,32 @@  discard block
 block discarded – undo
123 123
     /**
124 124
      * @return array
125 125
      */
126
-    public static function deleted(){
126
+    public static function deleted() {
127 127
 		$data = array();
128 128
         $dataID = (int)Template::getParam('docId', $_GET);
129
-        if($dataID>0 && self::_checkObj($dataID)){
129
+        if ($dataID > 0 && self::_checkObj($dataID)) {
130 130
             $oldValue = self::_getValue('deleted_at', $dataID);
131 131
             $q = self::$modx->db->update(array(
132 132
                     'deleted_at' => empty($oldValue) ? date('Y-m-d H:i:s') : null
133 133
                 ), self::$modx->getFullTableName(self::TABLE()), "id = ".$dataID);
134
-            if($q){
134
+            if ($q) {
135 135
                 $data['log'] = $oldValue ? 'Запись с ID '.$dataID.' восстановлена' : 'Запись с ID '.$dataID.' удалена';
136
-            }else{
136
+            } else {
137 137
                 $data['log'] = $oldValue ? 'Не удалось восстановить запись с ID '.$dataID : 'Не удалось удалить запись с ID '.$dataID;
138 138
             }
139
-        }else{
139
+        } else {
140 140
             $data['log'] = '<span class="error">Ошибка</span>. Не удалось определить обновляему запись';
141 141
         }
142 142
         return $data;
143 143
     }
144
-    public static function lists(){
144
+    public static function lists() {
145 145
         self::$TPL = 'ajax/lists';
146 146
     }
147 147
 
148 148
     /**
149 149
      * @return null
150 150
      */
151
-    public static function getClassTable(){
151
+    public static function getClassTable() {
152 152
 		return self::$classTable;
153 153
 	}
154 154
 }
155 155
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     }
59 59
 
60 60
     /**
61
-     * @param $id
61
+     * @param integer $id
62 62
      * @return bool
63 63
      */
64 64
     protected static function _checkObj($id){
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
     }
68 68
 
69 69
     /**
70
-     * @param $field
71
-     * @param $id
70
+     * @param string $field
71
+     * @param integer $id
72 72
      * @return mixed
73 73
      */
74 74
     protected static function _getValue($field, $id){
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     }
93 93
 
94 94
     /**
95
-     * @param $callback
95
+     * @param \Closure $callback
96 96
      * @return array|mixed
97 97
      */
98 98
     protected static function _workValue($callback){
Please login to merge, or discard this patch.
assets/lib/Formatter/HtmlFormatter.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@
 block discarded – undo
22 22
             '<span style="color:'.$tag.';">$1</span>',
23 23
             '<span style="font-style:italic;">$1</span>',
24 24
         );
25
-        if($decode)
26
-            $string = htmlentities($string);
25
+        if($decode) {
26
+                    $string = htmlentities($string);
27
+        }
27 28
         return '<pre>'.preg_replace($find, $replace, $string).'</pre>';
28 29
     }
29 30
 }
30 31
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,24 +4,24 @@  discard block
 block discarded – undo
4 4
  * Class HtmlFormatter
5 5
  * @package Formatter
6 6
  */
7
-class HtmlFormatter{
7
+class HtmlFormatter {
8 8
     /**
9 9
      * @param $string
10 10
      * @param bool $decode
11 11
      * @return string
12 12
      */
13
-    public static function format($string, $decode = TRUE){
13
+    public static function format($string, $decode = TRUE) {
14 14
         $tag = '#0000ff';
15 15
         $att = '#ff0000';
16 16
         $val = '#8000ff';
17 17
         $com = '#34803a';
18 18
         $find = array(
19
-            '~(\s[a-z].*?=)~',                    // Highlight the attributes
20
-            '~(&lt;\!--.*?--&gt;)~s',            // Hightlight comments
21
-            '~(&quot;[a-zA-Z0-9\/].*?&quot;)~',    // Highlight the values
22
-            '~(&lt;[a-z].*?&gt;)~',                // Highlight the beginning of the opening tag
23
-            '~(&lt;/[a-z].*?&gt;)~',            // Highlight the closing tag
24
-            '~(&amp;.*?;)~',                    // Stylize HTML entities
19
+            '~(\s[a-z].*?=)~', // Highlight the attributes
20
+            '~(&lt;\!--.*?--&gt;)~s', // Hightlight comments
21
+            '~(&quot;[a-zA-Z0-9\/].*?&quot;)~', // Highlight the values
22
+            '~(&lt;[a-z].*?&gt;)~', // Highlight the beginning of the opening tag
23
+            '~(&lt;/[a-z].*?&gt;)~', // Highlight the closing tag
24
+            '~(&amp;.*?;)~', // Stylize HTML entities
25 25
         );
26 26
         $replace = array(
27 27
             '<span style="color:'.$att.';">$1</span>',
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             '<span style="color:'.$tag.';">$1</span>',
32 32
             '<span style="font-style:italic;">$1</span>',
33 33
         );
34
-        if($decode)
34
+        if ($decode)
35 35
             $string = htmlentities($string);
36 36
         return '<pre>'.preg_replace($find, $replace, $string).'</pre>';
37 37
     }
Please login to merge, or discard this patch.
assets/lib/SimpleTab/table.abstract.php 3 patches
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
     public function place($ids, $dir, $rid) {
43 43
         $table = $this->makeTable($this->table);
44 44
         $ids = $this->cleanIDs($ids, ',', array(0));
45
-        if(empty($ids) || is_scalar($ids)) return false;
45
+        if(empty($ids) || is_scalar($ids)) {
46
+            return false;
47
+        }
46 48
         $rows = $this->query("SELECT count(`{$this->pkName}`) FROM {$table} WHERE `{$this->rfName}`={$rid}");
47 49
         $index = $this->modx->db->getValue($rows);
48 50
         $cnt = count($ids);
@@ -67,15 +69,25 @@  discard block
 block discarded – undo
67 69
      */
68 70
     public function deleteThumb($url, $cache = false) {
69 71
         $url = $this->fs->relativePath($url);
70
-        if (empty($url)) return;
71
-        if ($this->fs->checkFile($url)) unlink(MODX_BASE_PATH . $url);
72
+        if (empty($url)) {
73
+            return;
74
+        }
75
+        if ($this->fs->checkFile($url)) {
76
+            unlink(MODX_BASE_PATH . $url);
77
+        }
72 78
         $dir = $this->fs->takeFileDir($url);
73 79
         $iterator = new \FilesystemIterator($dir);
74
-        if (!$iterator->valid()) rmdir($dir);
75
-        if ($cache) return;
80
+        if (!$iterator->valid()) {
81
+            rmdir($dir);
82
+        }
83
+        if ($cache) {
84
+            return;
85
+        }
76 86
         $thumbsCache = isset($this->params['thumbsCache']) ? $this->params['thumbsCache'] : $this->thumbsCache;
77 87
         $thumb = $thumbsCache.$url;
78
-        if ($this->fs->checkFile($thumb)) $this->deleteThumb($thumb, true);
88
+        if ($this->fs->checkFile($thumb)) {
89
+            $this->deleteThumb($thumb, true);
90
+        }
79 91
     }
80 92
 
81 93
     public function delete($ids, $fire_events = NULL) {
@@ -141,7 +153,9 @@  discard block
 block discarded – undo
141 153
      * @return bool
142 154
      */
143 155
     public function makeThumb($folder,$url,$options) {
144
-        if (empty($url)) return false;
156
+        if (empty($url)) {
157
+            return false;
158
+        }
145 159
         $thumb = new \Helpers\PHPThumb();
146 160
         $inputFile = MODX_BASE_PATH . $this->fs->relativePath($url);
147 161
         $outputFile = MODX_BASE_PATH. $this->fs->relativePath($folder). '/' . $this->fs->relativePath($url);
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php namespace SimpleTab;
2
-require_once (MODX_BASE_PATH . 'assets/lib/MODxAPI/autoTable.abstract.php');
3
-require_once (MODX_BASE_PATH . 'assets/lib/Helpers/FS.php');
4
-require_once (MODX_BASE_PATH . 'assets/lib/Helpers/PHPThumb.php');
2
+require_once (MODX_BASE_PATH.'assets/lib/MODxAPI/autoTable.abstract.php');
3
+require_once (MODX_BASE_PATH.'assets/lib/Helpers/FS.php');
4
+require_once (MODX_BASE_PATH.'assets/lib/Helpers/PHPThumb.php');
5 5
 
6 6
 class dataTable extends \autoTable {
7 7
     protected $params = array();
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         return $out;
31 31
     }
32 32
 
33
-    public function touch($field){
33
+    public function touch($field) {
34 34
         $this->set($field, date('Y-m-d H:i:s', time() + $this->modx->config['server_offset_time']));
35 35
         return $this;
36 36
     }
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
     public function place($ids, $dir, $rid) {
44 44
         $table = $this->makeTable($this->table);
45 45
         $ids = $this->cleanIDs($ids, ',', array(0));
46
-        if(empty($ids) || is_scalar($ids)) return false;
46
+        if (empty($ids) || is_scalar($ids)) return false;
47 47
         $rows = $this->query("SELECT count(`{$this->pkName}`) FROM {$table} WHERE `{$this->rfName}`={$rid}");
48 48
         $index = $this->modx->db->getValue($rows);
49 49
         $cnt = count($ids);
50
-        $ids = implode(',',$ids);
50
+        $ids = implode(',', $ids);
51 51
         if ($dir == 'top') {
52
-            $this->query("SET @index := " . ($index - $cnt - 1));
52
+            $this->query("SET @index := ".($index - $cnt - 1));
53 53
             $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC");
54 54
             $this->query("SET @index := -1");
55 55
         } else {
56 56
             $this->query("SET @index := -1");
57 57
             $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC");
58
-            $this->query("SET @index := " . ($cnt - 1));
58
+            $this->query("SET @index := ".($cnt - 1));
59 59
         }
60 60
         $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` NOT IN ({$ids})) AND `{$this->rfName}` = {$rid} ORDER BY `{$this->indexName}` ASC");
61 61
         $out = $this->modx->db->getAffectedRows();
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     public function deleteThumb($url, $cache = false) {
70 70
         $url = $this->fs->relativePath($url);
71 71
         if (empty($url)) return;
72
-        if ($this->fs->checkFile($url)) unlink(MODX_BASE_PATH . $url);
72
+        if ($this->fs->checkFile($url)) unlink(MODX_BASE_PATH.$url);
73 73
         $dir = $this->fs->takeFileDir($url);
74 74
         $iterator = new \FilesystemIterator($dir);
75 75
         if (!$iterator->valid()) rmdir($dir);
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
         return $out;
86 86
     }
87 87
 
88
-    public function deleteAll ($ids, $rid, $fire_events = NULL) {
88
+    public function deleteAll($ids, $rid, $fire_events = NULL) {
89 89
         $this->clearIndexes($ids, $rid);
90 90
         return $this->delete($ids, $fire_events);
91 91
     }
92 92
 
93
-    public function fieldNames(){
93
+    public function fieldNames() {
94 94
         $fields = array_keys($this->getDefaultFields());
95 95
         $fields[] = $this->fieldPKName();
96 96
         return $fields;
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
         /* more refactoring  needed */
119 119
         if ($targetIndex < $sourceIndex) {
120 120
             if (($point == 'top' && $orderDir == 'asc') || ($point == 'bottom' && $orderDir == 'desc')) {
121
-                $this->modx->db->update("`{$this->indexName}`=`{$this->indexName}`+1",$table,"`{$this->indexName}`>={$targetIndex} AND `{$this->indexName}`<{$sourceIndex} AND `{$this->rfName}`={$rid}");
122
-                $rows = $this->modx->db->update("`{$this->indexName}`={$targetIndex}",$table,"`{$this->pkName}`={$sourceId}");             
121
+                $this->modx->db->update("`{$this->indexName}`=`{$this->indexName}`+1", $table, "`{$this->indexName}`>={$targetIndex} AND `{$this->indexName}`<{$sourceIndex} AND `{$this->rfName}`={$rid}");
122
+                $rows = $this->modx->db->update("`{$this->indexName}`={$targetIndex}", $table, "`{$this->pkName}`={$sourceId}");             
123 123
             } elseif (($point == 'bottom' && $orderDir == 'asc') || ($point == 'top' && $orderDir == 'desc')) {
124
-                $this->modx->db->update("`{$this->indexName}`=`{$this->indexName}`+1",$table,"`{$this->indexName}`>{$targetIndex} AND `{$this->indexName}`<{$sourceIndex} AND `{$this->rfName}`={$rid}");
125
-                $rows = $this->modx->db->update("`{$this->indexName}`=1+{$targetIndex}",$table,"`{$this->pkName}`={$sourceId}");             
124
+                $this->modx->db->update("`{$this->indexName}`=`{$this->indexName}`+1", $table, "`{$this->indexName}`>{$targetIndex} AND `{$this->indexName}`<{$sourceIndex} AND `{$this->rfName}`={$rid}");
125
+                $rows = $this->modx->db->update("`{$this->indexName}`=1+{$targetIndex}", $table, "`{$this->pkName}`={$sourceId}");             
126 126
             }
127 127
         } else {
128 128
             if (($point == 'bottom' && $orderDir == 'asc') || ($point == 'top' && $orderDir == 'desc')) {
129
-                $this->modx->db->update("`{$this->indexName}`=`{$this->indexName}`-1",$table,"`{$this->indexName}`<={$targetIndex} AND `{$this->indexName}`>={$sourceIndex} AND `{$this->rfName}`={$rid}");
130
-                $rows = $this->modx->db->update("`{$this->indexName}`={$targetIndex}",$table,"`{$this->pkName}`={$sourceId}");             
129
+                $this->modx->db->update("`{$this->indexName}`=`{$this->indexName}`-1", $table, "`{$this->indexName}`<={$targetIndex} AND `{$this->indexName}`>={$sourceIndex} AND `{$this->rfName}`={$rid}");
130
+                $rows = $this->modx->db->update("`{$this->indexName}`={$targetIndex}", $table, "`{$this->pkName}`={$sourceId}");             
131 131
             } elseif (($point == 'top' && $orderDir == 'asc') || ($point == 'bottom' && $orderDir == 'desc')) {
132
-                $this->modx->db->update("`{$this->indexName}`=`{$this->indexName}`-1",$table,"`{$this->indexName}`<{$targetIndex} AND `{$this->indexName}`>={$sourceIndex} AND `{$this->rfName}`={$rid}");
133
-                $rows = $this->modx->db->update("`{$this->indexName}`=-1+{$targetIndex}",$table,"`{$this->pkName}`={$sourceId}");                
132
+                $this->modx->db->update("`{$this->indexName}`=`{$this->indexName}`-1", $table, "`{$this->indexName}`<{$targetIndex} AND `{$this->indexName}`>={$sourceIndex} AND `{$this->rfName}`={$rid}");
133
+                $rows = $this->modx->db->update("`{$this->indexName}`=-1+{$targetIndex}", $table, "`{$this->pkName}`={$sourceId}");                
134 134
             }
135 135
         }
136 136
         
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
      * @param $options
144 144
      * @return bool
145 145
      */
146
-    public function makeThumb($folder,$url,$options) {
146
+    public function makeThumb($folder, $url, $options) {
147 147
         if (empty($url)) return false;
148 148
         $thumb = new \Helpers\PHPThumb();
149
-        $inputFile = MODX_BASE_PATH . $this->fs->relativePath($url);
150
-        $outputFile = MODX_BASE_PATH. $this->fs->relativePath($folder). '/' . $this->fs->relativePath($url);
149
+        $inputFile = MODX_BASE_PATH.$this->fs->relativePath($url);
150
+        $outputFile = MODX_BASE_PATH.$this->fs->relativePath($folder).'/'.$this->fs->relativePath($url);
151 151
         $dir = $this->fs->takeFileDir($outputFile);
152 152
         $this->fs->makeDir($dir, $this->modx->config['new_folder_permissions']);
153
-        if ($thumb->create($inputFile,$outputFile,$options)) {
153
+        if ($thumb->create($inputFile, $outputFile, $options)) {
154 154
             return true;
155 155
         } else {
156
-            $this->modx->logEvent(0, 3, $thumb->debugMessages,  __NAMESPACE__);
156
+            $this->modx->logEvent(0, 3, $thumb->debugMessages, __NAMESPACE__);
157 157
             return false;
158 158
         }
159 159
     }
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@
 block discarded – undo
21 21
     /**
22 22
      * @var null
23 23
      */
24
-	protected $indexName = null;
24
+    protected $indexName = null;
25 25
 
26 26
     /**
27 27
      * @var null
28 28
      */
29
-	protected $rfName = null;
29
+    protected $rfName = null;
30 30
 
31 31
     /**
32 32
      * @var null
33 33
      */
34
-	protected $thumbsCache = null;
34
+    protected $thumbsCache = null;
35 35
 
36 36
     /**
37 37
      * dataTable constructor.
Please login to merge, or discard this patch.
assets/lib/SimpleTab/plugin.class.php 3 patches
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,9 +45,10 @@  discard block
 block discarded – undo
45 45
         }
46 46
         //overload plugin and class properties
47 47
         $_params = $modx->parseProperties('&template=;;'.$this->params['template'].' &id=;;'.$this->params['id'],$modx->event->activePlugin,'plugin');
48
-        foreach ($_params as $key=>$value) 
49
-            if (property_exists ($this, $key)) 
50
-                $this->$key = $value;
48
+        foreach ($_params as $key=>$value) {
49
+                    if (property_exists ($this, $key)) 
50
+                $this->$key = $value;
51
+        }
51 52
 
52 53
         $this->params = array_merge($this->params,$_params);
53 54
         $modx->event->_output = "";
@@ -57,7 +58,9 @@  discard block
 block discarded – undo
57 58
     }
58 59
 
59 60
 	public function clearFolders($ids = array(), $folder) {
60
-        foreach ($ids as $id) $this->fs->rmDir($folder.$id.'/');
61
+        foreach ($ids as $id) {
62
+            $this->fs->rmDir($folder.$id.'/');
63
+        }
61 64
     }
62 65
 
63 66
     public function checkPermissions() {
@@ -124,7 +127,9 @@  discard block
 block discarded – undo
124 127
 			$scripts = isset($scripts['scripts']) ? $scripts['scripts'] : $scripts['styles'];
125 128
 			foreach ($scripts as $name => $params) {
126 129
 				$script = $this->assets->registerScript($name,$params);
127
-                if ($script !== false) $js .= $script;
130
+                if ($script !== false) {
131
+                    $js .= $script;
132
+                }
128 133
 			}
129 134
 		} else {
130 135
 			if ($list == $this->jsListDefault) {
@@ -197,7 +202,9 @@  discard block
 block discarded – undo
197 202
 			$result = $this->modx->db->select('`id`',$eventsTable,"`name` = '{$event}'");
198 203
 			if (!$this->modx->db->getRecordCount($result)) {
199 204
 				$sql = "INSERT INTO {$eventsTable} VALUES (NULL, '{$event}', '{$eventsType}', '{$this->pluginName} Events')";
200
-				if (!$this->modx->db->query($sql)) $this->modx->logEvent(0, 3, "Cannot register {$event} event.", $this->pluginName);
205
+				if (!$this->modx->db->query($sql)) {
206
+				    $this->modx->logEvent(0, 3, "Cannot register {$event} event.", $this->pluginName);
207
+				}
201 208
 			}
202 209
 		}
203 210
 	}
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace SimpleTab;
3
-include_once (MODX_BASE_PATH . 'assets/snippets/DocLister/lib/DLTemplate.class.php');
4
-include_once (MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php');
5
-require_once (MODX_BASE_PATH . 'assets/lib/Helpers/FS.php');
6
-require_once (MODX_BASE_PATH . 'assets/lib/Helpers/Assets.php');
3
+include_once (MODX_BASE_PATH.'assets/snippets/DocLister/lib/DLTemplate.class.php');
4
+include_once (MODX_BASE_PATH.'assets/lib/APIHelpers.class.php');
5
+require_once (MODX_BASE_PATH.'assets/lib/Helpers/FS.php');
6
+require_once (MODX_BASE_PATH.'assets/lib/Helpers/Assets.php');
7 7
 
8 8
 abstract class Plugin {
9 9
 	public $modx = null;
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
         $this->lang_attribute = $lang_attribute;
41 41
         $this->params = $modx->event->params;
42 42
         if ($this->checkTemplate && !isset($this->params['template']) && $modx->event->name != 'OnEmptyTrash') {
43
-			$doc = $modx->getDocument($this->params['id'],'template','all','all');
43
+			$doc = $modx->getDocument($this->params['id'], 'template', 'all', 'all');
44 44
             $this->params['template'] = is_array($doc) ? end($doc) : null;
45 45
         }
46 46
         //overload plugin and class properties
47
-        $_params = $modx->parseProperties('&template=;;'.$this->params['template'].' &id=;;'.$this->params['id'],$modx->event->activePlugin,'plugin');
47
+        $_params = $modx->parseProperties('&template=;;'.$this->params['template'].' &id=;;'.$this->params['id'], $modx->event->activePlugin, 'plugin');
48 48
         foreach ($_params as $key=>$value) 
49
-            if (property_exists ($this, $key)) 
49
+            if (property_exists($this, $key)) 
50 50
                 $this->$key = $value;
51 51
 
52
-        $this->params = array_merge($this->params,$_params);
52
+        $this->params = array_merge($this->params, $_params);
53 53
         $modx->event->_output = "";
54 54
         $this->DLTemplate = \DLTemplate::getInstance($this->modx);
55 55
         $this->fs = \Helpers\FS::getInstance();
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
     }
62 62
 
63 63
     public function checkPermissions() {
64
-        $templates = isset($this->params['templates']) ? explode(',',$this->params['templates']) : false;
65
-        $roles = isset($this->params['roles']) ? explode(',',$this->params['roles']) : false;
64
+        $templates = isset($this->params['templates']) ? explode(',', $this->params['templates']) : false;
65
+        $roles = isset($this->params['roles']) ? explode(',', $this->params['roles']) : false;
66 66
 
67
-        $tplFlag = ($this->checkTemplate && !$templates || ($templates && !in_array($this->params['template'],$templates)));
67
+        $tplFlag = ($this->checkTemplate && !$templates || ($templates && !in_array($this->params['template'], $templates)));
68 68
 
69
-        $documents = isset($this->params['documents']) ? explode(',',$this->params['documents']) : false;
69
+        $documents = isset($this->params['documents']) ? explode(',', $this->params['documents']) : false;
70 70
         $docFlag = ($this->checkId && $tplFlag) ? !($documents && in_array($this->params['id'], $documents)) : $tplFlag;
71 71
 
72
-        $ignoreDocs = isset($this->params['ignoreDoc']) ? explode(',',$this->params['ignoreDoc']) : false;
72
+        $ignoreDocs = isset($this->params['ignoreDoc']) ? explode(',', $this->params['ignoreDoc']) : false;
73 73
         $ignoreFlag = ($this->checkId && $ignoreDocs && in_array($this->params['id'], $ignoreDocs));
74 74
 
75
-        return ($docFlag || $ignoreFlag || ($roles && !in_array($_SESSION['mgrRole'],$roles)));
75
+        return ($docFlag || $ignoreFlag || ($roles && !in_array($_SESSION['mgrRole'], $roles)));
76 76
     }
77 77
 
78 78
     /**
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
         }
90 90
         $output = '';
91 91
 		$plugins = $this->modx->pluginEvent;
92
-		if(($this->renderEvent!=='OnDocFormRender' || (array_search('ManagerManager', $plugins['OnDocFormRender']) === false))) {
93
-			$jquery = $this->assets->registerScript('jQuery',array(
92
+		if (($this->renderEvent !== 'OnDocFormRender' || (array_search('ManagerManager', $plugins['OnDocFormRender']) === false))) {
93
+			$jquery = $this->assets->registerScript('jQuery', array(
94 94
                 'version' => '1.9.1',
95 95
                 'src'     => 'assets/js/jquery/jquery-1.9.1.min.js'
96 96
             ));
97 97
             if ($jquery !== false) {
98 98
                 $output .= $jquery;
99
-                $output .='<script type="text/javascript">var jQuery = jQuery.noConflict(true);</script>';    
99
+                $output .= '<script type="text/javascript">var jQuery = jQuery.noConflict(true);</script>';    
100 100
             }
101 101
 		}
102 102
 		$tpl = MODX_BASE_PATH.$this->tpl;
103
-		if($this->fs->checkFile($tpl)) {
103
+		if ($this->fs->checkFile($tpl)) {
104 104
 			$output .= '[+js+][+styles+]'.file_get_contents($tpl);
105 105
 		} else {
106 106
 			$this->modx->logEvent(0, 3, "Cannot load {$this->tpl} .", $this->pluginName);
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
      * @param array $ph
115 115
      * @return string
116 116
      */
117
-    public function renderJS($list,$ph = array()) {
117
+    public function renderJS($list, $ph = array()) {
118 118
     	$js = '';
119 119
     	$scripts = MODX_BASE_PATH.$list;
120
-		if($this->fs->checkFile($scripts)) {
120
+		if ($this->fs->checkFile($scripts)) {
121 121
 			$scripts = @file_get_contents($scripts);
122
-			$scripts = $this->DLTemplate->parseChunk('@CODE:'.$scripts,$ph);
123
-			$scripts = json_decode($scripts,true);
122
+			$scripts = $this->DLTemplate->parseChunk('@CODE:'.$scripts, $ph);
123
+			$scripts = json_decode($scripts, true);
124 124
 			$scripts = isset($scripts['scripts']) ? $scripts['scripts'] : $scripts['styles'];
125 125
 			foreach ($scripts as $name => $params) {
126
-				$script = $this->assets->registerScript($name,$params);
126
+				$script = $this->assets->registerScript($name, $params);
127 127
                 if ($script !== false) $js .= $script;
128 128
 			}
129 129
 		} else {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * @return array
141 141
 	 */
142 142
 	public function getTplPlaceholders() {
143
-		$ph = array ();
143
+		$ph = array();
144 144
 		return $ph;
145 145
 	}
146 146
 
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
             $output = $this->prerender();
153 153
     		if ($output !== false) {
154 154
     			$ph = $this->getTplPlaceholders();
155
-    			$ph['js'] = $this->renderJS($this->jsListDefault,$ph) . $this->renderJS($this->jsListCustom,$ph);
156
-    			$ph['styles'] = $this->renderJS($this->cssListDefault,$ph) . $this->renderJS($this->cssListCustom,$ph);
157
-    			$output = $this->DLTemplate->parseChunk('@CODE:'.$output,$ph);
155
+    			$ph['js'] = $this->renderJS($this->jsListDefault, $ph).$this->renderJS($this->jsListCustom, $ph);
156
+    			$ph['styles'] = $this->renderJS($this->cssListDefault, $ph).$this->renderJS($this->cssListCustom, $ph);
157
+    			$output = $this->DLTemplate->parseChunk('@CODE:'.$output, $ph);
158 158
     		}
159 159
     		return $output;
160 160
         }
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
     public function renderEmpty() {
167 167
         if (!$this->checkPermissions()) {
168 168
             $tpl = MODX_BASE_PATH.$this->emptyTpl;
169
-            if($this->fs->checkFile($tpl)) {
169
+            if ($this->fs->checkFile($tpl)) {
170 170
                 $output = '[+js+]'.file_get_contents($tpl);
171 171
                 $ph = $this->getTplPlaceholders();
172
-                $ph['js'] = $this->renderJS($this->jsListEmpty,$ph);
173
-                $output = $this->DLTemplate->parseChunk('@CODE:'.$output,$ph);
172
+                $ph['js'] = $this->renderJS($this->jsListEmpty, $ph);
173
+                $output = $this->DLTemplate->parseChunk('@CODE:'.$output, $ph);
174 174
                 return $output;
175 175
             } else {
176 176
                 $this->modx->logEvent(0, 3, "Cannot load {$this->emptyTpl} .", $this->pluginName);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function checkTable() {
185 185
         $sql = "SHOW TABLES LIKE '{$this->_table}'";
186
-        return $this->modx->db->getRecordCount( $this->modx->db->query($sql));
186
+        return $this->modx->db->getRecordCount($this->modx->db->query($sql));
187 187
     }
188 188
 
189 189
     public function createTable() {
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	public function registerEvents($events = array(), $eventsType = '6') {
195 195
 		$eventsTable = $this->modx->getFullTableName('system_eventnames');
196 196
 		foreach ($events as $event) {
197
-			$result = $this->modx->db->select('`id`',$eventsTable,"`name` = '{$event}'");
197
+			$result = $this->modx->db->select('`id`', $eventsTable, "`name` = '{$event}'");
198 198
 			if (!$this->modx->db->getRecordCount($result)) {
199 199
 				$sql = "INSERT INTO {$eventsTable} VALUES (NULL, '{$event}', '{$eventsType}', '{$this->pluginName} Events')";
200 200
 				if (!$this->modx->db->query($sql)) $this->modx->logEvent(0, 3, "Cannot register {$event} event.", $this->pluginName);
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * @var \DocumentParser|null
16 16
      */
17
-	public $modx = null;
17
+    public $modx = null;
18 18
 
19 19
     /**
20 20
      * @var string
21 21
      */
22
-	public $pluginName = '';
22
+    public $pluginName = '';
23 23
 
24 24
     /**
25 25
      * @var array
26 26
      */
27
-	public $params = array();
27
+    public $params = array();
28 28
 
29 29
     /**
30 30
      * @var string
@@ -34,32 +34,32 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * @var string
36 36
      */
37
-	public $tpl = '';
37
+    public $tpl = '';
38 38
 
39 39
     /**
40 40
      * @var string
41 41
      */
42
-	public $jsListDefault = '';
42
+    public $jsListDefault = '';
43 43
 
44 44
     /**
45 45
      * @var string
46 46
      */
47
-	public $jsListCustom = '';
47
+    public $jsListCustom = '';
48 48
 
49 49
     /**
50 50
      * @var string
51 51
      */
52
-	public $cssListDefault = '';
52
+    public $cssListDefault = '';
53 53
 
54 54
     /**
55 55
      * @var string
56 56
      */
57
-	public $cssListCustom = '';
57
+    public $cssListCustom = '';
58 58
 
59 59
     /**
60 60
      * @var array
61 61
      */
62
-	public $pluginEvents = array();
62
+    public $pluginEvents = array();
63 63
 
64 64
     /**
65 65
      * @var string
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     /**
70 70
      * @var \Helpers\FS|null
71 71
      */
72
-	protected $fs = null;
72
+    protected $fs = null;
73 73
 
74 74
     /**
75 75
      * @var \AssetsHelper|null
@@ -79,39 +79,39 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * @var null
81 81
      */
82
-	protected $emptyTpl = null;
82
+    protected $emptyTpl = null;
83 83
 
84 84
     /**
85 85
      * @var string
86 86
      */
87
-	protected $jsListEmpty = '';
87
+    protected $jsListEmpty = '';
88 88
 
89 89
     /**
90 90
      * @var \DLTemplate|null
91 91
      */
92
-	public $DLTemplate = null;
92
+    public $DLTemplate = null;
93 93
 
94 94
     /**
95 95
      * @var string
96 96
      */
97
-	public $lang_attribute = '';
97
+    public $lang_attribute = '';
98 98
 
99 99
     /**
100 100
      * @var bool
101 101
      */
102
-	protected $checkTemplate = true;
102
+    protected $checkTemplate = true;
103 103
 
104 104
     /**
105 105
      * @var string
106 106
      */
107
-	protected $renderEvent = 'OnDocFormRender';
107
+    protected $renderEvent = 'OnDocFormRender';
108 108
 
109 109
     /**
110 110
      * @var bool
111 111
      */
112
-	protected $checkId = true;
112
+    protected $checkId = true;
113 113
 
114
-	/**
114
+    /**
115 115
      * @param $modx
116 116
      * @param string $lang_attribute
117 117
      */
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $this->lang_attribute = $lang_attribute;
122 122
         $this->params = $modx->event->params;
123 123
         if ($this->checkTemplate && !isset($this->params['template']) && $modx->event->name != 'OnEmptyTrash') {
124
-			$doc = $modx->getDocument($this->params['id'],'template','all','all');
124
+            $doc = $modx->getDocument($this->params['id'],'template','all','all');
125 125
             $this->params['template'] = is_array($doc) ? end($doc) : null;
126 126
         }
127 127
         //overload plugin and class properties
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
                 $this->modx->logEvent(0, 3, "Cannot create {$this->table} table.", $this->pluginName);
174 174
                 return;
175 175
             }
176
-			$this->registerEvents($this->pluginEvents);
176
+            $this->registerEvents($this->pluginEvents);
177 177
         }
178 178
         $output = '';
179
-		$plugins = $this->modx->pluginEvent;
180
-		if(($this->renderEvent!=='OnDocFormRender' || (array_search('ManagerManager', $plugins['OnDocFormRender']) === false))) {
181
-			$jquery = $this->assets->registerScript('jQuery',array(
179
+        $plugins = $this->modx->pluginEvent;
180
+        if(($this->renderEvent!=='OnDocFormRender' || (array_search('ManagerManager', $plugins['OnDocFormRender']) === false))) {
181
+            $jquery = $this->assets->registerScript('jQuery',array(
182 182
                 'version' => '1.9.1',
183 183
                 'src'     => 'assets/js/jquery/jquery-1.9.1.min.js'
184 184
             ));
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
                 $output .= $jquery;
187 187
                 $output .='<script type="text/javascript">var jQuery = jQuery.noConflict(true);</script>';    
188 188
             }
189
-		}
190
-		$tpl = MODX_BASE_PATH.$this->tpl;
191
-		if($this->fs->checkFile($tpl)) {
192
-			$output .= '[+js+][+styles+]'.file_get_contents($tpl);
193
-		} else {
194
-			$this->modx->logEvent(0, 3, "Cannot load {$this->tpl} .", $this->pluginName);
189
+        }
190
+        $tpl = MODX_BASE_PATH.$this->tpl;
191
+        if($this->fs->checkFile($tpl)) {
192
+            $output .= '[+js+][+styles+]'.file_get_contents($tpl);
193
+        } else {
194
+            $this->modx->logEvent(0, 3, "Cannot load {$this->tpl} .", $this->pluginName);
195 195
             return false;
196
-		}
196
+        }
197 197
         return $output;
198 198
     }
199 199
 
@@ -203,48 +203,48 @@  discard block
 block discarded – undo
203 203
      * @return string
204 204
      */
205 205
     public function renderJS($list,$ph = array()) {
206
-    	$js = '';
207
-    	$scripts = MODX_BASE_PATH.$list;
208
-		if($this->fs->checkFile($scripts)) {
209
-			$scripts = @file_get_contents($scripts);
210
-			$scripts = $this->DLTemplate->parseChunk('@CODE:'.$scripts,$ph);
211
-			$scripts = json_decode($scripts,true);
212
-			$scripts = isset($scripts['scripts']) ? $scripts['scripts'] : $scripts['styles'];
213
-			foreach ($scripts as $name => $params) {
214
-				$script = $this->assets->registerScript($name,$params);
206
+        $js = '';
207
+        $scripts = MODX_BASE_PATH.$list;
208
+        if($this->fs->checkFile($scripts)) {
209
+            $scripts = @file_get_contents($scripts);
210
+            $scripts = $this->DLTemplate->parseChunk('@CODE:'.$scripts,$ph);
211
+            $scripts = json_decode($scripts,true);
212
+            $scripts = isset($scripts['scripts']) ? $scripts['scripts'] : $scripts['styles'];
213
+            foreach ($scripts as $name => $params) {
214
+                $script = $this->assets->registerScript($name,$params);
215 215
                 if ($script !== false) $js .= $script;
216
-			}
217
-		} else {
218
-			if ($list == $this->jsListDefault) {
219
-				$this->modx->logEvent(0, 3, "Cannot load {$this->jsListDefault} .", $this->pluginName);
220
-			} elseif ($list == $this->cssListDefault) {
221
-				$this->modx->logEvent(0, 3, "Cannot load {$this->cssListDefault} .", $this->pluginName);
222
-			}
223
-		}
224
-		return $js;
216
+            }
217
+        } else {
218
+            if ($list == $this->jsListDefault) {
219
+                $this->modx->logEvent(0, 3, "Cannot load {$this->jsListDefault} .", $this->pluginName);
220
+            } elseif ($list == $this->cssListDefault) {
221
+                $this->modx->logEvent(0, 3, "Cannot load {$this->cssListDefault} .", $this->pluginName);
222
+            }
223
+        }
224
+        return $js;
225 225
     }
226 226
 
227
-	/**
228
-	 * @return array
229
-	 */
230
-	public function getTplPlaceholders() {
231
-		$ph = array ();
232
-		return $ph;
233
-	}
227
+    /**
228
+     * @return array
229
+     */
230
+    public function getTplPlaceholders() {
231
+        $ph = array ();
232
+        return $ph;
233
+    }
234 234
 
235 235
     /**
236 236
      * @return string
237 237
      */
238 238
     public function render() {
239
-		if (!$this->checkPermissions()) {
239
+        if (!$this->checkPermissions()) {
240 240
             $output = $this->prerender();
241
-    		if ($output !== false) {
242
-    			$ph = $this->getTplPlaceholders();
243
-    			$ph['js'] = $this->renderJS($this->jsListDefault,$ph) . $this->renderJS($this->jsListCustom,$ph);
244
-    			$ph['styles'] = $this->renderJS($this->cssListDefault,$ph) . $this->renderJS($this->cssListCustom,$ph);
245
-    			$output = $this->DLTemplate->parseChunk('@CODE:'.$output,$ph);
246
-    		}
247
-    		return $output;
241
+            if ($output !== false) {
242
+                $ph = $this->getTplPlaceholders();
243
+                $ph['js'] = $this->renderJS($this->jsListDefault,$ph) . $this->renderJS($this->jsListCustom,$ph);
244
+                $ph['styles'] = $this->renderJS($this->cssListDefault,$ph) . $this->renderJS($this->cssListCustom,$ph);
245
+                $output = $this->DLTemplate->parseChunk('@CODE:'.$output,$ph);
246
+            }
247
+            return $output;
248 248
         }
249 249
     }
250 250
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
      * @return mixed
279 279
      */
280 280
     public function createTable() {
281
-    	$sql = '';
282
-    	return $this->modx->db->query($sql);
281
+        $sql = '';
282
+        return $this->modx->db->query($sql);
283 283
     }
284 284
 
285 285
     /**
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
      * @param string $eventsType
288 288
      */
289 289
     public function registerEvents($events = array(), $eventsType = '6') {
290
-		$eventsTable = $this->modx->getFullTableName('system_eventnames');
291
-		foreach ($events as $event) {
292
-			$result = $this->modx->db->select('`id`',$eventsTable,"`name` = '{$event}'");
293
-			if (!$this->modx->db->getRecordCount($result)) {
294
-				$sql = "INSERT INTO {$eventsTable} VALUES (NULL, '{$event}', '{$eventsType}', '{$this->pluginName} Events')";
295
-				if (!$this->modx->db->query($sql)) $this->modx->logEvent(0, 3, "Cannot register {$event} event.", $this->pluginName);
296
-			}
297
-		}
298
-	}
290
+        $eventsTable = $this->modx->getFullTableName('system_eventnames');
291
+        foreach ($events as $event) {
292
+            $result = $this->modx->db->select('`id`',$eventsTable,"`name` = '{$event}'");
293
+            if (!$this->modx->db->getRecordCount($result)) {
294
+                $sql = "INSERT INTO {$eventsTable} VALUES (NULL, '{$event}', '{$eventsType}', '{$this->pluginName} Events')";
295
+                if (!$this->modx->db->query($sql)) $this->modx->logEvent(0, 3, "Cannot register {$event} event.", $this->pluginName);
296
+            }
297
+        }
298
+    }
299 299
 }
300 300
\ No newline at end of file
Please login to merge, or discard this patch.
assets/lib/SimpleTab/controller.abstract.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     public $isExit = false;
11 11
     public $output = null;
12 12
     public $params = null;
13
-	public $fireEvents = true;
13
+    public $fireEvents = true;
14 14
 	
15 15
     public $dlParams = array(
16 16
         "controller"    =>  "onetable",
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,9 @@  discard block
 block discarded – undo
101 101
         $this->dlParams['table'] = $this->data->tableName();
102 102
         $this->dlParams['idField'] = $this->data->fieldPKName();
103 103
         $this->dlParams['addWhereList'] = "`{$this->rfName}`={$this->rid}";
104
-        if (isset($_REQUEST['rows'])) $this->dlParams['display'] = (int)$_REQUEST['rows'];
104
+        if (isset($_REQUEST['rows'])) {
105
+            $this->dlParams['display'] = (int)$_REQUEST['rows'];
106
+        }
105 107
         $offset = isset($_REQUEST['page']) ? (int)$_REQUEST['page'] : 1;
106 108
         $offset = $offset ? $offset : 1;
107 109
         $offset = $this->dlParams['display']*abs($offset-1);
@@ -113,7 +115,9 @@  discard block
 block discarded – undo
113 115
             $this->dlParams['sortDir'] = $_REQUEST['order'];
114 116
         }
115 117
         foreach ($this->dlParams as &$param) {
116
-            if (empty($param)) unset($param);
118
+            if (empty($param)) {
119
+                unset($param);
120
+            }
117 121
         }
118 122
     }
119 123
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php namespace SimpleTab;
2 2
 
3
-require_once (MODX_BASE_PATH . 'assets/lib/Helpers/FS.php');
3
+require_once (MODX_BASE_PATH.'assets/lib/Helpers/FS.php');
4 4
 
5 5
 abstract class AbstractController {
6 6
     public $rfName = '';
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 
31 31
     protected $modx = null;
32 32
 
33
-    public function __construct(\DocumentParser $modx){
33
+    public function __construct(\DocumentParser $modx) {
34 34
         $this->FS = \Helpers\FS::getInstance();
35 35
         $this->modx = $modx;
36 36
         $this->params = $modx->event->params;
37 37
         $this->rid = isset($_REQUEST[$this->rfName]) ? (int)$_REQUEST[$this->rfName] : 0;
38 38
     }
39 39
 
40
-    public function callExit(){
41
-        if($this->isExit){
40
+    public function callExit() {
41
+        if ($this->isExit) {
42 42
             echo $this->output;
43 43
             exit;
44 44
         }
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
         if (isset($_REQUEST['rows'])) $this->dlParams['display'] = (int)$_REQUEST['rows'];
105 105
         $offset = isset($_REQUEST['page']) ? (int)$_REQUEST['page'] : 1;
106 106
         $offset = $offset ? $offset : 1;
107
-        $offset = $this->dlParams['display']*abs($offset-1);
107
+        $offset = $this->dlParams['display'] * abs($offset - 1);
108 108
         $this->dlParams['offset'] = $offset;
109
-        if(isset($_REQUEST['sort'])){
109
+        if (isset($_REQUEST['sort'])) {
110 110
             $this->dlParams['sortBy'] = preg_replace('/[^A-Za-z0-9_\-]/', '', $_REQUEST['sort']);
111 111
         }
112
-        if(isset($_REQUEST['order']) && in_array(strtoupper($_REQUEST['order']), array("ASC","DESC"))){
112
+        if (isset($_REQUEST['order']) && in_array(strtoupper($_REQUEST['order']), array("ASC", "DESC"))) {
113 113
             $this->dlParams['sortDir'] = $_REQUEST['order'];
114 114
         }
115 115
         foreach ($this->dlParams as &$param) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
     public function getLanguageCode() {
121 121
         $manager_language = $this->modx->config['manager_language'];
122
-        if(file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
122
+        if (file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
123 123
             include_once MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php";
124 124
         }
125 125
         return $modx_lang_attribute;
Please login to merge, or discard this patch.
assets/lib/Helpers/PHPThumb.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
 
8 8
     private $thumb = null;
9 9
     protected $fs = null;
10
-	public $debugMessages = '';
10
+    public $debugMessages = '';
11 11
 
12 12
     public function __construct()
13 13
     {
14
-       	$this->thumb = new \phpthumb();
15
-		$this->fs = FS::getInstance();
14
+            $this->thumb = new \phpthumb();
15
+        $this->fs = FS::getInstance();
16 16
     }
17 17
 
18 18
     public function create($inputFile, $outputFile, $options) {
19 19
         $this->thumb->sourceFilename = $inputFile;
20
-		$ext = explode('.',$inputFile);
20
+        $ext = explode('.',$inputFile);
21 21
         $ext = str_replace('jpeg','jpg',strtolower(array_pop($ext)));
22 22
         $options = 'f='.$ext.'&'.$options;
23 23
         $this->setOptions($options);
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     public function optimize($file, $type = 'jpg') {
33 33
         switch ($type) {
34 34
             case 'jpg':
35
-				$ext = $this->fs->takeFileExt($file);
35
+                $ext = $this->fs->takeFileExt($file);
36 36
                 if ($ext == 'jpeg' || $ext == 'jpg') {
37 37
                     $cmd = '/usr/bin/jpegtran -optimize -progressive -copy none -outfile '.escapeshellarg($file.'_').' '.escapeshellarg($file);
38 38
                     exec($cmd, $result, $return_var);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php namespace Helpers;
2 2
 
3 3
 include_once(MODX_BASE_PATH.'assets/snippets/phpthumb/phpthumb.class.php');
4
-require_once(MODX_BASE_PATH . 'assets/lib/Helpers/FS.php');
4
+require_once(MODX_BASE_PATH.'assets/lib/Helpers/FS.php');
5 5
 
6
-class PHPThumb{
6
+class PHPThumb {
7 7
 
8 8
     private $thumb = null;
9 9
     protected $fs = null;
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function create($inputFile, $outputFile, $options) {
19 19
         $this->thumb->sourceFilename = $inputFile;
20
-		$ext = explode('.',$inputFile);
21
-        $ext = str_replace('jpeg','jpg',strtolower(array_pop($ext)));
20
+		$ext = explode('.', $inputFile);
21
+        $ext = str_replace('jpeg', 'jpg', strtolower(array_pop($ext)));
22 22
         $options = 'f='.$ext.'&'.$options;
23 23
         $this->setOptions($options);
24 24
         if ($this->thumb->GenerateThumbnail() && $this->thumb->RenderToFile($outputFile)) {
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
     }
24 24
 
25 25
     /**
26
-     * @param $inputFile
27
-     * @param $outputFile
26
+     * @param string $inputFile
27
+     * @param string $outputFile
28 28
      * @param $options
29 29
      * @return bool
30 30
      */
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     }
67 67
 
68 68
     /**
69
-     * @param $options
69
+     * @param string $options
70 70
      */
71 71
     private function setOptions($options) {
72 72
         $options = strtr($options, Array("," => "&", "_" => "=", '{' => '[', '}' => ']'));
Please login to merge, or discard this patch.
assets/lib/class.summary.php 4 patches
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,7 +108,9 @@  discard block
 block discarded – undo
108 108
         } else if ($this->_useCut !== true && (mb_strlen($resource, 'UTF-8') > $truncLen)) {
109 109
 
110 110
             $summary = $this->html_substr($resource, $truncLen, $truncOffset, $truncChars);
111
-            if ($resource != $summary) $this->_useSubstr = true;
111
+            if ($resource != $summary) {
112
+                $this->_useSubstr = true;
113
+            }
112 114
         } else {
113 115
             $summary = $resource;
114 116
         }
@@ -149,15 +151,23 @@  discard block
 block discarded – undo
149 151
                     }
150 152
                     // Slash signifies an ending (like </a> or ... />)
151 153
                     // substract 2
152
-                    if ($current_char == '/' && $tag_counter <> 0) $tag_counter -= 2;
154
+                    if ($current_char == '/' && $tag_counter <> 0) {
155
+                        $tag_counter -= 2;
156
+                    }
153 157
                     // On a ">" substract 1
154
-                    if ($current_char == '>') $tag_counter -= 1;
158
+                    if ($current_char == '>') {
159
+                        $tag_counter -= 1;
160
+                    }
155 161
                     // If quotes are encountered, start ignoring the tags
156 162
                     // (for directory slashes)
157
-                    if ($current_char == '"') $quotes_on = TRUE;
163
+                    if ($current_char == '"') {
164
+                        $quotes_on = TRUE;
165
+                    }
158 166
                 } else {
159 167
                     // IF quotes are encountered again, turn it back off
160
-                    if ($current_char == '"') $quotes_on = FALSE;
168
+                    if ($current_char == '"') {
169
+                        $quotes_on = FALSE;
170
+                    }
161 171
                 }
162 172
 
163 173
                 // Count only the chars outside html tags
@@ -185,7 +195,9 @@  discard block
 block discarded – undo
185 195
         // Original PHP code from The Art of Web: www.the-art-of-web.com
186 196
 
187 197
         // return with no change if string is shorter than $limit
188
-        if (mb_strlen($string, 'UTF-8') < $limit) return $string;
198
+        if (mb_strlen($string, 'UTF-8') < $limit) {
199
+            return $string;
200
+        }
189 201
 
190 202
         $string = mb_substr($string, 0, $limit, 'UTF-8');
191 203
         if (false !== ($breakpoint = mb_strrpos($string, $break, 'UTF-8'))) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
                 $process = explode(":", $doing);
66 66
                 switch ($process[0]) {
67 67
                     case 'notags':
68
-                    	$this->_cfg['content'] = strip_tags($this->_cfg['content']);
68
+                        $this->_cfg['content'] = strip_tags($this->_cfg['content']);
69 69
                         break;
70 70
                     case 'noparser':
71 71
                         $this->_cfg['content'] = APIhelpers::sanitarTag($this->_cfg['content']);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @date 31.07.2013
13 13
  * @version 1.0.3
14 14
  */
15
-include_once(MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php');
15
+include_once(MODX_BASE_PATH.'assets/lib/APIHelpers.class.php');
16 16
 class SummaryText
17 17
 {
18 18
     private $_cfg = array('content' => '', 'summary' => '', 'original' => '', 'break' => '');
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     protected  function beforeCut($resource, $splitter = '')
92 92
     {
93 93
         if ($splitter !== '') {
94
-            $summary = str_replace('<p>' . $splitter . '</p>', $splitter, $resource); // For TinyMCE or if it isn't wrapped inside paragraph tags
94
+            $summary = str_replace('<p>'.$splitter.'</p>', $splitter, $resource); // For TinyMCE or if it isn't wrapped inside paragraph tags
95 95
             $summary = explode($splitter, $summary, 2);
96 96
             $this->_useCut = isset($summary[1]);
97 97
             $summary = $summary['0'];
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
                     $tag = mb_substr($tag, 0, strpos($tag, ' '), 'UTF-8');
253 253
                 }
254 254
                 if (!mb_stristr($tag, 'br', 'UTF-8') && !mb_stristr($tag, 'img', 'UTF-8') && !empty ($tag)) {
255
-                    $endTags .= '</' . $tag . '>';
255
+                    $endTags .= '</'.$tag.'>';
256 256
                 }
257 257
             }
258 258
         }
259
-        return $text . $endTags;
259
+        return $text.$endTags;
260 260
     }
261 261
 }
262 262
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     }
70 70
 
71 71
     /**
72
-     * @return mixed
72
+     * @return string
73 73
      */
74 74
     public function getCut()
75 75
     {
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
     /**
150 150
      * @param $resource
151 151
      * @param $truncLen
152
-     * @param $truncOffset
153
-     * @param $truncChars
152
+     * @param integer $truncOffset
153
+     * @param boolean $truncChars
154 154
      * @param string $splitter
155 155
      * @return array|mixed|string
156 156
      */
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      */
243 243
     /**
244 244
      * @param $string
245
-     * @param $limit
245
+     * @param integer $limit
246 246
      * @param string $break
247 247
      * @return string
248 248
      */
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     }
266 266
 
267 267
     /**
268
-     * @param $str
268
+     * @param string $str
269 269
      * @return mixed
270 270
      */
271 271
     protected function rTriming($str)
Please login to merge, or discard this patch.
assets/snippets/DocLister/lib/DLphx.class.php 4 patches
Braces   +70 added lines, -28 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
         $this->maxPasses = ($maxpass != '') ? $maxpass : 50;
48 48
 
49 49
         $modx->setPlaceholder("phx", "&_PHX_INTERNAL_&");
50
-        if (function_exists('mb_internal_encoding')) mb_internal_encoding($modx->config['modx_charset']);
50
+        if (function_exists('mb_internal_encoding')) {
51
+            mb_internal_encoding($modx->config['modx_charset']);
52
+        }
51 53
     }
52 54
 
53 55
     // Plugin event hook for MODx
@@ -67,7 +69,9 @@  discard block
 block discarded – undo
67 69
     {
68 70
         global $modx;
69 71
         // If we already reached max passes don't get at it again.
70
-        if ($this->curPass == $this->maxPasses) return $template;
72
+        if ($this->curPass == $this->maxPasses) {
73
+            return $template;
74
+        }
71 75
         // Set template pre-process hash
72 76
         $st = md5($template);
73 77
         // Replace non-call characters in the template: [, ]
@@ -85,7 +89,9 @@  discard block
 block discarded – undo
85 89
         // Set template post-process hash
86 90
         $et = md5($template);
87 91
         // If template has changed, parse it once more...
88
-        if ($st != $et) $template = $this->Parse($template);
92
+        if ($st != $et) {
93
+            $template = $this->Parse($template);
94
+        }
89 95
         // Write an event log if debugging is enabled and there is something to log
90 96
         if ($this->debug && $this->debugLog) {
91 97
             $modx->logEvent($this->curPass, 1, $this->createEventLog(), $this->name . ' ' . $this->version);
@@ -203,9 +209,13 @@  discard block
 block discarded – undo
203 209
         $et = md5($template); // Post-process template hash
204 210
 
205 211
         // Log an event if this was the maximum pass
206
-        if ($this->curPass == $this->maxPasses) $this->Log("Max passes reached. infinite loop protection so exiting.\n If you need the extra passes set the max passes to the highest count of nested tags in your template.");
212
+        if ($this->curPass == $this->maxPasses) {
213
+            $this->Log("Max passes reached. infinite loop protection so exiting.\n If you need the extra passes set the max passes to the highest count of nested tags in your template.");
214
+        }
207 215
         // If this pass is not at maximum passes and the template hash is not the same, get at it again.
208
-        if (($this->curPass < $this->maxPasses) && ($st != $et)) $template = $this->ParseValues($template);
216
+        if (($this->curPass < $this->maxPasses) && ($st != $et)) {
217
+            $template = $this->ParseValues($template);
218
+        }
209 219
 
210 220
         return $template;
211 221
     }
@@ -224,7 +234,9 @@  discard block
 block discarded – undo
224 234
             for ($i = 0; $i < $count; $i++) {
225 235
                 $output = trim($output);
226 236
                 $this->Log("  |--- Modifier = '" . $modifier_cmd[$i] . "'");
227
-                if ($modifier_value[$i] != '') $this->Log("  |--- Options = '" . $modifier_value[$i] . "'");
237
+                if ($modifier_value[$i] != '') {
238
+                    $this->Log("  |--- Options = '" . $modifier_value[$i] . "'");
239
+                }
228 240
                 switch ($modifier_cmd[$i]) {
229 241
                     #####  Conditional Modifiers
230 242
                     case "input":
@@ -267,7 +279,9 @@  discard block
 block discarded – undo
267 279
                     case "ir":
268 280
                     case "memberof":
269 281
                     case "mo": // Is Member Of  (same as inrole but this one can be stringed as a conditional)
270
-                        if ($output == "&_PHX_INTERNAL_&") $output = $this->user["id"];
282
+                        if ($output == "&_PHX_INTERNAL_&") {
283
+                            $output = $this->user["id"];
284
+                        }
271 285
                         $grps = ($this->strlen($modifier_value[$i]) > 0) ? explode(",", $modifier_value[$i]) : array();
272 286
                         $condition[] = intval($this->isMemberOfWebGroupByUserId($output, $grps));
273 287
                         break;
@@ -386,11 +400,15 @@  discard block
 block discarded – undo
386 400
                         $output = eval("return " . $filter . ";");
387 401
                         break;
388 402
                     case "isnotempty":
389
-                        if (!empty($output)) $output = $modifier_value[$i];
403
+                        if (!empty($output)) {
404
+                            $output = $modifier_value[$i];
405
+                        }
390 406
                         break;
391 407
                     case "isempty":
392 408
                     case "ifempty":
393
-                        if (empty($output)) $output = $modifier_value[$i];
409
+                        if (empty($output)) {
410
+                            $output = $modifier_value[$i];
411
+                        }
394 412
                         break;
395 413
                     case "nl2br":
396 414
                         $output = nl2br($output);
@@ -400,7 +418,9 @@  discard block
 block discarded – undo
400 418
                         break;
401 419
                     case "set":
402 420
                         $c = $i + 1;
403
-                        if ($count > $c && $modifier_cmd[$c] == "value") $output = preg_replace("~([^a-zA-Z0-9])~", "", $modifier_value[$i]);
421
+                        if ($count > $c && $modifier_cmd[$c] == "value") {
422
+                            $output = preg_replace("~([^a-zA-Z0-9])~", "", $modifier_value[$i]);
423
+                        }
404 424
                         break;
405 425
                     case "value":
406 426
                         if ($i > 0 && $modifier_cmd[$i - 1] == "set") {
@@ -412,11 +432,15 @@  discard block
 block discarded – undo
412 432
                         $output = md5($output);
413 433
                         break;
414 434
                     case "userinfo":
415
-                        if ($output == "&_PHX_INTERNAL_&") $output = $this->user["id"];
435
+                        if ($output == "&_PHX_INTERNAL_&") {
436
+                            $output = $this->user["id"];
437
+                        }
416 438
                         $output = $this->ModUser($output, $modifier_value[$i]);
417 439
                         break;
418 440
                     case "inrole": // deprecated
419
-                        if ($output == "&_PHX_INTERNAL_&") $output = $this->user["id"];
441
+                        if ($output == "&_PHX_INTERNAL_&") {
442
+                            $output = $this->user["id"];
443
+                        }
420 444
                         $grps = ($this->strlen($modifier_value[$i]) > 0) ? explode(",", $modifier_value[$i]) : array();
421 445
                         $output = intval($this->isMemberOfWebGroupByUserId($output, $grps));
422 446
                         break;
@@ -460,12 +484,14 @@  discard block
 block discarded – undo
460 484
 							$msg = ob_get_contents();
461 485
 							$output = $msg . $custom;
462 486
 							ob_end_clean();
463
-						}else{
487
+						} else{
464 488
 							$output = '';
465 489
 						}
466 490
                         break;
467 491
                 }
468
-                if (count($condition)) $this->Log("  |--- Condition = '" . $condition[count($condition) - 1] . "'");
492
+                if (count($condition)) {
493
+                    $this->Log("  |--- Condition = '" . $condition[count($condition) - 1] . "'");
494
+                }
469 495
                 $this->Log("  |--- Output = '" . $output . "'");
470 496
             }
471 497
         }
@@ -545,7 +571,9 @@  discard block
 block discarded – undo
545 571
         global $modx;
546 572
 
547 573
         // if $groupNames is not an array return false
548
-        if (!is_array($groupNames)) return false;
574
+        if (!is_array($groupNames)) {
575
+            return false;
576
+        }
549 577
 
550 578
         // if the user id is a negative number make it positive
551 579
         if (intval($userid) < 0) {
@@ -562,8 +590,9 @@  discard block
 block discarded – undo
562 590
             $grpNames = $this->cache["mo"][$userid];
563 591
         }
564 592
         // Check if a supplied group matches a webgroup from the array we just created
565
-        foreach ($groupNames as $k => $v)
566
-            if (in_array(trim($v), $grpNames)) return true;
593
+        foreach ($groupNames as $k => $v) {
594
+                    if (in_array(trim($v), $grpNames)) return true;
595
+        }
567 596
 
568 597
         // If we get here the above logic did not find a match, so return false
569 598
         return false;
@@ -586,52 +615,65 @@  discard block
 block discarded – undo
586 615
     // Sets a placeholder variable which can only be access by PHx
587 616
 	public function setPHxVariable($name, $value)
588 617
     {
589
-        if ($name != "phx") $this->placeholders[$name] = $value;
618
+        if ($name != "phx") {
619
+            $this->placeholders[$name] = $value;
620
+        }
590 621
     }
591 622
 
592 623
     //mbstring
593 624
 	public function substr($str, $s, $l = null)
594 625
     {
595
-        if (function_exists('mb_substr')) return mb_substr($str, $s, $l);
626
+        if (function_exists('mb_substr')) {
627
+            return mb_substr($str, $s, $l);
628
+        }
596 629
         return substr($str, $s, $l);
597 630
     }
598 631
 
599 632
 	public function strlen($str)
600 633
     {
601
-        if (function_exists('mb_strlen')) return mb_strlen($str);
634
+        if (function_exists('mb_strlen')) {
635
+            return mb_strlen($str);
636
+        }
602 637
         return strlen($str);
603 638
     }
604 639
 
605 640
 	public function strtolower($str)
606 641
     {
607
-        if (function_exists('mb_strtolower')) return mb_strtolower($str);
642
+        if (function_exists('mb_strtolower')) {
643
+            return mb_strtolower($str);
644
+        }
608 645
         return strtolower($str);
609 646
     }
610 647
 
611 648
 	public function strtoupper($str)
612 649
     {
613
-        if (function_exists('mb_strtoupper')) return mb_strtoupper($str);
650
+        if (function_exists('mb_strtoupper')) {
651
+            return mb_strtoupper($str);
652
+        }
614 653
         return strtoupper($str);
615 654
     }
616 655
 
617 656
 	public function ucfirst($str)
618 657
     {
619
-        if (function_exists('mb_strtoupper') && function_exists('mb_substr') && function_exists('mb_strlen'))
620
-            return mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str));
658
+        if (function_exists('mb_strtoupper') && function_exists('mb_substr') && function_exists('mb_strlen')) {
659
+                    return mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str));
660
+        }
621 661
         return ucfirst($str);
622 662
     }
623 663
 
624 664
 	public function lcfirst($str)
625 665
     {
626
-        if (function_exists('mb_strtolower') && function_exists('mb_substr') && function_exists('mb_strlen'))
627
-            return mb_strtolower(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str));
666
+        if (function_exists('mb_strtolower') && function_exists('mb_substr') && function_exists('mb_strlen')) {
667
+                    return mb_strtolower(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str));
668
+        }
628 669
         return lcfirst($str);
629 670
     }
630 671
 
631 672
 	public function ucwords($str)
632 673
     {
633
-        if (function_exists('mb_convert_case'))
634
-            return mb_convert_case($str, MB_CASE_TITLE);
674
+        if (function_exists('mb_convert_case')) {
675
+                    return mb_convert_case($str, MB_CASE_TITLE);
676
+        }
635 677
         return ucwords($str);
636 678
     }
637 679
 
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 #	Date: March 22, 2013
11 11
 #
12 12
 ####*/
13
-include_once(MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php');
13
+include_once(MODX_BASE_PATH.'assets/lib/APIHelpers.class.php');
14 14
 
15 15
 class DLphx
16 16
 {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         preg_match_all('~(?:=`[^`@]*?)(\[\+([^:\+\[\]]+)([^\[\]]*?)\+\])~s', $template, $matches);
79 79
         if ($matches[0]) {
80 80
             $template = str_replace($matches[1], '', $template);
81
-            $this->Log("Cleaning unsolved tags: \n" . implode("\n", $matches[2]));
81
+            $this->Log("Cleaning unsolved tags: \n".implode("\n", $matches[2]));
82 82
         }
83 83
         // Restore non-call characters in the template: [, ]
84 84
         $template = str_replace($this->safetags[1], $this->safetags[2], $template);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         if ($st != $et) $template = $this->Parse($template);
89 89
         // Write an event log if debugging is enabled and there is something to log
90 90
         if ($this->debug && $this->debugLog) {
91
-            $modx->logEvent($this->curPass, 1, $this->createEventLog(), $this->name . ' ' . $this->version);
91
+            $modx->logEvent($this->curPass, 1, $this->createEventLog(), $this->name.' '.$this->version);
92 92
             $this->debugLog = false;
93 93
         }
94 94
         // Return the processed template
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
             for ($i = 0; $i < $count; $i++) {
116 116
 				$var_search[] = $matches[0][$i];
117 117
 				$input = $matches[1][$i];
118
-				$this->Log('MODX Chunk: ' . $input);
119
-                $input = $modx->mergeChunkContent('{{' . $input . '}}');
118
+				$this->Log('MODX Chunk: '.$input);
119
+                $input = $modx->mergeChunkContent('{{'.$input.'}}');
120 120
                 $var_replace[] = $this->Filter($input, $matches[2][$i]);
121 121
             }
122 122
             $template = str_replace($var_search, $var_replace, $template);
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
             // for each detected snippet
133 133
             for ($i = 0; $i < $count; $i++) {
134 134
                 $snippet = $matches[2][$i]; // snippet call
135
-                $this->Log("MODx Snippet -> " . $snippet);
135
+                $this->Log("MODx Snippet -> ".$snippet);
136 136
 
137 137
                 // Let MODx evaluate snippet
138
-                $replace = $modx->evalSnippets("[[" . $snippet . "]]");
138
+                $replace = $modx->evalSnippets("[[".$snippet."]]");
139 139
                 $this->LogSnippet($replace);
140 140
 
141 141
                 // Replace values
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
                 switch ($matches[1][$i]) {
165 165
                     // Document / Template Variable eXtended
166 166
                     case "*":
167
-                        $this->Log("MODx TV/DV: " . $input);
168
-                        $input = $modx->mergeDocumentContent("[*" . $input . "*]");
167
+                        $this->Log("MODx TV/DV: ".$input);
168
+                        $input = $modx->mergeDocumentContent("[*".$input."*]");
169 169
                         $replace = $this->Filter($input, $modifiers);
170 170
                         break;
171 171
                     // MODx Setting eXtended
172 172
                     case "(":
173
-                        $this->Log("MODx Setting variable: " . $input);
174
-                        $input = $modx->mergeSettingsContent("[(" . $input . ")]");
173
+                        $this->Log("MODx Setting variable: ".$input);
174
+                        $input = $modx->mergeSettingsContent("[(".$input.")]");
175 175
                         $replace = $this->Filter($input, $modifiers);
176 176
                         break;
177 177
                     // MODx Placeholder eXtended
178 178
                     default:
179
-                        $this->Log("MODx / PHx placeholder variable: " . $input);
179
+                        $this->Log("MODx / PHx placeholder variable: ".$input);
180 180
                         // Check if placeholder is set
181 181
                         if (!array_key_exists($input, $this->placeholders) && !array_key_exists($input, $modx->placeholders)) {
182 182
                             // not set so try again later.
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     {
208 208
         global $modx;
209 209
         $output = $input;
210
-        $this->Log("  |--- Input = '" . $output . "'");
210
+        $this->Log("  |--- Input = '".$output."'");
211 211
         if (preg_match_all('~:([^:=]+)(?:=`(.*?)`(?=:[^:=]+|$))?~s', $modifiers, $matches)) {
212 212
             $modifier_cmd = $matches[1]; // modifier command
213 213
             $modifier_value = $matches[2]; // modifier value
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
             $condition = array();
216 216
             for ($i = 0; $i < $count; $i++) {
217 217
                 $output = trim($output);
218
-                $this->Log("  |--- Modifier = '" . $modifier_cmd[$i] . "'");
219
-                if ($modifier_value[$i] != '') $this->Log("  |--- Options = '" . $modifier_value[$i] . "'");
218
+                $this->Log("  |--- Modifier = '".$modifier_cmd[$i]."'");
219
+                if ($modifier_value[$i] != '') $this->Log("  |--- Options = '".$modifier_value[$i]."'");
220 220
                 switch ($modifier_cmd[$i]) {
221 221
                     #####  Conditional Modifiers
222 222
                     case "input":
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
                         break;
272 272
                     case "show":
273 273
                         $conditional = implode(' ', $condition);
274
-                        $isvalid = intval(eval("return (" . $conditional . ");"));
274
+                        $isvalid = intval(eval("return (".$conditional.");"));
275 275
                         if (!$isvalid) {
276 276
                             $output = NULL;
277 277
                         }
278 278
 						break;
279 279
                     case "then":
280 280
                         $conditional = implode(' ', $condition);
281
-                        $isvalid = intval(eval("return (" . $conditional . ");"));
281
+                        $isvalid = intval(eval("return (".$conditional.");"));
282 282
                         if ($isvalid) {
283 283
                             $output = $modifier_value[$i];
284 284
                         } else {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                         break;
288 288
                     case "else":
289 289
                         $conditional = implode(' ', $condition);
290
-						$isvalid = intval(eval("return (" . $conditional . ");"));
290
+						$isvalid = intval(eval("return (".$conditional.");"));
291 291
                         if (!$isvalid) {
292 292
                             $output = $modifier_value[$i];
293 293
                         }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
                     case "math":
375 375
                         $filter = preg_replace("~([a-zA-Z\n\r\t\s])~", "", $modifier_value[$i]);
376 376
                         $filter = str_replace("?", $output, $filter);
377
-                        $output = eval("return " . $filter . ";");
377
+                        $output = eval("return ".$filter.";");
378 378
                         break;
379 379
                     case "isnotempty":
380 380
                         if (!empty($output)) $output = $modifier_value[$i];
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
                         break;
396 396
                     case "value":
397 397
                         if ($i > 0 && $modifier_cmd[$i - 1] == "set") {
398
-                            $modx->SetPlaceholder("phx." . $output, $modifier_value[$i]);
398
+                            $modx->SetPlaceholder("phx.".$output, $modifier_value[$i]);
399 399
                         }
400 400
                         $output = NULL;
401 401
                         break;
@@ -416,25 +416,25 @@  discard block
 block discarded – undo
416 416
                     default:
417 417
 						$snippet = '';
418 418
                         // modified by Anton Kuzmin (23.06.2010) //
419
-                        $snippetName = 'phx:' . $modifier_cmd[$i];
419
+                        $snippetName = 'phx:'.$modifier_cmd[$i];
420 420
                         if (isset($modx->snippetCache[$snippetName])) {
421 421
                             $snippet = $modx->snippetCache[$snippetName];
422 422
                         } else { // not in cache so let's check the db
423
-                            $sql = "SELECT snippet FROM " . $modx->getFullTableName("site_snippets") . " WHERE " . $modx->getFullTableName("site_snippets") . ".name='" . $modx->db->escape($snippetName) . "';";
423
+                            $sql = "SELECT snippet FROM ".$modx->getFullTableName("site_snippets")." WHERE ".$modx->getFullTableName("site_snippets").".name='".$modx->db->escape($snippetName)."';";
424 424
                             $result = $modx->dbQuery($sql);
425 425
                             if ($modx->recordCount($result) == 1) {
426 426
                                 $row = $modx->fetchRow($result);
427 427
                                 $snippet = $modx->snippetCache[$row['name']] = $row['snippet'];
428 428
                                 $this->Log("  |--- DB -> Custom Modifier");
429 429
                             } else if ($modx->recordCount($result) == 0) { // If snippet not found, look in the modifiers folder
430
-                                $filename = $modx->config['rb_base_dir'] . 'plugins/phx/modifiers/' . $modifier_cmd[$i] . '.phx.php';
430
+                                $filename = $modx->config['rb_base_dir'].'plugins/phx/modifiers/'.$modifier_cmd[$i].'.phx.php';
431 431
                                 if (@file_exists($filename)) {
432 432
                                     $file_contents = @file_get_contents($filename);
433
-                                    $file_contents = str_replace('<' . '?php', '', $file_contents);
434
-                                    $file_contents = str_replace('?' . '>', '', $file_contents);
433
+                                    $file_contents = str_replace('<'.'?php', '', $file_contents);
434
+                                    $file_contents = str_replace('?'.'>', '', $file_contents);
435 435
                                     $file_contents = str_replace('<?', '', $file_contents);
436 436
                                     $snippet = $modx->snippetCache[$snippetName] = $file_contents;
437
-                                    $modx->snippetCache[$snippetName . 'Props'] = '';
437
+                                    $modx->snippetCache[$snippetName.'Props'] = '';
438 438
                                     $this->Log("  |--- File ($filename) -> Custom Modifier");
439 439
                                 } else {
440 440
                                     $this->Log("  |--- PHX Error:  {$modifier_cmd[$i]} could not be found");
@@ -444,20 +444,20 @@  discard block
 block discarded – undo
444 444
                         $cm = $snippet;
445 445
                         // end //
446 446
 
447
-						if(!empty($cm)){
447
+						if (!empty($cm)) {
448 448
 							ob_start();
449 449
 							$options = $modifier_value[$i];
450 450
 							$custom = eval($cm);
451 451
 							$msg = ob_get_contents();
452
-							$output = $msg . $custom;
452
+							$output = $msg.$custom;
453 453
 							ob_end_clean();
454
-						}else{
454
+						} else {
455 455
 							$output = '';
456 456
 						}
457 457
                         break;
458 458
                 }
459
-                if (count($condition)) $this->Log("  |--- Condition = '" . $condition[count($condition) - 1] . "'");
460
-                $this->Log("  |--- Output = '" . $output . "'");
459
+                if (count($condition)) $this->Log("  |--- Condition = '".$condition[count($condition) - 1]."'");
460
+                $this->Log("  |--- Output = '".$output."'");
461 461
             }
462 462
         }
463 463
         return $output;
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         if (!empty($this->console)) {
470 470
             $console = implode("\n", $this->console);
471 471
             $this->console = array();
472
-            return '<pre style="overflow: auto;">' . $console . '</pre>';
472
+            return '<pre style="overflow: auto;">'.$console.'</pre>';
473 473
         }
474 474
     }
475 475
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
     {
487 487
         if ($this->debug) {
488 488
             $this->debugLog = true;
489
-            $this->console[] = (count($this->console) + 1 - $this->curPass) . " [" . strftime("%H:%M:%S", time()) . "] " . $this->LogClean($string);
489
+            $this->console[] = (count($this->console) + 1 - $this->curPass)." [".strftime("%H:%M:%S", time())."] ".$this->LogClean($string);
490 490
         }
491 491
     }
492 492
 
@@ -495,20 +495,20 @@  discard block
 block discarded – undo
495 495
     {
496 496
         if ($this->debug) {
497 497
             $this->debugLog = true;
498
-            $this->console[] = (count($this->console) + 1 - $this->curPass) . " [" . strftime("%H:%M:%S", time()) . "] " . "  |--- Returns: <div style='margin: 10px;'>" . $this->LogClean($string) . "</div>";
498
+            $this->console[] = (count($this->console) + 1 - $this->curPass)." [".strftime("%H:%M:%S", time())."] "."  |--- Returns: <div style='margin: 10px;'>".$this->LogClean($string)."</div>";
499 499
         }
500 500
     }
501 501
 
502 502
     // Log pass
503 503
 	public function LogPass()
504 504
     {
505
-        $this->console[] = "<div style='margin: 2px;margin-top: 5px;border-bottom: 1px solid black;'>Pass " . $this->curPass . "</div>";
505
+        $this->console[] = "<div style='margin: 2px;margin-top: 5px;border-bottom: 1px solid black;'>Pass ".$this->curPass."</div>";
506 506
     }
507 507
 
508 508
     // Log pass
509 509
 	public function LogSource($string)
510 510
     {
511
-        $this->console[] = "<div style='margin: 2px;margin-top: 5px;border-bottom: 1px solid black;'>Source:</div>" . $this->LogClean($string);
511
+        $this->console[] = "<div style='margin: 2px;margin-top: 5px;border-bottom: 1px solid black;'>Source:</div>".$this->LogClean($string);
512 512
     }
513 513
 
514 514
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         if (!array_key_exists($userid, $this->cache["mo"])) {
548 548
             $tbl = $modx->getFullTableName("webgroup_names");
549 549
             $tbl2 = $modx->getFullTableName("web_groups");
550
-            $sql = "SELECT wgn.name FROM $tbl wgn INNER JOIN $tbl2 wg ON wg.webgroup=wgn.id AND wg.webuser='" . $userid . "'";
550
+            $sql = "SELECT wgn.name FROM $tbl wgn INNER JOIN $tbl2 wg ON wg.webgroup=wgn.id AND wg.webuser='".$userid."'";
551 551
             $this->cache["mo"][$userid] = $grpNames = $modx->db->getColumn("name", $sql);
552 552
         } else {
553 553
             $grpNames = $this->cache["mo"][$userid];
@@ -608,14 +608,14 @@  discard block
 block discarded – undo
608 608
 	public function ucfirst($str)
609 609
     {
610 610
         if (function_exists('mb_strtoupper') && function_exists('mb_substr') && function_exists('mb_strlen'))
611
-            return mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str));
611
+            return mb_strtoupper(mb_substr($str, 0, 1)).mb_substr($str, 1, mb_strlen($str));
612 612
         return ucfirst($str);
613 613
     }
614 614
 
615 615
 	public function lcfirst($str)
616 616
     {
617 617
         if (function_exists('mb_strtolower') && function_exists('mb_substr') && function_exists('mb_strlen'))
618
-            return mb_strtolower(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str));
618
+            return mb_strtolower(mb_substr($str, 0, 1)).mb_substr($str, 1, mb_strlen($str));
619 619
         return lcfirst($str);
620 620
     }
621 621
 
Please login to merge, or discard this patch.
Doc Comments   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     // Parser: Preparation, cleaning and checkup
121 121
     /**
122 122
      * @param string $template
123
-     * @return mixed|string
123
+     * @return string
124 124
      */
125 125
     public function Parse($template = '')
126 126
     {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     // Parser: modifier detection and eXtended processing if needed
269 269
     /**
270 270
      * @param $input
271
-     * @param $modifiers
271
+     * @param string $modifiers
272 272
      * @return mixed|null|string
273 273
      */
274 274
     public function Filter($input, $modifiers)
@@ -600,8 +600,8 @@  discard block
 block discarded – undo
600 600
     // positive userid = manager, negative integer = webuser
601 601
     /**
602 602
      * @param $userid
603
-     * @param $field
604
-     * @return mixed
603
+     * @param string $field
604
+     * @return string
605 605
      */
606 606
     public function ModUser($userid, $field)
607 607
     {
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 
657 657
     // Returns the value of a PHx/MODx placeholder.
658 658
     /**
659
-     * @param $name
659
+     * @param string $name
660 660
      * @return mixed
661 661
      */
662 662
     public function getPHxVariable($name)
@@ -684,9 +684,9 @@  discard block
 block discarded – undo
684 684
 
685 685
     //mbstring
686 686
     /**
687
-     * @param $str
688
-     * @param $s
689
-     * @param null $l
687
+     * @param string $str
688
+     * @param integer $s
689
+     * @param integer $l
690 690
      * @return string
691 691
      */
692 692
     public function substr($str, $s, $l = null)
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
     }
697 697
 
698 698
     /**
699
-     * @param $str
699
+     * @param string $str
700 700
      * @return int
701 701
      */
702 702
     public function strlen($str)
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
     }
707 707
 
708 708
     /**
709
-     * @param $str
709
+     * @param string $str
710 710
      * @return string
711 711
      */
712 712
     public function strtolower($str)
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
     }
717 717
 
718 718
     /**
719
-     * @param $str
719
+     * @param string $str
720 720
      * @return string
721 721
      */
722 722
     public function strtoupper($str)
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
     }
727 727
 
728 728
     /**
729
-     * @param $str
729
+     * @param string $str
730 730
      * @return string
731 731
      */
732 732
     public function ucfirst($str)
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
     }
738 738
 
739 739
     /**
740
-     * @param $str
740
+     * @param string $str
741 741
      * @return string
742 742
      */
743 743
     public function lcfirst($str)
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     }
749 749
 
750 750
     /**
751
-     * @param $str
751
+     * @param string $str
752 752
      * @return string
753 753
      */
754 754
     public function ucwords($str)
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
     }
760 760
 
761 761
     /**
762
-     * @param $str
762
+     * @param string $str
763 763
      * @return string
764 764
      */
765 765
     public function strrev($str)
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
     }
770 770
 
771 771
     /**
772
-     * @param $str
772
+     * @param string $str
773 773
      * @return string
774 774
      */
775 775
     public function str_shuffle($str)
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
     }
781 781
 
782 782
     /**
783
-     * @param $str
783
+     * @param string $str
784 784
      * @return int
785 785
      */
786 786
     public function str_word_count($str)
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -25,65 +25,65 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * @var string
27 27
      */
28
-	public $name = 'PHx';
28
+    public $name = 'PHx';
29 29
 
30 30
     /**
31 31
      * @var string
32 32
      */
33
-	public $version = '2.2.0';
33
+    public $version = '2.2.0';
34 34
 
35 35
     /**
36 36
      * @var array
37 37
      */
38
-	public $user = array();
38
+    public $user = array();
39 39
 
40 40
     /**
41 41
      * @var array
42 42
      */
43
-	public $cache = array(
44
-		'cm' => array(),
45
-		'ui' => array(),
46
-		'mo' => array()
47
-	);
43
+    public $cache = array(
44
+        'cm' => array(),
45
+        'ui' => array(),
46
+        'mo' => array()
47
+    );
48 48
 
49 49
     /**
50 50
      * @var array
51 51
      */
52
-	public $safetags = array(
53
-		array('~(?<![\[]|^\^)\[(?=[^\+\*\(\[]|$)~s', '~(?<=[^\+\*\)\]]|^)\](?=[^\]]|$)~s'),
54
-		array('&_PHX_INTERNAL_091_&', '&_PHX_INTERNAL_093_&'),
55
-		array('[', ']')
56
-	);
52
+    public $safetags = array(
53
+        array('~(?<![\[]|^\^)\[(?=[^\+\*\(\[]|$)~s', '~(?<=[^\+\*\)\]]|^)\](?=[^\]]|$)~s'),
54
+        array('&_PHX_INTERNAL_091_&', '&_PHX_INTERNAL_093_&'),
55
+        array('[', ']')
56
+    );
57 57
 
58 58
     /**
59 59
      * @var array
60 60
      */
61
-	public $console = array();
61
+    public $console = array();
62 62
 
63 63
     /**
64 64
      * @var bool|int
65 65
      */
66
-	public $debug = false;
66
+    public $debug = false;
67 67
 
68 68
     /**
69 69
      * @var bool
70 70
      */
71
-	public $debugLog = false;
71
+    public $debugLog = false;
72 72
 
73 73
     /**
74 74
      * @var int
75 75
      */
76
-	public $curPass = 0;
76
+    public $curPass = 0;
77 77
 
78 78
     /**
79 79
      * @var int
80 80
      */
81
-	public $maxPasses = 50;
81
+    public $maxPasses = 50;
82 82
 
83 83
     /**
84 84
      * @var array
85 85
      */
86
-	public $swapSnippetCache = array();
86
+    public $swapSnippetCache = array();
87 87
 
88 88
     /**
89 89
      * DLphx constructor.
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $this->user["usrid"] = isset($_SESSION['webInternalKey']) ? intval($_SESSION['webInternalKey']) : 0;
98 98
         $this->user["id"] = ($this->user["usrid"] > 0) ? (-$this->user["usrid"]) : $this->user["mgrid"];
99 99
 
100
-		$this->debug = ($debug != '') ? $debug : 0;
100
+        $this->debug = ($debug != '') ? $debug : 0;
101 101
 
102 102
         $this->maxPasses = ($maxpass != '') ? $maxpass : 50;
103 103
 
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
             $var_search = array();
177 177
             $var_replace = array();
178 178
             for ($i = 0; $i < $count; $i++) {
179
-				$var_search[] = $matches[0][$i];
180
-				$input = $matches[1][$i];
181
-				$this->Log('MODX Chunk: ' . $input);
179
+                $var_search[] = $matches[0][$i];
180
+                $input = $matches[1][$i];
181
+                $this->Log('MODX Chunk: ' . $input);
182 182
                 $input = $modx->mergeChunkContent('{{' . $input . '}}');
183 183
                 $var_replace[] = $this->Filter($input, $matches[2][$i]);
184 184
             }
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
                     case "eq":
297 297
                         $condition[] = intval(($output == $modifier_value[$i]));
298 298
                         break;
299
-					case "empty":
300
-						 $condition[] = intval(empty($output));
301
-						break;
299
+                    case "empty":
300
+                         $condition[] = intval(empty($output));
301
+                        break;
302 302
                     case "notequals":
303 303
                     case "isnot":
304 304
                     case "isnt":
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                         if (!$isvalid) {
344 344
                             $output = NULL;
345 345
                         }
346
-						break;
346
+                        break;
347 347
                     case "then":
348 348
                         $conditional = implode(' ', $condition);
349 349
                         $isvalid = intval(eval("return (" . $conditional . ");"));
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                         break;
356 356
                     case "else":
357 357
                         $conditional = implode(' ', $condition);
358
-						$isvalid = intval(eval("return (" . $conditional . ");"));
358
+                        $isvalid = intval(eval("return (" . $conditional . ");"));
359 359
                         if (!$isvalid) {
360 360
                             $output = $modifier_value[$i];
361 361
                         }
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                     case "select":
364 364
                         $raw = explode("&", $modifier_value[$i]);
365 365
                         $map = array();
366
-						$count = count($raw);
366
+                        $count = count($raw);
367 367
                         for ($m = 0; $m < $count; $m++) {
368 368
                             $mi = explode("=", $raw[$m]);
369 369
                             $map[$mi[0]] = $mi[1];
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                     ##### End of Conditional Modifiers
374 374
 
375 375
                     #####  String Modifiers
376
-					case "default":
376
+                    case "default":
377 377
                         $output = ($output === '') ? $modifier_value[0] : $output;
378 378
                         break;
379 379
                     case "lcase":
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
                     // If we haven't yet found the modifier, let's look elsewhere
484 484
                     default:
485
-						$snippet = '';
485
+                        $snippet = '';
486 486
                         // modified by Anton Kuzmin (23.06.2010) //
487 487
                         $snippetName = 'phx:' . $modifier_cmd[$i];
488 488
                         if (isset($modx->snippetCache[$snippetName])) {
@@ -512,16 +512,16 @@  discard block
 block discarded – undo
512 512
                         $cm = $snippet;
513 513
                         // end //
514 514
 
515
-						if(!empty($cm)){
516
-							ob_start();
517
-							$options = $modifier_value[$i];
518
-							$custom = eval($cm);
519
-							$msg = ob_get_contents();
520
-							$output = $msg . $custom;
521
-							ob_end_clean();
522
-						}else{
523
-							$output = '';
524
-						}
515
+                        if(!empty($cm)){
516
+                            ob_start();
517
+                            $options = $modifier_value[$i];
518
+                            $custom = eval($cm);
519
+                            $msg = ob_get_contents();
520
+                            $output = $msg . $custom;
521
+                            ob_end_clean();
522
+                        }else{
523
+                            $output = '';
524
+                        }
525 525
                         break;
526 526
                 }
527 527
                 if (count($condition)) $this->Log("  |--- Condition = '" . $condition[count($condition) - 1] . "'");
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
     }
582 582
 
583 583
     // Log pass
584
-	public function LogPass()
584
+    public function LogPass()
585 585
     {
586 586
         $this->console[] = "<div style='margin: 2px;margin-top: 5px;border-bottom: 1px solid black;'>Pass " . $this->curPass . "</div>";
587 587
     }
Please login to merge, or discard this patch.