@@ -14,16 +14,16 @@ discard block |
||
| 14 | 14 | 'DIRECTORY' |
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
| 17 | +function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) |
|
| 18 | +{ |
|
| 18 | 19 | global $modx; |
| 19 | 20 | $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier; |
| 20 | 21 | $nvalue = trim($value); |
| 21 | - if (substr($nvalue, 0, 1) != '@') |
|
| 22 | - return $value; |
|
| 23 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
| 22 | + if (substr($nvalue, 0, 1) != '@') { |
|
| 23 | + return $value; |
|
| 24 | + } elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
| 24 | 25 | return '@Bindings is disabled.'; |
| 25 | - } |
|
| 26 | - else { |
|
| 26 | + } else { |
|
| 27 | 27 | list ($cmd, $param) = ParseCommand($nvalue); |
| 28 | 28 | $cmd = trim($cmd); |
| 29 | 29 | $param = parseTvValues($param, $tvsArray); |
@@ -39,10 +39,11 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | case "DOCUMENT" : // retrieve a document and process it's content |
| 41 | 41 | $rs = $modx->getDocument($param); |
| 42 | - if (is_array($rs)) |
|
| 43 | - $output = $rs['content']; |
|
| 44 | - else |
|
| 45 | - $output = "Unable to locate document $param"; |
|
| 42 | + if (is_array($rs)) { |
|
| 43 | + $output = $rs['content']; |
|
| 44 | + } else { |
|
| 45 | + $output = "Unable to locate document $param"; |
|
| 46 | + } |
|
| 46 | 47 | break; |
| 47 | 48 | |
| 48 | 49 | case "SELECT" : // selects a record from the cms database |
@@ -72,8 +73,10 @@ discard block |
||
| 72 | 73 | |
| 73 | 74 | // Grab document regardless of publish status |
| 74 | 75 | $doc = $modx->getPageInfo($parent_id, 0, 'id,parent,published'); |
| 75 | - if ($doc['parent'] != 0 && !$doc['published']) |
|
| 76 | - continue; // hide unpublished docs if we're not at the top |
|
| 76 | + if ($doc['parent'] != 0 && !$doc['published']) { |
|
| 77 | + continue; |
|
| 78 | + } |
|
| 79 | + // hide unpublished docs if we're not at the top |
|
| 77 | 80 | |
| 78 | 81 | $tv = $modx->getTemplateVar($name, '*', $doc['id'], $doc['published']); |
| 79 | 82 | |
@@ -117,10 +120,13 @@ discard block |
||
| 117 | 120 | } |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | -function ProcessFile($file) { |
|
| 123 | +function ProcessFile($file) |
|
| 124 | +{ |
|
| 121 | 125 | // get the file |
| 122 | 126 | $buffer = @file_get_contents($file); |
| 123 | - if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
| 127 | + if ($buffer===false) { |
|
| 128 | + $buffer = " Could not retrieve document '$file'."; |
|
| 129 | + } |
|
| 124 | 130 | return $buffer; |
| 125 | 131 | } |
| 126 | 132 | |
@@ -129,10 +135,8 @@ discard block |
||
| 129 | 135 | { |
| 130 | 136 | global $BINDINGS; |
| 131 | 137 | $binding_array = array(); |
| 132 | - foreach($BINDINGS as $cmd) |
|
| 133 | - { |
|
| 134 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
| 135 | - { |
|
| 138 | + foreach($BINDINGS as $cmd) { |
|
| 139 | + if(strpos($binding_string,'@'.$cmd)===0) { |
|
| 136 | 140 | $code = substr($binding_string,strlen($cmd)+1); |
| 137 | 141 | $binding_array = array($cmd,trim($code)); |
| 138 | 142 | break; |
@@ -12,11 +12,13 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class logHandler { |
|
| 15 | +class logHandler |
|
| 16 | +{ |
|
| 16 | 17 | // Single variable for a log entry |
| 17 | 18 | var $entry = array(); |
| 18 | 19 | |
| 19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
| 20 | + function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") |
|
| 21 | + { |
|
| 20 | 22 | global $modx; |
| 21 | 23 | $this->entry['msg'] = $msg; // writes testmessage to the object |
| 22 | 24 | $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
@@ -26,10 +28,16 @@ discard block |
||
| 26 | 28 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
| 27 | 29 | |
| 28 | 30 | $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
| 29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
| 31 | + if($this->entry['itemId'] == 0) { |
|
| 32 | + $this->entry['itemId'] = "-"; |
|
| 33 | + } |
|
| 34 | + // to stop items having id 0 |
|
| 30 | 35 | |
| 31 | 36 | $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
| 32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
| 37 | + if($this->entry['itemName'] == "") { |
|
| 38 | + $this->entry['itemName'] = "-"; |
|
| 39 | + } |
|
| 40 | + // to stop item name being empty |
|
| 33 | 41 | |
| 34 | 42 | $this->writeToLog(); |
| 35 | 43 | return; |
@@ -38,7 +46,8 @@ discard block |
||
| 38 | 46 | // function to write to the log |
| 39 | 47 | // collects all required info, and |
| 40 | 48 | // writes it to the logging table |
| 41 | - function writeToLog() { |
|
| 49 | + function writeToLog() |
|
| 50 | + { |
|
| 42 | 51 | global $modx; |
| 43 | 52 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
| 44 | 53 | |
@@ -7,9 +7,11 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -Class TemplateParser {
|
|
| 10 | +Class TemplateParser |
|
| 11 | +{ |
|
| 11 | 12 | |
| 12 | - function __construct() {
|
|
| 13 | + function __construct() |
|
| 14 | + { |
|
| 13 | 15 | } |
| 14 | 16 | |
| 15 | 17 | /** |
@@ -17,46 +19,47 @@ discard block |
||
| 17 | 19 | * @param array $data |
| 18 | 20 | * @return string |
| 19 | 21 | */ |
| 20 | - public function output($config = array(), $data = array()) {
|
|
| 22 | + public function output($config = array(), $data = array()) |
|
| 23 | + { |
|
| 21 | 24 | global $modx; |
| 22 | 25 | |
| 23 | 26 | $output = ''; |
| 24 | 27 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
| 25 | 28 | $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
| 26 | 29 | |
| 27 | - if($action) {
|
|
| 30 | + if($action) { |
|
| 28 | 31 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
| 29 | 32 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
|
| 30 | 33 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
|
| 31 | 34 | WHERE t1.action IN(' . $action . ') ' . $tab . '
|
| 32 | 35 | ORDER BY t1.tab ASC, t1.rank ASC'); |
| 33 | 36 | |
| 34 | - if($modx->db->getRecordCount($sql)) {
|
|
| 37 | + if($modx->db->getRecordCount($sql)) { |
|
| 35 | 38 | $tabs = array(); |
| 36 | - while($row = $modx->db->getRow($sql)) {
|
|
| 37 | - if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 39 | + while($row = $modx->db->getRow($sql)) { |
|
| 40 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
| 38 | 41 | $row['value'] = $data[$row['name']]; |
| 39 | 42 | } |
| 40 | 43 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
| 41 | 44 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
| 42 | 45 | } |
| 43 | 46 | |
| 44 | - if(!empty($config['toArray'])) {
|
|
| 47 | + if(!empty($config['toArray'])) { |
|
| 45 | 48 | $output = $tabs; |
| 46 | - } else {
|
|
| 49 | + } else { |
|
| 47 | 50 | $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
| 48 | 51 | $output .= ' |
| 49 | 52 | <script type="text/javascript"> |
| 50 | 53 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
|
| 51 | 54 | </script>'; |
| 52 | 55 | |
| 53 | - foreach($tabs as $idTab => $tab) {
|
|
| 56 | + foreach($tabs as $idTab => $tab) { |
|
| 54 | 57 | $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
| 55 | 58 | $output .= ' |
| 56 | 59 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
| 57 | 60 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
|
| 58 | 61 | unset($tab['category_name']); |
| 59 | - foreach($tab as $item) {
|
|
| 62 | + foreach($tab as $item) { |
|
| 60 | 63 | $output .= $item; |
| 61 | 64 | } |
| 62 | 65 | $output .= '</div>'; |
@@ -69,7 +72,8 @@ discard block |
||
| 69 | 72 | return $output; |
| 70 | 73 | } |
| 71 | 74 | |
| 72 | - private function render($data) {
|
|
| 75 | + private function render($data) |
|
| 76 | + { |
|
| 73 | 77 | global $modx, $_lang, $_country_lang; |
| 74 | 78 | |
| 75 | 79 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +83,7 @@ discard block |
||
| 79 | 83 | $output = ''; |
| 80 | 84 | $output .= '<div class="form-group row">'; |
| 81 | 85 | |
| 82 | - switch($data['type']) {
|
|
| 86 | + switch($data['type']) { |
|
| 83 | 87 | |
| 84 | 88 | case 'text': |
| 85 | 89 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,16 +117,16 @@ discard block |
||
| 113 | 117 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 114 | 118 | $output .= '<div class="col-sm-7">'; |
| 115 | 119 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
| 116 | - if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 120 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
| 117 | 121 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
| 118 | 122 | $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
| 119 | - foreach($_country_lang as $key => $value) {
|
|
| 123 | + foreach($_country_lang as $key => $value) { |
|
| 120 | 124 | $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
| 121 | 125 | } |
| 122 | - } else {
|
|
| 123 | - if($data['elements']) {
|
|
| 126 | + } else { |
|
| 127 | + if($data['elements']) { |
|
| 124 | 128 | $elements = explode('||', $data['elements']);
|
| 125 | - foreach($elements as $key => $value) {
|
|
| 129 | + foreach($elements as $key => $value) { |
|
| 126 | 130 | $value = explode('==', $value);
|
| 127 | 131 | $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
| 128 | 132 | } |
@@ -138,9 +142,9 @@ discard block |
||
| 138 | 142 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 139 | 143 | $output .= '<div class="col-sm-7">'; |
| 140 | 144 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 141 | - if($data['elements']) {
|
|
| 145 | + if($data['elements']) { |
|
| 142 | 146 | $elements = explode('||', $data['elements']);
|
| 143 | - foreach($elements as $key => $value) {
|
|
| 147 | + foreach($elements as $key => $value) { |
|
| 144 | 148 | $value = explode('==', $value);
|
| 145 | 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]); |
| 146 | 150 | } |
@@ -154,9 +158,9 @@ discard block |
||
| 154 | 158 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 155 | 159 | $output .= '<div class="col-sm-7">'; |
| 156 | 160 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 157 | - if($data['elements']) {
|
|
| 161 | + if($data['elements']) { |
|
| 158 | 162 | $elements = explode('||', $data['elements']);
|
| 159 | - foreach($elements as $key => $value) {
|
|
| 163 | + foreach($elements as $key => $value) { |
|
| 160 | 164 | $value = explode('==', $value);
|
| 161 | 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]); |
| 162 | 166 | } |
@@ -3,10 +3,12 @@ discard block |
||
| 3 | 3 | global $ContextMenuCnt; |
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | -class ContextMenu { |
|
| 6 | +class ContextMenu |
|
| 7 | +{ |
|
| 7 | 8 | var $id; |
| 8 | 9 | |
| 9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
| 10 | + function __construct($id = '', $width = 120, $visible = false) |
|
| 11 | + { |
|
| 10 | 12 | global $ContextMenuCnt; |
| 11 | 13 | $ContextMenuCnt++; |
| 12 | 14 | $this->html = ""; |
@@ -15,7 +17,8 @@ discard block |
||
| 15 | 17 | $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
| 16 | 18 | } |
| 17 | 19 | |
| 18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
| 20 | + function addItem($text, $action = "", $img = "", $disabled = 0) |
|
| 21 | + { |
|
| 19 | 22 | global $base_url, $_style; |
| 20 | 23 | if($disabled) { |
| 21 | 24 | return; |
@@ -40,13 +43,15 @@ discard block |
||
| 40 | 43 | $this->html .= $img . ' ' . $text . '</div>'; |
| 41 | 44 | } |
| 42 | 45 | |
| 43 | - function addSeparator() { |
|
| 46 | + function addSeparator() |
|
| 47 | + { |
|
| 44 | 48 | $this->html .= " |
| 45 | 49 | <div class='cntxMnuSeparator'></div> |
| 46 | 50 | "; |
| 47 | 51 | } |
| 48 | 52 | |
| 49 | - function render() { |
|
| 53 | + function render() |
|
| 54 | + { |
|
| 50 | 55 | global $ContextMenuScript; |
| 51 | 56 | |
| 52 | 57 | $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
@@ -54,7 +59,8 @@ discard block |
||
| 54 | 59 | return $html; |
| 55 | 60 | } |
| 56 | 61 | |
| 57 | - function getClientScriptObject() { |
|
| 62 | + function getClientScriptObject() |
|
| 63 | + { |
|
| 58 | 64 | return "getCntxMenu('" . $this->id . "')"; |
| 59 | 65 | } |
| 60 | 66 | } |
@@ -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 | var $ds; // datasource |
| 16 | 17 | var $id; |
@@ -52,7 +53,8 @@ discard block |
||
| 52 | 53 | var $selPageClass; |
| 53 | 54 | var $noRecordMsg = "No records found."; |
| 54 | 55 | |
| 55 | - function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
|
| 56 | + function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) |
|
| 57 | + { |
|
| 56 | 58 | global $__DataGridCnt; |
| 57 | 59 | |
| 58 | 60 | // set id |
@@ -68,11 +70,13 @@ discard block |
||
| 68 | 70 | $this->pagerLocation = 'top-right'; |
| 69 | 71 | } |
| 70 | 72 | |
| 71 | - function setDataSource($ds) { |
|
| 73 | + function setDataSource($ds) |
|
| 74 | + { |
|
| 72 | 75 | $this->ds = $ds; |
| 73 | 76 | } |
| 74 | 77 | |
| 75 | - function render() { |
|
| 78 | + function render() |
|
| 79 | + { |
|
| 76 | 80 | global $modx; |
| 77 | 81 | $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
| 78 | 82 | $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
@@ -107,7 +111,9 @@ discard block |
||
| 107 | 111 | |
| 108 | 112 | if($this->_isDataset && !$this->columns) { |
| 109 | 113 | $cols = $modx->db->numFields($this->ds); |
| 110 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 114 | + for($i = 0; $i < $cols; $i++) { |
|
| 115 | + $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 116 | + } |
|
| 111 | 117 | } |
| 112 | 118 | |
| 113 | 119 | // start grid |
@@ -187,7 +193,8 @@ discard block |
||
| 187 | 193 | |
| 188 | 194 | // format column values |
| 189 | 195 | |
| 190 | - function RenderRowFnc($n, $row) { |
|
| 196 | + function RenderRowFnc($n, $row) |
|
| 197 | + { |
|
| 191 | 198 | if($this->_alt == 0) { |
| 192 | 199 | $Style = $this->_itemStyle; |
| 193 | 200 | $Class = $this->_itemClass; |
@@ -217,7 +224,8 @@ discard block |
||
| 217 | 224 | return $o; |
| 218 | 225 | } |
| 219 | 226 | |
| 220 | - function formatColumnValue($row, $value, $type, &$align) { |
|
| 227 | + function formatColumnValue($row, $value, $type, &$align) |
|
| 228 | + { |
|
| 221 | 229 | if(strpos($type, ":") !== false) { |
| 222 | 230 | list($type, $type_format) = explode(":", $type, 2); |
| 223 | 231 | } |
@@ -344,7 +344,8 @@ |
||
| 344 | 344 | protected function sendString($string) |
| 345 | 345 | { |
| 346 | 346 | if ($this->pop_conn) { |
| 347 | - if ($this->do_debug >= 2) { //Show client messages when debug >= 2 |
|
| 347 | + if ($this->do_debug >= 2) { |
|
| 348 | +//Show client messages when debug >= 2 |
|
| 348 | 349 | echo 'Client -> Server: ', $string; |
| 349 | 350 | } |
| 350 | 351 | |
@@ -2059,7 +2059,8 @@ discard block |
||
| 2059 | 2059 | */ |
| 2060 | 2060 | public function addrFormat($addr) |
| 2061 | 2061 | { |
| 2062 | - if (empty($addr[1])) { // No name provided |
|
| 2062 | + if (empty($addr[1])) { |
|
| 2063 | +// No name provided |
|
| 2063 | 2064 | return $this->secureHeader($addr[0]); |
| 2064 | 2065 | } |
| 2065 | 2066 | |
@@ -3425,7 +3426,7 @@ discard block |
||
| 3425 | 3426 | { |
| 3426 | 3427 | $this->RecipientsQueue = array_filter( |
| 3427 | 3428 | $this->RecipientsQueue, |
| 3428 | - function ($params) use ($kind) { |
|
| 3429 | + function ($params) use ($kind){ |
|
| 3429 | 3430 | return $params[0] != $kind; |
| 3430 | 3431 | } |
| 3431 | 3432 | ); |
@@ -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 | var $ds; // datasource |
| 16 | 17 | var $pageSize; |
@@ -27,7 +28,8 @@ discard block |
||
| 27 | 28 | var $selPageStyle; |
| 28 | 29 | var $selPageClass; |
| 29 | 30 | |
| 30 | - function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
| 31 | + function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) |
|
| 32 | + { |
|
| 31 | 33 | global $_PAGE; // use view state object |
| 32 | 34 | |
| 33 | 35 | global $__DataSetPagerCnt; |
@@ -57,35 +59,42 @@ discard block |
||
| 57 | 59 | $this->pager = ''; |
| 58 | 60 | } |
| 59 | 61 | |
| 60 | - function getRenderedPager() { |
|
| 62 | + function getRenderedPager() |
|
| 63 | + { |
|
| 61 | 64 | return $this->pager; |
| 62 | 65 | } |
| 63 | 66 | |
| 64 | - function getRenderedRows() { |
|
| 67 | + function getRenderedRows() |
|
| 68 | + { |
|
| 65 | 69 | return $this->rows; |
| 66 | 70 | } |
| 67 | 71 | |
| 68 | - function setDataSource($ds) { |
|
| 72 | + function setDataSource($ds) |
|
| 73 | + { |
|
| 69 | 74 | $this->ds = $ds; |
| 70 | 75 | } |
| 71 | 76 | |
| 72 | - function setPageSize($ps) { |
|
| 77 | + function setPageSize($ps) |
|
| 78 | + { |
|
| 73 | 79 | $this->pageSize = $ps; |
| 74 | 80 | } |
| 75 | 81 | |
| 76 | - function setRenderRowFnc($fncName, $args = "") { |
|
| 82 | + function setRenderRowFnc($fncName, $args = "") |
|
| 83 | + { |
|
| 77 | 84 | $this->renderRowFnc = &$fncName; |
| 78 | 85 | $this->renderRowFncArgs = $args; // extra agruments |
| 79 | 86 | |
| 80 | 87 | |
| 81 | 88 | } |
| 82 | 89 | |
| 83 | - function setRenderPagerFnc($fncName, $args = "") { |
|
| 90 | + function setRenderPagerFnc($fncName, $args = "") |
|
| 91 | + { |
|
| 84 | 92 | $this->renderPagerFnc = $fncName; |
| 85 | 93 | $this->renderPagerFncArgs = $args; // extra agruments |
| 86 | 94 | } |
| 87 | 95 | |
| 88 | - function render() { |
|
| 96 | + function render() |
|
| 97 | + { |
|
| 89 | 98 | global $modx, $_PAGE; |
| 90 | 99 | |
| 91 | 100 | $isDataset = $modx->db->isResult($this->ds); |
@@ -137,8 +146,10 @@ discard block |
||
| 137 | 146 | $url = $_SERVER['PHP_SELF'] . '?'; |
| 138 | 147 | } |
| 139 | 148 | $i = 0; |
| 140 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 149 | + foreach($_GET as $n => $v) { |
|
| 150 | + if($n != 'dpgn' . $this->id) { |
|
| 141 | 151 | $i++; |
| 152 | + } |
|
| 142 | 153 | $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
| 143 | 154 | } |
| 144 | 155 | if($i >= 1) { |
@@ -1,6 +1,7 @@ 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 | 5 | global $modx; |
| 5 | 6 | global $_style; |
| 6 | 7 | global $_lang; |
@@ -368,13 +369,16 @@ discard block |
||
| 368 | 369 | return $field_html; |
| 369 | 370 | } // end renderFormElement function |
| 370 | 371 | |
| 371 | -function ParseIntputOptions($v) { |
|
| 372 | +function ParseIntputOptions($v) |
|
| 373 | +{ |
|
| 372 | 374 | global $modx; |
| 373 | 375 | $a = array(); |
| 374 | 376 | if(is_array($v)) { |
| 375 | 377 | return $v; |
| 376 | 378 | } else if($modx->db->isResult($v)) { |
| 377 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
| 379 | + while($cols = $modx->db->getRow($v, 'num')) { |
|
| 380 | + $a[] = $cols; |
|
| 381 | + } |
|
| 378 | 382 | } else { |
| 379 | 383 | $a = explode("||", $v); |
| 380 | 384 | } |