@@ -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); |
@@ -38,16 +38,16 @@ discard block |
||
| 38 | 38 | $form_name = self::form_name($cname, $this->id); |
| 39 | 39 | |
| 40 | 40 | $config = Api\Html\CkEditorConfig::get_ckeditor_config_array($this->attrs['mode'], $this->attrs['height'], |
| 41 | - $this->attrs['expand_toolbar'],$this->attrs['base_href'] |
|
| 41 | + $this->attrs['expand_toolbar'], $this->attrs['base_href'] |
|
| 42 | 42 | ); |
| 43 | 43 | // User preferences |
| 44 | 44 | $font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font']; |
| 45 | 45 | $font_size = Api\Html\CkEditorConfig::font_size_from_prefs(); |
| 46 | 46 | $font_span = '<span style="width: 100%; display: inline; '. |
| 47 | - ($font?'font-family:'.$font.'; ':'').($font_size?'font-size:'.$font_size.'; ':''). |
|
| 47 | + ($font ? 'font-family:'.$font.'; ' : '').($font_size ? 'font-size:'.$font_size.'; ' : ''). |
|
| 48 | 48 | '">​</span>'; |
| 49 | 49 | if (empty($font) && empty($font_size)) $font_span = ''; |
| 50 | - if($font_span) |
|
| 50 | + if ($font_span) |
|
| 51 | 51 | { |
| 52 | 52 | $config['preference_style'] = $font_span; |
| 53 | 53 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param array &$validated=array() validated content |
| 66 | 66 | * @return boolean true if no validation error, false otherwise |
| 67 | 67 | */ |
| 68 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 68 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 69 | 69 | { |
| 70 | 70 | $form_name = self::form_name($cname, $this->id, $expand); |
| 71 | 71 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | $value = Api\Html\HtmLawed::purify($value, $this->attrs['validation_rules']); |
| 79 | 79 | } |
| 80 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 80 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 81 | 81 | if (true) $valid = $value; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -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 | } |
@@ -29,14 +29,14 @@ |
||
| 29 | 29 | * @param array &$validated=array() validated content |
| 30 | 30 | * @return boolean true if no validation error, false otherwise |
| 31 | 31 | */ |
| 32 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 32 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 33 | 33 | { |
| 34 | 34 | $form_name = self::form_name($cname, $this->id, $expand); |
| 35 | 35 | |
| 36 | 36 | if (!$this->is_readonly($cname, $form_name)) |
| 37 | 37 | { |
| 38 | 38 | $value = self::get_array($content, $form_name); |
| 39 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 39 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 40 | 40 | if (true) $valid = $value; |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -29,21 +29,21 @@ |
||
| 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 | 34 | $form_name = self::form_name($cname, $this->id, $expand); |
| 35 | - $value =& self::get_array(self::$request->content, $form_name); |
|
| 35 | + $value = & self::get_array(self::$request->content, $form_name); |
|
| 36 | 36 | |
| 37 | 37 | $image = $value != '' ? $value : $this->attrs['src']; |
| 38 | 38 | |
| 39 | - if (is_string($image)) list($app,$img) = explode('/',$image,2); |
|
| 40 | - if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img,'/')!==false) |
|
| 39 | + if (is_string($image)) list($app, $img) = explode('/', $image, 2); |
|
| 40 | + if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img, '/') !== false) |
|
| 41 | 41 | { |
| 42 | 42 | $img = $image; |
| 43 | - list($app) = explode('.',$form_name); |
|
| 43 | + list($app) = explode('.', $form_name); |
|
| 44 | 44 | } |
| 45 | 45 | $src = Api\Image::find($app, $img); |
| 46 | - if(!$this->id) |
|
| 46 | + if (!$this->id) |
|
| 47 | 47 | { |
| 48 | 48 | // self::setElementAttribute($this->attrs['src'], 'id', $this->attrs['src']); |
| 49 | 49 | } |
@@ -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 | |
@@ -56,28 +56,28 @@ discard block |
||
| 56 | 56 | if (!$this->is_readonly($cname, $form_name)) |
| 57 | 57 | { |
| 58 | 58 | $value = self::get_array($content, $form_name); |
| 59 | - if (!isset($value)) return; // value not transmitted --> nothing to validate |
|
| 60 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 59 | + if (!isset($value)) return; // value not transmitted --> nothing to validate |
|
| 60 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 61 | 61 | |
| 62 | 62 | if (!$value && $this->attrs['needed']) |
| 63 | 63 | { |
| 64 | - self::set_validation_error($form_name,lang('Field must not be empty !!!'),''); |
|
| 64 | + self::set_validation_error($form_name, lang('Field must not be empty !!!'), ''); |
|
| 65 | 65 | } |
| 66 | 66 | $type = $this->type ? $this->type : $this->attrs['type']; |
| 67 | 67 | $value_attr = $type == 'radio' ? 'set_value' : 'selected_value'; |
| 68 | 68 | // defaults for set and unset values |
| 69 | 69 | $selected_value = true; |
| 70 | 70 | $unselected_value = false; |
| 71 | - if (array_key_exists($value_attr, $this->attrs) || array_key_exists('unselected_value',$this->attrs)) |
|
| 71 | + if (array_key_exists($value_attr, $this->attrs) || array_key_exists('unselected_value', $this->attrs)) |
|
| 72 | 72 | { |
| 73 | - if(array_key_exists($value_attr, $this->attrs)) |
|
| 73 | + if (array_key_exists($value_attr, $this->attrs)) |
|
| 74 | 74 | { |
| 75 | 75 | // Expand any content stuff |
| 76 | - $selected_value = self::expand_name($this->attrs[$value_attr], $expand['c'], $expand['row'], $expand['c_'], $expand['row_'],$expand['cont']); |
|
| 76 | + $selected_value = self::expand_name($this->attrs[$value_attr], $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']); |
|
| 77 | 77 | } |
| 78 | - if(array_key_exists('unselected_value',$this->attrs)) |
|
| 78 | + if (array_key_exists('unselected_value', $this->attrs)) |
|
| 79 | 79 | { |
| 80 | - $unselected_value = self::expand_name($this->attrs['unselected_value'], $expand['c'], $expand['row'], $expand['c_'], $expand['row_'],$expand['cont']); |
|
| 80 | + $unselected_value = self::expand_name($this->attrs['unselected_value'], $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | if ($type == 'radio') |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | $valid = $value; |
| 89 | 89 | } |
| 90 | - elseif ( !$options && $selected_value && $value == $selected_value) |
|
| 90 | + elseif (!$options && $selected_value && $value == $selected_value) |
|
| 91 | 91 | { |
| 92 | 92 | // Options set in template, not in sel_options |
| 93 | 93 | $valid = $selected_value; |
| 94 | 94 | } |
| 95 | 95 | elseif (!isset($valid)) |
| 96 | 96 | { |
| 97 | - $valid = ''; // do not overwrite value of an other radio-button of the same group (identical name)! |
|
| 97 | + $valid = ''; // do not overwrite value of an other radio-button of the same group (identical name)! |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | elseif (in_array((string)$selected_value, (array)$value)) |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | Api\Framework::includeCSS('/api/templates/default/etemplate2.css'); |
| 48 | 48 | |
| 49 | - Api\Framework::includeCSS('api','widget_browser',false); |
|
| 49 | + Api\Framework::includeCSS('api', 'widget_browser', false); |
|
| 50 | 50 | |
| 51 | 51 | // load translations |
| 52 | 52 | Api\Translation::add_app('etemplate'); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | return $mime; |
| 48 | 48 | } |
| 49 | - return lang('%1 file',strtoupper($ext)).' ('.$mime.')'; |
|
| 49 | + return lang('%1 file', strtoupper($ext)).' ('.$mime.')'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | if (empty($_ext)) |
| 65 | 65 | { |
| 66 | - return 'text/plain';//assume no extension is a text file |
|
| 66 | + return 'text/plain'; //assume no extension is a text file |
|
| 67 | 67 | } |
| 68 | 68 | $ext = strtolower($_ext); |
| 69 | 69 | if (!array_key_exists($ext, self::$mime_extension_map)) |
@@ -188,24 +188,24 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public static function analyze_data($data) |
| 190 | 190 | { |
| 191 | - if(!is_writeable(@$GLOBALS['egw_info']['server']['temp_dir'])) |
|
| 191 | + if (!is_writeable(@$GLOBALS['egw_info']['server']['temp_dir'])) |
|
| 192 | 192 | { |
| 193 | 193 | //nothing we can do but bail out |
| 194 | 194 | return false; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | mt_srand(time()); |
| 198 | - $filename = $GLOBALS['egw_info']['server']['temp_dir'] . '/' |
|
| 199 | - . md5( time() + mt_rand() ) . '.tmp'; |
|
| 198 | + $filename = $GLOBALS['egw_info']['server']['temp_dir'].'/' |
|
| 199 | + . md5(time() + mt_rand()).'.tmp'; |
|
| 200 | 200 | |
| 201 | 201 | $fp = @fopen($filename, 'ab'); |
| 202 | - if(!$fp || !$data) |
|
| 202 | + if (!$fp || !$data) |
|
| 203 | 203 | { |
| 204 | 204 | //houston we have a problem - bail out |
| 205 | 205 | return false; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if(!fwrite($fp, $data)) |
|
| 208 | + if (!fwrite($fp, $data)) |
|
| 209 | 209 | { |
| 210 | 210 | //bail out again |
| 211 | 211 | return false; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $mime = self::analyze_file($filename); |
| 217 | 217 | |
| 218 | - unlink($filename);//remove the temp file |
|
| 218 | + unlink($filename); //remove the temp file |
|
| 219 | 219 | |
| 220 | 220 | return $mime; |
| 221 | 221 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @var array of extenstion to mime mappings |
| 234 | 234 | */ |
| 235 | 235 | static $mime_extension_map = array( |
| 236 | - 'txt' => 'text/plain', // should be first, so text/plain maps back to .txt |
|
| 236 | + 'txt' => 'text/plain', // should be first, so text/plain maps back to .txt |
|
| 237 | 237 | '3dml' => 'text/vnd.in3d.3dml', |
| 238 | 238 | '3ds' => 'image/x-3ds', |
| 239 | 239 | '3g2' => 'video/3gpp2', |