@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | public function add($name, $value) |
| 51 | 51 | { |
| 52 | 52 | if (is_scalar($value)) { |
| 53 | - $value = explode(' ', (string) $value); |
|
| 53 | + $value = explode(' ', (string)$value); |
|
| 54 | 54 | } |
| 55 | 55 | $values = $this->get($name, []); |
| 56 | 56 | if (is_scalar($values)) { |
| 57 | - $values = (array) $values; |
|
| 57 | + $values = (array)$values; |
|
| 58 | 58 | } |
| 59 | 59 | foreach ($value as $v) { |
| 60 | 60 | if (!in_array($v, $values)) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function suppressRender($names) |
| 80 | 80 | { |
| 81 | - $names = (array) $names; |
|
| 81 | + $names = (array)$names; |
|
| 82 | 82 | $this->suppressRenderAttributes = array_unique( |
| 83 | 83 | array_merge($this->suppressRenderAttributes, $names) |
| 84 | 84 | ); |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | if (is_array($value)) { |
| 128 | 128 | // arrays can be used for class attributes, space separated |
| 129 | - $set = '="' . htmlspecialchars(implode(' ', $value), ENT_QUOTES) .'"'; |
|
| 130 | - } elseif ($value===null) { |
|
| 129 | + $set = '="'.htmlspecialchars(implode(' ', $value), ENT_QUOTES).'"'; |
|
| 130 | + } elseif ($value === null) { |
|
| 131 | 131 | // null indicates attribute minimization (name only,) like autofocus or readonly |
| 132 | 132 | $set = ''; |
| 133 | 133 | } else { |
| 134 | - $set = '="' . htmlspecialchars($value, ENT_QUOTES) .'"'; |
|
| 134 | + $set = '="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
|
| 135 | 135 | } |
| 136 | - $rendered .= htmlspecialchars($name, ENT_QUOTES) . $set . ' '; |
|
| 136 | + $rendered .= htmlspecialchars($name, ENT_QUOTES).$set.' '; |
|
| 137 | 137 | } |
| 138 | 138 | return $rendered; |
| 139 | 139 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function getNames() |
| 235 | 235 | { |
| 236 | - return array_keys((array) $this); |
|
| 236 | + return array_keys((array)$this); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $likeSet = array(); |
| 311 | 311 | foreach ($this as $k => $v) { |
| 312 | - if (substr($k, 0, strlen($nameLike))==$nameLike) { |
|
| 313 | - $likeSet[$k]=$v; |
|
| 312 | + if (substr($k, 0, strlen($nameLike)) == $nameLike) { |
|
| 313 | + $likeSet[$k] = $v; |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | return $likeSet; |
@@ -174,12 +174,12 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public $headersCacheEngine = 'default'; |
| 176 | 176 | |
| 177 | - /** |
|
| 177 | + /** |
|
| 178 | 178 | * |
| 179 | 179 | *$renderer instance of renderer |
| 180 | 180 | * |
| 181 | 181 | */ |
| 182 | - protected $renderer; |
|
| 182 | + protected $renderer; |
|
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | 185 | * *#@- |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | public function setRenderer($renderer) |
| 323 | 323 | { |
| 324 | - $this->renderer = $renderer; |
|
| 324 | + $this->renderer = $renderer; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - /** |
|
| 327 | + /** |
|
| 328 | 328 | * get the renderer |
| 329 | 329 | * |
| 330 | 330 | * @return Renderer |
@@ -333,10 +333,10 @@ discard block |
||
| 333 | 333 | { |
| 334 | 334 | // return a default if not set |
| 335 | 335 | if (null === $this->renderer) { |
| 336 | - return $element->defaultRender(); |
|
| 337 | - } else { |
|
| 338 | - return $this->renderer->render($element); |
|
| 339 | - } |
|
| 336 | + return $element->defaultRender(); |
|
| 337 | + } else { |
|
| 338 | + return $this->renderer->render($element); |
|
| 339 | + } |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function getSize() |
| 59 | 59 | { |
| 60 | - return (int) $this->get('size'); |
|
| 60 | + return (int)$this->get('size'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getMaxlength() |
| 69 | 69 | { |
| 70 | - return (int) $this->get('maxlength'); |
|
| 70 | + return (int)$this->get('maxlength'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function getPlaceholder() |
| 79 | 79 | { |
| 80 | - return (string) $this->get('placeholder'); |
|
| 80 | + return (string)$this->get('placeholder'); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $dataList = $this->isDatalist(); |
| 91 | 91 | if (!empty($dataList)) { |
| 92 | - $this->add('list', 'list_' . $this->getName()); |
|
| 92 | + $this->add('list', 'list_'.$this->getName()); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $attributes = $this->renderAttributeString(); |
| 96 | - return '<input ' . $attributes . ' ' . $this->getExtra() .' >'; |
|
| 96 | + return '<input '.$attributes.' '.$this->getExtra().' >'; |
|
| 97 | 97 | } |
| 98 | 98 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function getSize() |
| 75 | 75 | { |
| 76 | - return (int) $this->get('size'); |
|
| 76 | + return (int)$this->get('size'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function renderOption($optionValue, $optionDisplay, $selected) |
| 102 | 102 | { |
| 103 | - $rendered = '<option value="' . htmlspecialchars($optionValue, ENT_QUOTES) . '"'; |
|
| 103 | + $rendered = '<option value="'.htmlspecialchars($optionValue, ENT_QUOTES).'"'; |
|
| 104 | 104 | if (in_array($optionValue, $selected)) { |
| 105 | 105 | $rendered .= ' selected="selected"'; |
| 106 | 106 | } |
| 107 | - $rendered .= '>' . $optionDisplay . '</option>' . "\n"; |
|
| 107 | + $rendered .= '>'.$optionDisplay.'</option>'."\n"; |
|
| 108 | 108 | |
| 109 | 109 | return $rendered; |
| 110 | 110 | } |
@@ -116,18 +116,18 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function defaultRender() |
| 118 | 118 | { |
| 119 | - $selected = (array) $this->getValue(); |
|
| 119 | + $selected = (array)$this->getValue(); |
|
| 120 | 120 | |
| 121 | 121 | $ele_options = $this->getOptions(); |
| 122 | 122 | |
| 123 | - $extra = ($this->getExtra() != '' ? " " . $this->getExtra() : ''); |
|
| 123 | + $extra = ($this->getExtra() != '' ? " ".$this->getExtra() : ''); |
|
| 124 | 124 | $attributes = $this->renderAttributeString(); |
| 125 | - $rendered = '<select ' . $attributes . $extra .' >' . "\n"; |
|
| 125 | + $rendered = '<select '.$attributes.$extra.' >'."\n"; |
|
| 126 | 126 | |
| 127 | 127 | if (empty($ele_optgroup)) { |
| 128 | 128 | foreach ($ele_options as $value => $display) { |
| 129 | 129 | if (is_array($display)) { |
| 130 | - $rendered .= '<optgroup label="' . $value . '">' . "\n"; |
|
| 130 | + $rendered .= '<optgroup label="'.$value.'">'."\n"; |
|
| 131 | 131 | foreach ($display as $optvalue => $optdisplay) { |
| 132 | 132 | $rendered .= $this->renderOption($optvalue, $optdisplay, $selected); |
| 133 | 133 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | - $rendered .= '</select>' . "\n"; |
|
| 139 | + $rendered .= '</select>'."\n"; |
|
| 140 | 140 | |
| 141 | 141 | return $rendered; |
| 142 | 142 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | return "\nvar hasSelected = false; var selectBox = myform.{$eltname};" |
| 163 | 163 | . "for (i = 0; i < selectBox.options.length; i++ ) { " |
| 164 | 164 | . "if (selectBox.options[i].selected == true && selectBox.options[i].value != '') " |
| 165 | - . "{ hasSelected = true; break; } }" . "if (!hasSelected) " |
|
| 165 | + . "{ hasSelected = true; break; } }"."if (!hasSelected) " |
|
| 166 | 166 | . "{ window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }"; |
| 167 | 167 | } |
| 168 | 168 | return ''; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | if (is_array($caption)) { |
| 38 | 38 | parent::__construct($caption); |
| 39 | - $value = $this->get('value',''); |
|
| 39 | + $value = $this->get('value', ''); |
|
| 40 | 40 | if (empty($value)) { |
| 41 | 41 | $this->set('value', '#FFFFFF'); |
| 42 | 42 | } |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | if ($xoops->theme()) { |
| 65 | 65 | $xoops->theme()->addScript('include/color-picker.js'); |
| 66 | 66 | } else { |
| 67 | - echo '<script type="text/javascript" src="' . $xoops->url('/include/color-picker.js') . '"></script>'; |
|
| 67 | + echo '<script type="text/javascript" src="'.$xoops->url('/include/color-picker.js').'"></script>'; |
|
| 68 | 68 | } |
| 69 | 69 | $temp = $this->get('value', ''); |
| 70 | 70 | if (!empty($temp)) { |
| 71 | - $this->set('style', 'background-color:' . $temp . ';'); |
|
| 71 | + $this->set('style', 'background-color:'.$temp.';'); |
|
| 72 | 72 | } |
| 73 | 73 | $ret = '<div>'; |
| 74 | 74 | $attributes = $this->renderAttributeString(); |
| 75 | - $ret .= '<input ' . $attributes . ' ' . $this->getExtra() .' >'; |
|
| 75 | + $ret .= '<input '.$attributes.' '.$this->getExtra().' >'; |
|
| 76 | 76 | $ret .= '<span>'; |
| 77 | 77 | $ret .= '<button type="button" '; |
| 78 | - $ret .= 'data-toggle="tooltip" data-placement="left" title="' . \XoopsLocale::A_SELECT . '" '; |
|
| 78 | + $ret .= 'data-toggle="tooltip" data-placement="left" title="'.\XoopsLocale::A_SELECT.'" '; |
|
| 79 | 79 | $ret .= 'onclick="return TCP.popup(\''; |
| 80 | - $ret .= $xoops->url('/include/') . '\',document.getElementById(\'' . $this->getName() . '\'));">'; |
|
| 80 | + $ret .= $xoops->url('/include/').'\',document.getElementById(\''.$this->getName().'\'));">'; |
|
| 81 | 81 | $ret .= '<span>...</span></button>'; |
| 82 | 82 | $ret .= '</span></div>'; |
| 83 | 83 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function getType() |
| 60 | 60 | { |
| 61 | - return (string) $this->get('type', ''); |
|
| 61 | + return (string)$this->get('type', ''); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -69,18 +69,18 @@ discard block |
||
| 69 | 69 | public function defaultRender() |
| 70 | 70 | { |
| 71 | 71 | $ret = ''; |
| 72 | - $class = 'class="' . $this->getClass() . '"'; |
|
| 72 | + $class = 'class="'.$this->getClass().'"'; |
|
| 73 | 73 | |
| 74 | 74 | $attributes = $this->renderAttributeString(); |
| 75 | 75 | |
| 76 | - if ((bool) $this->get(':showdelete', false)) { |
|
| 77 | - $ret .= '<input type="submit"' . $class . ' name="delete" id="delete" value="' |
|
| 78 | - . \XoopsLocale::A_DELETE . '" onclick="this.form.elements.op.value=\'delete\'">'; |
|
| 76 | + if ((bool)$this->get(':showdelete', false)) { |
|
| 77 | + $ret .= '<input type="submit"'.$class.' name="delete" id="delete" value="' |
|
| 78 | + . \XoopsLocale::A_DELETE.'" onclick="this.form.elements.op.value=\'delete\'">'; |
|
| 79 | 79 | } |
| 80 | - $ret .= ' <input type="button" ' . $class . ' value="' . \XoopsLocale::A_CANCEL |
|
| 80 | + $ret .= ' <input type="button" '.$class.' value="'.\XoopsLocale::A_CANCEL |
|
| 81 | 81 | . '" onclick="history.go(-1);return true;" />' |
| 82 | - . ' <input type="reset"' . $class . ' name="reset" id="reset" value="' . \XoopsLocale::A_RESET . '" />' |
|
| 83 | - . ' <input ' . $attributes . $this->getExtra() . ' />'; |
|
| 82 | + . ' <input type="reset"'.$class.' name="reset" id="reset" value="'.\XoopsLocale::A_RESET.'" />' |
|
| 83 | + . ' <input '.$attributes.$this->getExtra().' />'; |
|
| 84 | 84 | return $ret; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | parent::__construct([]); |
| 54 | 54 | $this->setCaption($caption); |
| 55 | 55 | $this->setWithDefaults('name', $name, 'name_error'); |
| 56 | - $this->set('size', empty($size) ? 32 : (int) $size); |
|
| 57 | - $this->set('maxlength', empty($maxlength) ? 64 : (int) $maxlength); |
|
| 56 | + $this->set('size', empty($size) ? 32 : (int)$size); |
|
| 57 | + $this->set('maxlength', empty($maxlength) ? 64 : (int)$maxlength); |
|
| 58 | 58 | $this->setValue($value); |
| 59 | 59 | $this->setWithDefaults('autocomplete', $autoComplete, 'off', ['on', 'off']); |
| 60 | 60 | if (!empty($placeholder)) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function getSize() |
| 73 | 73 | { |
| 74 | - return (int) $this->get('size', 32); |
|
| 74 | + return (int)$this->get('size', 32); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function getMaxlength() |
| 83 | 83 | { |
| 84 | - return (int) $this->get('maxlength', 64); |
|
| 84 | + return (int)$this->get('maxlength', 64); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -92,6 +92,6 @@ discard block |
||
| 92 | 92 | public function defaultRender() |
| 93 | 93 | { |
| 94 | 94 | $attributes = $this->renderAttributeString(); |
| 95 | - return '<input ' . $attributes . $this->getExtra() .' >'; |
|
| 95 | + return '<input '.$attributes.$this->getExtra().' >'; |
|
| 96 | 96 | } |
| 97 | 97 | } |
@@ -53,6 +53,6 @@ |
||
| 53 | 53 | public function defaultRender() |
| 54 | 54 | { |
| 55 | 55 | $attributes = $this->renderAttributeString(); |
| 56 | - return '<input ' . $attributes . $this->getExtra() .' >'; |
|
| 56 | + return '<input '.$attributes.$this->getExtra().' >'; |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $dataList = $this->isDatalist(); |
| 61 | 61 | if (!empty($dataList)) { |
| 62 | - $this->add('list', 'list_' . $this->getName()); |
|
| 62 | + $this->add('list', 'list_'.$this->getName()); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $this->suppressRender(['value']); |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | $xoops->theme()->addScript( |
| 73 | 73 | '', |
| 74 | 74 | '', |
| 75 | - ' $(function() { $( "#' . $this->get('id') . '" ).datepicker({' . |
|
| 76 | - 'showOn: "focus", changeYear: true, constrainInput: false ' . |
|
| 75 | + ' $(function() { $( "#'.$this->get('id').'" ).datepicker({'. |
|
| 76 | + 'showOn: "focus", changeYear: true, constrainInput: false '. |
|
| 77 | 77 | ' }); }); ' |
| 78 | 78 | ); |
| 79 | 79 | $ret = '<div>'; |
| 80 | - $ret .= '<input ' . $attributes . ' value="' . $display_value . '" ' . $this->getExtra() .' >'; |
|
| 80 | + $ret .= '<input '.$attributes.' value="'.$display_value.'" '.$this->getExtra().' >'; |
|
| 81 | 81 | $ret .= '<span>'; |
| 82 | 82 | $ret .= '<button type="button" '; |
| 83 | - $ret .= 'data-toggle="tooltip" data-placement="left" title="' . \XoopsLocale::A_SELECT . '" '; |
|
| 84 | - $ret .= 'onclick="$( \'#' . $this->get('id') . '\' ).datepicker( \'show\' );"> '; |
|
| 83 | + $ret .= 'data-toggle="tooltip" data-placement="left" title="'.\XoopsLocale::A_SELECT.'" '; |
|
| 84 | + $ret .= 'onclick="$( \'#'.$this->get('id').'\' ).datepicker( \'show\' );"> '; |
|
| 85 | 85 | $ret .= '<span>...</span></button>'; |
| 86 | 86 | $ret .= '</span></div>'; |
| 87 | 87 | |