@@ -53,7 +53,7 @@ |
||
| 53 | 53 | public function setValue($value) |
| 54 | 54 | { |
| 55 | 55 | if ($value === 'true' || $value === true) |
| 56 | - $this->getForm()->submittedButton=$this->getName(); |
|
| 56 | + $this->getForm()->submittedButton = $this->getName(); |
|
| 57 | 57 | return $this; |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * @inheritdoc |
| 37 | 37 | */ |
| 38 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 38 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 39 | 39 | { |
| 40 | 40 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 41 | 41 | if (!empty($searchData)) { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class Textarea extends Text |
| 20 | 20 | { |
| 21 | - const TEXT_TRUNCATE_LENGTH=250; |
|
| 21 | + const TEXT_TRUNCATE_LENGTH = 250; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Set some allowable tags for single text fields |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * @inheritdoc |
| 59 | 59 | */ |
| 60 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 60 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 61 | 61 | { |
| 62 | 62 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 63 | 63 | if ($searchData !== '') { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @param array $config |
| 191 | 191 | * @throws \neon\core\form\exceptions\InvalidNameFormat |
| 192 | 192 | */ |
| 193 | - public function __construct($name=[], array $config=[]) |
|
| 193 | + public function __construct($name = [], array $config = []) |
|
| 194 | 194 | { |
| 195 | 195 | // The $name field can also be a configuration array |
| 196 | 196 | if (is_array($name)) { |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | */ |
| 516 | 516 | public function getLabelHtml() |
| 517 | 517 | { |
| 518 | - return $this->getLabel() ? Html::activeLabel($this->getForm(), $this->getName(), $this->labelAttributes ) : ''; |
|
| 518 | + return $this->getLabel() ? Html::activeLabel($this->getForm(), $this->getName(), $this->labelAttributes) : ''; |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | /** |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | public function validate() |
| 598 | 598 | { |
| 599 | 599 | $validators = $this->getValidators(); |
| 600 | - if (count($validators)==0) |
|
| 600 | + if (count($validators) == 0) |
|
| 601 | 601 | return true; |
| 602 | 602 | |
| 603 | 603 | $isEmpty = empty($this->getValue()); |
@@ -625,10 +625,10 @@ discard block |
||
| 625 | 625 | $validator->validateAttribute($form, $attribute); |
| 626 | 626 | } catch (\yii\base\UnknownPropertyException $e) { |
| 627 | 627 | throw new UnknownPropertyException( |
| 628 | - "You are using a validator " . get_class($validator) . " that has a when clause or needs to use validateAttribute. " |
|
| 628 | + "You are using a validator ".get_class($validator)." that has a when clause or needs to use validateAttribute. " |
|
| 629 | 629 | . "This requires you to have <br><br>" |
| 630 | - . "public function get" . ucfirst($attribute) . "<br>{ <br> return \$this->getField("$attribute")->getValue()); <br>}" |
|
| 631 | - . "<br><br>on the form. You may also need the equivalent set" . ucfirst($attribute) . " method. <br>Error was " . $e->getMessage()); |
|
| 630 | + . "public function get".ucfirst($attribute)."<br>{ <br> return \$this->getField("$attribute")->getValue()); <br>}" |
|
| 631 | + . "<br><br>on the form. You may also need the equivalent set".ucfirst($attribute)." method. <br>Error was ".$e->getMessage()); |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | } |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | /** |
| 777 | 777 | * @inheritdoc |
| 778 | 778 | */ |
| 779 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 779 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 780 | 780 | { |
| 781 | 781 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 782 | 782 | // Note: we can not use empty here |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | * @param array|null $ddsMembers if not specified it will look up the members of the classType |
| 822 | 822 | * @deprecated |
| 823 | 823 | */ |
| 824 | - public function ddsSaveDefinition($classType=null, $ddsMembers=null) |
|
| 824 | + public function ddsSaveDefinition($classType = null, $ddsMembers = null) |
|
| 825 | 825 | { |
| 826 | 826 | Deprecated::ddsSaveDefinitionField($this, $classType, $ddsMembers); |
| 827 | 827 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | /** |
| 61 | 61 | * @inheritdoc |
| 62 | 62 | */ |
| 63 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 63 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 64 | 64 | { |
| 65 | 65 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 66 | 66 | if ($searchData !== '') { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function getProperties() |
| 27 | 27 | { |
| 28 | - return array_merge(parent::getProperties(), ['decimal', 'height', 'vertical', 'min', 'max'] ); |
|
| 28 | + return array_merge(parent::getProperties(), ['decimal', 'height', 'vertical', 'min', 'max']); |
|
| 29 | 29 | } |
| 30 | 30 | /** |
| 31 | 31 | * @inheritdoc |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | /** |
| 74 | 74 | * @inheritdoc |
| 75 | 75 | */ |
| 76 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 76 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 77 | 77 | { |
| 78 | 78 | // no filters can be applied here - so we override and do nothing. |
| 79 | 79 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public function getValueDisplay() |
| 45 | 45 | { |
| 46 | - return '<code>' . $this->getValue() . '</code>'; |
|
| 46 | + return '<code>'.$this->getValue().'</code>'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * set whether or not this is an absolute or relative URL |
| 23 | 23 | */ |
| 24 | - public $absolute=true; |
|
| 24 | + public $absolute = true; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Set some allowable tags for single text fields |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function getValueDisplay() |
| 48 | 48 | { |
| 49 | - return '<a href="'.$this->getValue().'" target="_blank" noopener noreferrer>'.$this->getValue().'</a>' ; |
|
| 49 | + return '<a href="'.$this->getValue().'" target="_blank" noopener noreferrer>'.$this->getValue().'</a>'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | if ($this->_sanitisedValue === null) { |
| 60 | 60 | $value = $this->getUnsafeValue(); |
| 61 | 61 | // disallow any quotes in the URL to prevent a class of attacks |
| 62 | - if (strpos($value, "'") === false && strpos($value,'"') === false) { |
|
| 62 | + if (strpos($value, "'") === false && strpos($value, '"') === false) { |
|
| 63 | 63 | // prefix with the schema if not provided |
| 64 | - if ($value && $this->absolute && strpos($value, 'http')===false) |
|
| 65 | - $value = str_replace('///','//','https://'.$value); |
|
| 64 | + if ($value && $this->absolute && strpos($value, 'http') === false) |
|
| 65 | + $value = str_replace('///', '//', 'https://'.$value); |
|
| 66 | 66 | // now turn into a link and run through purify to strip |
| 67 | 67 | // out any dodgy shenanigans |
| 68 | 68 | $link = '<a href="'.$value.'">'; |
| 69 | 69 | $safeValue = $this->purifyInput($link); |
| 70 | 70 | if (strpos($safeValue, 'href')) { |
| 71 | - $exploded = explode('"',$safeValue); |
|
| 71 | + $exploded = explode('"', $safeValue); |
|
| 72 | 72 | $this->_sanitisedValue = $exploded[1]; |
| 73 | 73 | } |
| 74 | 74 | } else |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | public function getProperties() |
| 84 | 84 | { |
| 85 | 85 | // convert the database values to booleans |
| 86 | - $this->absolute = (bool)$this->absolute; |
|
| 86 | + $this->absolute = (bool) $this->absolute; |
|
| 87 | 87 | $properties = parent::getProperties(); |
| 88 | 88 | $properties[] = 'absolute'; |
| 89 | 89 | return $properties; |