@@ -22,7 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @param string $property Property that was guarded. |
24 | 24 | */ |
25 | - public function __construct( $property ) { |
|
25 | + public function __construct($property) { |
|
26 | 26 | parent::__construct(); |
27 | 27 | |
28 | 28 | $this->property = $property; |
@@ -73,21 +73,21 @@ discard block |
||
73 | 73 | * @param string $type |
74 | 74 | * @param string $file |
75 | 75 | */ |
76 | - public function __construct( $type, $file ) { |
|
77 | - $this->type = new ConfigType( $type ); |
|
76 | + public function __construct($type, $file) { |
|
77 | + $this->type = new ConfigType($type); |
|
78 | 78 | $this->file = $file; |
79 | 79 | |
80 | - switch ( $this->type->getValue() ) { |
|
80 | + switch ($this->type->getValue()) { |
|
81 | 81 | case ConfigType::PLUGIN: |
82 | 82 | case ConfigType::MU_PLUGIN: |
83 | - $this->url = plugin_dir_url( $file ); |
|
84 | - $this->path = plugin_dir_path( $file ); |
|
85 | - $this->slug = dirname( $this->basename = plugin_basename( $file ) ); |
|
83 | + $this->url = plugin_dir_url($file); |
|
84 | + $this->path = plugin_dir_path($file); |
|
85 | + $this->slug = dirname($this->basename = plugin_basename($file)); |
|
86 | 86 | break; |
87 | 87 | case ConfigType::THEME: |
88 | - $this->url = get_stylesheet_directory_uri() . '/'; |
|
89 | - $this->path = get_stylesheet_directory() . '/'; |
|
90 | - $this->slug = dirname( $this->basename = plugin_basename( $file ) ); |
|
88 | + $this->url = get_stylesheet_directory_uri().'/'; |
|
89 | + $this->path = get_stylesheet_directory().'/'; |
|
90 | + $this->slug = dirname($this->basename = plugin_basename($file)); |
|
91 | 91 | break; |
92 | 92 | } |
93 | 93 | } |
@@ -99,24 +99,24 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return array|null |
101 | 101 | */ |
102 | - public function get_json_resource( $filename ) { |
|
103 | - if ( isset( $this->json[ $filename ] ) ) { |
|
104 | - return $this->json[ $filename ]; |
|
102 | + public function get_json_resource($filename) { |
|
103 | + if (isset($this->json[$filename])) { |
|
104 | + return $this->json[$filename]; |
|
105 | 105 | } |
106 | 106 | |
107 | - $path = $this->path . 'resources/' . $filename . '.json'; |
|
107 | + $path = $this->path.'resources/'.$filename.'.json'; |
|
108 | 108 | |
109 | - if ( ! file_exists( $path ) ) { |
|
109 | + if (!file_exists($path)) { |
|
110 | 110 | return null; |
111 | 111 | } |
112 | 112 | |
113 | - $contents = file_get_contents( $path ); |
|
113 | + $contents = file_get_contents($path); |
|
114 | 114 | |
115 | - if ( false === $contents ) { |
|
115 | + if (false === $contents) { |
|
116 | 116 | return null; |
117 | 117 | } |
118 | 118 | |
119 | - return $this->json[ $filename ] = json_decode( $contents, true ); |
|
119 | + return $this->json[$filename] = json_decode($contents, true); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,17 +126,17 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return array|null |
128 | 128 | */ |
129 | - public function get_php_config( $filename ) { |
|
130 | - if ( isset( $this->php[ $filename ] ) ) { |
|
131 | - return $this->php[ $filename ]; |
|
129 | + public function get_php_config($filename) { |
|
130 | + if (isset($this->php[$filename])) { |
|
131 | + return $this->php[$filename]; |
|
132 | 132 | } |
133 | 133 | |
134 | - $path = $this->path . 'resources/config/' . $filename . '.php'; |
|
134 | + $path = $this->path.'resources/config/'.$filename.'.php'; |
|
135 | 135 | |
136 | - if ( ! file_exists( $path ) ) { |
|
136 | + if (!file_exists($path)) { |
|
137 | 137 | return null; |
138 | 138 | } |
139 | 139 | |
140 | - return $this->php[ $filename ] = require $path; |
|
140 | + return $this->php[$filename] = require $path; |
|
141 | 141 | } |
142 | 142 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @return array |
18 | 18 | */ |
19 | 19 | public function filter_hooks() { |
20 | - return HooksReader::read( $this, function( $annotation ) { |
|
20 | + return HooksReader::read($this, function($annotation) { |
|
21 | 21 | return $annotation instanceof Annotation\Filter; |
22 | 22 | }); |
23 | 23 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return array |
29 | 29 | */ |
30 | 30 | public function action_hooks() { |
31 | - return HooksReader::read( $this, function( $annotation ) { |
|
31 | + return HooksReader::read($this, function($annotation) { |
|
32 | 32 | return $annotation instanceof Annotation\Action; |
33 | 33 | }); |
34 | 34 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | private function __construct() { |
18 | 18 | $this->reader = new AnnotationReader(); |
19 | 19 | AnnotationRegistry::registerFile( |
20 | - __DIR__ . '/Annotations.php' |
|
20 | + __DIR__.'/Annotations.php' |
|
21 | 21 | ); |
22 | 22 | } |
23 | 23 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | static private function instance() { |
39 | 39 | static $instance; |
40 | 40 | |
41 | - if ( ! $instance ) { |
|
41 | + if (!$instance) { |
|
42 | 42 | $instance = new HooksReader(); |
43 | 43 | } |
44 | 44 | |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | * @param \Closure $condition Whether the annotation should be registered. |
53 | 53 | * @return array |
54 | 54 | */ |
55 | - static public function read( $target, $condition ) { |
|
55 | + static public function read($target, $condition) { |
|
56 | 56 | $reader = static::instance()->reader(); |
57 | - $rmethods = (new ReflectionClass( $target ))->getMethods(); |
|
57 | + $rmethods = (new ReflectionClass($target))->getMethods(); |
|
58 | 58 | |
59 | 59 | $hooks = []; |
60 | 60 | |
61 | - foreach ( $rmethods as $rmethod ) { |
|
62 | - foreach ( $reader->getMethodAnnotations( $rmethod ) as $annotation ) { |
|
63 | - if ( $condition( $annotation ) ) { |
|
61 | + foreach ($rmethods as $rmethod) { |
|
62 | + foreach ($reader->getMethodAnnotations($rmethod) as $annotation) { |
|
63 | + if ($condition($annotation)) { |
|
64 | 64 | $hooks[] = [ |
65 | 65 | 'hook' => $annotation->hook, |
66 | 66 | 'method' => $rmethod->getName(), |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param array $options |
39 | 39 | */ |
40 | - public function __construct( array $options = array() ) { |
|
41 | - $this->options = $this->set_defaults( $options ); |
|
40 | + public function __construct(array $options = array()) { |
|
41 | + $this->options = $this->set_defaults($options); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,23 +48,23 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function authorized() { |
50 | 50 | // if the rule is public, always authorized |
51 | - if ( 'public' === $this->options['rule'] ) { |
|
51 | + if ('public' === $this->options['rule']) { |
|
52 | 52 | return true; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // enable passing in callback |
56 | - if ( 'callback' === $this->options['rule'] && is_callable( $this->options['callback'] ) ) { |
|
57 | - return call_user_func( $this->options['callback'] ); |
|
56 | + if ('callback' === $this->options['rule'] && is_callable($this->options['callback'])) { |
|
57 | + return call_user_func($this->options['callback']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // map rule to method |
61 | - if ( method_exists( $this, $method = $this->options['rule'] ) ) { |
|
61 | + if (method_exists($this, $method = $this->options['rule'])) { |
|
62 | 62 | return $this->{$method}(); |
63 | 63 | } |
64 | 64 | |
65 | 65 | // disable in rule is misconfigused |
66 | 66 | // @todo set up internal translations |
67 | - return new WP_Error( 'misconfigured_guard', __( 'Misconfigured guard rule', 'jaxion' ), [ 'status' => 500 ] ); |
|
67 | + return new WP_Error('misconfigured_guard', __('Misconfigured guard rule', 'jaxion'), ['status' => 500]); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return bool|WP_Error |
74 | 74 | */ |
75 | 75 | protected function can_edit_others_posts() { |
76 | - return current_user_can( 'edit_others_posts' ) ?: $this->make_error(); |
|
76 | + return current_user_can('edit_others_posts') ?: $this->make_error(); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return bool|WP_Error |
92 | 92 | */ |
93 | 93 | protected function can_manage_options() { |
94 | - return current_user_can( 'manage_options' ) ?: $this->make_error(); |
|
94 | + return current_user_can('manage_options') ?: $this->make_error(); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return array |
103 | 103 | */ |
104 | - protected function set_defaults( $options ) { |
|
104 | + protected function set_defaults($options) { |
|
105 | 105 | // these are the valid options |
106 | - return wp_parse_args( $options, $this->defaults ); |
|
106 | + return wp_parse_args($options, $this->defaults); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -112,6 +112,6 @@ discard block |
||
112 | 112 | * @return WP_Error |
113 | 113 | */ |
114 | 114 | protected function make_error() { |
115 | - return new WP_Error( 'unauthorized', __( 'Unauthorized user', 'jaxion' ), array( 'status' => 401 ) ); |
|
115 | + return new WP_Error('unauthorized', __('Unauthorized user', 'jaxion'), array('status' => 401)); |
|
116 | 116 | } |
117 | 117 | } |
@@ -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,17 +57,17 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param mixed $service |
59 | 59 | */ |
60 | - public function register( $service ) { |
|
61 | - if ( $service instanceof HasActions ) { |
|
62 | - $this->register_actions( $service ); |
|
60 | + public function register($service) { |
|
61 | + if ($service instanceof HasActions) { |
|
62 | + $this->register_actions($service); |
|
63 | 63 | } |
64 | 64 | |
65 | - if ( $service instanceof HasFilters ) { |
|
66 | - $this->register_filters( $service ); |
|
65 | + if ($service instanceof HasFilters) { |
|
66 | + $this->register_filters($service); |
|
67 | 67 | } |
68 | 68 | |
69 | - if ( $service instanceof HasShortcode ) { |
|
70 | - $this->register_shortcode( $service ); |
|
69 | + if ($service instanceof HasShortcode) { |
|
70 | + $this->register_shortcode($service); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param HasActions $service |
78 | 78 | */ |
79 | - public function register_actions( HasActions $service ) { |
|
80 | - foreach ( $service->action_hooks() as $action ) { |
|
79 | + public function register_actions(HasActions $service) { |
|
80 | + foreach ($service->action_hooks() as $action) { |
|
81 | 81 | $this->actions = $this->add( |
82 | 82 | $this->actions, |
83 | 83 | $action['hook'], |
84 | 84 | $service, |
85 | 85 | $action['method'], |
86 | - isset( $action['priority'] ) ? $action['priority'] : 10, |
|
87 | - isset( $action['args'] ) ? $action['args'] : 1 |
|
86 | + isset($action['priority']) ? $action['priority'] : 10, |
|
87 | + isset($action['args']) ? $action['args'] : 1 |
|
88 | 88 | ); |
89 | 89 | } |
90 | 90 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param HasFilters $service |
96 | 96 | */ |
97 | - public function register_filters( HasFilters $service ) { |
|
98 | - foreach ( $service->filter_hooks() as $filter ) { |
|
97 | + public function register_filters(HasFilters $service) { |
|
98 | + foreach ($service->filter_hooks() as $filter) { |
|
99 | 99 | $this->filters = $this->add( |
100 | 100 | $this->filters, |
101 | 101 | $filter['hook'], |
102 | 102 | $service, |
103 | 103 | $filter['method'], |
104 | - isset( $filter['priority'] ) ? $filter['priority'] : 10, |
|
105 | - isset( $filter['args'] ) ? $filter['args'] : 1 |
|
104 | + isset($filter['priority']) ? $filter['priority'] : 10, |
|
105 | + isset($filter['args']) ? $filter['args'] : 1 |
|
106 | 106 | ); |
107 | 107 | } |
108 | 108 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param HasShortcode $service |
114 | 114 | */ |
115 | - public function register_shortcode( HasShortcode $service ) { |
|
116 | - add_shortcode( $service->shortcode_name(), array( $service, 'do_shortcode' ) ); |
|
115 | + public function register_shortcode(HasShortcode $service) { |
|
116 | + add_shortcode($service->shortcode_name(), array($service, 'do_shortcode')); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return array |
130 | 130 | */ |
131 | - protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) { |
|
131 | + protected function add($hooks, $hook, $service, $method, $priority, $accepted_args) { |
|
132 | 132 | $hooks[] = array( |
133 | 133 | 'hook' => $hook, |
134 | 134 | 'service' => $service, |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @param array $script |
12 | 12 | */ |
13 | - public function register_script( $script ); |
|
13 | + public function register_script($script); |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Provides a method to register new styles outside of the constructor. |
17 | 17 | * |
18 | 18 | * @param array $style |
19 | 19 | */ |
20 | - public function register_style( $style ); |
|
20 | + public function register_style($style); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Enqueues the web & shared scripts on the Register. |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param string $hook Passes a string representing the current page. |
36 | 36 | */ |
37 | - public function enqueue_admin_scripts( $hook ); |
|
37 | + public function enqueue_admin_scripts($hook); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Enqueues the admin & shared styles on the Register. |
41 | 41 | * |
42 | 42 | * @param string $hook Passes a string representing the current page. |
43 | 43 | */ |
44 | - public function enqueue_admin_styles( $hook ); |
|
44 | + public function enqueue_admin_styles($hook); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Enqueues the block styles & registers the block. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $url |
53 | 53 | * @param string $version |
54 | 54 | */ |
55 | - public function __construct( $url, $version = null ) { |
|
55 | + public function __construct($url, $version = null) { |
|
56 | 56 | $this->url = $url; |
57 | 57 | $this->version = $version ?: null; // Empty string should remain null. |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param array $script |
64 | 64 | */ |
65 | - public function register_script( $script ) { |
|
65 | + public function register_script($script) { |
|
66 | 66 | $this->scripts[] = $script; |
67 | 67 | } |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @param array $style |
73 | 73 | */ |
74 | - public function register_style( $style ) { |
|
74 | + public function register_style($style) { |
|
75 | 75 | $this->styles[] = $style; |
76 | 76 | } |
77 | 77 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * {@inheritDoc} |
80 | 80 | */ |
81 | 81 | public function enqueue_web_scripts() { |
82 | - foreach ( $this->scripts as $script ) { |
|
83 | - if ( in_array( $script['type'], array( 'web', 'shared' ) ) ) { |
|
84 | - $this->enqueue_script( $script ); |
|
82 | + foreach ($this->scripts as $script) { |
|
83 | + if (in_array($script['type'], array('web', 'shared'))) { |
|
84 | + $this->enqueue_script($script); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * {@inheritDoc} |
91 | 91 | */ |
92 | 92 | public function enqueue_web_styles() { |
93 | - foreach ( $this->styles as $style ) { |
|
94 | - if ( in_array( $style['type'], array( 'web', 'shared' ) ) ) { |
|
95 | - $this->enqueue_style( $style ); |
|
93 | + foreach ($this->styles as $style) { |
|
94 | + if (in_array($style['type'], array('web', 'shared'))) { |
|
95 | + $this->enqueue_style($style); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @param string $hook Passes a string representing the current page. |
104 | 104 | */ |
105 | - public function enqueue_admin_scripts( $hook ) { |
|
106 | - foreach ( $this->scripts as $script ) { |
|
107 | - if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) { |
|
108 | - $this->enqueue_script( $script, $hook ); |
|
105 | + public function enqueue_admin_scripts($hook) { |
|
106 | + foreach ($this->scripts as $script) { |
|
107 | + if (in_array($script['type'], array('admin', 'shared'))) { |
|
108 | + $this->enqueue_script($script, $hook); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @param string $hook Passes a string representing the current page. |
117 | 117 | */ |
118 | - public function enqueue_admin_styles( $hook ) { |
|
119 | - foreach ( $this->styles as $style ) { |
|
120 | - if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) { |
|
121 | - $this->enqueue_style( $style, $hook ); |
|
118 | + public function enqueue_admin_styles($hook) { |
|
119 | + foreach ($this->styles as $style) { |
|
120 | + if (in_array($style['type'], array('admin', 'shared'))) { |
|
121 | + $this->enqueue_style($style, $hook); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
@@ -129,46 +129,46 @@ discard block |
||
129 | 129 | public function register_blocks() { |
130 | 130 | $blocks = array(); |
131 | 131 | |
132 | - foreach ( $this->styles as $style ) { |
|
133 | - if ( in_array( $style['type'], array( 'block' ) ) ) { |
|
132 | + foreach ($this->styles as $style) { |
|
133 | + if (in_array($style['type'], array('block'))) { |
|
134 | 134 | wp_register_style( |
135 | 135 | $style['handle'], |
136 | - $this->url . $style['src'], |
|
137 | - isset( $style['deps'] ) ? $style['deps'] : array(), |
|
136 | + $this->url.$style['src'], |
|
137 | + isset($style['deps']) ? $style['deps'] : array(), |
|
138 | 138 | $this->version, |
139 | - isset( $style['media'] ) ? $style['media'] : 'all' |
|
139 | + isset($style['media']) ? $style['media'] : 'all' |
|
140 | 140 | ); |
141 | 141 | |
142 | - if ( ! isset( $blocks[ $style['block'] ] ) ) { |
|
143 | - $blocks[ $style['block'] ] = array(); |
|
142 | + if (!isset($blocks[$style['block']])) { |
|
143 | + $blocks[$style['block']] = array(); |
|
144 | 144 | } |
145 | 145 | |
146 | - $blocks[ $style['block'] ]['editor_style'] = $style['handle']; |
|
146 | + $blocks[$style['block']]['editor_style'] = $style['handle']; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - foreach ( $this->scripts as $script ) { |
|
151 | - if ( in_array( $script['type'], array( 'block' ) ) ) { |
|
150 | + foreach ($this->scripts as $script) { |
|
151 | + if (in_array($script['type'], array('block'))) { |
|
152 | 152 | wp_register_script( |
153 | 153 | $script['handle'], |
154 | - $this->url . $script['src'], |
|
155 | - isset( $script['deps'] ) ? $script['deps'] : array(), |
|
154 | + $this->url.$script['src'], |
|
155 | + isset($script['deps']) ? $script['deps'] : array(), |
|
156 | 156 | $this->version, |
157 | - isset( $script['footer'] ) ? $script['footer'] : false |
|
157 | + isset($script['footer']) ? $script['footer'] : false |
|
158 | 158 | ); |
159 | 159 | |
160 | - $this->localize_script( $script ); |
|
160 | + $this->localize_script($script); |
|
161 | 161 | |
162 | - if ( ! isset( $blocks[ $script['block'] ] ) ) { |
|
163 | - $blocks[ $script['block'] ] = array(); |
|
162 | + if (!isset($blocks[$script['block']])) { |
|
163 | + $blocks[$script['block']] = array(); |
|
164 | 164 | } |
165 | 165 | |
166 | - $blocks[ $script['block'] ]['editor_script'] = $script['handle']; |
|
166 | + $blocks[$script['block']]['editor_script'] = $script['handle']; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - foreach ( $blocks as $slug => $opts ) { |
|
171 | - register_block_type( $slug, $opts ); |
|
170 | + foreach ($blocks as $slug => $opts) { |
|
171 | + register_block_type($slug, $opts); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -208,17 +208,17 @@ discard block |
||
208 | 208 | * @param array $script The script attachment callback. |
209 | 209 | * @param string $hook The location hook. Only passed on admin side. |
210 | 210 | */ |
211 | - protected function enqueue_script( $script, $hook = null ) { |
|
212 | - if ( $script['condition']( $hook ) ) { |
|
211 | + protected function enqueue_script($script, $hook = null) { |
|
212 | + if ($script['condition']($hook)) { |
|
213 | 213 | wp_enqueue_script( |
214 | 214 | $script['handle'], |
215 | - $this->url . $script['src'], |
|
216 | - isset( $script['deps'] ) ? $script['deps'] : array(), |
|
215 | + $this->url.$script['src'], |
|
216 | + isset($script['deps']) ? $script['deps'] : array(), |
|
217 | 217 | $this->version, |
218 | - isset( $script['footer'] ) ? $script['footer'] : false |
|
218 | + isset($script['footer']) ? $script['footer'] : false |
|
219 | 219 | ); |
220 | 220 | |
221 | - $this->localize_script( $script ); |
|
221 | + $this->localize_script($script); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | * @param array $style The style attachment callback. |
229 | 229 | * @param string $hook The location hook. |
230 | 230 | */ |
231 | - protected function enqueue_style( $style, $hook = null ) { |
|
232 | - if ( $style['condition']( $hook ) ) { |
|
231 | + protected function enqueue_style($style, $hook = null) { |
|
232 | + if ($style['condition']($hook)) { |
|
233 | 233 | wp_enqueue_style( |
234 | 234 | $style['handle'], |
235 | - $this->url . $style['src'], |
|
236 | - isset( $style['deps'] ) ? $style['deps'] : array(), |
|
235 | + $this->url.$style['src'], |
|
236 | + isset($style['deps']) ? $style['deps'] : array(), |
|
237 | 237 | $this->version, |
238 | - isset( $style['media'] ) ? $style['media'] : 'all' |
|
238 | + isset($style['media']) ? $style['media'] : 'all' |
|
239 | 239 | ); |
240 | 240 | } |
241 | 241 | } |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @param array $script Script defintion. |
247 | 247 | */ |
248 | - protected function localize_script( $script ) { |
|
249 | - if ( ! isset( $script['localize'] ) ) { |
|
248 | + protected function localize_script($script) { |
|
249 | + if (!isset($script['localize'])) { |
|
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | - if ( is_callable( $script['localize'] ) ) { // @todo make all properties callables |
|
254 | - $script['localize'] = call_user_func( $script['localize'] ); |
|
253 | + if (is_callable($script['localize'])) { // @todo make all properties callables |
|
254 | + $script['localize'] = call_user_func($script['localize']); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | wp_localize_script( |