@@ -8,10 +8,10 @@ |
||
| 8 | 8 | * @subpackage Contract\Axolotl |
| 9 | 9 | */ |
| 10 | 10 | interface UsesWordPressTerm { |
| 11 | - /** |
|
| 12 | - * Returns the taxonomy used by the Model. |
|
| 13 | - * |
|
| 14 | - * @return string |
|
| 15 | - */ |
|
| 16 | - public static function get_taxonomy(); |
|
| 11 | + /** |
|
| 12 | + * Returns the taxonomy used by the Model. |
|
| 13 | + * |
|
| 14 | + * @return string |
|
| 15 | + */ |
|
| 16 | + public static function get_taxonomy(); |
|
| 17 | 17 | } |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | namespace Intraxia\Jaxion\Contract\Axolotl; |
| 3 | 3 | |
| 4 | 4 | interface UsesCustomTable { |
| 5 | - /** |
|
| 6 | - * Returns the custom table name used by the model. |
|
| 7 | - * |
|
| 8 | - * @return string |
|
| 9 | - */ |
|
| 10 | - public static function get_table_name(); |
|
| 5 | + /** |
|
| 6 | + * Returns the custom table name used by the model. |
|
| 7 | + * |
|
| 8 | + * @return string |
|
| 9 | + */ |
|
| 10 | + public static function get_table_name(); |
|
| 11 | 11 | } |
@@ -6,62 +6,62 @@ |
||
| 6 | 6 | use WP_Error; |
| 7 | 7 | |
| 8 | 8 | interface EntityManager { |
| 9 | - /** |
|
| 10 | - * Get a single model of the provided class with the given ID. |
|
| 11 | - * |
|
| 12 | - * @param string $class Fully qualified class name of model. |
|
| 13 | - * @param int $id ID of the model. |
|
| 14 | - * |
|
| 15 | - * @return Model|WP_Error |
|
| 16 | - */ |
|
| 17 | - public function find( $class, $id ); |
|
| 9 | + /** |
|
| 10 | + * Get a single model of the provided class with the given ID. |
|
| 11 | + * |
|
| 12 | + * @param string $class Fully qualified class name of model. |
|
| 13 | + * @param int $id ID of the model. |
|
| 14 | + * |
|
| 15 | + * @return Model|WP_Error |
|
| 16 | + */ |
|
| 17 | + public function find( $class, $id ); |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Finds all the models of the provided class for the given params. |
|
| 21 | - * |
|
| 22 | - * This method will return an empty Collection if the query returns no models. |
|
| 23 | - * |
|
| 24 | - * @param string $class Fully qualified class name of models to find. |
|
| 25 | - * @param array $params Params to constrain the find. |
|
| 26 | - * |
|
| 27 | - * @return Collection|WP_Error |
|
| 28 | - */ |
|
| 29 | - public function find_by( $class, $params = array() ); |
|
| 19 | + /** |
|
| 20 | + * Finds all the models of the provided class for the given params. |
|
| 21 | + * |
|
| 22 | + * This method will return an empty Collection if the query returns no models. |
|
| 23 | + * |
|
| 24 | + * @param string $class Fully qualified class name of models to find. |
|
| 25 | + * @param array $params Params to constrain the find. |
|
| 26 | + * |
|
| 27 | + * @return Collection|WP_Error |
|
| 28 | + */ |
|
| 29 | + public function find_by( $class, $params = array() ); |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Saves a new model of the provided class with the given data. |
|
| 33 | - * |
|
| 34 | - * @param string $class |
|
| 35 | - * @param array $data |
|
| 36 | - * |
|
| 37 | - * @return Model|WP_Error |
|
| 38 | - */ |
|
| 39 | - public function create( $class, $data = array() ); |
|
| 31 | + /** |
|
| 32 | + * Saves a new model of the provided class with the given data. |
|
| 33 | + * |
|
| 34 | + * @param string $class |
|
| 35 | + * @param array $data |
|
| 36 | + * |
|
| 37 | + * @return Model|WP_Error |
|
| 38 | + */ |
|
| 39 | + public function create( $class, $data = array() ); |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Updates a model with its latest data. |
|
| 43 | - * |
|
| 44 | - * @param Model $model |
|
| 45 | - * |
|
| 46 | - * @return Model|WP_Error |
|
| 47 | - */ |
|
| 48 | - public function persist( Model $model ); |
|
| 41 | + /** |
|
| 42 | + * Updates a model with its latest data. |
|
| 43 | + * |
|
| 44 | + * @param Model $model |
|
| 45 | + * |
|
| 46 | + * @return Model|WP_Error |
|
| 47 | + */ |
|
| 48 | + public function persist( Model $model ); |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Delete the provided Model. |
|
| 52 | - * |
|
| 53 | - * @param Model $model |
|
| 54 | - * @param bool $force |
|
| 55 | - * |
|
| 56 | - * @return Model|WP_Error |
|
| 57 | - */ |
|
| 58 | - public function delete( Model $model, $force = false ); |
|
| 50 | + /** |
|
| 51 | + * Delete the provided Model. |
|
| 52 | + * |
|
| 53 | + * @param Model $model |
|
| 54 | + * @param bool $force |
|
| 55 | + * |
|
| 56 | + * @return Model|WP_Error |
|
| 57 | + */ |
|
| 58 | + public function delete( Model $model, $force = false ); |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Frees all currently managed models from the EntityManager. |
|
| 62 | - * |
|
| 63 | - * This ensures no models are managed by the Manager and all |
|
| 64 | - * future models are refetched from the database. |
|
| 65 | - */ |
|
| 66 | - public function free(); |
|
| 60 | + /** |
|
| 61 | + * Frees all currently managed models from the EntityManager. |
|
| 62 | + * |
|
| 63 | + * This ensures no models are managed by the Manager and all |
|
| 64 | + * future models are refetched from the database. |
|
| 65 | + */ |
|
| 66 | + public function free(); |
|
| 67 | 67 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @return Model|WP_Error |
| 16 | 16 | */ |
| 17 | - public function find( $class, $id ); |
|
| 17 | + public function find($class, $id); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Finds all the models of the provided class for the given params. |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return Collection|WP_Error |
| 28 | 28 | */ |
| 29 | - public function find_by( $class, $params = array() ); |
|
| 29 | + public function find_by($class, $params = array()); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Saves a new model of the provided class with the given data. |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return Model|WP_Error |
| 38 | 38 | */ |
| 39 | - public function create( $class, $data = array() ); |
|
| 39 | + public function create($class, $data = array()); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Updates a model with its latest data. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return Model|WP_Error |
| 47 | 47 | */ |
| 48 | - public function persist( Model $model ); |
|
| 48 | + public function persist(Model $model); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Delete the provided Model. |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return Model|WP_Error |
| 57 | 57 | */ |
| 58 | - public function delete( Model $model, $force = false ); |
|
| 58 | + public function delete(Model $model, $force = false); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Frees all currently managed models from the EntityManager. |
@@ -2,13 +2,13 @@ |
||
| 2 | 2 | namespace Intraxia\Jaxion\Contract\Axolotl; |
| 3 | 3 | |
| 4 | 4 | interface HasEagerRelationships { |
| 5 | - /** |
|
| 6 | - * Returns an array of relationships to load eagerly with the Model. |
|
| 7 | - * |
|
| 8 | - * This should define relationships that are always loaded with the Model, |
|
| 9 | - * to ensure the relationships are cached and queried together. |
|
| 10 | - * |
|
| 11 | - * @return array |
|
| 12 | - */ |
|
| 13 | - public static function get_eager_relationships(); |
|
| 5 | + /** |
|
| 6 | + * Returns an array of relationships to load eagerly with the Model. |
|
| 7 | + * |
|
| 8 | + * This should define relationships that are always loaded with the Model, |
|
| 9 | + * to ensure the relationships are cached and queried together. |
|
| 10 | + * |
|
| 11 | + * @return array |
|
| 12 | + */ |
|
| 13 | + public static function get_eager_relationships(); |
|
| 14 | 14 | } |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | namespace Intraxia\Jaxion\Contract\Axolotl; |
| 3 | 3 | |
| 4 | 4 | interface Serializes { |
| 5 | - /** |
|
| 6 | - * Serializes the model's public data into an array. |
|
| 7 | - * |
|
| 8 | - * @return array |
|
| 9 | - */ |
|
| 10 | - public function serialize(); |
|
| 5 | + /** |
|
| 6 | + * Serializes the model's public data into an array. |
|
| 7 | + * |
|
| 8 | + * @return array |
|
| 9 | + */ |
|
| 10 | + public function serialize(); |
|
| 11 | 11 | } |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | * @subpackage Contract\Axolotl |
| 9 | 9 | */ |
| 10 | 10 | interface UsesWordPressPost { |
| 11 | - /** |
|
| 12 | - * Returns the custom post type used by the Model. |
|
| 13 | - * |
|
| 14 | - * @return string |
|
| 15 | - */ |
|
| 16 | - public static function get_post_type(); |
|
| 11 | + /** |
|
| 12 | + * Returns the custom post type used by the Model. |
|
| 13 | + * |
|
| 14 | + * @return string |
|
| 15 | + */ |
|
| 16 | + public static function get_post_type(); |
|
| 17 | 17 | } |
@@ -12,202 +12,202 @@ |
||
| 12 | 12 | * @subpackage Register |
| 13 | 13 | */ |
| 14 | 14 | class Register implements RegisterContract { |
| 15 | - /** |
|
| 16 | - * Minification string for enqueued assets. |
|
| 17 | - * |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 20 | - private $min = ''; |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Url to the plugin directory. |
|
| 24 | - * |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 27 | - protected $url; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Script/plugin version. |
|
| 31 | - * |
|
| 32 | - * @var string |
|
| 33 | - */ |
|
| 34 | - protected $version; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Array of script definition arrays. |
|
| 38 | - * |
|
| 39 | - * @var array |
|
| 40 | - */ |
|
| 41 | - private $scripts = array(); |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Array of style definition arrays. |
|
| 45 | - * |
|
| 46 | - * @var array |
|
| 47 | - */ |
|
| 48 | - private $styles = array(); |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Instantiates a new instance of the Register class. |
|
| 52 | - * |
|
| 53 | - * The URL param should be relative to the plugin directory. The URL |
|
| 54 | - * form should always end with a '/'. All asset location definitions |
|
| 55 | - * should not begin with a slash and should be relative to the plugin's |
|
| 56 | - * root directory. The URL provided by default from the Application |
|
| 57 | - * class is compatible. |
|
| 58 | - * |
|
| 59 | - * @param string $url |
|
| 60 | - * @param string $version |
|
| 61 | - */ |
|
| 62 | - public function __construct( $url, $version = null ) { |
|
| 63 | - $this->url = $url; |
|
| 64 | - $this->version = $version ? : null; // Empty string should remain null. |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * {@inheritdoc} |
|
| 69 | - * |
|
| 70 | - * @param bool $debug |
|
| 71 | - */ |
|
| 72 | - public function set_debug( $debug ) { |
|
| 73 | - if ( $debug ) { |
|
| 74 | - $this->min = '.min'; |
|
| 75 | - } else { |
|
| 76 | - $this->min = ''; |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * {@inheritdoc} |
|
| 82 | - * |
|
| 83 | - * @param array $script |
|
| 84 | - */ |
|
| 85 | - public function register_script( $script ) { |
|
| 86 | - $this->scripts[] = $script; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * {@inheritdoc} |
|
| 91 | - * |
|
| 92 | - * @param array $style |
|
| 93 | - */ |
|
| 94 | - public function register_style( $style ) { |
|
| 95 | - $this->styles[] = $style; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * {@inheritDoc} |
|
| 100 | - */ |
|
| 101 | - public function enqueue_web_scripts() { |
|
| 102 | - foreach ( $this->scripts as $script ) { |
|
| 103 | - if ( in_array( $script['type'], array( 'web', 'shared' ) ) ) { |
|
| 104 | - $this->enqueue_script( $script ); |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * {@inheritDoc} |
|
| 111 | - */ |
|
| 112 | - public function enqueue_web_styles() { |
|
| 113 | - foreach ( $this->styles as $style ) { |
|
| 114 | - if ( in_array( $style['type'], array( 'web', 'shared' ) ) ) { |
|
| 115 | - $this->enqueue_style( $style ); |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * {@inheritDoc} |
|
| 122 | - */ |
|
| 123 | - public function enqueue_admin_scripts() { |
|
| 124 | - foreach ( $this->scripts as $script ) { |
|
| 125 | - if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) { |
|
| 126 | - $this->enqueue_script( $script ); |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * {@inheritDoc} |
|
| 133 | - */ |
|
| 134 | - public function enqueue_admin_styles() { |
|
| 135 | - foreach ( $this->styles as $style ) { |
|
| 136 | - if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) { |
|
| 137 | - $this->enqueue_style( $style ); |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * {@inheritDoc} |
|
| 144 | - * |
|
| 145 | - * @return array[] |
|
| 146 | - */ |
|
| 147 | - public function action_hooks() { |
|
| 148 | - return array( |
|
| 149 | - array( |
|
| 150 | - 'hook' => 'wp_enqueue_scripts', |
|
| 151 | - 'method' => 'enqueue_web_scripts', |
|
| 152 | - ), |
|
| 153 | - array( |
|
| 154 | - 'hook' => 'wp_enqueue_scripts', |
|
| 155 | - 'method' => 'enqueue_web_styles', |
|
| 156 | - ), |
|
| 157 | - array( |
|
| 158 | - 'hook' => 'admin_enqueue_scripts', |
|
| 159 | - 'method' => 'enqueue_admin_scripts', |
|
| 160 | - ), |
|
| 161 | - array( |
|
| 162 | - 'hook' => 'admin_enqueue_scripts', |
|
| 163 | - 'method' => 'enqueue_admin_styles', |
|
| 164 | - ), |
|
| 165 | - ); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * Enqueues an individual script if the style's condition is met. |
|
| 170 | - * |
|
| 171 | - * @param array $script |
|
| 172 | - */ |
|
| 173 | - protected function enqueue_script( $script ) { |
|
| 174 | - if ( $script['condition']() ) { |
|
| 175 | - wp_enqueue_script( |
|
| 176 | - $script['handle'], |
|
| 177 | - $this->url . $script['src'] . '.js', |
|
| 178 | - isset( $script['deps'] ) ? $script['deps'] : array(), |
|
| 179 | - $this->version, |
|
| 180 | - isset( $script['footer'] ) ? $script['footer'] : false |
|
| 181 | - ); |
|
| 182 | - |
|
| 183 | - if ( isset( $script['localize'] ) ) { |
|
| 184 | - if ( is_callable( $script['localize'] ) ) { // @todo make all properties callables |
|
| 185 | - $script['localize'] = call_user_func( $script['localize'] ); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - wp_localize_script( |
|
| 189 | - $script['handle'], |
|
| 190 | - $script['localize']['name'], |
|
| 191 | - $script['localize']['data'] |
|
| 192 | - ); |
|
| 193 | - } |
|
| 194 | - } |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Enqueues an individual stylesheet if the style's condition is met. |
|
| 199 | - * |
|
| 200 | - * @param array $style |
|
| 201 | - */ |
|
| 202 | - protected function enqueue_style( $style ) { |
|
| 203 | - if ( $style['condition']() ) { |
|
| 204 | - wp_enqueue_style( |
|
| 205 | - $style['handle'], |
|
| 206 | - $this->url . $style['src'] . '.css', |
|
| 207 | - isset( $style['deps'] ) ? $style['deps'] : array(), |
|
| 208 | - $this->version, |
|
| 209 | - isset( $style['media'] ) ? $style['media'] : 'all' |
|
| 210 | - ); |
|
| 211 | - } |
|
| 212 | - } |
|
| 15 | + /** |
|
| 16 | + * Minification string for enqueued assets. |
|
| 17 | + * |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | + private $min = ''; |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Url to the plugin directory. |
|
| 24 | + * |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | + protected $url; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Script/plugin version. |
|
| 31 | + * |
|
| 32 | + * @var string |
|
| 33 | + */ |
|
| 34 | + protected $version; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Array of script definition arrays. |
|
| 38 | + * |
|
| 39 | + * @var array |
|
| 40 | + */ |
|
| 41 | + private $scripts = array(); |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Array of style definition arrays. |
|
| 45 | + * |
|
| 46 | + * @var array |
|
| 47 | + */ |
|
| 48 | + private $styles = array(); |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Instantiates a new instance of the Register class. |
|
| 52 | + * |
|
| 53 | + * The URL param should be relative to the plugin directory. The URL |
|
| 54 | + * form should always end with a '/'. All asset location definitions |
|
| 55 | + * should not begin with a slash and should be relative to the plugin's |
|
| 56 | + * root directory. The URL provided by default from the Application |
|
| 57 | + * class is compatible. |
|
| 58 | + * |
|
| 59 | + * @param string $url |
|
| 60 | + * @param string $version |
|
| 61 | + */ |
|
| 62 | + public function __construct( $url, $version = null ) { |
|
| 63 | + $this->url = $url; |
|
| 64 | + $this->version = $version ? : null; // Empty string should remain null. |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * {@inheritdoc} |
|
| 69 | + * |
|
| 70 | + * @param bool $debug |
|
| 71 | + */ |
|
| 72 | + public function set_debug( $debug ) { |
|
| 73 | + if ( $debug ) { |
|
| 74 | + $this->min = '.min'; |
|
| 75 | + } else { |
|
| 76 | + $this->min = ''; |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * {@inheritdoc} |
|
| 82 | + * |
|
| 83 | + * @param array $script |
|
| 84 | + */ |
|
| 85 | + public function register_script( $script ) { |
|
| 86 | + $this->scripts[] = $script; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * {@inheritdoc} |
|
| 91 | + * |
|
| 92 | + * @param array $style |
|
| 93 | + */ |
|
| 94 | + public function register_style( $style ) { |
|
| 95 | + $this->styles[] = $style; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * {@inheritDoc} |
|
| 100 | + */ |
|
| 101 | + public function enqueue_web_scripts() { |
|
| 102 | + foreach ( $this->scripts as $script ) { |
|
| 103 | + if ( in_array( $script['type'], array( 'web', 'shared' ) ) ) { |
|
| 104 | + $this->enqueue_script( $script ); |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * {@inheritDoc} |
|
| 111 | + */ |
|
| 112 | + public function enqueue_web_styles() { |
|
| 113 | + foreach ( $this->styles as $style ) { |
|
| 114 | + if ( in_array( $style['type'], array( 'web', 'shared' ) ) ) { |
|
| 115 | + $this->enqueue_style( $style ); |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * {@inheritDoc} |
|
| 122 | + */ |
|
| 123 | + public function enqueue_admin_scripts() { |
|
| 124 | + foreach ( $this->scripts as $script ) { |
|
| 125 | + if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) { |
|
| 126 | + $this->enqueue_script( $script ); |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * {@inheritDoc} |
|
| 133 | + */ |
|
| 134 | + public function enqueue_admin_styles() { |
|
| 135 | + foreach ( $this->styles as $style ) { |
|
| 136 | + if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) { |
|
| 137 | + $this->enqueue_style( $style ); |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * {@inheritDoc} |
|
| 144 | + * |
|
| 145 | + * @return array[] |
|
| 146 | + */ |
|
| 147 | + public function action_hooks() { |
|
| 148 | + return array( |
|
| 149 | + array( |
|
| 150 | + 'hook' => 'wp_enqueue_scripts', |
|
| 151 | + 'method' => 'enqueue_web_scripts', |
|
| 152 | + ), |
|
| 153 | + array( |
|
| 154 | + 'hook' => 'wp_enqueue_scripts', |
|
| 155 | + 'method' => 'enqueue_web_styles', |
|
| 156 | + ), |
|
| 157 | + array( |
|
| 158 | + 'hook' => 'admin_enqueue_scripts', |
|
| 159 | + 'method' => 'enqueue_admin_scripts', |
|
| 160 | + ), |
|
| 161 | + array( |
|
| 162 | + 'hook' => 'admin_enqueue_scripts', |
|
| 163 | + 'method' => 'enqueue_admin_styles', |
|
| 164 | + ), |
|
| 165 | + ); |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * Enqueues an individual script if the style's condition is met. |
|
| 170 | + * |
|
| 171 | + * @param array $script |
|
| 172 | + */ |
|
| 173 | + protected function enqueue_script( $script ) { |
|
| 174 | + if ( $script['condition']() ) { |
|
| 175 | + wp_enqueue_script( |
|
| 176 | + $script['handle'], |
|
| 177 | + $this->url . $script['src'] . '.js', |
|
| 178 | + isset( $script['deps'] ) ? $script['deps'] : array(), |
|
| 179 | + $this->version, |
|
| 180 | + isset( $script['footer'] ) ? $script['footer'] : false |
|
| 181 | + ); |
|
| 182 | + |
|
| 183 | + if ( isset( $script['localize'] ) ) { |
|
| 184 | + if ( is_callable( $script['localize'] ) ) { // @todo make all properties callables |
|
| 185 | + $script['localize'] = call_user_func( $script['localize'] ); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + wp_localize_script( |
|
| 189 | + $script['handle'], |
|
| 190 | + $script['localize']['name'], |
|
| 191 | + $script['localize']['data'] |
|
| 192 | + ); |
|
| 193 | + } |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Enqueues an individual stylesheet if the style's condition is met. |
|
| 199 | + * |
|
| 200 | + * @param array $style |
|
| 201 | + */ |
|
| 202 | + protected function enqueue_style( $style ) { |
|
| 203 | + if ( $style['condition']() ) { |
|
| 204 | + wp_enqueue_style( |
|
| 205 | + $style['handle'], |
|
| 206 | + $this->url . $style['src'] . '.css', |
|
| 207 | + isset( $style['deps'] ) ? $style['deps'] : array(), |
|
| 208 | + $this->version, |
|
| 209 | + isset( $style['media'] ) ? $style['media'] : 'all' |
|
| 210 | + ); |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | 213 | } |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | * @param string $url |
| 60 | 60 | * @param string $version |
| 61 | 61 | */ |
| 62 | - public function __construct( $url, $version = null ) { |
|
| 62 | + public function __construct($url, $version = null) { |
|
| 63 | 63 | $this->url = $url; |
| 64 | - $this->version = $version ? : null; // Empty string should remain null. |
|
| 64 | + $this->version = $version ?: null; // Empty string should remain null. |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @param bool $debug |
| 71 | 71 | */ |
| 72 | - public function set_debug( $debug ) { |
|
| 73 | - if ( $debug ) { |
|
| 72 | + public function set_debug($debug) { |
|
| 73 | + if ($debug) { |
|
| 74 | 74 | $this->min = '.min'; |
| 75 | 75 | } else { |
| 76 | 76 | $this->min = ''; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @param array $script |
| 84 | 84 | */ |
| 85 | - public function register_script( $script ) { |
|
| 85 | + public function register_script($script) { |
|
| 86 | 86 | $this->scripts[] = $script; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @param array $style |
| 93 | 93 | */ |
| 94 | - public function register_style( $style ) { |
|
| 94 | + public function register_style($style) { |
|
| 95 | 95 | $this->styles[] = $style; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | * {@inheritDoc} |
| 100 | 100 | */ |
| 101 | 101 | public function enqueue_web_scripts() { |
| 102 | - foreach ( $this->scripts as $script ) { |
|
| 103 | - if ( in_array( $script['type'], array( 'web', 'shared' ) ) ) { |
|
| 104 | - $this->enqueue_script( $script ); |
|
| 102 | + foreach ($this->scripts as $script) { |
|
| 103 | + if (in_array($script['type'], array('web', 'shared'))) { |
|
| 104 | + $this->enqueue_script($script); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | * {@inheritDoc} |
| 111 | 111 | */ |
| 112 | 112 | public function enqueue_web_styles() { |
| 113 | - foreach ( $this->styles as $style ) { |
|
| 114 | - if ( in_array( $style['type'], array( 'web', 'shared' ) ) ) { |
|
| 115 | - $this->enqueue_style( $style ); |
|
| 113 | + foreach ($this->styles as $style) { |
|
| 114 | + if (in_array($style['type'], array('web', 'shared'))) { |
|
| 115 | + $this->enqueue_style($style); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | * {@inheritDoc} |
| 122 | 122 | */ |
| 123 | 123 | public function enqueue_admin_scripts() { |
| 124 | - foreach ( $this->scripts as $script ) { |
|
| 125 | - if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) { |
|
| 126 | - $this->enqueue_script( $script ); |
|
| 124 | + foreach ($this->scripts as $script) { |
|
| 125 | + if (in_array($script['type'], array('admin', 'shared'))) { |
|
| 126 | + $this->enqueue_script($script); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | * {@inheritDoc} |
| 133 | 133 | */ |
| 134 | 134 | public function enqueue_admin_styles() { |
| 135 | - foreach ( $this->styles as $style ) { |
|
| 136 | - if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) { |
|
| 137 | - $this->enqueue_style( $style ); |
|
| 135 | + foreach ($this->styles as $style) { |
|
| 136 | + if (in_array($style['type'], array('admin', 'shared'))) { |
|
| 137 | + $this->enqueue_style($style); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -170,19 +170,19 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @param array $script |
| 172 | 172 | */ |
| 173 | - protected function enqueue_script( $script ) { |
|
| 174 | - if ( $script['condition']() ) { |
|
| 173 | + protected function enqueue_script($script) { |
|
| 174 | + if ($script['condition']()) { |
|
| 175 | 175 | wp_enqueue_script( |
| 176 | 176 | $script['handle'], |
| 177 | 177 | $this->url . $script['src'] . '.js', |
| 178 | - isset( $script['deps'] ) ? $script['deps'] : array(), |
|
| 178 | + isset($script['deps']) ? $script['deps'] : array(), |
|
| 179 | 179 | $this->version, |
| 180 | - isset( $script['footer'] ) ? $script['footer'] : false |
|
| 180 | + isset($script['footer']) ? $script['footer'] : false |
|
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | - if ( isset( $script['localize'] ) ) { |
|
| 184 | - if ( is_callable( $script['localize'] ) ) { // @todo make all properties callables |
|
| 185 | - $script['localize'] = call_user_func( $script['localize'] ); |
|
| 183 | + if (isset($script['localize'])) { |
|
| 184 | + if (is_callable($script['localize'])) { // @todo make all properties callables |
|
| 185 | + $script['localize'] = call_user_func($script['localize']); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | wp_localize_script( |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @param array $style |
| 201 | 201 | */ |
| 202 | - protected function enqueue_style( $style ) { |
|
| 203 | - if ( $style['condition']() ) { |
|
| 202 | + protected function enqueue_style($style) { |
|
| 203 | + if ($style['condition']()) { |
|
| 204 | 204 | wp_enqueue_style( |
| 205 | 205 | $style['handle'], |
| 206 | 206 | $this->url . $style['src'] . '.css', |
| 207 | - isset( $style['deps'] ) ? $style['deps'] : array(), |
|
| 207 | + isset($style['deps']) ? $style['deps'] : array(), |
|
| 208 | 208 | $this->version, |
| 209 | - isset( $style['media'] ) ? $style['media'] : 'all' |
|
| 209 | + isset($style['media']) ? $style['media'] : 'all' |
|
| 210 | 210 | ); |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -11,40 +11,40 @@ |
||
| 11 | 11 | * @subpackage Assets |
| 12 | 12 | */ |
| 13 | 13 | class ServiceProvider implements ServiceProviderContract { |
| 14 | - /** |
|
| 15 | - * Container to register with. |
|
| 16 | - * |
|
| 17 | - * @var Container |
|
| 18 | - */ |
|
| 19 | - protected $container; |
|
| 14 | + /** |
|
| 15 | + * Container to register with. |
|
| 16 | + * |
|
| 17 | + * @var Container |
|
| 18 | + */ |
|
| 19 | + protected $container; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * {@inheritDoc} |
|
| 23 | - * |
|
| 24 | - * @param Container $container |
|
| 25 | - */ |
|
| 26 | - public function register( Container $container ) { |
|
| 27 | - $this->container = $container; |
|
| 21 | + /** |
|
| 22 | + * {@inheritDoc} |
|
| 23 | + * |
|
| 24 | + * @param Container $container |
|
| 25 | + */ |
|
| 26 | + public function register( Container $container ) { |
|
| 27 | + $this->container = $container; |
|
| 28 | 28 | |
| 29 | - $container->define( |
|
| 30 | - array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ), |
|
| 31 | - $register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) ) |
|
| 32 | - ); |
|
| 29 | + $container->define( |
|
| 30 | + array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ), |
|
| 31 | + $register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) ) |
|
| 32 | + ); |
|
| 33 | 33 | |
| 34 | - $this->add_assets( $register ); |
|
| 35 | - } |
|
| 34 | + $this->add_assets( $register ); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Registers the assets on the generated Register. |
|
| 39 | - * |
|
| 40 | - * This is a no-op by default by can be overwritten by the implementing developer |
|
| 41 | - * to provide a single, clean location to register their assets. |
|
| 42 | - * |
|
| 43 | - * @param Register $register |
|
| 44 | - * |
|
| 45 | - * @codeCoverageIgnore |
|
| 46 | - */ |
|
| 47 | - protected function add_assets( Register $register ) { |
|
| 48 | - // no-op |
|
| 49 | - } |
|
| 37 | + /** |
|
| 38 | + * Registers the assets on the generated Register. |
|
| 39 | + * |
|
| 40 | + * This is a no-op by default by can be overwritten by the implementing developer |
|
| 41 | + * to provide a single, clean location to register their assets. |
|
| 42 | + * |
|
| 43 | + * @param Register $register |
|
| 44 | + * |
|
| 45 | + * @codeCoverageIgnore |
|
| 46 | + */ |
|
| 47 | + protected function add_assets( Register $register ) { |
|
| 48 | + // no-op |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @param Container $container |
| 25 | 25 | */ |
| 26 | - public function register( Container $container ) { |
|
| 26 | + public function register(Container $container) { |
|
| 27 | 27 | $this->container = $container; |
| 28 | 28 | |
| 29 | 29 | $container->define( |
| 30 | - array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ), |
|
| 31 | - $register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) ) |
|
| 30 | + array('assets' => 'Intraxia\Jaxion\Contract\Assets\Register'), |
|
| 31 | + $register = new Register($container->fetch('url'), $container->fetch('version')) |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - $this->add_assets( $register ); |
|
| 34 | + $this->add_assets($register); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @codeCoverageIgnore |
| 46 | 46 | */ |
| 47 | - protected function add_assets( Register $register ) { |
|
| 47 | + protected function add_assets(Register $register) { |
|
| 48 | 48 | // no-op |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -15,109 +15,109 @@ |
||
| 15 | 15 | * @subpackage Core |
| 16 | 16 | */ |
| 17 | 17 | class Loader implements LoaderContract { |
| 18 | - /** |
|
| 19 | - * Array of action hooks to attach. |
|
| 20 | - * |
|
| 21 | - * @var array[] |
|
| 22 | - */ |
|
| 23 | - protected $actions = array(); |
|
| 18 | + /** |
|
| 19 | + * Array of action hooks to attach. |
|
| 20 | + * |
|
| 21 | + * @var array[] |
|
| 22 | + */ |
|
| 23 | + protected $actions = array(); |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Array of filter hooks to attach. |
|
| 27 | - * |
|
| 28 | - * @var array[] |
|
| 29 | - */ |
|
| 30 | - protected $filters = array(); |
|
| 25 | + /** |
|
| 26 | + * Array of filter hooks to attach. |
|
| 27 | + * |
|
| 28 | + * @var array[] |
|
| 29 | + */ |
|
| 30 | + protected $filters = array(); |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * {@inheritDoc} |
|
| 34 | - */ |
|
| 35 | - public function run() { |
|
| 36 | - foreach ( $this->actions as $action ) { |
|
| 37 | - add_action( |
|
| 38 | - $action['hook'], |
|
| 39 | - array( $action['service'], $action['method'] ), |
|
| 40 | - $action['priority'], |
|
| 41 | - $action['args'] |
|
| 42 | - ); |
|
| 43 | - } |
|
| 32 | + /** |
|
| 33 | + * {@inheritDoc} |
|
| 34 | + */ |
|
| 35 | + public function run() { |
|
| 36 | + foreach ( $this->actions as $action ) { |
|
| 37 | + add_action( |
|
| 38 | + $action['hook'], |
|
| 39 | + array( $action['service'], $action['method'] ), |
|
| 40 | + $action['priority'], |
|
| 41 | + $action['args'] |
|
| 42 | + ); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - foreach ( $this->filters as $filter ) { |
|
| 46 | - add_filter( |
|
| 47 | - $filter['hook'], |
|
| 48 | - array( $filter['service'], $filter['method'] ), |
|
| 49 | - $filter['priority'], |
|
| 50 | - $filter['args'] |
|
| 51 | - ); |
|
| 52 | - } |
|
| 53 | - } |
|
| 45 | + foreach ( $this->filters as $filter ) { |
|
| 46 | + add_filter( |
|
| 47 | + $filter['hook'], |
|
| 48 | + array( $filter['service'], $filter['method'] ), |
|
| 49 | + $filter['priority'], |
|
| 50 | + $filter['args'] |
|
| 51 | + ); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * {@inheritDoc} |
|
| 57 | - * |
|
| 58 | - * @param HasActions $service |
|
| 59 | - */ |
|
| 60 | - public function register_actions( HasActions $service ) { |
|
| 61 | - foreach ( $service->action_hooks() as $action ) { |
|
| 62 | - $this->actions = $this->add( |
|
| 63 | - $this->actions, |
|
| 64 | - $action['hook'], |
|
| 65 | - $service, |
|
| 66 | - $action['method'], |
|
| 67 | - isset( $action['priority'] ) ? $action['priority'] : 10, |
|
| 68 | - isset( $action['args'] ) ? $action['args'] : 1 |
|
| 69 | - ); |
|
| 70 | - } |
|
| 71 | - } |
|
| 55 | + /** |
|
| 56 | + * {@inheritDoc} |
|
| 57 | + * |
|
| 58 | + * @param HasActions $service |
|
| 59 | + */ |
|
| 60 | + public function register_actions( HasActions $service ) { |
|
| 61 | + foreach ( $service->action_hooks() as $action ) { |
|
| 62 | + $this->actions = $this->add( |
|
| 63 | + $this->actions, |
|
| 64 | + $action['hook'], |
|
| 65 | + $service, |
|
| 66 | + $action['method'], |
|
| 67 | + isset( $action['priority'] ) ? $action['priority'] : 10, |
|
| 68 | + isset( $action['args'] ) ? $action['args'] : 1 |
|
| 69 | + ); |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * {@inheritDoc} |
|
| 75 | - * |
|
| 76 | - * @param HasFilters $service |
|
| 77 | - */ |
|
| 78 | - public function register_filters( HasFilters $service ) { |
|
| 79 | - foreach ( $service->filter_hooks() as $filter ) { |
|
| 80 | - $this->filters = $this->add( |
|
| 81 | - $this->filters, |
|
| 82 | - $filter['hook'], |
|
| 83 | - $service, |
|
| 84 | - $filter['method'], |
|
| 85 | - isset( $filter['priority'] ) ? $filter['priority'] : 10, |
|
| 86 | - isset( $filter['args'] ) ? $filter['args'] : 1 |
|
| 87 | - ); |
|
| 88 | - } |
|
| 89 | - } |
|
| 73 | + /** |
|
| 74 | + * {@inheritDoc} |
|
| 75 | + * |
|
| 76 | + * @param HasFilters $service |
|
| 77 | + */ |
|
| 78 | + public function register_filters( HasFilters $service ) { |
|
| 79 | + foreach ( $service->filter_hooks() as $filter ) { |
|
| 80 | + $this->filters = $this->add( |
|
| 81 | + $this->filters, |
|
| 82 | + $filter['hook'], |
|
| 83 | + $service, |
|
| 84 | + $filter['method'], |
|
| 85 | + isset( $filter['priority'] ) ? $filter['priority'] : 10, |
|
| 86 | + isset( $filter['args'] ) ? $filter['args'] : 1 |
|
| 87 | + ); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * {@inheritDoc} |
|
| 93 | - * |
|
| 94 | - * @param HasShortcode $service |
|
| 95 | - */ |
|
| 96 | - public function register_shortcode( HasShortcode $service ) { |
|
| 97 | - add_shortcode( $service->shortcode_name(), array( $service, 'do_shortcode' ) ); |
|
| 98 | - } |
|
| 91 | + /** |
|
| 92 | + * {@inheritDoc} |
|
| 93 | + * |
|
| 94 | + * @param HasShortcode $service |
|
| 95 | + */ |
|
| 96 | + public function register_shortcode( HasShortcode $service ) { |
|
| 97 | + add_shortcode( $service->shortcode_name(), array( $service, 'do_shortcode' ) ); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Utility to register the actions and hooks into a single collection. |
|
| 102 | - * |
|
| 103 | - * @param array $hooks |
|
| 104 | - * @param string $hook |
|
| 105 | - * @param object $service |
|
| 106 | - * @param string $method |
|
| 107 | - * @param int $priority |
|
| 108 | - * @param int $accepted_args |
|
| 109 | - * |
|
| 110 | - * @return array |
|
| 111 | - */ |
|
| 112 | - protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) { |
|
| 113 | - $hooks[] = array( |
|
| 114 | - 'hook' => $hook, |
|
| 115 | - 'service' => $service, |
|
| 116 | - 'method' => $method, |
|
| 117 | - 'priority' => $priority, |
|
| 118 | - 'args' => $accepted_args, |
|
| 119 | - ); |
|
| 100 | + /** |
|
| 101 | + * Utility to register the actions and hooks into a single collection. |
|
| 102 | + * |
|
| 103 | + * @param array $hooks |
|
| 104 | + * @param string $hook |
|
| 105 | + * @param object $service |
|
| 106 | + * @param string $method |
|
| 107 | + * @param int $priority |
|
| 108 | + * @param int $accepted_args |
|
| 109 | + * |
|
| 110 | + * @return array |
|
| 111 | + */ |
|
| 112 | + protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) { |
|
| 113 | + $hooks[] = array( |
|
| 114 | + 'hook' => $hook, |
|
| 115 | + 'service' => $service, |
|
| 116 | + 'method' => $method, |
|
| 117 | + 'priority' => $priority, |
|
| 118 | + 'args' => $accepted_args, |
|
| 119 | + ); |
|
| 120 | 120 | |
| 121 | - return $hooks; |
|
| 122 | - } |
|
| 121 | + return $hooks; |
|
| 122 | + } |
|
| 123 | 123 | } |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | * {@inheritDoc} |
| 34 | 34 | */ |
| 35 | 35 | public function run() { |
| 36 | - foreach ( $this->actions as $action ) { |
|
| 36 | + foreach ($this->actions as $action) { |
|
| 37 | 37 | add_action( |
| 38 | 38 | $action['hook'], |
| 39 | - array( $action['service'], $action['method'] ), |
|
| 39 | + array($action['service'], $action['method']), |
|
| 40 | 40 | $action['priority'], |
| 41 | 41 | $action['args'] |
| 42 | 42 | ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - foreach ( $this->filters as $filter ) { |
|
| 45 | + foreach ($this->filters as $filter) { |
|
| 46 | 46 | add_filter( |
| 47 | 47 | $filter['hook'], |
| 48 | - array( $filter['service'], $filter['method'] ), |
|
| 48 | + array($filter['service'], $filter['method']), |
|
| 49 | 49 | $filter['priority'], |
| 50 | 50 | $filter['args'] |
| 51 | 51 | ); |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @param HasActions $service |
| 59 | 59 | */ |
| 60 | - public function register_actions( HasActions $service ) { |
|
| 61 | - foreach ( $service->action_hooks() as $action ) { |
|
| 60 | + public function register_actions(HasActions $service) { |
|
| 61 | + foreach ($service->action_hooks() as $action) { |
|
| 62 | 62 | $this->actions = $this->add( |
| 63 | 63 | $this->actions, |
| 64 | 64 | $action['hook'], |
| 65 | 65 | $service, |
| 66 | 66 | $action['method'], |
| 67 | - isset( $action['priority'] ) ? $action['priority'] : 10, |
|
| 68 | - isset( $action['args'] ) ? $action['args'] : 1 |
|
| 67 | + isset($action['priority']) ? $action['priority'] : 10, |
|
| 68 | + isset($action['args']) ? $action['args'] : 1 |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -75,15 +75,15 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @param HasFilters $service |
| 77 | 77 | */ |
| 78 | - public function register_filters( HasFilters $service ) { |
|
| 79 | - foreach ( $service->filter_hooks() as $filter ) { |
|
| 78 | + public function register_filters(HasFilters $service) { |
|
| 79 | + foreach ($service->filter_hooks() as $filter) { |
|
| 80 | 80 | $this->filters = $this->add( |
| 81 | 81 | $this->filters, |
| 82 | 82 | $filter['hook'], |
| 83 | 83 | $service, |
| 84 | 84 | $filter['method'], |
| 85 | - isset( $filter['priority'] ) ? $filter['priority'] : 10, |
|
| 86 | - isset( $filter['args'] ) ? $filter['args'] : 1 |
|
| 85 | + isset($filter['priority']) ? $filter['priority'] : 10, |
|
| 86 | + isset($filter['args']) ? $filter['args'] : 1 |
|
| 87 | 87 | ); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @param HasShortcode $service |
| 95 | 95 | */ |
| 96 | - public function register_shortcode( HasShortcode $service ) { |
|
| 97 | - add_shortcode( $service->shortcode_name(), array( $service, 'do_shortcode' ) ); |
|
| 96 | + public function register_shortcode(HasShortcode $service) { |
|
| 97 | + add_shortcode($service->shortcode_name(), array($service, 'do_shortcode')); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return array |
| 111 | 111 | */ |
| 112 | - protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) { |
|
| 112 | + protected function add($hooks, $hook, $service, $method, $priority, $accepted_args) { |
|
| 113 | 113 | $hooks[] = array( |
| 114 | 114 | 'hook' => $hook, |
| 115 | 115 | 'service' => $service, |