| @@ -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 | // Load required classes if not using composer | 
| 18 | 18 | } | 
| 19 | 19 | \ No newline at end of file | 
| @@ -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'; | 
| 13 | 13 | \ No newline at end of file | 
| @@ -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')) | 
| @@ -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); | 
| @@ -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 |