Completed
Push — master ( 6a93fb...4ff74f )
by Askupa
02:39
created
ChildPage.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
      * 
25 25
      * @param array $config
26 26
      */
27
-    public function __construct( array $config = array() ) 
27
+    public function __construct(array $config = array()) 
28 28
     {
29 29
         $this->config = array_merge($this->default_args(), $config);
30 30
         $this->form = new \Amarkal\UI\Form($this->config['fields']);
31 31
         
32
-        \add_action('admin_menu', array($this,'add_submenu_page'));
33
-        \add_action('admin_enqueue_scripts', array($this,'enqueue_scripts'));
32
+        \add_action('admin_menu', array($this, 'add_submenu_page'));
33
+        \add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
34 34
     }
35 35
     
36 36
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function enqueue_scripts()
56 56
     {
57 57
         // Only enqueue styles & scripts if this is a settings page
58
-        if($this->config['slug'] === filter_input(INPUT_GET, 'page'))
58
+        if ($this->config['slug'] === filter_input(INPUT_GET, 'page'))
59 59
         {
60 60
             \wp_enqueue_style('amarkal-settings');
61 61
             \wp_enqueue_script('amarkal-settings');
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
      * @param array $new_instance
80 80
      * @return array
81 81
      */
82
-    public function update( $new_instance )
82
+    public function update($new_instance)
83 83
     {
84
-        if($this->can_update())
84
+        if ($this->can_update())
85 85
         {
86 86
             $old_instance = $this->get_old_instance();
87 87
             $final_instance = $this->form->update($new_instance, $old_instance);
88
-            foreach($final_instance as $name => $value)
88
+            foreach ($final_instance as $name => $value)
89 89
             {
90
-                \update_option($name,$value);
90
+                \update_option($name, $value);
91 91
             }
92 92
             return $this->results_array(
93 93
                 $this->get_errors(),
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function reset()
109 109
     {
110
-        if($this->can_update())
110
+        if ($this->can_update())
111 111
         {
112
-            foreach($this->config['fields'] as $field)
112
+            foreach ($this->config['fields'] as $field)
113 113
             {
114 114
                 \delete_option($field['name']);
115 115
             }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     private function get_errors()
140 140
     {
141 141
         $errors = array();
142
-        foreach($this->form->get_errors() as $name => $error)
142
+        foreach ($this->form->get_errors() as $name => $error)
143 143
         {
144 144
             $component = $this->form->get_component($name);
145 145
             $errors[] = array(
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param array $values The list of values
158 158
      * @return array
159 159
      */
160
-    private function results_array( $errors = array(), $values = '' )
160
+    private function results_array($errors = array(), $values = '')
161 161
     {
162 162
         return array(
163 163
             'values' => $values,
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     private function get_old_instance()
185 185
     {
186 186
         $old_instance = array();
187
-        foreach($this->form->get_components() as $component)
187
+        foreach ($this->form->get_components() as $component)
188 188
         {
189 189
             $old_instance[$component->name] = \get_option($component->name, $component->default);
190 190
         }
Please login to merge, or discard this patch.