@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public static function get_instance() |
20 | 20 | { |
21 | - if( null === static::$instance ) |
|
21 | + if (null === static::$instance) |
|
22 | 22 | { |
23 | 23 | static::$instance = new static(); |
24 | 24 | } |
25 | 25 | return static::$instance; |
26 | 26 | } |
27 | 27 | |
28 | - public function register_shortcode( $args ) |
|
28 | + public function register_shortcode($args) |
|
29 | 29 | { |
30 | 30 | $this->validate_args($args); |
31 | - if($this->shortcode_exists($args['id'])) |
|
31 | + if ($this->shortcode_exists($args['id'])) |
|
32 | 32 | { |
33 | 33 | throw new \RuntimeException("A shortcode with id '{$args['id']}' has already been registered"); |
34 | 34 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | private function prepare_json_object() |
61 | 61 | { |
62 | 62 | $json = array(); |
63 | - foreach($this->shortcodes as $id => $shortcode) |
|
63 | + foreach ($this->shortcodes as $id => $shortcode) |
|
64 | 64 | { |
65 | 65 | $popup = new Popup($shortcode['fields']); |
66 | 66 | $json[$id] = $shortcode; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * Check if a shortcode with the given ID has already been registered |
92 | 92 | */ |
93 | - private function shortcode_exists( $id ) |
|
93 | + private function shortcode_exists($id) |
|
94 | 94 | { |
95 | 95 | return array_key_exists($id, $this->shortcodes); |
96 | 96 | } |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | * Validate that the provided arguments have the required arguments as |
100 | 100 | * specified in self::required_args() |
101 | 101 | */ |
102 | - private function validate_args( $args ) |
|
102 | + private function validate_args($args) |
|
103 | 103 | { |
104 | - foreach($this->required_args() as $arg) |
|
104 | + foreach ($this->required_args() as $arg) |
|
105 | 105 | { |
106 | - if(!array_key_exists($arg, $args)) |
|
106 | + if (!array_key_exists($arg, $args)) |
|
107 | 107 | { |
108 | 108 | throw new \RuntimeException("Missing required argument '$arg'"); |
109 | 109 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function required_args() |
117 | 117 | { |
118 | - return array('id','template','fields'); |
|
118 | + return array('id', 'template', 'fields'); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -123,6 +123,6 @@ discard block |
||
123 | 123 | */ |
124 | 124 | private function __construct() |
125 | 125 | { |
126 | - \add_filter('mce_external_plugins',array($this,'enqueue_script')); |
|
126 | + \add_filter('mce_external_plugins', array($this, 'enqueue_script')); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | \ No newline at end of file |
@@ -12,34 +12,34 @@ |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Prevent direct file access |
15 | -defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
|
15 | +defined('ABSPATH') or die('No script kiddies please!'); |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Prevent loading the library more than once |
19 | 19 | */ |
20 | -if( defined( 'AMARKAL_SHORTCODE' ) ) return false; |
|
21 | -define( 'AMARKAL_SHORTCODE', true ); |
|
20 | +if (defined('AMARKAL_SHORTCODE')) return false; |
|
21 | +define('AMARKAL_SHORTCODE', true); |
|
22 | 22 | |
23 | -if(!function_exists('amarkal_register_shortcode')) |
|
23 | +if (!function_exists('amarkal_register_shortcode')) |
|
24 | 24 | { |
25 | - function amarkal_register_shortcode( $args ) |
|
25 | + function amarkal_register_shortcode($args) |
|
26 | 26 | { |
27 | 27 | $manager = Amarkal\Shortcode\Manager::get_instance(); |
28 | 28 | $manager->register_shortcode($args); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -if(!function_exists('amarkal_shortcode_enqueue_editor_script')) |
|
32 | +if (!function_exists('amarkal_shortcode_enqueue_editor_script')) |
|
33 | 33 | { |
34 | 34 | function amarkal_shortcode_enqueue_editor_script() |
35 | 35 | { |
36 | - \wp_register_script('amarkal-shortcode',\Amarkal\Core\Utility::path_to_url(__DIR__.'/tinymce.plugin.js'),array('jquery')); |
|
36 | + \wp_register_script('amarkal-shortcode', \Amarkal\Core\Utility::path_to_url(__DIR__.'/tinymce.plugin.js'), array('jquery')); |
|
37 | 37 | } |
38 | 38 | add_action('wp_enqueue_scripts', 'amarkal_shortcode_enqueue_editor_script'); |
39 | 39 | add_action('admin_enqueue_scripts', 'amarkal_shortcode_enqueue_editor_script'); |
40 | 40 | } |
41 | 41 | |
42 | -if(!function_exists('amarkal_shortcode_enqueue_editor_style')) |
|
42 | +if (!function_exists('amarkal_shortcode_enqueue_editor_style')) |
|
43 | 43 | { |
44 | 44 | function amarkal_shortcode_enqueue_editor_style() |
45 | 45 | { |
@@ -17,7 +17,9 @@ |
||
17 | 17 | /** |
18 | 18 | * Prevent loading the library more than once |
19 | 19 | */ |
20 | -if( defined( 'AMARKAL_SHORTCODE' ) ) return false; |
|
20 | +if( defined( 'AMARKAL_SHORTCODE' ) ) { |
|
21 | + return false; |
|
22 | +} |
|
21 | 23 | define( 'AMARKAL_SHORTCODE', true ); |
22 | 24 | |
23 | 25 | if(!function_exists('amarkal_register_shortcode')) |