@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'script-src' => array("'unsafe-eval'"), |
| 34 | 34 | 'style-src' => array("'unsafe-inline'"), |
| 35 | 35 | 'connect-src' => array(), |
| 36 | - 'frame-src' => null, // NOT array(), to allow setting no default frame-src! |
|
| 36 | + 'frame-src' => null, // NOT array(), to allow setting no default frame-src! |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $attrs = array('www.egroupware.org'); |
| 56 | 56 | if (($app_additional = Api\Hooks::process('csp-frame-src'))) |
| 57 | 57 | { |
| 58 | - foreach($app_additional as $addtional) |
|
| 58 | + foreach ($app_additional as $addtional) |
|
| 59 | 59 | { |
| 60 | 60 | if ($addtional) $attrs = array_unique(array_merge($attrs, $addtional)); |
| 61 | 61 | } |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | self::$sources[$source] = array(); |
| 65 | 65 | } |
| 66 | - foreach((array)$attrs as $attr) |
|
| 66 | + foreach ((array)$attrs as $attr) |
|
| 67 | 67 | { |
| 68 | 68 | if (in_array($attr, array('none', 'self', 'unsafe-eval', 'unsafe-inline'))) |
| 69 | 69 | { |
| 70 | - $attr = "'$attr'"; // automatic add quotes |
|
| 70 | + $attr = "'$attr'"; // automatic add quotes |
|
| 71 | 71 | } |
| 72 | 72 | if (!in_array($attr, self::$sources[$source])) |
| 73 | 73 | { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param string|array $set =array() 'unsafe-eval' and/or 'unsafe-inline' (without quotes!) or URL (incl. protocol!) |
| 90 | 90 | */ |
| 91 | - public static function add_script_src($set=null) |
|
| 91 | + public static function add_script_src($set = null) |
|
| 92 | 92 | { |
| 93 | 93 | self::add('script-src', $set); |
| 94 | 94 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @param string|array $set =array() 'unsafe-inline' (without quotes!) and/or URL (incl. protocol!) |
| 102 | 102 | */ |
| 103 | - public static function add_style_src($set=null) |
|
| 103 | + public static function add_style_src($set = null) |
|
| 104 | 104 | { |
| 105 | 105 | self::add('style-src', $set); |
| 106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @param string|array $set =array() URL (incl. protocol!) |
| 112 | 112 | */ |
| 113 | - public static function add_connect_src($set=null) |
|
| 113 | + public static function add_connect_src($set = null) |
|
| 114 | 114 | { |
| 115 | 115 | self::add('connect-src', $set); |
| 116 | 116 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param string|array $set =array() URL (incl. protocol!) |
| 124 | 124 | * @return string with attributes eg. "'unsafe-inline'" |
| 125 | 125 | */ |
| 126 | - public static function add_frame_src($set=null) |
|
| 126 | + public static function add_frame_src($set = null) |
|
| 127 | 127 | { |
| 128 | 128 | self::add('frame-src', $set); |
| 129 | 129 | } |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public static function send() |
| 137 | 137 | { |
| 138 | - self::add('frame-src', null); // set defaults for frame-src |
|
| 138 | + self::add('frame-src', null); // set defaults for frame-src |
|
| 139 | 139 | |
| 140 | 140 | $policies = array(); |
| 141 | - foreach(self::$sources as $source => $urls) |
|
| 141 | + foreach (self::$sources as $source => $urls) |
|
| 142 | 142 | { |
| 143 | 143 | $policies[] = "$source 'self' ".implode(' ', $urls); |
| 144 | 144 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // recommendaton ist to not send regular AND deprecated headers together, as they can cause unexpected behavior |
| 153 | 153 | if ($user_agent == 'chrome' && $version < 25 || $user_agent == 'safari' && $version < 7) |
| 154 | 154 | { |
| 155 | - header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS |
|
| 155 | + header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS |
|
| 156 | 156 | } |
| 157 | 157 | elseif ($user_agent == 'firefox' && $version < 23 || $user_agent == 'msie') // Edge is reported as 'edge'! |
| 158 | 158 | { |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | // should be Ok for all HTML 4 compatible browsers |
| 78 | 78 | $parts = $all_parts = null; |
| 79 | - if(!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$parts)) |
|
| 79 | + if (!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i', $_SERVER['HTTP_USER_AGENT'], $parts)) |
|
| 80 | 80 | { |
| 81 | - preg_match_all('/([a-z]+)\/([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$all_parts,PREG_SET_ORDER); |
|
| 81 | + preg_match_all('/([a-z]+)\/([0-9.]+)/i', $_SERVER['HTTP_USER_AGENT'], $all_parts, PREG_SET_ORDER); |
|
| 82 | 82 | $parts = array_pop($all_parts); |
| 83 | - foreach($all_parts as $p) |
|
| 83 | + foreach ($all_parts as $p) |
|
| 84 | 84 | { |
| 85 | 85 | if ($p[1] == 'Chrome' && $parts[1] != 'Edge') |
| 86 | 86 | { |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | - list(,self::$user_agent,self::$ua_version) = $parts; |
|
| 92 | + list(,self::$user_agent, self::$ua_version) = $parts; |
|
| 93 | 93 | if ((self::$user_agent = strtolower(self::$user_agent)) == 'version') self::$user_agent = 'opera'; |
| 94 | 94 | // IE no longer reports MSIE, but "Trident/7.0; rv:11.0" |
| 95 | - if (self::$user_agent=='trident') |
|
| 95 | + if (self::$user_agent == 'trident') |
|
| 96 | 96 | { |
| 97 | - self::$user_agent='msie'; |
|
| 97 | + self::$user_agent = 'msie'; |
|
| 98 | 98 | $matches = null; |
| 99 | 99 | self::$ua_version = preg_match('|Trident/[0-9.]+; rv:([0-9.]+)|i', $_SERVER['HTTP_USER_AGENT'], $matches) ? |
| 100 | 100 | $matches[1] : 11.0; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @return string |
| 27 | 27 | * @todo get "real" referer for jDots template |
| 28 | 28 | */ |
| 29 | - static function get($default='',$referer='') |
|
| 29 | + static function get($default = '', $referer = '') |
|
| 30 | 30 | { |
| 31 | 31 | // HTTP_REFERER seems NOT to get urldecoded |
| 32 | 32 | if (!$referer) $referer = urldecode($_SERVER['HTTP_REFERER']); |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | $webserver_url = $GLOBALS['egw_info']['server']['webserver_url']; |
| 35 | 35 | if (empty($webserver_url) || $webserver_url{0} == '/') // url is just a path |
| 36 | 36 | { |
| 37 | - $referer = preg_replace('/^https?:\/\/[^\/]+/','',$referer); // removing the domain part |
|
| 37 | + $referer = preg_replace('/^https?:\/\/[^\/]+/', '', $referer); // removing the domain part |
|
| 38 | 38 | } |
| 39 | 39 | if (strlen($webserver_url) > 1) |
| 40 | 40 | { |
| 41 | - list(,$referer) = explode($webserver_url,$referer,2); |
|
| 41 | + list(,$referer) = explode($webserver_url, $referer, 2); |
|
| 42 | 42 | } |
| 43 | 43 | $ret = str_replace('/etemplate/process_exec.php', '/index.php', $referer); |
| 44 | 44 | |
@@ -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 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $this->contacts->__construct(); |
| 130 | 130 | $options = $this->contacts->contact_fields; |
| 131 | - foreach($this->contacts->customfields as $name => $data) |
|
| 131 | + foreach ($this->contacts->customfields as $name => $data) |
|
| 132 | 132 | { |
| 133 | 133 | $options['#'.$name] = $data['label']; |
| 134 | 134 | } |
@@ -148,28 +148,28 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function get_contact($value, array $attrs) |
| 150 | 150 | { |
| 151 | - if (is_array($value) && !(array_key_exists('app',$value) && array_key_exists('id', $value))) return $value; |
|
| 151 | + if (is_array($value) && !(array_key_exists('app', $value) && array_key_exists('id', $value))) return $value; |
|
| 152 | 152 | |
| 153 | - if(is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) $value = $value['id']; |
|
| 154 | - switch($attrs['type']) |
|
| 153 | + if (is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) $value = $value['id']; |
|
| 154 | + switch ($attrs['type']) |
|
| 155 | 155 | { |
| 156 | 156 | case 'contact-account': |
| 157 | 157 | case 'contact-template': |
| 158 | - if (substr($value,0,8) != 'account:') |
|
| 158 | + if (substr($value, 0, 8) != 'account:') |
|
| 159 | 159 | { |
| 160 | 160 | $value = 'account:'.($attrs['name'] != 'account:' ? $value : $GLOBALS['egw_info']['user']['account_id']); |
| 161 | 161 | } |
| 162 | 162 | // fall-through |
| 163 | 163 | case 'contact-value': |
| 164 | 164 | default: |
| 165 | - if (substr($value,0,12) == 'addressbook:') $value = substr($value,12); // link-entry syntax |
|
| 165 | + if (substr($value, 0, 12) == 'addressbook:') $value = substr($value, 12); // link-entry syntax |
|
| 166 | 166 | if (!($contact = $this->contacts->read($value))) |
| 167 | 167 | { |
| 168 | 168 | $contact = array(); |
| 169 | 169 | } |
| 170 | 170 | break; |
| 171 | 171 | } |
| 172 | - unset($contact['jpegphoto']); // makes no sense to return binary image |
|
| 172 | + unset($contact['jpegphoto']); // makes no sense to return binary image |
|
| 173 | 173 | |
| 174 | 174 | //error_log(__METHOD__."('$value') returning ".array2string($contact)); |
| 175 | 175 | return $contact; |
@@ -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; |