@@ -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 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | private function prepare_json_object() |
| 66 | 66 | { |
| 67 | 67 | $json = array(); |
| 68 | - foreach($this->shortcodes as $id => $shortcode) |
|
| 68 | + foreach ($this->shortcodes as $id => $shortcode) |
|
| 69 | 69 | { |
| 70 | 70 | $popup = new Popup($shortcode['fields']); |
| 71 | 71 | $json[$id] = $shortcode; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | * Check if a shortcode with the given ID has already been registered |
| 97 | 97 | */ |
| 98 | - private function shortcode_exists( $id ) |
|
| 98 | + private function shortcode_exists($id) |
|
| 99 | 99 | { |
| 100 | 100 | return array_key_exists($id, $this->shortcodes); |
| 101 | 101 | } |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | * Validate that the provided arguments have the required arguments as |
| 105 | 105 | * specified in self::required_args() |
| 106 | 106 | */ |
| 107 | - private function validate_args( $args ) |
|
| 107 | + private function validate_args($args) |
|
| 108 | 108 | { |
| 109 | - foreach($this->required_args() as $arg) |
|
| 109 | + foreach ($this->required_args() as $arg) |
|
| 110 | 110 | { |
| 111 | - if(!array_key_exists($arg, $args)) |
|
| 111 | + if (!array_key_exists($arg, $args)) |
|
| 112 | 112 | { |
| 113 | 113 | throw new \RuntimeException("Missing required argument '$arg'"); |
| 114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | private function required_args() |
| 122 | 122 | { |
| 123 | - return array('id','template','fields'); |
|
| 123 | + return array('id', 'template', 'fields'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private function __construct() |
| 130 | 130 | { |
| 131 | - \add_filter('mce_external_plugins',array($this,'enqueue_script')); |
|
| 132 | - \add_action('admin_init', array($this,'enqueue_style')); |
|
| 131 | + \add_filter('mce_external_plugins', array($this, 'enqueue_script')); |
|
| 132 | + \add_action('admin_init', array($this, 'enqueue_style')); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | \ No newline at end of file |
@@ -12,17 +12,17 @@ |
||
| 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); |