@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @param string $cname |
| 75 | 75 | */ |
| 76 | - public function beforeSendToClient($cname, array $expand=array()) |
|
| 76 | + public function beforeSendToClient($cname, array $expand = array()) |
|
| 77 | 77 | { |
| 78 | 78 | $attrs = $this->attrs; |
| 79 | 79 | $form_name = self::form_name($cname, $this->id); |
@@ -82,14 +82,14 @@ discard block |
||
| 82 | 82 | error_log(__METHOD__."() $this has no id!"); |
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | - $attrs['value'] = $value =& self::get_array(self::$request->content, $form_name, false, true); |
|
| 85 | + $attrs['value'] = $value = & self::get_array(self::$request->content, $form_name, false, true); |
|
| 86 | 86 | $attrs['type'] = $this->type; |
| 87 | 87 | $attrs['id'] = $this->id; |
| 88 | 88 | |
| 89 | 89 | $unmodified = $attrs; |
| 90 | 90 | |
| 91 | 91 | // run the transformation |
| 92 | - foreach(static::$transformation as $filter => $data) |
|
| 92 | + foreach (static::$transformation as $filter => $data) |
|
| 93 | 93 | { |
| 94 | 94 | $this->action($filter, $data, $attrs); |
| 95 | 95 | } |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | //echo $this; _debug_array($unmodified); _debug_array($attrs); _debug_array(array_diff_assoc($attrs, $unmodified)); |
| 98 | 98 | // compute the difference and send it to the client as modifications |
| 99 | 99 | $type_changed = false; |
| 100 | - foreach(array_diff_assoc($attrs, $unmodified) as $attr => $val) |
|
| 100 | + foreach (array_diff_assoc($attrs, $unmodified) as $attr => $val) |
|
| 101 | 101 | { |
| 102 | - switch($attr) |
|
| 102 | + switch ($attr) |
|
| 103 | 103 | { |
| 104 | 104 | case 'value': |
| 105 | 105 | if ($val != $value) |
| 106 | 106 | { |
| 107 | - $value = $val; // $value is reference to self::$request->content |
|
| 107 | + $value = $val; // $value is reference to self::$request->content |
|
| 108 | 108 | } |
| 109 | 109 | break; |
| 110 | 110 | case 'sel_options': |
@@ -112,15 +112,15 @@ discard block |
||
| 112 | 112 | break; |
| 113 | 113 | case 'type': // not an attribute in etemplate2 |
| 114 | 114 | $type_changed = true; |
| 115 | - if($val == 'template') |
|
| 115 | + if ($val == 'template') |
|
| 116 | 116 | { |
| 117 | 117 | // If the widget has been transformed into a template, we |
| 118 | 118 | // also need to try and instanciate & parse the template too |
| 119 | 119 | $transformed_template = Template::instance($attrs['template']); |
| 120 | - if($transformed_template) |
|
| 120 | + if ($transformed_template) |
|
| 121 | 121 | { |
| 122 | 122 | $this->expand_widget($transformed_template, $expand); |
| 123 | - $transformed_template->run('beforeSendToClient',array($cname,$expand)); |
|
| 123 | + $transformed_template->run('beforeSendToClient', array($cname, $expand)); |
|
| 124 | 124 | } |
| 125 | 125 | $type_changed = false; |
| 126 | 126 | } |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | break; |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | - if($type_changed) |
|
| 132 | + if ($type_changed) |
|
| 133 | 133 | { |
| 134 | 134 | // Run the new widget type's beforeSendToClient |
| 135 | - $expanded_child = self::factory($attrs['type'], false,$this->id); |
|
| 135 | + $expanded_child = self::factory($attrs['type'], false, $this->id); |
|
| 136 | 136 | $expanded_child->id = $this->id; |
| 137 | 137 | $expanded_child->type = $attrs['type']; |
| 138 | 138 | $expanded_child->attrs = $attrs; |
| 139 | - $expanded_child->run('beforeSendToClient',array($cname,$expand)); |
|
| 139 | + $expanded_child->run('beforeSendToClient', array($cname, $expand)); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | if (strpos($action, '@') !== false) |
| 159 | 159 | { |
| 160 | 160 | $replace = array(); |
| 161 | - foreach($attrs as $a => $v) |
|
| 161 | + foreach ($attrs as $a => $v) |
|
| 162 | 162 | { |
| 163 | 163 | if (is_scalar($v) || is_null($v)) $replace['@'.$a] = $v; |
| 164 | 164 | } |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | // now replace with non-scalar value, eg. if values is an array: "@value", "@value[key] or "@value[@key]" |
| 167 | 167 | if (($a = strstr($action, '@'))) |
| 168 | 168 | { |
| 169 | - $action = self::get_array($attrs, substr($a,1)); |
|
| 169 | + $action = self::get_array($attrs, substr($a, 1)); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | $attrs[$attr] = $action; |
| 173 | 173 | if (self::DEBUG) error_log(__METHOD__."('$attr', ".array2string($action).") attrs['$attr'] = ".array2string($action).', attrs='.array2string($attrs)); |
| 174 | 174 | } |
| 175 | 175 | // action is a serverside callback |
| 176 | - elseif(is_array($action) && isset($action['__callback__'])) |
|
| 176 | + elseif (is_array($action) && isset($action['__callback__'])) |
|
| 177 | 177 | { |
| 178 | 178 | if (!is_string(($callback = $action['__callback__']))) |
| 179 | 179 | { |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | { |
| 184 | 184 | $attrs[$attr] = $this->$callback($attrs[$attr], $attrs); |
| 185 | 185 | } |
| 186 | - elseif(count(explode('.', $callback)) == 3) |
|
| 186 | + elseif (count(explode('.', $callback)) == 3) |
|
| 187 | 187 | { |
| 188 | 188 | $attrs[$attr] = ExecMethod($callback, $attrs[$attr], $attrs); |
| 189 | 189 | } |
@@ -197,29 +197,29 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | // action is a clientside callback |
| 200 | - elseif(is_array($action) && isset($action['__js__'])) |
|
| 200 | + elseif (is_array($action) && isset($action['__js__'])) |
|
| 201 | 201 | { |
| 202 | 202 | // nothing to do here |
| 203 | 203 | } |
| 204 | 204 | // TODO: Might be a better way to handle when value to be set is an array |
| 205 | - elseif(is_array($action) && $attr == 'sel_options') |
|
| 205 | + elseif (is_array($action) && $attr == 'sel_options') |
|
| 206 | 206 | { |
| 207 | 207 | $attrs[$attr] = $action; |
| 208 | 208 | } |
| 209 | 209 | // action is a switch --> check cases |
| 210 | - elseif(is_array($action)) |
|
| 210 | + elseif (is_array($action)) |
|
| 211 | 211 | { |
| 212 | 212 | // case matches --> run all actions |
| 213 | 213 | if (isset($action[$attrs[$attr]]) || !isset($action[$attrs[$attr]]) && isset($action['__default__'])) |
| 214 | 214 | { |
| 215 | 215 | $actions = isset($action[$attrs[$attr]]) ? $action[$attrs[$attr]] : $action['__default__']; |
| 216 | - if(!is_array($actions)) |
|
| 216 | + if (!is_array($actions)) |
|
| 217 | 217 | { |
| 218 | 218 | $attrs[$attr] = $actions; |
| 219 | 219 | $actions = array($attr => $actions); |
| 220 | 220 | } |
| 221 | 221 | if (self::DEBUG) error_log(__METHOD__."(attr='$attr', action=".array2string($action).") attrs['$attr']=='{$attrs[$attr]}' --> running actions"); |
| 222 | - foreach($actions as $attr => $action) |
|
| 222 | + foreach ($actions as $attr => $action) |
|
| 223 | 223 | { |
| 224 | 224 | $this->action($attr, $action, $attrs); |
| 225 | 225 | } |
@@ -42,17 +42,17 @@ discard block |
||
| 42 | 42 | * @param array $params =array('') parameter(s) first parameter has to be cname! |
| 43 | 43 | * @param boolean $respect_disabled =false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children |
| 44 | 44 | */ |
| 45 | - public function run($method_name, $params=array(''), $respect_disabled=false) |
|
| 45 | + public function run($method_name, $params = array(''), $respect_disabled = false) |
|
| 46 | 46 | { |
| 47 | - $cname =& $params[0]; |
|
| 48 | - $expand =& $params[1]; |
|
| 47 | + $cname = & $params[0]; |
|
| 48 | + $expand = & $params[1]; |
|
| 49 | 49 | $old_cname = $params[0]; |
| 50 | 50 | $old_expand = $params[1]; |
| 51 | 51 | |
| 52 | 52 | if ($this->id && $this->type != 'groupbox') $cname = self::form_name($cname, $this->id, $params[1]); |
| 53 | 53 | if ($expand['cname'] !== $cname && $cname) |
| 54 | 54 | { |
| 55 | - $expand['cont'] =& self::get_array(self::$request->content, $cname); |
|
| 55 | + $expand['cont'] = & self::get_array(self::$request->content, $cname); |
|
| 56 | 56 | $expand['cname'] = $cname; |
| 57 | 57 | } |
| 58 | 58 | if ($respect_disabled && ($disabled = $this->attrs['disabled'] && self::check_disabled($this->attrs['disabled'], $expand))) |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | // Expand children |
| 69 | 69 | $columns_disabled = null; |
| 70 | - for($n = 0; ; ++$n) |
|
| 70 | + for ($n = 0; ; ++$n) |
|
| 71 | 71 | { |
| 72 | 72 | if (isset($this->children[$n])) |
| 73 | 73 | { |
| 74 | - $child =& $this->children[$n]; |
|
| 74 | + $child = & $this->children[$n]; |
|
| 75 | 75 | // If type has something that can be expanded, we need to expand it so the correct method is run |
| 76 | 76 | $this->expand_widget($child, $expand); |
| 77 | 77 | } |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | private function need_autorepeat(Etemplate\Widget $widget, $cname, array $expand) |
| 109 | 109 | { |
| 110 | - foreach(array($widget) + $widget->children as $check_widget) |
|
| 110 | + foreach (array($widget) + $widget->children as $check_widget) |
|
| 111 | 111 | { |
| 112 | 112 | $pat = $check_widget->id; |
| 113 | - while(($pattern = strstr($pat, '$'))) |
|
| 113 | + while (($pattern = strstr($pat, '$'))) |
|
| 114 | 114 | { |
| 115 | - $pat = substr($pattern,$pattern[1] == '{' ? 2 : 1); |
|
| 115 | + $pat = substr($pattern, $pattern[1] == '{' ? 2 : 1); |
|
| 116 | 116 | |
| 117 | - $Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' || |
|
| 118 | - substr($pat,0,4) == 'row_' && substr($pat,0,8) != 'row_cont'); |
|
| 117 | + $Ok = $pat[0] == 'r' && !(substr($pat, 0, 2) == 'r_' || |
|
| 118 | + substr($pat, 0, 4) == 'row_' && substr($pat, 0, 8) != 'row_cont'); |
|
| 119 | 119 | |
| 120 | - if ($Ok && ($fname=self::form_name($cname, $check_widget->id, $expand)) && |
|
| 120 | + if ($Ok && ($fname = self::form_name($cname, $check_widget->id, $expand)) && |
|
| 121 | 121 | // need to break if fname ends in [] as get_array() will ignore it and returns whole array |
| 122 | 122 | // for an id like "run[$row_cont[appname]]" |
| 123 | 123 | substr($fname, -2) != '[]' && |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param string $cname |
| 27 | 27 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
| 28 | 28 | */ |
| 29 | - public function beforeSendToClient($cname, array $expand=null) |
|
| 29 | + public function beforeSendToClient($cname, array $expand = null) |
|
| 30 | 30 | { |
| 31 | 31 | $matches = null; |
| 32 | 32 | if ($cname == '$row') // happens eg. with custom-fields: $cname='$row', this->id='#something' |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | // Make sure s, etc. are properly encoded when sent, and not double-encoded |
| 57 | 57 | $options = (isset(self::$request->sel_options[$form_name]) ? $form_name : $this->id); |
| 58 | - if(is_array(self::$request->sel_options[$options])) |
|
| 58 | + if (is_array(self::$request->sel_options[$options])) |
|
| 59 | 59 | { |
| 60 | 60 | |
| 61 | 61 | // Fix any custom options from application |
| 62 | - self::fix_encoded_options(self::$request->sel_options[$options],true); |
|
| 62 | + self::fix_encoded_options(self::$request->sel_options[$options], true); |
|
| 63 | 63 | |
| 64 | - if(!self::$request->sel_options[$options]) |
|
| 64 | + if (!self::$request->sel_options[$options]) |
|
| 65 | 65 | { |
| 66 | 66 | unset(self::$request->sel_options[$options]); |
| 67 | 67 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | * @param string|XMLReader $xml |
| 27 | 27 | * @param boolean $cloned =true true: object does NOT need to be cloned, false: to set attribute, set them in cloned object |
| 28 | 28 | */ |
| 29 | - public function set_attrs($xml, $cloned=true) |
|
| 29 | + public function set_attrs($xml, $cloned = true) |
|
| 30 | 30 | { |
| 31 | 31 | parent::set_attrs($xml, $cloned); |
| 32 | 32 | |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | * @param string $cname |
| 30 | 30 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
| 31 | 31 | */ |
| 32 | - public function beforeSendToClient($cname, array $expand=null) |
|
| 32 | + public function beforeSendToClient($cname, array $expand = null) |
|
| 33 | 33 | { |
| 34 | - switch($this->attrs['type']) |
|
| 34 | + switch ($this->attrs['type']) |
|
| 35 | 35 | { |
| 36 | 36 | case "link-entry": |
| 37 | 37 | self::$transformation['type'] = $this->attrs['type'] = 'nextmatch-entryheader'; |
| 38 | 38 | break; |
| 39 | 39 | default: |
| 40 | - list($type) = explode('-',$this->attrs['type']); |
|
| 41 | - if($type == 'select') |
|
| 40 | + list($type) = explode('-', $this->attrs['type']); |
|
| 41 | + if ($type == 'select') |
|
| 42 | 42 | { |
| 43 | - if(in_array($this->attrs['type'], Widget\Select::$cached_types)) |
|
| 43 | + if (in_array($this->attrs['type'], Widget\Select::$cached_types)) |
|
| 44 | 44 | { |
| 45 | 45 | $widget_type = $this->attrs['type']; |
| 46 | 46 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $this->setElementAttribute($form_name, 'options', trim($this->attrs['widget_options']) != '' ? $this->attrs['widget_options'] : ''); |
| 54 | 54 | |
| 55 | 55 | $this->setElementAttribute($form_name, 'type', $this->attrs['type']); |
| 56 | - if($widget_type) |
|
| 56 | + if ($widget_type) |
|
| 57 | 57 | { |
| 58 | 58 | $this->setElementAttribute($form_name, 'widget_type', $widget_type); |
| 59 | 59 | } |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | * @param array $content |
| 70 | 70 | * @param array &$validated=array() validated content |
| 71 | 71 | */ |
| 72 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 72 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 73 | 73 | { |
| 74 | 74 | $value = $value_in = self::get_array($content, $form_name); |
| 75 | 75 | |
| 76 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 76 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 77 | 77 | // returning null instead of array(), as array() will be overwritten by etemplate_new::complete_array_merge() |
| 78 | 78 | // with preserved old content and therefore user can not empty a taglist |
| 79 | 79 | $valid = $value ? $value : null; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param array &$validated=array() validated content |
| 45 | 45 | * @return boolean true if no validation error, false otherwise |
| 46 | 46 | */ |
| 47 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 47 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 48 | 48 | { |
| 49 | 49 | $form_name = self::form_name($cname, $this->id, $expand); |
| 50 | 50 | //error_log(__METHOD__."('$cname', ".array2string($expand).", ...) $this: get_array(\$content, '$form_name')=".array2string(self::get_array($content, $form_name))); |
@@ -53,18 +53,18 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $value = self::get_array($content, $form_name); |
| 55 | 55 | |
| 56 | - if( |
|
| 56 | + if ( |
|
| 57 | 57 | // Handle case of not existing $row_cont[id], eg: create[] |
| 58 | 58 | is_array($value) && count($value) == 1 || |
| 59 | 59 | // check === true, as get_array() ignores a "[]" postfix and returns array() eg. for a not existing $row_cont[id] in "delete[$row_cont[id]]" |
| 60 | 60 | $value == true |
| 61 | 61 | ) |
| 62 | 62 | { |
| 63 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 63 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 64 | 64 | if (true) $valid = is_array($value) ? $value : 'pressed'; |
| 65 | 65 | |
| 66 | 66 | // recorded pressed button globally, was in the template object before, put now as static on this object |
| 67 | - if ($this->type == 'cancel' || $form_name == 'cancel' || substr($form_name,-10) == '[cancel]') |
|
| 67 | + if ($this->type == 'cancel' || $form_name == 'cancel' || substr($form_name, -10) == '[cancel]') |
|
| 68 | 68 | { |
| 69 | 69 | self::$canceled = true; |
| 70 | 70 | } |
@@ -76,4 +76,4 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | -Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Button', array('button','buttononly')); |
|
| 79 | +Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Button', array('button', 'buttononly')); |
|
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | * @param boolean $respect_disabled =false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children |
| 66 | 66 | * @param array $columns_disabled=array() disabled columns |
| 67 | 67 | */ |
| 68 | - public function run($method_name, $params=array(''), $respect_disabled=false, &$columns_disabled=array()) |
|
| 68 | + public function run($method_name, $params = array(''), $respect_disabled = false, &$columns_disabled = array()) |
|
| 69 | 69 | { |
| 70 | 70 | // maintain $expand array name-expansion |
| 71 | - $cname =& $params[0]; |
|
| 72 | - $expand =& $params[1]; |
|
| 71 | + $cname = & $params[0]; |
|
| 72 | + $expand = & $params[1]; |
|
| 73 | 73 | $old_cname = $params[0]; |
| 74 | 74 | $old_expand = $params[1]; |
| 75 | 75 | |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | //error_log(__METHOD__."('$method_name', ".array2string($params).', '.array2string($respect_disabled).") $this disabled='{$this->attrs['disabled']}'=".array2string($disabled).": NOT running"); |
| 86 | 86 | $params[0] = $old_cname; |
| 87 | 87 | $params[1] = $old_expand; |
| 88 | - return false; // return |
|
| 88 | + return false; // return |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if ($this->id) $cname = self::form_name($cname, $this->id, $expand); |
| 92 | 92 | if ($expand['cname'] !== $cname && $cname) |
| 93 | 93 | { |
| 94 | - $expand['cont'] =& self::get_array(self::$request->content, $cname); |
|
| 94 | + $expand['cont'] = & self::get_array(self::$request->content, $cname); |
|
| 95 | 95 | $expand['cname'] = $cname; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | //foreach($this->children as $n => $child) |
| 103 | 103 | $repeat_child = null; |
| 104 | - for($n = 0; ; ++$n) |
|
| 104 | + for ($n = 0; ; ++$n) |
|
| 105 | 105 | { |
| 106 | 106 | // maintain $expand array name-expansion |
| 107 | - switch($this->type) |
|
| 107 | + switch ($this->type) |
|
| 108 | 108 | { |
| 109 | 109 | case 'rows': |
| 110 | 110 | $expand['row'] = $n; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if (isset($this->children[$n])) |
| 117 | 117 | { |
| 118 | 118 | $child = $this->children[$n]; |
| 119 | - if($this->type == 'rows' || $this->type == 'columns') |
|
| 119 | + if ($this->type == 'rows' || $this->type == 'columns') |
|
| 120 | 120 | { |
| 121 | 121 | /* |
| 122 | 122 | * We store a clone of the repeated child, because at the end |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | if (in_array($n, $columns_disabled)) |
| 144 | 144 | { |
| 145 | 145 | //error_log(__METHOD__."('$method_name', ".array2string($params).', '.array2string($respect_disabled).") $this column $n is disabled: NOT running"); |
| 146 | - continue; // do NOT run $method_name on disabled columns |
|
| 146 | + continue; // do NOT run $method_name on disabled columns |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | //error_log('Running ' . $method_name . ' on child ' . $n . '(' . $child . ') ['.$expand['row'] . ','.$expand['c'] . ']'); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | if ($this->type == 'columns' && $disabled) |
| 153 | 153 | { |
| 154 | - $columns_disabled[] = $n; // mark column as disabled |
|
| 154 | + $columns_disabled[] = $n; // mark column as disabled |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | if ($this->type == 'grid') |
@@ -175,34 +175,34 @@ discard block |
||
| 175 | 175 | private function need_autorepeat($cname, array $expand) |
| 176 | 176 | { |
| 177 | 177 | // check id's of children |
| 178 | - foreach($this->children as $n => $direct_child) |
|
| 178 | + foreach ($this->children as $n => $direct_child) |
|
| 179 | 179 | { |
| 180 | - foreach(array_merge(array($direct_child), $n ? array() : $direct_child->children) as $child) |
|
| 180 | + foreach (array_merge(array($direct_child), $n ? array() : $direct_child->children) as $child) |
|
| 181 | 181 | { |
| 182 | 182 | $pat = $child->id; |
| 183 | - while(($patstr = strstr($pat, '$'))) |
|
| 183 | + while (($patstr = strstr($pat, '$'))) |
|
| 184 | 184 | { |
| 185 | - $pat = substr($patstr,$patstr[1] == '{' ? 2 : 1); |
|
| 185 | + $pat = substr($patstr, $patstr[1] == '{' ? 2 : 1); |
|
| 186 | 186 | |
| 187 | 187 | switch ($this->type) |
| 188 | 188 | { |
| 189 | 189 | case 'column': |
| 190 | - $Ok = $pat[0] == 'c' && !(substr($pat,0,4) == 'cont' || substr($pat,0,2) == 'c_' || |
|
| 191 | - substr($pat,0,4) == 'col_'); |
|
| 190 | + $Ok = $pat[0] == 'c' && !(substr($pat, 0, 4) == 'cont' || substr($pat, 0, 2) == 'c_' || |
|
| 191 | + substr($pat, 0, 4) == 'col_'); |
|
| 192 | 192 | break; |
| 193 | 193 | case 'row': |
| 194 | - $Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' || |
|
| 195 | - substr($pat,0,4) == 'row_' && substr($pat,0,8) != 'row_cont'); |
|
| 194 | + $Ok = $pat[0] == 'r' && !(substr($pat, 0, 2) == 'r_' || |
|
| 195 | + substr($pat, 0, 4) == 'row_' && substr($pat, 0, 8) != 'row_cont'); |
|
| 196 | 196 | //error_log(__METHOD__."() pat='$pat' --> Ok=".array2string($Ok)); |
| 197 | 197 | break; |
| 198 | 198 | default: |
| 199 | 199 | return false; |
| 200 | 200 | } |
| 201 | - if ($Ok && ($fname=self::form_name($cname, $child->id, $expand)) && |
|
| 201 | + if ($Ok && ($fname = self::form_name($cname, $child->id, $expand)) && |
|
| 202 | 202 | // need to break if fname ends in [] as get_array() will ignore it and returns whole array |
| 203 | 203 | // for an id like "run[$row_cont[appname]]" |
| 204 | 204 | substr($fname, -2) != '[]' && |
| 205 | - ($value = self::get_array(self::$request->content,$fname)) !== null) // null = not found (can be false!) |
|
| 205 | + ($value = self::get_array(self::$request->content, $fname)) !== null) // null = not found (can be false!) |
|
| 206 | 206 | { |
| 207 | 207 | //error_log(__METHOD__."('$cname', ) $this autorepeating row $expand[row] because of $child->id = '$fname' is ".array2string($value)); |
| 208 | 208 | unset($value); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function __construct($xml = '') |
| 33 | 33 | { |
| 34 | - if($xml) { |
|
| 34 | + if ($xml) { |
|
| 35 | 35 | parent::__construct($xml); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * Find items that match the given parameters |
| 41 | 41 | * using the egw_link class |
| 42 | 42 | */ |
| 43 | - public static function ajax_item_search($app, $type, $pattern, $options=array()) |
|
| 43 | + public static function ajax_item_search($app, $type, $pattern, $options = array()) |
|
| 44 | 44 | { |
| 45 | 45 | $options['type'] = $type ? $type : $options['type']; |
| 46 | 46 | $items = Api\Link::query($app, $pattern, $options); |
@@ -38,19 +38,19 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $form_name = self::form_name($cname, $this->id); |
| 40 | 40 | |
| 41 | - if(is_array(self::$request->content[$form_name]['status-widgets'])) |
|
| 41 | + if (is_array(self::$request->content[$form_name]['status-widgets'])) |
|
| 42 | 42 | { |
| 43 | - foreach(self::$request->content[$form_name]['status-widgets'] as $key => $type) |
|
| 43 | + foreach (self::$request->content[$form_name]['status-widgets'] as $key => $type) |
|
| 44 | 44 | { |
| 45 | - if(!is_array($type)) |
|
| 45 | + if (!is_array($type)) |
|
| 46 | 46 | { |
| 47 | - list($basetype) = explode('-',$type); |
|
| 47 | + list($basetype) = explode('-', $type); |
|
| 48 | 48 | $widget = @self::factory($basetype, '<?xml version="1.0"?><'.$type.' type="'.$type.'"/>', $key); |
| 49 | 49 | $widget->id = $key; |
| 50 | 50 | $widget->attrs['type'] = $type; |
| 51 | 51 | $widget->type = $type; |
| 52 | 52 | |
| 53 | - if(method_exists($widget, 'beforeSendToClient')) |
|
| 53 | + if (method_exists($widget, 'beforeSendToClient')) |
|
| 54 | 54 | { |
| 55 | 55 | // need to use $form_name as $cname see comment in header |
| 56 | 56 | $widget->beforeSendToClient($form_name, array()); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | else |
| 60 | 60 | { |
| 61 | 61 | // need to use self::form_name($form_name, $key) as index into sel_options see comment in header |
| 62 | - $options =& self::get_array(self::$request->sel_options, self::form_name($form_name, $key), true); |
|
| 62 | + $options = & self::get_array(self::$request->sel_options, self::form_name($form_name, $key), true); |
|
| 63 | 63 | if (!is_array($options)) $options = array(); |
| 64 | 64 | $options += $type; |
| 65 | 65 | } |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | * @param array &$validated=array() validated content |
| 83 | 83 | * @return boolean true if no validation error, false otherwise |
| 84 | 84 | */ |
| 85 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 85 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 86 | 86 | { |
| 87 | 87 | $form_name = self::form_name($cname, $this->id, $expand); |
| 88 | 88 | $value = self::get_array($content, $form_name); |
| 89 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 89 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 90 | 90 | if (true) $valid = $value; |
| 91 | 91 | return true; |
| 92 | 92 | } |