Completed
Push — master ( 7f7f84...c9c13f )
by
unknown
03:06
created
assets/snippets/DocLister/lib/DLFixedPrepare.class.php 1 patch
Braces   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!class_exists("DLFixedPrepare", false)) {
3
+if (!class_exists("DLFixedPrepare", false)) {
4 4
     /**
5 5
      * Class DLFixedPrepare
6 6
      */
7
-    class DLFixedPrepare
8
-    {
7
+    class DLFixedPrepare
8
+    {
9 9
         /**
10 10
          * @param array $data
11 11
          * @param DocumentParser $modx
@@ -13,44 +13,44 @@  discard block
 block discarded – undo
13 13
          * @param prepare_DL_Extender $_eDL
14 14
          * @return array
15 15
          */
16
-        public static function buildMenu(array $data = array(), DocumentParser $modx, $_DL, prepare_DL_Extender $_eDL)
17
-        {
16
+        public static function buildMenu(array $data = array(), DocumentParser $modx, $_DL, prepare_DL_Extender $_eDL)
17
+        {
18 18
             $params = $_DL->getCFGDef('params', array());
19
-            if ($_DL->getCfgDef('currentDepth', 1) < $_DL->getCFGDef('maxDepth', 5)) {
19
+            if ($_DL->getCfgDef('currentDepth', 1) < $_DL->getCFGDef('maxDepth', 5)) {
20 20
                 $params['currentDepth'] = $_DL->getCfgDef('currentDepth', 1) + 1;
21 21
                 $params['parents'] = $data['id'];
22 22
                 $params['idType'] = 'parents';
23 23
                 $params['documents'] = '';
24 24
                 $data['dl.submenu'] = ($data['isfolder']) ? $modx->runSnippet('DLBuildMenu', $params) : '';
25
-            } else {
25
+            } else {
26 26
                 $data['dl.submenu'] = '';
27 27
             }
28 28
             $data['dl.currentDepth'] = $_DL->getCfgDef('currentDepth', 1);
29 29
 
30
-            if (($parentIDs = $_eDL->getStore('parentIDs')) === null) {
30
+            if (($parentIDs = $_eDL->getStore('parentIDs')) === null) {
31 31
                 $parentIDs = array_values($modx->getParentIds($modx->documentObject['id']));
32 32
                 $_eDL->setStore('parentIDs', $parentIDs);
33 33
             }
34 34
             $isActive = ((is_array($parentIDs) && in_array($data['id'],
35 35
                         $parentIDs)) || $data['id'] == $modx->documentObject['id']);
36 36
             $activeClass = $_DL->getCfgDef('activeClass', 'active');
37
-            if ($isActive) {
37
+            if ($isActive) {
38 38
                 $data['dl.class'] .= ' ' . $activeClass;
39 39
             }
40 40
 
41 41
             if (strpos($data['dl.class'], 'current') !== false && strpos($data['dl.class'],
42 42
                     ' ' . $activeClass) === false
43
-            ) {
43
+            ) {
44 44
                 $data['dl.class'] = str_replace('current', 'current ' . $activeClass, $data['dl.class']);
45 45
             }
46 46
 
47 47
             $tpl = empty($data['dl.submenu']) ? 'noChildrenRowTPL' : 'mainRowTpl';
48 48
 
49 49
             $_DL->renderTPL = $_DL->getCfgDef($tpl);
50
-            if (strpos($data['dl.class'], 'current') !== false) {
50
+            if (strpos($data['dl.class'], 'current') !== false) {
51 51
                 $_DL->renderTPL = $_DL->getCfgDef('TplCurrent', $_DL->renderTPL);
52 52
                 $_DL->renderTPL = $_DL->getCfgDef('TplCurrent' . $data['dl.currentDepth'], $_DL->renderTPL);
53
-                if (empty($data['dl.submenu'])) {
53
+                if (empty($data['dl.submenu'])) {
54 54
                     $_DL->renderTPL = $_DL->getCfgDef('TplCurrentNoChildren' . $data['dl.currentDepth'],
55 55
                         $_DL->renderTPL);
56 56
                 }
@@ -71,37 +71,37 @@  discard block
 block discarded – undo
71 71
             DocumentParser $modx,
72 72
             DocLister $_DocLister,
73 73
             prepare_DL_Extender $_extDocLister
74
-        ) {
74
+        ) {
75 75
             $char = mb_substr($data['pagetitle'], 0, 1, 'UTF-8');
76 76
             $oldChar = $_extDocLister->getStore('char');
77
-            if ($oldChar !== $char) {
77
+            if ($oldChar !== $char) {
78 78
                 $sanitarInIDs = $_DocLister->sanitarIn($_DocLister->getIDs());
79 79
                 $where = sqlHelper::trimLogicalOp($_DocLister->getCFGDef('addWhereList', ''));
80 80
                 $where = sqlHelper::trimLogicalOp(($where ? $where . ' AND ' : '') . $_DocLister->filtersWhere());
81 81
                 $where = sqlHelper::trimLogicalOp(($where ? $where . ' AND ' : '') . "SUBSTRING(c.pagetitle,1,1) = '" . $modx->db->escape($char) . "'");
82 82
 
83
-                if ($_DocLister->getCFGDef('idType', 'parents') == 'parents') {
83
+                if ($_DocLister->getCFGDef('idType', 'parents') == 'parents') {
84 84
 
85
-                    if ($where != '') {
85
+                    if ($where != '') {
86 86
                         $where .= " AND ";
87 87
                     }
88 88
                     $where = "WHERE {$where} c.parent IN (" . $sanitarInIDs . ")";
89
-                    if (!$_DocLister->getCFGDef('showNoPublish', 0)) {
89
+                    if (!$_DocLister->getCFGDef('showNoPublish', 0)) {
90 90
                         $where .= " AND c.deleted=0 AND c.published=1";
91 91
                     }
92
-                } else {
93
-                    if ($sanitarInIDs != "''") {
92
+                } else {
93
+                    if ($sanitarInIDs != "''") {
94 94
                         $where .= ($where ? " AND " : "") . "c.id IN ({$sanitarInIDs}) AND";
95 95
                     }
96 96
                     $where = sqlHelper::trimLogicalOp($where);
97
-                    if ($_DocLister->getCFGDef('showNoPublish', 0)) {
98
-                        if ($where != '') {
97
+                    if ($_DocLister->getCFGDef('showNoPublish', 0)) {
98
+                        if ($where != '') {
99 99
                             $where = "WHERE {$where}";
100 100
                         }
101
-                    } else {
102
-                        if ($where != '') {
101
+                    } else {
102
+                        if ($where != '') {
103 103
                             $where = "WHERE {$where} AND ";
104
-                        } else {
104
+                        } else {
105 105
                             $where = "WHERE {$where} ";
106 106
                         }
107 107
                         $where .= "c.deleted=0 AND c.published=1";
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                     compact("char", "total"));
115 115
                 $_extDocLister->setStore('char', $char);
116 116
 
117
-                if ($oldChar !== null) {
117
+                if ($oldChar !== null) {
118 118
                     $data['CharSeparator'] = $_DocLister->parseChunk($_DocLister->getCFGDef('tplCharSeparator'),
119 119
                         compact("char", "total"));
120 120
                 }
Please login to merge, or discard this patch.