@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | $__DataSetPagerCnt = 0; |
12 | 12 | |
13 | -class DataSetPager { |
|
13 | +class DataSetPager{ |
|
14 | 14 | |
15 | 15 | var $ds; // datasource |
16 | 16 | var $pageSize; |
@@ -27,26 +27,26 @@ discard block |
||
27 | 27 | var $selPageStyle; |
28 | 28 | var $selPageClass; |
29 | 29 | |
30 | - function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
30 | + function __construct($id, $ds, $pageSize = 10, $pageNumber = -1){ |
|
31 | 31 | global $_PAGE; // use view state object |
32 | 32 | |
33 | 33 | global $__DataSetPagerCnt; |
34 | 34 | |
35 | 35 | // set id |
36 | 36 | $__DataSetPagerCnt++; |
37 | - $this->id = !empty($id) ? $id : "dsp" . $__DataSetPagerCnt; |
|
37 | + $this->id = !empty($id) ? $id : "dsp".$__DataSetPagerCnt; |
|
38 | 38 | |
39 | 39 | // get pagenumber |
40 | 40 | // by setting pager to -1 cause pager to load it's last page number |
41 | - if($pageNumber == -1) { |
|
41 | + if ($pageNumber == -1) { |
|
42 | 42 | $pageNumber = 1; |
43 | - if(isset($_GET["dpgn" . $this->id])) { |
|
44 | - $pageNumber = $_GET["dpgn" . $this->id]; |
|
45 | - } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) { |
|
46 | - $pageNumber = $_PAGE['vs'][$id . '_dpgn']; |
|
43 | + if (isset($_GET["dpgn".$this->id])) { |
|
44 | + $pageNumber = $_GET["dpgn".$this->id]; |
|
45 | + } elseif (isset($_PAGE['vs'][$id.'_dpgn'])) { |
|
46 | + $pageNumber = $_PAGE['vs'][$id.'_dpgn']; |
|
47 | 47 | } |
48 | 48 | } |
49 | - if(!is_numeric($pageNumber)) { |
|
49 | + if (!is_numeric($pageNumber)) { |
|
50 | 50 | $pageNumber = 1; |
51 | 51 | } |
52 | 52 | |
@@ -57,40 +57,40 @@ discard block |
||
57 | 57 | $this->pager = ''; |
58 | 58 | } |
59 | 59 | |
60 | - function getRenderedPager() { |
|
60 | + function getRenderedPager(){ |
|
61 | 61 | return $this->pager; |
62 | 62 | } |
63 | 63 | |
64 | - function getRenderedRows() { |
|
64 | + function getRenderedRows(){ |
|
65 | 65 | return $this->rows; |
66 | 66 | } |
67 | 67 | |
68 | - function setDataSource($ds) { |
|
68 | + function setDataSource($ds){ |
|
69 | 69 | $this->ds = $ds; |
70 | 70 | } |
71 | 71 | |
72 | - function setPageSize($ps) { |
|
72 | + function setPageSize($ps){ |
|
73 | 73 | $this->pageSize = $ps; |
74 | 74 | } |
75 | 75 | |
76 | - function setRenderRowFnc($fncName, $args = "") { |
|
76 | + function setRenderRowFnc($fncName, $args = ""){ |
|
77 | 77 | $this->renderRowFnc = &$fncName; |
78 | - $this->renderRowFncArgs = $args; // extra agruments |
|
78 | + $this->renderRowFncArgs = $args; // extra agruments |
|
79 | 79 | |
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | - function setRenderPagerFnc($fncName, $args = "") { |
|
83 | + function setRenderPagerFnc($fncName, $args = ""){ |
|
84 | 84 | $this->renderPagerFnc = $fncName; |
85 | - $this->renderPagerFncArgs = $args; // extra agruments |
|
85 | + $this->renderPagerFncArgs = $args; // extra agruments |
|
86 | 86 | } |
87 | 87 | |
88 | - function render() { |
|
88 | + function render(){ |
|
89 | 89 | global $modx, $_PAGE; |
90 | 90 | |
91 | 91 | $isDataset = $modx->db->isResult($this->ds); |
92 | 92 | |
93 | - if(!$this->selPageStyle) { |
|
93 | + if (!$this->selPageStyle) { |
|
94 | 94 | $this->selPageStyle = "font-weight:bold"; |
95 | 95 | } |
96 | 96 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | $tnr = ($isDataset) ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
99 | 99 | |
100 | 100 | // render: no records found |
101 | - if($tnr <= 0) { |
|
101 | + if ($tnr <= 0) { |
|
102 | 102 | $fnc = $this->renderRowFnc; |
103 | 103 | $args = $this->renderRowFncArgs; |
104 | - if(isset($fnc)) { |
|
105 | - if($args != "") { |
|
104 | + if (isset($fnc)) { |
|
105 | + if ($args != "") { |
|
106 | 106 | $this->rows .= $fnc(0, null, $args); |
107 | 107 | } // if agrs was specified then we will pass three params |
108 | 108 | else { |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | // get total pages |
116 | 116 | $tp = ceil($tnr / $this->pageSize); |
117 | - if($this->pageNumber > $tp) { |
|
117 | + if ($this->pageNumber > $tp) { |
|
118 | 118 | $this->pageNumber = 1; |
119 | 119 | } |
120 | 120 | |
@@ -122,38 +122,38 @@ discard block |
||
122 | 122 | $p = $this->pageNumber; |
123 | 123 | |
124 | 124 | // save page number to view state if available |
125 | - if(isset($_PAGE['vs'])) { |
|
126 | - $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
125 | + if (isset($_PAGE['vs'])) { |
|
126 | + $_PAGE['vs'][$this->id.'_dpgn'] = $p; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
130 | - if($tp > 1) { |
|
130 | + if ($tp > 1) { |
|
131 | 131 | $fnc = $this->renderPagerFnc; |
132 | 132 | $args = $this->renderPagerFncArgs; |
133 | - if(!isset($fnc)) { |
|
134 | - if($modx->isFrontend()) { |
|
135 | - $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
133 | + if (!isset($fnc)) { |
|
134 | + if ($modx->isFrontend()) { |
|
135 | + $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full').'?'; |
|
136 | 136 | } else { |
137 | - $url = $_SERVER['PHP_SELF'] . '?'; |
|
137 | + $url = $_SERVER['PHP_SELF'].'?'; |
|
138 | 138 | } |
139 | 139 | $i = 0; |
140 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
140 | + foreach ($_GET as $n => $v) if ($n != 'dpgn'.$this->id) { |
|
141 | 141 | $i++; |
142 | - $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
142 | + $url .= (($i > 1) ? "&" : "")."$n=$v"; |
|
143 | 143 | } |
144 | - if($i >= 1) { |
|
144 | + if ($i >= 1) { |
|
145 | 145 | $url .= "&"; |
146 | 146 | } |
147 | 147 | } |
148 | - for($i = 1; $i <= $tp; $i++) { |
|
149 | - if(isset($fnc)) { |
|
150 | - if($args != "") { |
|
148 | + for ($i = 1; $i <= $tp; $i++) { |
|
149 | + if (isset($fnc)) { |
|
150 | + if ($args != "") { |
|
151 | 151 | $this->pager .= $fnc($p, $i, $args); |
152 | 152 | } else { |
153 | 153 | $this->pager .= $fnc($p, $i); |
154 | 154 | } |
155 | 155 | } else { |
156 | - $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> "; |
|
156 | + $this->pager .= ($p == $i) ? " <span class='".$this->selPageClass."' style='".$this->selPageStyle."'>$i</span> " : " <a href='".$url."dpgn".$this->id."=$i' class='".$this->pageClass."' style='".$this->pageStyle."'>$i</a> "; |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
@@ -162,21 +162,21 @@ discard block |
||
162 | 162 | $fnc = $this->renderRowFnc; |
163 | 163 | $args = $this->renderRowFncArgs; |
164 | 164 | |
165 | - if(isset($fnc)) { |
|
165 | + if (isset($fnc)) { |
|
166 | 166 | $i = 1; |
167 | 167 | $fncObject = is_object($fnc); |
168 | 168 | $minitems = (($p - 1) * $this->pageSize) + 1; |
169 | 169 | $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
170 | - while($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) { |
|
171 | - if($i >= $minitems && $i <= $maxitems) { |
|
172 | - if($fncObject) { |
|
173 | - if($args != "") { |
|
170 | + while ($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) { |
|
171 | + if ($i >= $minitems && $i <= $maxitems) { |
|
172 | + if ($fncObject) { |
|
173 | + if ($args != "") { |
|
174 | 174 | $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
175 | 175 | } else { |
176 | 176 | $this->rows .= $fnc->RenderRowFnc($i, $row); |
177 | 177 | } |
178 | 178 | } else { |
179 | - if($args != "") { |
|
179 | + if ($args != "") { |
|
180 | 180 | $this->rows .= $fnc($i, $row, $args); |
181 | 181 | } // if agrs was specified then we wil pass three params |
182 | 182 | else { |
@@ -11,13 +11,13 @@ |
||
11 | 11 | $modx->getSettings(); |
12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
13 | 13 | $ok = false; |
14 | -if(isset($_SESSION['mgrToken']) && $_GET['tok'] == $_SESSION['mgrToken']) { |
|
14 | +if (isset($_SESSION['mgrToken']) && $_GET['tok'] == $_SESSION['mgrToken']) { |
|
15 | 15 | $ok = true; |
16 | 16 | $modx->updateValidatedUserSession(); |
17 | 17 | } |
18 | 18 | |
19 | 19 | header('Content-type: application/json'); |
20 | -if($ok) { |
|
20 | +if ($ok) { |
|
21 | 21 | echo '{"status":"ok"}'; |
22 | 22 | } else { |
23 | 23 | echo '{"status":"null"}'; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -$modx_version = '1.5.0-beta'; // Current version number |
|
3 | -$modx_release_date = 'Jan 26, 2018'; // Date of release |
|
4 | -$modx_branch = 'Evolution'; // Codebase name |
|
2 | +$modx_version = '1.5.0-beta'; // Current version number |
|
3 | +$modx_release_date = 'Jan 26, 2018'; // Date of release |
|
4 | +$modx_branch = 'Evolution'; // Codebase name |
|
5 | 5 | $modx_full_appname = "{$modx_branch} {$modx_version} ({$modx_release_date})"; |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // DISPLAY FORM ELEMENTS |
3 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
3 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()){ |
|
4 | 4 | global $modx; |
5 | 5 | global $_style; |
6 | 6 | global $_lang; |
7 | 7 | global $content; |
8 | 8 | global $which_browser; |
9 | 9 | |
10 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
10 | + if (substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
11 | 11 | $eval_str = trim(substr($default_text, 7)); |
12 | 12 | $default_text = eval($eval_str); |
13 | 13 | $field_value = $default_text; |
@@ -15,74 +15,74 @@ discard block |
||
15 | 15 | |
16 | 16 | $field_html = ''; |
17 | 17 | $cimode = strpos($field_type, ':'); |
18 | - if($cimode === false) { |
|
19 | - switch($field_type) { |
|
18 | + if ($cimode === false) { |
|
19 | + switch ($field_type) { |
|
20 | 20 | |
21 | 21 | case "text": // handler for regular text boxes |
22 | 22 | case "rawtext"; // non-htmlentity converted text boxes |
23 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
23 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />'; |
|
24 | 24 | break; |
25 | 25 | case "email": // handles email input fields |
26 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
26 | + $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>'; |
|
27 | 27 | break; |
28 | 28 | case "number": // handles the input of numbers |
29 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
29 | + $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
30 | 30 | break; |
31 | 31 | case "textareamini": // handler for textarea mini boxes |
32 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
32 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
33 | 33 | break; |
34 | 34 | case "textarea": // handler for textarea boxes |
35 | 35 | case "rawtextarea": // non-htmlentity convertex textarea boxes |
36 | 36 | case "htmlarea": // handler for textarea boxes (deprecated) |
37 | 37 | case "richtext": // handler for textarea boxes |
38 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
38 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
39 | 39 | break; |
40 | 40 | case "date": |
41 | 41 | $field_id = str_replace(array( |
42 | 42 | '-', |
43 | 43 | '.' |
44 | 44 | ), '_', urldecode($field_id)); |
45 | - if($field_value == '') { |
|
45 | + if ($field_value == '') { |
|
46 | 46 | $field_value = 0; |
47 | 47 | } |
48 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
49 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
48 | + $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />'; |
|
49 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>'; |
|
50 | 50 | |
51 | 51 | break; |
52 | 52 | case "dropdown": // handler for select boxes |
53 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
53 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">'; |
|
54 | 54 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
55 | - while(list($item, $itemvalue) = each($index_list)) { |
|
55 | + while (list($item, $itemvalue) = each($index_list)) { |
|
56 | 56 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
57 | - if(strlen($itemvalue) == 0) { |
|
57 | + if (strlen($itemvalue) == 0) { |
|
58 | 58 | $itemvalue = $item; |
59 | 59 | } |
60 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
60 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
61 | 61 | } |
62 | 62 | $field_html .= "</select>"; |
63 | 63 | break; |
64 | 64 | case "listbox": // handler for select boxes |
65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
65 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">'; |
|
66 | 66 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
67 | + while (list($item, $itemvalue) = each($index_list)) { |
|
68 | 68 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
69 | - if(strlen($itemvalue) == 0) { |
|
69 | + if (strlen($itemvalue) == 0) { |
|
70 | 70 | $itemvalue = $item; |
71 | 71 | } |
72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
72 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
73 | 73 | } |
74 | 74 | $field_html .= "</select>"; |
75 | 75 | break; |
76 | 76 | case "listbox-multiple": // handler for select boxes where you can choose multiple items |
77 | 77 | $field_value = explode("||", $field_value); |
78 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
78 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
79 | 79 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
80 | - while(list($item, $itemvalue) = each($index_list)) { |
|
80 | + while (list($item, $itemvalue) = each($index_list)) { |
|
81 | 81 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
82 | - if(strlen($itemvalue) == 0) { |
|
82 | + if (strlen($itemvalue) == 0) { |
|
83 | 83 | $itemvalue = $item; |
84 | 84 | } |
85 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
85 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
86 | 86 | } |
87 | 87 | $field_html .= "</select>"; |
88 | 88 | break; |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | 'ftp://' => 'ftp://', |
95 | 95 | 'mailto:' => 'mailto:' |
96 | 96 | ); |
97 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
98 | - foreach($urls as $k => $v) { |
|
99 | - if(strpos($field_value, $v) === false) { |
|
100 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
97 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">'; |
|
98 | + foreach ($urls as $k => $v) { |
|
99 | + if (strpos($field_value, $v) === false) { |
|
100 | + $field_html .= '<option value="'.$v.'">'.$k.'</option>'; |
|
101 | 101 | } else { |
102 | 102 | $field_value = str_replace($v, '', $field_value); |
103 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
103 | + $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>'; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | $field_html .= '</select></td><td>'; |
107 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
107 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>'; |
|
108 | 108 | break; |
109 | 109 | case 'checkbox': // handles check boxes |
110 | 110 | $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
113 | 113 | static $i = 0; |
114 | 114 | $_ = array(); |
115 | - foreach($index_list as $c => $item) { |
|
116 | - if(is_array($item)) { |
|
115 | + foreach ($index_list as $c => $item) { |
|
116 | + if (is_array($item)) { |
|
117 | 117 | $name = trim($item[0]); |
118 | 118 | $value = isset($item[1]) ? $item[1] : $name; |
119 | 119 | } else { |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | case "option": // handles radio buttons |
140 | 140 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
141 | 141 | static $i = 0; |
142 | - while(list($item, $itemvalue) = each($index_list)) { |
|
142 | + while (list($item, $itemvalue) = each($index_list)) { |
|
143 | 143 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
144 | - if(strlen($itemvalue) == 0) { |
|
144 | + if (strlen($itemvalue) == 0) { |
|
145 | 145 | $itemvalue = $item; |
146 | 146 | } |
147 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
147 | + $field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />'; |
|
148 | 148 | $i++; |
149 | 149 | } |
150 | 150 | break; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | global $_lang; |
153 | 153 | global $ResourceManagerLoaded; |
154 | 154 | global $content, $use_editor, $which_editor; |
155 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
155 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
156 | 156 | $field_html .= " |
157 | 157 | <script type=\"text/javascript\"> |
158 | 158 | /* <![CDATA[ */ |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | lastImageCtrl = ctrl; |
175 | 175 | var w = screen.width * 0.5; |
176 | 176 | var h = screen.height * 0.5; |
177 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
177 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
178 | 178 | } |
179 | 179 | function BrowseFileServer(ctrl) { |
180 | 180 | lastFileCtrl = ctrl; |
181 | 181 | var w = screen.width * 0.5; |
182 | 182 | var h = screen.height * 0.5; |
183 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
183 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
184 | 184 | } |
185 | 185 | function SetUrlChange(el) { |
186 | 186 | if ('createEvent' in document) { |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | </script>"; |
215 | 215 | $ResourceManagerLoaded = true; |
216 | 216 | } |
217 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
217 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />'; |
|
218 | 218 | break; |
219 | 219 | case "file": // handles the input of file uploads |
220 | 220 | /* Modified by Timon for use with resource browser */ |
221 | 221 | global $_lang; |
222 | 222 | global $ResourceManagerLoaded; |
223 | 223 | global $content, $use_editor, $which_editor; |
224 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
224 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
225 | 225 | /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
226 | 226 | $field_html .= " |
227 | 227 | <script type=\"text/javascript\"> |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | lastImageCtrl = ctrl; |
245 | 245 | var w = screen.width * 0.5; |
246 | 246 | var h = screen.height * 0.5; |
247 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
247 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
248 | 248 | } |
249 | 249 | function BrowseFileServer(ctrl) { |
250 | 250 | lastFileCtrl = ctrl; |
251 | 251 | var w = screen.width * 0.5; |
252 | 252 | var h = screen.height * 0.5; |
253 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
253 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
254 | 254 | } |
255 | 255 | function SetUrlChange(el) { |
256 | 256 | if ('createEvent' in document) { |
@@ -284,39 +284,39 @@ discard block |
||
284 | 284 | </script>"; |
285 | 285 | $ResourceManagerLoaded = true; |
286 | 286 | } |
287 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
287 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />'; |
|
288 | 288 | |
289 | 289 | break; |
290 | 290 | |
291 | 291 | case 'custom_tv': |
292 | 292 | $custom_output = ''; |
293 | 293 | /* If we are loading a file */ |
294 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
295 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
296 | - if(!file_exists($file_name)) { |
|
297 | - $custom_output = $file_name . ' does not exist'; |
|
294 | + if (substr($field_elements, 0, 5) == "@FILE") { |
|
295 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); |
|
296 | + if (!file_exists($file_name)) { |
|
297 | + $custom_output = $file_name.' does not exist'; |
|
298 | 298 | } else { |
299 | 299 | $custom_output = file_get_contents($file_name); |
300 | 300 | } |
301 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
302 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
303 | - if(!file_exists($file_name)) { |
|
304 | - $custom_output = $file_name . ' does not exist'; |
|
301 | + } elseif (substr($field_elements, 0, 8) == '@INCLUDE') { |
|
302 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9)); |
|
303 | + if (!file_exists($file_name)) { |
|
304 | + $custom_output = $file_name.' does not exist'; |
|
305 | 305 | } else { |
306 | 306 | ob_start(); |
307 | 307 | include $file_name; |
308 | 308 | $custom_output = ob_get_contents(); |
309 | 309 | ob_end_clean(); |
310 | 310 | } |
311 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
311 | + } elseif (substr($field_elements, 0, 6) == "@CHUNK") { |
|
312 | 312 | $chunk_name = trim(substr($field_elements, 7)); |
313 | 313 | $chunk_body = $modx->getChunk($chunk_name); |
314 | - if($chunk_body == false) { |
|
315 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
314 | + if ($chunk_body == false) { |
|
315 | + $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')'; |
|
316 | 316 | } else { |
317 | 317 | $custom_output = $chunk_body; |
318 | 318 | } |
319 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
319 | + } elseif (substr($field_elements, 0, 5) == "@EVAL") { |
|
320 | 320 | $eval_str = trim(substr($field_elements, 6)); |
321 | 321 | $custom_output = eval($eval_str); |
322 | 322 | } else { |
@@ -337,15 +337,15 @@ discard block |
||
337 | 337 | break; |
338 | 338 | |
339 | 339 | default: // the default handler -- for errors, mostly |
340 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
340 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />'; |
|
341 | 341 | |
342 | 342 | } // end switch statement |
343 | 343 | } else { |
344 | 344 | $custom = explode(":", $field_type); |
345 | 345 | $custom_output = ''; |
346 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
347 | - if(!file_exists($file_name)) { |
|
348 | - $custom_output = $file_name . ' does not exist'; |
|
346 | + $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php'; |
|
347 | + if (!file_exists($file_name)) { |
|
348 | + $custom_output = $file_name.' does not exist'; |
|
349 | 349 | } else { |
350 | 350 | ob_start(); |
351 | 351 | include $file_name; |
@@ -368,13 +368,13 @@ discard block |
||
368 | 368 | return $field_html; |
369 | 369 | } // end renderFormElement function |
370 | 370 | |
371 | -function ParseIntputOptions($v) { |
|
371 | +function ParseIntputOptions($v){ |
|
372 | 372 | global $modx; |
373 | 373 | $a = array(); |
374 | - if(is_array($v)) { |
|
374 | + if (is_array($v)) { |
|
375 | 375 | return $v; |
376 | - } else if($modx->db->isResult($v)) { |
|
377 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
376 | + } else if ($modx->db->isResult($v)) { |
|
377 | + while ($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
378 | 378 | } else { |
379 | 379 | $a = explode("||", $v); |
380 | 380 | } |
@@ -5,9 +5,9 @@ |
||
5 | 5 | * Time: 14:38 |
6 | 6 | */ |
7 | 7 | |
8 | -if (!include_once MODX_MANAGER_PATH . 'includes/extenders/maketable.class.php'){ |
|
8 | +if (!include_once MODX_MANAGER_PATH.'includes/extenders/maketable.class.php') { |
|
9 | 9 | return false; |
10 | -}else{ |
|
11 | - $this->table= new MakeTable; |
|
10 | +} else { |
|
11 | + $this->table = new MakeTable; |
|
12 | 12 | return true; |
13 | 13 | } |
14 | 14 | \ No newline at end of file |
@@ -5,9 +5,9 @@ |
||
5 | 5 | * Time: 14:16 |
6 | 6 | */ |
7 | 7 | |
8 | -if (!include_once MODX_MANAGER_PATH . 'includes/extenders/manager.api.class.inc.php'){ |
|
8 | +if (!include_once MODX_MANAGER_PATH.'includes/extenders/manager.api.class.inc.php') { |
|
9 | 9 | return false; |
10 | -}else{ |
|
11 | - $this->manager= new ManagerAPI; |
|
10 | +} else { |
|
11 | + $this->manager = new ManagerAPI; |
|
12 | 12 | return true; |
13 | 13 | } |
14 | 14 | \ No newline at end of file |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | $pattern = '/<img[\s\n]+.*src=[\s\n]*"([^"]+\.(jpg|jpeg|png|gif))"[^>]+>/i'; |
3 | -preg_match_all($pattern , $value , $images); |
|
4 | -if($opt==='') |
|
3 | +preg_match_all($pattern, $value, $images); |
|
4 | +if ($opt === '') |
|
5 | 5 | { |
6 | - if($images[1][0]) return $images[1][0]; |
|
6 | + if ($images[1][0]) return $images[1][0]; |
|
7 | 7 | else return ''; |
8 | 8 | } |
9 | 9 | else |
10 | 10 | { |
11 | - foreach($images[0] as $i=>$image) |
|
11 | + foreach ($images[0] as $i=>$image) |
|
12 | 12 | { |
13 | - if(strpos($image,$opt)!==false) return $images[1][$i]; |
|
13 | + if (strpos($image, $opt) !== false) return $images[1][$i]; |
|
14 | 14 | } |
15 | 15 | } |
16 | 16 |
@@ -1,2 +1,2 @@ |
||
1 | 1 | <?php |
2 | -return preg_replace_callback("~(\b\w+\b)~",function($m) use($wrapat) {return wordwrap($m[1],$wrapat,' ',1);},$value); |
|
2 | +return preg_replace_callback("~(\b\w+\b)~", function($m) use($wrapat) {return wordwrap($m[1], $wrapat, ' ', 1); },$value); |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | $text = $modx->filter->parseDocumentSource($value); |
3 | -$text = str_replace(array("\r\n","\r"),"\n",$text); |
|
3 | +$text = str_replace(array("\r\n", "\r"), "\n", $text); |
|
4 | 4 | |
5 | 5 | $blockElms = 'br,table,tbody,tr,td,th,thead,tfoot,caption,colgroup,div'; |
6 | 6 | $blockElms .= ',dl,dd,dt,ul,ol,li,pre,select,option,form,map,area,blockquote'; |
7 | 7 | $blockElms .= ',address,math,style,input,p,h1,h2,h3,h4,h5,h6,hr,object,param,embed'; |
8 | 8 | $blockElms .= ',noframes,noscript,section,article,aside,hgroup,footer,address,code'; |
9 | 9 | $blockElms = explode(',', $blockElms); |
10 | -$lines = explode("\n",$text); |
|
10 | +$lines = explode("\n", $text); |
|
11 | 11 | $c = count($lines); |
12 | -foreach($lines as $i=>$line) |
|
12 | +foreach ($lines as $i=>$line) |
|
13 | 13 | { |
14 | 14 | $line = rtrim($line); |
15 | - if($i===$c-1) break; |
|
16 | - foreach($blockElms as $block) |
|
15 | + if ($i === $c - 1) break; |
|
16 | + foreach ($blockElms as $block) |
|
17 | 17 | { |
18 | - if(preg_match("@</?{$block}" . '[^>]*>$@',$line)) |
|
18 | + if (preg_match("@</?{$block}".'[^>]*>$@', $line)) |
|
19 | 19 | continue 2; |
20 | 20 | } |
21 | 21 | $lines[$i] = "{$line}<br />"; |