@@ -6,7 +6,7 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | // Prevent direct file access |
| 9 | -defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
|
| 9 | +defined('ABSPATH') or die('No script kiddies please!'); |
|
| 10 | 10 | |
| 11 | 11 | // Load module functions |
| 12 | 12 | require_once 'functions.php'; |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | // Prevent direct file access |
| 9 | -defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
|
| 9 | +defined('ABSPATH') or die('No script kiddies please!'); |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Load module functions. If this amarkal module has not been loaded, |
| 13 | 13 | * functions.php will not return false. |
| 14 | 14 | */ |
| 15 | -if(false !== (require_once 'functions.php')) |
|
| 15 | +if (false !== (require_once 'functions.php')) |
|
| 16 | 16 | { |
| 17 | 17 | require_once 'AbstractWidget.php'; |
| 18 | 18 | } |
| 19 | 19 | \ No newline at end of file |
@@ -13,25 +13,25 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // Prevent direct file access |
| 16 | -defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
|
| 16 | +defined('ABSPATH') or die('No script kiddies please!'); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Prevent loading the library more than once |
| 20 | 20 | */ |
| 21 | -if( defined( 'AMARKAL_WIDGET' ) ) return false; |
|
| 22 | -define( 'AMARKAL_WIDGET', true ); |
|
| 21 | +if (defined('AMARKAL_WIDGET')) return false; |
|
| 22 | +define('AMARKAL_WIDGET', true); |
|
| 23 | 23 | |
| 24 | -if(!function_exists('amarkal_widget_assets')) |
|
| 24 | +if (!function_exists('amarkal_widget_assets')) |
|
| 25 | 25 | { |
| 26 | 26 | /** |
| 27 | 27 | * Print widget styles |
| 28 | 28 | */ |
| 29 | - function amarkal_widget_scripts( $hook ) |
|
| 29 | + function amarkal_widget_scripts($hook) |
|
| 30 | 30 | { |
| 31 | - if( 'widgets.php' === $hook ) |
|
| 31 | + if ('widgets.php' === $hook) |
|
| 32 | 32 | { |
| 33 | - \wp_enqueue_style('amarkal-widget',\Amarkal\Core\Utility::path_to_url(__DIR__.'/widget.css')); |
|
| 34 | - \wp_enqueue_script('amarkal-widget',\Amarkal\Core\Utility::path_to_url(__DIR__.'/widget.js'),array('jquery','amarkal-ui')); |
|
| 33 | + \wp_enqueue_style('amarkal-widget', \Amarkal\Core\Utility::path_to_url(__DIR__.'/widget.css')); |
|
| 34 | + \wp_enqueue_script('amarkal-widget', \Amarkal\Core\Utility::path_to_url(__DIR__.'/widget.js'), array('jquery', 'amarkal-ui')); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | add_action('admin_enqueue_scripts', 'amarkal_widget_scripts'); |
@@ -18,7 +18,9 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Prevent loading the library more than once |
| 20 | 20 | */ |
| 21 | -if( defined( 'AMARKAL_WIDGET' ) ) return false; |
|
| 21 | +if( defined( 'AMARKAL_WIDGET' ) ) { |
|
| 22 | + return false; |
|
| 23 | +} |
|
| 22 | 24 | define( 'AMARKAL_WIDGET', true ); |
| 23 | 25 | |
| 24 | 26 | if(!function_exists('amarkal_widget_assets')) |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param array $instance The array of keys and values for the widget |
| 36 | 36 | */ |
| 37 | - public function form( $instance ) |
|
| 37 | + public function form($instance) |
|
| 38 | 38 | { |
| 39 | 39 | $form = $this->get_form(); |
| 40 | 40 | $cl = $form->get_component_list(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $form->update($instance); |
| 43 | 43 | |
| 44 | 44 | // Set the widget-specific names and ids |
| 45 | - foreach( $cl->get_value_components() as $component ) |
|
| 45 | + foreach ($cl->get_value_components() as $component) |
|
| 46 | 46 | { |
| 47 | 47 | $component->original_name = $component->name; |
| 48 | 48 | $component->id = $this->get_field_id($component->name); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | include __DIR__.'/Form.phtml'; |
| 53 | 53 | |
| 54 | 54 | // Use the original names again (for when the components update) |
| 55 | - foreach( $cl->get_value_components() as $component ) |
|
| 55 | + foreach ($cl->get_value_components() as $component) |
|
| 56 | 56 | { |
| 57 | 57 | $component->id = $component->original_name; |
| 58 | 58 | $component->name = $component->original_name; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param array $new_instance The previous instance of values before the update. |
| 66 | 66 | * @param array $old_instance The new instance of values to be generated via the update. |
| 67 | 67 | */ |
| 68 | - public function update( $new_instance, $old_instance ) |
|
| 68 | + public function update($new_instance, $old_instance) |
|
| 69 | 69 | { |
| 70 | 70 | $form = $this->get_form(); |
| 71 | 71 | return $form->update($new_instance, $old_instance); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | private function get_form() |
| 80 | 80 | { |
| 81 | - if( !isset($this->form) ) |
|
| 81 | + if (!isset($this->form)) |
|
| 82 | 82 | { |
| 83 | 83 | $config = $this->get_config(); |
| 84 | 84 | $this->form = new \Amarkal\UI\Form( |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | private function get_config() |
| 115 | 115 | { |
| 116 | - if( !isset($this->config) ) |
|
| 116 | + if (!isset($this->config)) |
|
| 117 | 117 | { |
| 118 | 118 | $this->config = array_merge( |
| 119 | 119 | $this->default_config(), |
| 120 | 120 | $this->config() |
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | - if( null === $this->config['id'] ) |
|
| 123 | + if (null === $this->config['id']) |
|
| 124 | 124 | { |
| 125 | 125 | throw new \RuntimeException('No \'id\' was sepcified in the widget configuration'); |
| 126 | 126 | } |