@@ -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 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function enqueue_popup_style() |
| 57 | 57 | { |
| 58 | - \wp_enqueue_style('amarkal-shortcode',\Amarkal\Core\Utility::path_to_url(__DIR__.'/assets/css/dist/amarkal-shortcode-popup.min.css')); |
|
| 58 | + \wp_enqueue_style('amarkal-shortcode', \Amarkal\Core\Utility::path_to_url(__DIR__.'/assets/css/dist/amarkal-shortcode-popup.min.css')); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function enqueue_editor_style() |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | private function prepare_json_object() |
| 71 | 71 | { |
| 72 | 72 | $json = array(); |
| 73 | - foreach($this->shortcodes as $id => $shortcode) |
|
| 73 | + foreach ($this->shortcodes as $id => $shortcode) |
|
| 74 | 74 | { |
| 75 | 75 | $popup = new Popup($shortcode['fields']); |
| 76 | 76 | $json[$id] = $shortcode; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * Check if a shortcode with the given ID has already been registered |
| 102 | 102 | */ |
| 103 | - private function shortcode_exists( $id ) |
|
| 103 | + private function shortcode_exists($id) |
|
| 104 | 104 | { |
| 105 | 105 | return array_key_exists($id, $this->shortcodes); |
| 106 | 106 | } |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * Validate that the provided arguments have the required arguments as |
| 110 | 110 | * specified in self::required_args() |
| 111 | 111 | */ |
| 112 | - private function validate_args( $args ) |
|
| 112 | + private function validate_args($args) |
|
| 113 | 113 | { |
| 114 | - foreach($this->required_args() as $arg) |
|
| 114 | + foreach ($this->required_args() as $arg) |
|
| 115 | 115 | { |
| 116 | - if(!array_key_exists($arg, $args)) |
|
| 116 | + if (!array_key_exists($arg, $args)) |
|
| 117 | 117 | { |
| 118 | 118 | throw new \RuntimeException("Missing required argument '$arg'"); |
| 119 | 119 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function required_args() |
| 127 | 127 | { |
| 128 | - return array('id','template','fields'); |
|
| 128 | + return array('id', 'template', 'fields'); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | private function __construct() |
| 135 | 135 | { |
| 136 | - \add_filter('mce_external_plugins',array($this,'enqueue_script')); |
|
| 137 | - \add_action('admin_init', array($this,'enqueue_editor_style')); |
|
| 138 | - \add_action('admin_enqueue_scripts', array($this,'enqueue_popup_style')); |
|
| 139 | - \add_action('wp_enqueue_scripts', array($this,'enqueue_popup_style')); |
|
| 136 | + \add_filter('mce_external_plugins', array($this, 'enqueue_script')); |
|
| 137 | + \add_action('admin_init', array($this, 'enqueue_editor_style')); |
|
| 138 | + \add_action('admin_enqueue_scripts', array($this, 'enqueue_popup_style')); |
|
| 139 | + \add_action('wp_enqueue_scripts', array($this, 'enqueue_popup_style')); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | \ No newline at end of file |