@@ -177,7 +177,8 @@ |
||
| 177 | 177 | * @return bool|string |
| 178 | 178 | */ |
| 179 | 179 | public function putChunk($chunkName) |
| 180 | - { // alias name >.< |
|
| 180 | + { |
|
| 181 | +// alias name >.< |
|
| 181 | 182 | $modx = evolutionCMS(); |
| 182 | 183 | |
| 183 | 184 | return $modx->getChunk($chunkName); |
@@ -10,7 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataGridCnt = 0; |
| 12 | 12 | |
| 13 | -class DataGrid { |
|
| 13 | +class DataGrid |
|
| 14 | +{ |
|
| 14 | 15 | |
| 15 | 16 | public $ds; // datasource |
| 16 | 17 | public $id; |
@@ -72,7 +73,8 @@ discard block |
||
| 72 | 73 | */ |
| 73 | 74 | public $cdelim; |
| 74 | 75 | |
| 75 | - public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
|
| 76 | + public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) |
|
| 77 | + { |
|
| 76 | 78 | global $__DataGridCnt; |
| 77 | 79 | |
| 78 | 80 | // set id |
@@ -88,11 +90,13 @@ discard block |
||
| 88 | 90 | $this->pagerLocation = 'top-right'; |
| 89 | 91 | } |
| 90 | 92 | |
| 91 | - public function setDataSource($ds) { |
|
| 93 | + public function setDataSource($ds) |
|
| 94 | + { |
|
| 92 | 95 | $this->ds = $ds; |
| 93 | 96 | } |
| 94 | 97 | |
| 95 | - public function render() { |
|
| 98 | + public function render() |
|
| 99 | + { |
|
| 96 | 100 | $modx = evolutionCMS(); |
| 97 | 101 | $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
| 98 | 102 | $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
@@ -127,7 +131,9 @@ discard block |
||
| 127 | 131 | |
| 128 | 132 | if($this->_isDataset && !$this->columns) { |
| 129 | 133 | $cols = $modx->db->numFields($this->ds); |
| 130 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 134 | + for($i = 0; $i < $cols; $i++) { |
|
| 135 | + $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 136 | + } |
|
| 131 | 137 | } |
| 132 | 138 | |
| 133 | 139 | // start grid |
@@ -207,7 +213,8 @@ discard block |
||
| 207 | 213 | |
| 208 | 214 | // format column values |
| 209 | 215 | |
| 210 | - public function RenderRowFnc($n, $row) { |
|
| 216 | + public function RenderRowFnc($n, $row) |
|
| 217 | + { |
|
| 211 | 218 | if($this->_alt == 0) { |
| 212 | 219 | $Style = $this->_itemStyle; |
| 213 | 220 | $Class = $this->_itemClass; |
@@ -237,7 +244,8 @@ discard block |
||
| 237 | 244 | return $o; |
| 238 | 245 | } |
| 239 | 246 | |
| 240 | - public function formatColumnValue($row, $value, $type, &$align) { |
|
| 247 | + public function formatColumnValue($row, $value, $type, &$align) |
|
| 248 | + { |
|
| 241 | 249 | if(strpos($type, ":") !== false) { |
| 242 | 250 | list($type, $type_format) = explode(":", $type, 2); |
| 243 | 251 | } |
@@ -10,7 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataSetPagerCnt = 0; |
| 12 | 12 | |
| 13 | -class DataSetPager { |
|
| 13 | +class DataSetPager |
|
| 14 | +{ |
|
| 14 | 15 | |
| 15 | 16 | public $ds; // datasource |
| 16 | 17 | public $pageSize; |
@@ -31,7 +32,8 @@ discard block |
||
| 31 | 32 | public $renderPagerFnc; |
| 32 | 33 | public $renderPagerFncArgs; |
| 33 | 34 | |
| 34 | - public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
| 35 | + public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) |
|
| 36 | + { |
|
| 35 | 37 | global $_PAGE; // use view state object |
| 36 | 38 | |
| 37 | 39 | global $__DataSetPagerCnt; |
@@ -61,35 +63,42 @@ discard block |
||
| 61 | 63 | $this->pager = ''; |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | - public function getRenderedPager() { |
|
| 66 | + public function getRenderedPager() |
|
| 67 | + { |
|
| 65 | 68 | return $this->pager; |
| 66 | 69 | } |
| 67 | 70 | |
| 68 | - public function getRenderedRows() { |
|
| 71 | + public function getRenderedRows() |
|
| 72 | + { |
|
| 69 | 73 | return $this->rows; |
| 70 | 74 | } |
| 71 | 75 | |
| 72 | - public function setDataSource($ds) { |
|
| 76 | + public function setDataSource($ds) |
|
| 77 | + { |
|
| 73 | 78 | $this->ds = $ds; |
| 74 | 79 | } |
| 75 | 80 | |
| 76 | - public function setPageSize($ps) { |
|
| 81 | + public function setPageSize($ps) |
|
| 82 | + { |
|
| 77 | 83 | $this->pageSize = $ps; |
| 78 | 84 | } |
| 79 | 85 | |
| 80 | - public function setRenderRowFnc($fncName, $args = "") { |
|
| 86 | + public function setRenderRowFnc($fncName, $args = "") |
|
| 87 | + { |
|
| 81 | 88 | $this->renderRowFnc = &$fncName; |
| 82 | 89 | $this->renderRowFncArgs = $args; // extra agruments |
| 83 | 90 | |
| 84 | 91 | |
| 85 | 92 | } |
| 86 | 93 | |
| 87 | - public function setRenderPagerFnc($fncName, $args = "") { |
|
| 94 | + public function setRenderPagerFnc($fncName, $args = "") |
|
| 95 | + { |
|
| 88 | 96 | $this->renderPagerFnc = $fncName; |
| 89 | 97 | $this->renderPagerFncArgs = $args; // extra agruments |
| 90 | 98 | } |
| 91 | 99 | |
| 92 | - public function render() { |
|
| 100 | + public function render() |
|
| 101 | + { |
|
| 93 | 102 | $modx = evolutionCMS(); global $_PAGE; |
| 94 | 103 | |
| 95 | 104 | $isDataset = $modx->db->isResult($this->ds); |
@@ -142,8 +151,10 @@ discard block |
||
| 142 | 151 | $url = $_SERVER['PHP_SELF'] . '?'; |
| 143 | 152 | } |
| 144 | 153 | $i = 0; |
| 145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 154 | + foreach($_GET as $n => $v) { |
|
| 155 | + if($n != 'dpgn' . $this->id) { |
|
| 146 | 156 | $i++; |
| 157 | + } |
|
| 147 | 158 | $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
| 148 | 159 | } |
| 149 | 160 | if($i >= 1) { |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | $warningspresent = 0; |
| 20 | 20 | |
| 21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
| 22 | -if ($sysfiles_check!=='0'){ |
|
| 22 | +if ($sysfiles_check!=='0') { |
|
| 23 | 23 | $warningspresent = 1; |
| 24 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -if (is_writable("includes/config.inc.php")){ |
|
| 27 | +if (is_writable("includes/config.inc.php")) { |
|
| 28 | 28 | // Warn if world writable |
| 29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
| 30 | 30 | $warningspresent = 1; |
@@ -120,7 +120,8 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * @return bool |
| 122 | 122 | */ |
| 123 | - function checkSiteCache() { |
|
| 123 | + function checkSiteCache() |
|
| 124 | + { |
|
| 124 | 125 | $modx = evolutionCMS(); |
| 125 | 126 | $checked= true; |
| 126 | 127 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -159,26 +160,36 @@ discard block |
||
| 159 | 160 | |
| 160 | 161 | if ($warningspresent==1) { |
| 161 | 162 | |
| 162 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
| 163 | +if(!isset($modx->config['send_errormail'])) { |
|
| 164 | + $modx->config['send_errormail']='3'; |
|
| 165 | +} |
|
| 163 | 166 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
| 164 | 167 | |
| 165 | 168 | for ($i=0;$i<count($warnings);$i++) { |
| 166 | 169 | switch ($warnings[$i][0]) { |
| 167 | 170 | case $_lang['configcheck_configinc']; |
| 168 | 171 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
| 169 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
| 172 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 173 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
| 174 | + } |
|
| 170 | 175 | break; |
| 171 | 176 | case $_lang['configcheck_installer'] : |
| 172 | 177 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
| 173 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
| 178 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 179 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
| 180 | + } |
|
| 174 | 181 | break; |
| 175 | 182 | case $_lang['configcheck_cache'] : |
| 176 | 183 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
| 177 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
| 184 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 185 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
| 186 | + } |
|
| 178 | 187 | break; |
| 179 | 188 | case $_lang['configcheck_images'] : |
| 180 | 189 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
| 181 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
| 190 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 191 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
| 192 | + } |
|
| 182 | 193 | break; |
| 183 | 194 | case $_lang['configcheck_sysfiles_mod']: |
| 184 | 195 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -186,7 +197,9 @@ discard block |
||
| 186 | 197 | if($modx->hasPermission('settings')) { |
| 187 | 198 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
| 188 | 199 | } |
| 189 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
| 200 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 201 | + $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
| 202 | + } |
|
| 190 | 203 | break; |
| 191 | 204 | case $_lang['configcheck_lang_difference'] : |
| 192 | 205 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -22,16 +22,16 @@ discard block |
||
| 22 | 22 | * @param array $tvsArray |
| 23 | 23 | * @return string |
| 24 | 24 | */ |
| 25 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
| 25 | +function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) |
|
| 26 | +{ |
|
| 26 | 27 | $modx = evolutionCMS(); |
| 27 | 28 | $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
| 28 | 29 | $nvalue = trim($value); |
| 29 | - if (substr($nvalue, 0, 1) != '@') |
|
| 30 | - return $value; |
|
| 31 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
| 30 | + if (substr($nvalue, 0, 1) != '@') { |
|
| 31 | + return $value; |
|
| 32 | + } elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
| 32 | 33 | return '@Bindings is disabled.'; |
| 33 | - } |
|
| 34 | - else { |
|
| 34 | + } else { |
|
| 35 | 35 | list ($cmd, $param) = ParseCommand($nvalue); |
| 36 | 36 | $cmd = trim($cmd); |
| 37 | 37 | $param = parseTvValues($param, $tvsArray); |
@@ -47,10 +47,11 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | case "DOCUMENT" : // retrieve a document and process it's content |
| 49 | 49 | $rs = $modx->getDocument($param); |
| 50 | - if (is_array($rs)) |
|
| 51 | - $output = $rs['content']; |
|
| 52 | - else |
|
| 53 | - $output = "Unable to locate document $param"; |
|
| 50 | + if (is_array($rs)) { |
|
| 51 | + $output = $rs['content']; |
|
| 52 | + } else { |
|
| 53 | + $output = "Unable to locate document $param"; |
|
| 54 | + } |
|
| 54 | 55 | break; |
| 55 | 56 | |
| 56 | 57 | case "SELECT" : // selects a record from the cms database |
@@ -80,8 +81,10 @@ discard block |
||
| 80 | 81 | |
| 81 | 82 | // Grab document regardless of publish status |
| 82 | 83 | $doc = $modx->getPageInfo($parent_id, 0, 'id,parent,published'); |
| 83 | - if ($doc['parent'] != 0 && !$doc['published']) |
|
| 84 | - continue; // hide unpublished docs if we're not at the top |
|
| 84 | + if ($doc['parent'] != 0 && !$doc['published']) { |
|
| 85 | + continue; |
|
| 86 | + } |
|
| 87 | + // hide unpublished docs if we're not at the top |
|
| 85 | 88 | |
| 86 | 89 | $tv = $modx->getTemplateVar($name, '*', $doc['id'], $doc['published']); |
| 87 | 90 | |
@@ -129,10 +132,13 @@ discard block |
||
| 129 | 132 | * @param $file |
| 130 | 133 | * @return string |
| 131 | 134 | */ |
| 132 | -function ProcessFile($file) { |
|
| 135 | +function ProcessFile($file) |
|
| 136 | +{ |
|
| 133 | 137 | // get the file |
| 134 | 138 | $buffer = @file_get_contents($file); |
| 135 | - if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
| 139 | + if ($buffer === false) { |
|
| 140 | + $buffer = " Could not retrieve document '$file'."; |
|
| 141 | + } |
|
| 136 | 142 | return $buffer; |
| 137 | 143 | } |
| 138 | 144 | |
@@ -146,10 +152,8 @@ discard block |
||
| 146 | 152 | { |
| 147 | 153 | global $BINDINGS; |
| 148 | 154 | $binding_array = array(); |
| 149 | - foreach($BINDINGS as $cmd) |
|
| 150 | - { |
|
| 151 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
| 152 | - { |
|
| 155 | + foreach($BINDINGS as $cmd) { |
|
| 156 | + if(strpos($binding_string,'@'.$cmd)===0) { |
|
| 153 | 157 | $code = substr($binding_string,strlen($cmd)+1); |
| 154 | 158 | $binding_array = array($cmd,trim($code)); |
| 155 | 159 | break; |
@@ -7,53 +7,55 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -Class TemplateParser {
|
|
| 10 | +Class TemplateParser |
|
| 11 | +{ |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * @param array $config [action, tabs, toArray] |
| 14 | 15 | * @param array $data |
| 15 | 16 | * @return string |
| 16 | 17 | */ |
| 17 | - public function output($config = array(), $data = array()) {
|
|
| 18 | + public function output($config = array(), $data = array()) |
|
| 19 | + { |
|
| 18 | 20 | $modx = evolutionCMS(); |
| 19 | 21 | |
| 20 | 22 | $output = ''; |
| 21 | 23 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
| 22 | 24 | $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
| 23 | 25 | |
| 24 | - if($action) {
|
|
| 26 | + if($action) { |
|
| 25 | 27 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
| 26 | 28 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
|
| 27 | 29 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
|
| 28 | 30 | WHERE t1.action IN(' . $action . ') ' . $tab . '
|
| 29 | 31 | ORDER BY t1.tab ASC, t1.rank ASC'); |
| 30 | 32 | |
| 31 | - if($modx->db->getRecordCount($sql)) {
|
|
| 33 | + if($modx->db->getRecordCount($sql)) { |
|
| 32 | 34 | $tabs = array(); |
| 33 | - while($row = $modx->db->getRow($sql)) {
|
|
| 34 | - if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 35 | + while($row = $modx->db->getRow($sql)) { |
|
| 36 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
| 35 | 37 | $row['value'] = $data[$row['name']]; |
| 36 | 38 | } |
| 37 | 39 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
| 38 | 40 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
| 39 | 41 | } |
| 40 | 42 | |
| 41 | - if(!empty($config['toArray'])) {
|
|
| 43 | + if(!empty($config['toArray'])) { |
|
| 42 | 44 | $output = $tabs; |
| 43 | - } else {
|
|
| 45 | + } else { |
|
| 44 | 46 | $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
| 45 | 47 | $output .= ' |
| 46 | 48 | <script type="text/javascript"> |
| 47 | 49 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
|
| 48 | 50 | </script>'; |
| 49 | 51 | |
| 50 | - foreach($tabs as $idTab => $tab) {
|
|
| 52 | + foreach($tabs as $idTab => $tab) { |
|
| 51 | 53 | $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
| 52 | 54 | $output .= ' |
| 53 | 55 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
| 54 | 56 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
|
| 55 | 57 | unset($tab['category_name']); |
| 56 | - foreach($tab as $item) {
|
|
| 58 | + foreach($tab as $item) { |
|
| 57 | 59 | $output .= $item; |
| 58 | 60 | } |
| 59 | 61 | $output .= '</div>'; |
@@ -70,7 +72,8 @@ discard block |
||
| 70 | 72 | * @param array $data |
| 71 | 73 | * @return string |
| 72 | 74 | */ |
| 73 | - private function render($data) {
|
|
| 75 | + private function render($data) |
|
| 76 | + { |
|
| 74 | 77 | $modx = evolutionCMS(); global $_lang, $_country_lang; |
| 75 | 78 | |
| 76 | 79 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -80,7 +83,7 @@ discard block |
||
| 80 | 83 | $output = ''; |
| 81 | 84 | $output .= '<div class="form-group row">'; |
| 82 | 85 | |
| 83 | - switch($data['type']) {
|
|
| 86 | + switch($data['type']) { |
|
| 84 | 87 | |
| 85 | 88 | case 'text': |
| 86 | 89 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -114,16 +117,16 @@ discard block |
||
| 114 | 117 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 115 | 118 | $output .= '<div class="col-sm-7">'; |
| 116 | 119 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
| 117 | - if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 120 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
| 118 | 121 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
| 119 | 122 | $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
| 120 | - foreach($_country_lang as $key => $value) {
|
|
| 123 | + foreach($_country_lang as $key => $value) { |
|
| 121 | 124 | $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
| 122 | 125 | } |
| 123 | - } else {
|
|
| 124 | - if($data['elements']) {
|
|
| 126 | + } else { |
|
| 127 | + if($data['elements']) { |
|
| 125 | 128 | $elements = explode('||', $data['elements']);
|
| 126 | - foreach($elements as $key => $value) {
|
|
| 129 | + foreach($elements as $key => $value) { |
|
| 127 | 130 | $value = explode('==', $value);
|
| 128 | 131 | $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
| 129 | 132 | } |
@@ -139,9 +142,9 @@ discard block |
||
| 139 | 142 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 140 | 143 | $output .= '<div class="col-sm-7">'; |
| 141 | 144 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 142 | - if($data['elements']) {
|
|
| 145 | + if($data['elements']) { |
|
| 143 | 146 | $elements = explode('||', $data['elements']);
|
| 144 | - foreach($elements as $key => $value) {
|
|
| 147 | + foreach($elements as $key => $value) { |
|
| 145 | 148 | $value = explode('==', $value);
|
| 146 | 149 | $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
| 147 | 150 | } |
@@ -155,9 +158,9 @@ discard block |
||
| 155 | 158 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 156 | 159 | $output .= '<div class="col-sm-7">'; |
| 157 | 160 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 158 | - if($data['elements']) {
|
|
| 161 | + if($data['elements']) { |
|
| 159 | 162 | $elements = explode('||', $data['elements']);
|
| 160 | - foreach($elements as $key => $value) {
|
|
| 163 | + foreach($elements as $key => $value) { |
|
| 161 | 164 | $value = explode('==', $value);
|
| 162 | 165 | $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
| 163 | 166 | } |
@@ -15,7 +15,8 @@ discard block |
||
| 15 | 15 | * @param string $sep |
| 16 | 16 | * @return mixed|string |
| 17 | 17 | */ |
| 18 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
| 18 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') |
|
| 19 | +{ |
|
| 19 | 20 | |
| 20 | 21 | $modx = evolutionCMS(); |
| 21 | 22 | $o = ''; |
@@ -59,7 +60,9 @@ discard block |
||
| 59 | 60 | if(isset($params['align']) && $params['align'] != 'none') { |
| 60 | 61 | $attr['align'] = $params['align']; |
| 61 | 62 | } |
| 62 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 63 | + foreach($attr as $k => $v) { |
|
| 64 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 65 | + } |
|
| 63 | 66 | $attributes .= ' ' . $params['attrib']; |
| 64 | 67 | |
| 65 | 68 | // Output the image with attributes |
@@ -128,7 +131,9 @@ discard block |
||
| 128 | 131 | 'style' => $params['style'], |
| 129 | 132 | 'target' => $params['target'], |
| 130 | 133 | ); |
| 131 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 134 | + foreach($attr as $k => $v) { |
|
| 135 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 136 | + } |
|
| 132 | 137 | $attributes .= ' ' . $params['attrib']; // add extra |
| 133 | 138 | |
| 134 | 139 | // Output the link |
@@ -157,7 +162,9 @@ discard block |
||
| 157 | 162 | 'class' => $params['class'], |
| 158 | 163 | 'style' => $params['style'], |
| 159 | 164 | ); |
| 160 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 165 | + foreach($attr as $k => $v) { |
|
| 166 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 167 | + } |
|
| 161 | 168 | $attributes .= ' ' . $params['attrib']; // add extra |
| 162 | 169 | |
| 163 | 170 | // Output the HTML Tag |
@@ -341,7 +348,8 @@ discard block |
||
| 341 | 348 | * @param string $s |
| 342 | 349 | * @return string |
| 343 | 350 | */ |
| 344 | -function decodeParamValue($s) { |
|
| 351 | +function decodeParamValue($s) |
|
| 352 | +{ |
|
| 345 | 353 | $s = str_replace("%3D", '=', $s); // = |
| 346 | 354 | return str_replace("%26", '&', $s); // & |
| 347 | 355 | } |
@@ -355,12 +363,16 @@ discard block |
||
| 355 | 363 | * @param bool $columns |
| 356 | 364 | * @return array|string |
| 357 | 365 | */ |
| 358 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
| 366 | +function parseInput($src, $delim = "||", $type = "string", $columns = true) |
|
| 367 | +{ |
|
| 368 | +// type can be: string, array |
|
| 359 | 369 | $modx = evolutionCMS(); |
| 360 | 370 | if($modx->db->isResult($src)) { |
| 361 | 371 | // must be a recordset |
| 362 | 372 | $rows = array(); |
| 363 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
| 373 | + while($cols = $modx->db->getRow($src, 'num')) { |
|
| 374 | + $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
| 375 | + } |
|
| 364 | 376 | return ($type == "array") ? $rows : implode($delim, $rows); |
| 365 | 377 | } else { |
| 366 | 378 | // must be a text |
@@ -376,7 +388,8 @@ discard block |
||
| 376 | 388 | * @param string $value |
| 377 | 389 | * @return bool|false|int |
| 378 | 390 | */ |
| 379 | -function getUnixtimeFromDateString($value) { |
|
| 391 | +function getUnixtimeFromDateString($value) |
|
| 392 | +{ |
|
| 380 | 393 | $timestamp = false; |
| 381 | 394 | // Check for MySQL or legacy style date |
| 382 | 395 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
@@ -1,10 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class DATEPICKER {
|
|
| 4 | - function __construct() {
|
|
| 3 | +class DATEPICKER |
|
| 4 | +{ |
|
| 5 | + function __construct() |
|
| 6 | + { |
|
| 5 | 7 | } |
| 6 | 8 | |
| 7 | - function getDP() {
|
|
| 9 | + function getDP() |
|
| 10 | + { |
|
| 8 | 11 | $modx = evolutionCMS(); global $_lang; |
| 9 | 12 | |
| 10 | 13 | $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
@@ -1,8 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | -class DATEPICKER { |
|
| 3 | - function __construct() { |
|
| 2 | +class DATEPICKER |
|
| 3 | +{ |
|
| 4 | + function __construct() |
|
| 5 | + { |
|
| 4 | 6 | } |
| 5 | - function getDP() { |
|
| 7 | + function getDP() |
|
| 8 | + { |
|
| 6 | 9 | $modx = evolutionCMS(); global$_lang; |
| 7 | 10 | |
| 8 | 11 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |