@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | * @link https://github.com/askupasoftware/amarkal-widget |
12 | 12 | * @copyright 2017 Askupa Software |
13 | 13 | */ |
14 | -defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
|
14 | +defined('ABSPATH') or die('No script kiddies please!'); |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Prevent loading the library more than once |
18 | 18 | */ |
19 | -if( defined( 'AMARKAL_WIDGET' ) ) return; |
|
20 | -define( 'AMARKAL_WIDGET', true ); |
|
19 | +if (defined('AMARKAL_WIDGET')) return; |
|
20 | +define('AMARKAL_WIDGET', true); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Load required classes if not using composer |
24 | 24 | */ |
25 | -if( !class_exists('Composer\\Autoload\\ClassLoader') ) |
|
25 | +if (!class_exists('Composer\\Autoload\\ClassLoader')) |
|
26 | 26 | { |
27 | 27 | require_once 'AbstractWidget.php'; |
28 | 28 | require_once 'FormField.php'; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | function amarkal_widget_style() |
35 | 35 | { |
36 | 36 | $cs = get_current_screen(); |
37 | - if( 'widgets' === $cs->base ) |
|
37 | + if ('widgets' === $cs->base) |
|
38 | 38 | { |
39 | 39 | echo '<style>'; |
40 | 40 | include 'widget.css'; |
@@ -16,7 +16,9 @@ |
||
16 | 16 | /** |
17 | 17 | * Prevent loading the library more than once |
18 | 18 | */ |
19 | -if( defined( 'AMARKAL_WIDGET' ) ) return; |
|
19 | +if( defined( 'AMARKAL_WIDGET' ) ) { |
|
20 | + return; |
|
21 | +} |
|
20 | 22 | define( 'AMARKAL_WIDGET', true ); |
21 | 23 | |
22 | 24 | /** |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | ); |
19 | 19 | } |
20 | 20 | |
21 | - public function form( $instance ) |
|
21 | + public function form($instance) |
|
22 | 22 | { |
23 | - $values = array_merge($this->get_default_field_values(),$instance); |
|
23 | + $values = array_merge($this->get_default_field_values(), $instance); |
|
24 | 24 | $config = $this->get_config(); |
25 | 25 | |
26 | - foreach( $config['fields'] as $field_args ) |
|
26 | + foreach ($config['fields'] as $field_args) |
|
27 | 27 | { |
28 | 28 | $field_args['value'] = $values[$field_args['name']]; |
29 | 29 | $field_args['id'] = $this->get_field_id($field_args['name']); |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - public function update( $new_instance, $old_instance ) |
|
37 | + public function update($new_instance, $old_instance) |
|
38 | 38 | { |
39 | 39 | $instance = array_merge($this->get_default_field_values(), $new_instance); |
40 | 40 | $config = $this->get_config(); |
41 | 41 | |
42 | - foreach( $config['fields'] as $field ) |
|
42 | + foreach ($config['fields'] as $field) |
|
43 | 43 | { |
44 | 44 | $name = $field['name']; |
45 | 45 | $value = $new_instance[$name]; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $defaults = array(); |
54 | 54 | $config = $this->get_config(); |
55 | - foreach( $config['fields'] as $field ) |
|
55 | + foreach ($config['fields'] as $field) |
|
56 | 56 | { |
57 | 57 | $defaults[$field['name']] = $field['default']; |
58 | 58 | } |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | |
73 | 73 | private function get_config() |
74 | 74 | { |
75 | - if( !isset($this->config) ) |
|
75 | + if (!isset($this->config)) |
|
76 | 76 | { |
77 | 77 | $this->config = array_merge( |
78 | 78 | $this->default_config(), |
79 | 79 | $this->config() |
80 | 80 | ); |
81 | 81 | |
82 | - if( null === $this->config['id'] ) |
|
82 | + if (null === $this->config['id']) |
|
83 | 83 | { |
84 | 84 | throw new \RuntimeException('No \'id\' was sepcified in the widget configuration'); |
85 | 85 | } |