@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param array $config |
| 30 | 30 | */ |
| 31 | - public function __construct( array $config = array() ) |
|
| 31 | + public function __construct(array $config = array()) |
|
| 32 | 32 | { |
| 33 | 33 | $this->config = array_merge($this->default_args(), $config); |
| 34 | 34 | $this->form = new \Amarkal\UI\Form( |
| 35 | 35 | new \Amarkal\UI\ComponentList($this->config['fields']) |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - \add_action('admin_menu', array($this,'add_submenu_page')); |
|
| 39 | - \add_action('admin_enqueue_scripts', array($this,'enqueue_scripts')); |
|
| 38 | + \add_action('admin_menu', array($this, 'add_submenu_page')); |
|
| 39 | + \add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function enqueue_scripts() |
| 62 | 62 | { |
| 63 | 63 | // Only enqueue styles & scripts if this is a settings page |
| 64 | - if($this->config['slug'] === filter_input(INPUT_GET, 'page')) |
|
| 64 | + if ($this->config['slug'] === filter_input(INPUT_GET, 'page')) |
|
| 65 | 65 | { |
| 66 | 66 | \wp_enqueue_style('amarkal-settings'); |
| 67 | 67 | \wp_enqueue_script('amarkal-settings'); |
@@ -85,15 +85,15 @@ discard block |
||
| 85 | 85 | * @param array $new_instance |
| 86 | 86 | * @return array |
| 87 | 87 | */ |
| 88 | - public function update( $new_instance ) |
|
| 88 | + public function update($new_instance) |
|
| 89 | 89 | { |
| 90 | - if($this->can_update()) |
|
| 90 | + if ($this->can_update()) |
|
| 91 | 91 | { |
| 92 | 92 | $old_instance = $this->get_old_instance(); |
| 93 | 93 | $final_instance = $this->form->update($new_instance, $old_instance); |
| 94 | - foreach($final_instance as $name => $value) |
|
| 94 | + foreach ($final_instance as $name => $value) |
|
| 95 | 95 | { |
| 96 | - \update_option($name,$value); |
|
| 96 | + \update_option($name, $value); |
|
| 97 | 97 | } |
| 98 | 98 | return $this->results_array( |
| 99 | 99 | $this->get_errors(), |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function reset() |
| 115 | 115 | { |
| 116 | - if($this->can_update()) |
|
| 116 | + if ($this->can_update()) |
|
| 117 | 117 | { |
| 118 | - foreach($this->config['fields'] as $field) |
|
| 118 | + foreach ($this->config['fields'] as $field) |
|
| 119 | 119 | { |
| 120 | 120 | \delete_option($field['name']); |
| 121 | 121 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | private function get_errors() |
| 158 | 158 | { |
| 159 | 159 | $errors = array(); |
| 160 | - foreach($this->form->get_errors() as $name => $error) |
|
| 160 | + foreach ($this->form->get_errors() as $name => $error) |
|
| 161 | 161 | { |
| 162 | 162 | $errors[$name] = $error; |
| 163 | 163 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param array $values The list of values |
| 172 | 172 | * @return array |
| 173 | 173 | */ |
| 174 | - private function results_array( $errors = array(), $values = '' ) |
|
| 174 | + private function results_array($errors = array(), $values = '') |
|
| 175 | 175 | { |
| 176 | 176 | return array( |
| 177 | 177 | 'values' => $values, |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | private function get_old_instance() |
| 199 | 199 | { |
| 200 | 200 | $old_instance = array(); |
| 201 | - foreach($this->form->get_component_list()->get_value_components() as $component) |
|
| 201 | + foreach ($this->form->get_component_list()->get_value_components() as $component) |
|
| 202 | 202 | { |
| 203 | 203 | $old_instance[$component->name] = \get_option($component->name, $component->default); |
| 204 | 204 | } |