@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param boolean $overwrite (optional) - whether to overwrite an existing field of the same name defaults to false |
| 85 | 85 | * @return fields\Field|Form|FormRepeater |
| 86 | 86 | */ |
| 87 | - abstract public function add($field, $defaults=[], $overwrite=false); |
|
| 87 | + abstract public function add($field, $defaults = [], $overwrite = false); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Adds a sub form box to the form |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param array $options |
| 94 | 94 | * @return IField|Form |
| 95 | 95 | */ |
| 96 | - public function addSubForm($name, $options=[]) |
|
| 96 | + public function addSubForm($name, $options = []) |
|
| 97 | 97 | { |
| 98 | 98 | if (is_object($name)) { |
| 99 | 99 | return $this->add($name); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param array $options |
| 110 | 110 | * @return IField|fields\Text |
| 111 | 111 | */ |
| 112 | - public function addFieldText($name, $options=[]) |
|
| 112 | + public function addFieldText($name, $options = []) |
|
| 113 | 113 | { |
| 114 | 114 | return $this->add($options, ['name' => $name, 'class' => 'text']); |
| 115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param array $options |
| 122 | 122 | * @return IField|fields\Password |
| 123 | 123 | */ |
| 124 | - public function addFieldPassword($name, $options=[]) |
|
| 124 | + public function addFieldPassword($name, $options = []) |
|
| 125 | 125 | { |
| 126 | 126 | return $this->add($options, ['name' => $name, 'class' => 'password']); |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param string $name |
| 133 | 133 | * @return IField|fields\Text |
| 134 | 134 | */ |
| 135 | - public function addFieldFile($name, $options=[]) |
|
| 135 | + public function addFieldFile($name, $options = []) |
|
| 136 | 136 | { |
| 137 | 137 | return $this->add($options, ['class' => 'file', 'name' => $name]); |
| 138 | 138 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @param string $name |
| 146 | 146 | * @return IField|fields\Text |
| 147 | 147 | */ |
| 148 | - public function addFieldImage($name, $options=[]) |
|
| 148 | + public function addFieldImage($name, $options = []) |
|
| 149 | 149 | { |
| 150 | 150 | return $this->add($options, ['class' => 'image', 'name' => $name]); |
| 151 | 151 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param string $name |
| 157 | 157 | * @return IField|fields\Email |
| 158 | 158 | */ |
| 159 | - public function addFieldEmail($name, $options=[]) |
|
| 159 | + public function addFieldEmail($name, $options = []) |
|
| 160 | 160 | { |
| 161 | 161 | return $this->add($options, ['class' => 'email', 'name' => $name]); |
| 162 | 162 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @param array $options |
| 169 | 169 | * @return IField|fields\Submit |
| 170 | 170 | */ |
| 171 | - public function addFieldSubmit($name, $options=[]) |
|
| 171 | + public function addFieldSubmit($name, $options = []) |
|
| 172 | 172 | { |
| 173 | 173 | return $this->add($options, ['class' => 'submit', 'name' => $name]); |
| 174 | 174 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param array $options |
| 181 | 181 | * @return IField|fields\Text |
| 182 | 182 | */ |
| 183 | - public function addFieldHidden($name, $options=[]) |
|
| 183 | + public function addFieldHidden($name, $options = []) |
|
| 184 | 184 | { |
| 185 | 185 | return $this->add($options, ['class' => 'hidden', 'name' => $name]); |
| 186 | 186 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param array $options |
| 193 | 193 | * @return IField|fields\Checkbox |
| 194 | 194 | */ |
| 195 | - public function addFieldCheckbox($name, $options=[]) |
|
| 195 | + public function addFieldCheckbox($name, $options = []) |
|
| 196 | 196 | { |
| 197 | 197 | return $this->add($options, ['class' => 'checkbox', 'name' => $name]); |
| 198 | 198 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param array $options |
| 205 | 205 | * @return IField|fields\Checkbox |
| 206 | 206 | */ |
| 207 | - public function addFieldCheckList($name, $options=[]) |
|
| 207 | + public function addFieldCheckList($name, $options = []) |
|
| 208 | 208 | { |
| 209 | 209 | return $this->add($options, ['class' => 'checklist', 'name' => $name]); |
| 210 | 210 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @param array $options |
| 217 | 217 | * @return IField|fields\Date |
| 218 | 218 | */ |
| 219 | - public function addFieldDate($name, $options=[]) |
|
| 219 | + public function addFieldDate($name, $options = []) |
|
| 220 | 220 | { |
| 221 | 221 | return $this->add($options, ['name' => $name, 'class' => 'date']); |
| 222 | 222 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @param array $options |
| 229 | 229 | * @return IField|fields\DateTime |
| 230 | 230 | */ |
| 231 | - public function addFieldDateTime($name, $options=[]) |
|
| 231 | + public function addFieldDateTime($name, $options = []) |
|
| 232 | 232 | { |
| 233 | 233 | return $this->add($options, ['name' => $name, 'class' => 'datetime']); |
| 234 | 234 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @param array $options |
| 241 | 241 | * @return IField|fields\Integer |
| 242 | 242 | */ |
| 243 | - public function addFieldInteger($name, $options=[]) |
|
| 243 | + public function addFieldInteger($name, $options = []) |
|
| 244 | 244 | { |
| 245 | 245 | return $this->add($options, ['name' => $name, 'class' => 'integer']); |
| 246 | 246 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @param array $options |
| 253 | 253 | * @return IField|fields\Select |
| 254 | 254 | */ |
| 255 | - public function addFieldSelect($name, $options=[]) |
|
| 255 | + public function addFieldSelect($name, $options = []) |
|
| 256 | 256 | { |
| 257 | 257 | return $this->add($options, ['class' => 'select', 'name' => $name]); |
| 258 | 258 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param array $options |
| 265 | 265 | * @return IField|fields\Section |
| 266 | 266 | */ |
| 267 | - public function addFieldSection($name, $options=[]) |
|
| 267 | + public function addFieldSection($name, $options = []) |
|
| 268 | 268 | { |
| 269 | 269 | return $this->add($options, ['class' => 'section', 'name' => $name]); |
| 270 | 270 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @param array $options |
| 277 | 277 | * @return IField|fields\SwitchButton |
| 278 | 278 | */ |
| 279 | - public function addFieldSwitch($name, $options=[]) |
|
| 279 | + public function addFieldSwitch($name, $options = []) |
|
| 280 | 280 | { |
| 281 | 281 | return $this->add($options, ['class' => 'switch', 'name' => $name]); |
| 282 | 282 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | * @param array $options |
| 289 | 289 | * @return IField|fields\Textarea |
| 290 | 290 | */ |
| 291 | - public function addFieldTextArea($name, $options=[]) |
|
| 291 | + public function addFieldTextArea($name, $options = []) |
|
| 292 | 292 | { |
| 293 | 293 | return $this->add($options, ['class' => 'textarea', 'name' => $name]); |
| 294 | 294 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param array $options |
| 301 | 301 | * @return IField|fields\Time |
| 302 | 302 | */ |
| 303 | - public function addFieldTime($name, $options=[]) |
|
| 303 | + public function addFieldTime($name, $options = []) |
|
| 304 | 304 | { |
| 305 | 305 | return $this->add($options, ['name' => $name, 'class' => 'time']); |
| 306 | 306 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * @param array $options |
| 313 | 313 | * @return IField|fields\Wysiwyg |
| 314 | 314 | */ |
| 315 | - public function addFieldWysiwyg($name, $options=[]) |
|
| 315 | + public function addFieldWysiwyg($name, $options = []) |
|
| 316 | 316 | { |
| 317 | 317 | return $this->add($options, ['class' => 'wysiwyg', 'name' => $name]); |
| 318 | 318 | } |
@@ -350,14 +350,14 @@ discard block |
||
| 350 | 350 | * @throws UnknownFieldClass if the class is not found |
| 351 | 351 | * @return IField |
| 352 | 352 | */ |
| 353 | - public function makeField($field, $defaults=[]) |
|
| 353 | + public function makeField($field, $defaults = []) |
|
| 354 | 354 | { |
| 355 | 355 | if (is_array($field)) |
| 356 | 356 | $field = $this->createFieldObjectFromConfig($field, $defaults); |
| 357 | 357 | |
| 358 | 358 | if (!($field instanceof IField || $field instanceof Form)) { |
| 359 | 359 | // add this form as the parent form reference |
| 360 | - throw new \InvalidArgumentException('The $field parameter was not a valid \neon\core\form\fields\Field or \neon\core\form\Form object "' . print_r($field, true) . '" given'); |
|
| 360 | + throw new \InvalidArgumentException('The $field parameter was not a valid \neon\core\form\fields\Field or \neon\core\form\Form object "'.print_r($field, true).'" given'); |
|
| 361 | 361 | } |
| 362 | 362 | return $field; |
| 363 | 363 | } |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * @throws UnknownFieldClass |
| 382 | 382 | * @return IField |
| 383 | 383 | */ |
| 384 | - public function createFieldObjectFromConfig($config, $defaults=[]) |
|
| 384 | + public function createFieldObjectFromConfig($config, $defaults = []) |
|
| 385 | 385 | { |
| 386 | 386 | $config = Arr::merge($defaults, $config); |
| 387 | 387 | // allows class config property to be specified by an alias "switch" |
@@ -352,8 +352,9 @@ discard block |
||
| 352 | 352 | */ |
| 353 | 353 | public function makeField($field, $defaults=[]) |
| 354 | 354 | { |
| 355 | - if (is_array($field)) |
|
| 356 | - $field = $this->createFieldObjectFromConfig($field, $defaults); |
|
| 355 | + if (is_array($field)) { |
|
| 356 | + $field = $this->createFieldObjectFromConfig($field, $defaults); |
|
| 357 | + } |
|
| 357 | 358 | |
| 358 | 359 | if (!($field instanceof IField || $field instanceof Form)) { |
| 359 | 360 | // add this form as the parent form reference |
@@ -422,8 +423,9 @@ discard block |
||
| 422 | 423 | */ |
| 423 | 424 | public function getFieldClassByAlias($alias) |
| 424 | 425 | { |
| 425 | - if (!$this->fieldAliasExists($alias)) |
|
| 426 | - throw new \InvalidArgumentException("There is no alias with the key '$alias' in the Forms fieldAliases array"); |
|
| 426 | + if (!$this->fieldAliasExists($alias)) { |
|
| 427 | + throw new \InvalidArgumentException("There is no alias with the key '$alias' in the Forms fieldAliases array"); |
|
| 428 | + } |
|
| 427 | 429 | return $this->fieldAliases[strtolower($alias)]; |
| 428 | 430 | } |
| 429 | 431 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @return \neon\core\form\Form |
| 37 | 37 | * @deprecated should be using phoebe this should be replaced with using the loadFromDefinition via phoebe |
| 38 | 38 | */ |
| 39 | - public static function ddsLoadFrom($form, $classType, $includeDeleted=false) |
|
| 39 | + public static function ddsLoadFrom($form, $classType, $includeDeleted = false) |
|
| 40 | 40 | { |
| 41 | 41 | \Neon::warning('neon\core\form\Form::ddsLoadFrom is a deprecated function - phoebe is responsible for loading form definitions'); |
| 42 | 42 | $class = neon()->getDds()->getIDdsClassManagement()->getClass($classType); |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | $formDefinition = Arr::merge($formDefinition, $immutable); |
| 59 | 59 | // remove the class option |
| 60 | 60 | Arr::remove($formDefinition, 'class'); |
| 61 | - foreach($formDefinition as $key => $value) { |
|
| 61 | + foreach ($formDefinition as $key => $value) { |
|
| 62 | 62 | $form->$key = $value; |
| 63 | 63 | } |
| 64 | 64 | // Add fields to the form from the individual members |
| 65 | - if (! empty($members) ) { |
|
| 65 | + if (!empty($members)) { |
|
| 66 | 66 | foreach ($members as $member) { |
| 67 | 67 | $form->ddsAddField($member); |
| 68 | 68 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @return void |
| 79 | 79 | * @deprecated |
| 80 | 80 | */ |
| 81 | - public static function ddsSaveDefinition($form, $classType=null, $ddsMembers=null) |
|
| 81 | + public static function ddsSaveDefinition($form, $classType = null, $ddsMembers = null) |
|
| 82 | 82 | { |
| 83 | 83 | \Neon::warning('neon\core\form\Form::ddsSaveDefinition is a deprecated function - phoebe is now responsible for saving form definitions'); |
| 84 | 84 | // \neon\phoebe\builders\database\builder\Dds::saveDefinition($form); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | ]); |
| 98 | 98 | } |
| 99 | 99 | $members = $ddsClassManager->listMembers($classType, true); |
| 100 | - foreach($form->getFields() as $key => $field) { |
|
| 100 | + foreach ($form->getFields() as $key => $field) { |
|
| 101 | 101 | // set the order value to be the same as how we received them |
| 102 | 102 | $field->ddsSaveDefinition($classType, $members, $key); |
| 103 | 103 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ]); |
| 144 | 144 | // the definition might supply more information |
| 145 | 145 | $widgetDefinition = []; |
| 146 | - if (!empty($member['definition'])){ |
|
| 146 | + if (!empty($member['definition'])) { |
|
| 147 | 147 | // if the definition is already array then assume it is decoded - if it is not then assume it is a json string |
| 148 | 148 | $widgetDefinition = is_array($member['definition']) |
| 149 | 149 | ? $member['definition'] |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | // remove the value from the widget definition as this should be populated by the actual data |
| 153 | 153 | Arr::remove($widgetDefinition, 'value'); |
| 154 | - $config = Arr::merge($defaults, $widgetDefinition , $immutable); |
|
| 154 | + $config = Arr::merge($defaults, $widgetDefinition, $immutable); |
|
| 155 | 155 | |
| 156 | 156 | $form->add($config); |
| 157 | 157 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @param array|null $ddsMembers if not specified it will look up the members of the classType |
| 167 | 167 | * @deprecated |
| 168 | 168 | */ |
| 169 | - public static function ddsSaveDefinitionField($field, $classType=null, $ddsMembers=null) |
|
| 169 | + public static function ddsSaveDefinitionField($field, $classType = null, $ddsMembers = null) |
|
| 170 | 170 | { |
| 171 | 171 | \Neon::warning('neon\core\form\field::ddsSaveDefinition is a deprecated function - you should be using phoebe'); |
| 172 | 172 | $iDdsClassManagement = neon()->getDds()->getIDdsClassManagement(); |
@@ -180,8 +180,9 @@ |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // ignore if this is a deleted field |
| 183 | - if ($field->deleted == 1) |
|
| 184 | - return; |
|
| 183 | + if ($field->deleted == 1) { |
|
| 184 | + return; |
|
| 185 | + } |
|
| 185 | 186 | |
| 186 | 187 | // check if member exists |
| 187 | 188 | $memberRef = $field->getDdsName(); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @param bool $required |
| 17 | 17 | * @return $this method can be chained |
| 18 | 18 | */ |
| 19 | - public function setRequired($required=true); |
|
| 19 | + public function setRequired($required = true); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Add a validator to a form field |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return $this Is a chainable function |
| 54 | 54 | */ |
| 55 | - public function addValidator($validator, $options=[]); |
|
| 55 | + public function addValidator($validator, $options = []); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @param array $validators |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function init() |
| 32 | 32 | { |
| 33 | - $this->sourcePath = __DIR__ . '/vendor/ckeditor'; |
|
| 33 | + $this->sourcePath = __DIR__.'/vendor/ckeditor'; |
|
| 34 | 34 | parent::init(); |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | if (!is_array($value)) |
| 106 | 106 | throw new \InvalidArgumentException('The value should be an array'); |
| 107 | 107 | |
| 108 | - foreach($value as $position => $values) { |
|
| 108 | + foreach ($value as $position => $values) { |
|
| 109 | 109 | if (!$this->hasField($position)) { |
| 110 | 110 | $this->addInstance($position); |
| 111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $subFormCount = count(parent::getSubForms()); |
| 122 | 122 | if ($subFormCount < $this->count) { |
| 123 | - for ($i = $subFormCount; $i <= $this->count-1; $i++) { |
|
| 123 | + for ($i = $subFormCount; $i <= $this->count - 1; $i++) { |
|
| 124 | 124 | $this->addInstance($i); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * The fields in the template must register their scripts |
| 132 | 132 | * @param null $view |
| 133 | 133 | */ |
| 134 | - public function registerScripts($view=null, $mount=true) |
|
| 134 | + public function registerScripts($view = null, $mount = true) |
|
| 135 | 135 | { |
| 136 | 136 | $view = ($view === null) ? $this->getView() : $view; |
| 137 | 137 | foreach ($this->getTemplate()->getFields() as $field) |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | * Get fields - also add additional instances as appropriate |
| 210 | 210 | * @inheritdoc |
| 211 | 211 | */ |
| 212 | - public function getFields($names=null) |
|
| 212 | + public function getFields($names = null) |
|
| 213 | 213 | { |
| 214 | 214 | $subFormCount = count(parent::getSubForms()); |
| 215 | 215 | if ($subFormCount < $this->count) { |
| 216 | - for ($i = $subFormCount; $i <= $this->count-1; $i++) { |
|
| 216 | + for ($i = $subFormCount; $i <= $this->count - 1; $i++) { |
|
| 217 | 217 | $this->addInstance(Hash::uuid64()); |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -60,8 +60,9 @@ discard block |
||
| 60 | 60 | public function loadFromDb($data) |
| 61 | 61 | { |
| 62 | 62 | foreach ($data as $name => $value) { |
| 63 | - if (!$this->hasField($name)) |
|
| 64 | - $this->addInstance($name); |
|
| 63 | + if (!$this->hasField($name)) { |
|
| 64 | + $this->addInstance($name); |
|
| 65 | + } |
|
| 65 | 66 | $this->getField($name)->setValueFromDb($value); |
| 66 | 67 | } |
| 67 | 68 | } |
@@ -102,8 +103,9 @@ discard block |
||
| 102 | 103 | { |
| 103 | 104 | // throw an exception - should probably cope with this scenario but set |
| 104 | 105 | // a validation to fail rather than throwing toys out of the pram |
| 105 | - if (!is_array($value)) |
|
| 106 | - throw new \InvalidArgumentException('The value should be an array'); |
|
| 106 | + if (!is_array($value)) { |
|
| 107 | + throw new \InvalidArgumentException('The value should be an array'); |
|
| 108 | + } |
|
| 107 | 109 | |
| 108 | 110 | foreach($value as $position => $values) { |
| 109 | 111 | if (!$this->hasField($position)) { |
@@ -134,8 +136,9 @@ discard block |
||
| 134 | 136 | public function registerScripts($view=null, $mount=true) |
| 135 | 137 | { |
| 136 | 138 | $view = ($view === null) ? $this->getView() : $view; |
| 137 | - foreach ($this->getTemplate()->getFields() as $field) |
|
| 138 | - $field->registerScripts($view, $mount); |
|
| 139 | + foreach ($this->getTemplate()->getFields() as $field) { |
|
| 140 | + $field->registerScripts($view, $mount); |
|
| 141 | + } |
|
| 139 | 142 | } |
| 140 | 143 | |
| 141 | 144 | /** |
@@ -240,16 +243,18 @@ discard block |
||
| 240 | 243 | { |
| 241 | 244 | // the root path bit can be the the name or the id. |
| 242 | 245 | $bits = explode('.', $path); |
| 243 | - if (!($bits[0] === $this->name)) |
|
| 244 | - throw new \Exception("The first part of the path should be the current repeater name. Repeater form name=$this->name, id=$this->id, path=$path."); |
|
| 246 | + if (!($bits[0] === $this->name)) { |
|
| 247 | + throw new \Exception("The first part of the path should be the current repeater name. Repeater form name=$this->name, id=$this->id, path=$path."); |
|
| 248 | + } |
|
| 245 | 249 | |
| 246 | 250 | // if the repeater has an existing instance - then lets return that |
| 247 | 251 | if ($this->hasField($bits[1])) { |
| 248 | 252 | $field = $this->getField($bits[1]); |
| 249 | 253 | // fields within repeaters should always be forms - so this should never happen |
| 250 | 254 | // but just to ensure we trap the error - lets throw an exception |
| 251 | - if (!$field->isForm()) |
|
| 252 | - throw new \InvalidArgumentException('FormRepeaters should only contain form instances.'); |
|
| 255 | + if (!$field->isForm()) { |
|
| 256 | + throw new \InvalidArgumentException('FormRepeaters should only contain form instances.'); |
|
| 257 | + } |
|
| 253 | 258 | array_splice($bits, 0, 1); |
| 254 | 259 | return $field->getFieldByPath(implode('.', $bits)); |
| 255 | 260 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $block = ['neonPlugin']; |
| 73 | 73 | |
| 74 | 74 | $block['plugin'] = $this->_getPluginNameFromLines($lines, $current); |
| 75 | - $block['attributes'] = $this->_getPluginAttributesFromLines($lines, $current); |
|
| 75 | + $block['attributes'] = $this->_getPluginAttributesFromLines($lines, $current); |
|
| 76 | 76 | $block['content'] = $this->_getPluginContentFromLines($lines, $current, $endLine); |
| 77 | 77 | |
| 78 | 78 | return [$block, $endLine]; |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | protected function renderNeonPlugin($block) |
| 82 | 82 | { |
| 83 | 83 | $plugin = $block['plugin']; |
| 84 | - $content = implode("\n",$block['content']); |
|
| 84 | + $content = implode("\n", $block['content']); |
|
| 85 | 85 | $attributes = $block['attributes']; |
| 86 | 86 | if (class_exists($plugin)) |
| 87 | 87 | return $plugin::widget(array_merge($attributes, ['content' => $content])); |
| 88 | - return '<div class="alert alert-danger">unknown plugin: "' . $plugin . '"</div>'; |
|
| 88 | + return '<div class="alert alert-danger">unknown plugin: "'.$plugin.'"</div>'; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | protected function _getPluginAttributesFromLines($lines, $current) |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | // remove tag and open delimiter from first and last lines |
| 107 | 107 | $plugin = $this->_getPluginNameFromLines($lines, $current); |
| 108 | - $lastLine = \count($content)-1; |
|
| 108 | + $lastLine = \count($content) - 1; |
|
| 109 | 109 | $content[0] = Str::replaceFirst($openDelimiter, '', $content[0]); |
| 110 | 110 | $content[0] = Str::replaceFirst($plugin, '', $content[0]); |
| 111 | 111 | $content[$lastLine] = Str::replaceLast($closeDelimiter, '', $content[$lastLine]); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | // xml part |
| 115 | 115 | $xml = simplexml_load_string("<attr $attrs></attr>"); |
| 116 | 116 | $attributes = []; |
| 117 | - foreach($xml[0]->attributes() as $a => $b) { |
|
| 117 | + foreach ($xml[0]->attributes() as $a => $b) { |
|
| 118 | 118 | $attributes[$a] = (string) $b; |
| 119 | 119 | } |
| 120 | 120 | return $attributes; |
@@ -83,8 +83,9 @@ discard block |
||
| 83 | 83 | $plugin = $block['plugin']; |
| 84 | 84 | $content = implode("\n",$block['content']); |
| 85 | 85 | $attributes = $block['attributes']; |
| 86 | - if (class_exists($plugin)) |
|
| 87 | - return $plugin::widget(array_merge($attributes, ['content' => $content])); |
|
| 86 | + if (class_exists($plugin)) { |
|
| 87 | + return $plugin::widget(array_merge($attributes, ['content' => $content])); |
|
| 88 | + } |
|
| 88 | 89 | return '<div class="alert alert-danger">unknown plugin: "' . $plugin . '"</div>'; |
| 89 | 90 | } |
| 90 | 91 | |
@@ -151,8 +152,9 @@ discard block |
||
| 151 | 152 | for ($i = $current + 1, $count = count($lines); $i < $count; $i++) { |
| 152 | 153 | $line = $lines[$i]; |
| 153 | 154 | // stop consuming lines if we find the closing tag |
| 154 | - if (strpos($line, $closingTag) !== false) |
|
| 155 | - break; |
|
| 155 | + if (strpos($line, $closingTag) !== false) { |
|
| 156 | + break; |
|
| 157 | + } |
|
| 156 | 158 | $content[] = $line; |
| 157 | 159 | } |
| 158 | 160 | return $content; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | trigger_error("path: missing 'route' parameter"); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - array_unshift($params, $params['route']) ; |
|
| 75 | + array_unshift($params, $params['route']); |
|
| 76 | 76 | unset($params['route']); |
| 77 | 77 | |
| 78 | 78 | return Url::to($params); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | if ($type === 'block') { |
| 120 | 120 | // Register widget tag during compile time |
| 121 | 121 | $this->viewRenderer->widgets['blocks'][$alias] = $class; |
| 122 | - $this->smarty->registerPlugin('block', $alias, [$this->viewRenderer, '_widget_block__' . $alias]); |
|
| 122 | + $this->smarty->registerPlugin('block', $alias, [$this->viewRenderer, '_widget_block__'.$alias]); |
|
| 123 | 123 | |
| 124 | 124 | // Inject code to re-register widget tag during run-time |
| 125 | 125 | return <<<PHP |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } elseif ($type === 'function') { |
| 138 | 138 | // Register widget tag during compile time |
| 139 | 139 | $this->viewRenderer->widgets['functions'][$alias] = $class; |
| 140 | - $this->smarty->registerPlugin('function', $alias, [$this->viewRenderer, '_widget_function__' . $alias]); |
|
| 140 | + $this->smarty->registerPlugin('function', $alias, [$this->viewRenderer, '_widget_function__'.$alias]); |
|
| 141 | 141 | |
| 142 | 142 | // Inject code to re-register widget tag during run-time |
| 143 | 143 | return <<<PHP |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | protected function getViewConstVal($string, $default) |
| 285 | 285 | { |
| 286 | - $val = @constant('yii\web\View::' . $string); |
|
| 286 | + $val = @constant('yii\web\View::'.$string); |
|
| 287 | 287 | return isset($val) ? $val : $default; |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class JQueryUiAsset extends AssetBundle |
| 9 | 9 | { |
| 10 | - public $sourcePath = __DIR__ . '/publish/vendor/jqueryui'; |
|
| 10 | + public $sourcePath = __DIR__.'/publish/vendor/jqueryui'; |
|
| 11 | 11 | |
| 12 | 12 | public $js = [ |
| 13 | 13 | 'jquery-ui.min.js' |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class CoreAsset extends AssetBundle |
| 19 | 19 | { |
| 20 | - public $sourcePath = __DIR__ . '/publish'; |
|
| 20 | + public $sourcePath = __DIR__.'/publish'; |
|
| 21 | 21 | |
| 22 | 22 | public $js = [ |
| 23 | 23 | (YII_DEBUG ? 'vendor/vue.js' : 'vendor/vue.min.js'), |