@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * @since 1.0.0 |
99 | 99 | */ |
100 | - public function __construct( $slug, $parent = null ) { |
|
100 | + public function __construct($slug, $parent = null) { |
|
101 | 101 | |
102 | 102 | $this->slug = $slug; |
103 | 103 | $this->full_slug = $slug; |
104 | 104 | |
105 | - if ( $parent instanceof WordPoints_App ) { |
|
105 | + if ($parent instanceof WordPoints_App) { |
|
106 | 106 | $this->parent = $parent; |
107 | 107 | |
108 | - if ( 'apps' !== $this->parent->full_slug ) { |
|
109 | - $this->full_slug = $this->parent->full_slug . '-' . $this->full_slug; |
|
108 | + if ('apps' !== $this->parent->full_slug) { |
|
109 | + $this->full_slug = $this->parent->full_slug.'-'.$this->full_slug; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -118,32 +118,32 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * @since 1.0.0 |
120 | 120 | */ |
121 | - public function __isset( $var ) { |
|
122 | - return $this->sub_apps->is_registered( $var ); |
|
121 | + public function __isset($var) { |
|
122 | + return $this->sub_apps->is_registered($var); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * @since 1.0.0 |
127 | 127 | */ |
128 | - public function __get( $var ) { |
|
128 | + public function __get($var) { |
|
129 | 129 | |
130 | - if ( 'sub_apps' === $var ) { |
|
130 | + if ('sub_apps' === $var) { |
|
131 | 131 | return $this->$var; |
132 | 132 | } |
133 | 133 | |
134 | - $sub = $this->sub_apps->get( $var, array( $this ) ); |
|
134 | + $sub = $this->sub_apps->get($var, array($this)); |
|
135 | 135 | |
136 | - if ( ! $sub ) { |
|
136 | + if ( ! $sub) { |
|
137 | 137 | return null; |
138 | 138 | } |
139 | 139 | |
140 | 140 | if ( |
141 | - empty( $this->did_init[ $var ] ) |
|
141 | + empty($this->did_init[$var]) |
|
142 | 142 | && ! self::$main->silent |
143 | - && $this->should_do_registry_init( $sub ) |
|
143 | + && $this->should_do_registry_init($sub) |
|
144 | 144 | ) { |
145 | 145 | |
146 | - $is_protected_property = array_key_exists( $var, get_object_vars( $this ) ); |
|
146 | + $is_protected_property = array_key_exists($var, get_object_vars($this)); |
|
147 | 147 | |
148 | 148 | // When the below action is called it is possible that some hooked code |
149 | 149 | // may attempt to access the property that is being initialized. However, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // temporarily set this as a public property. However, we can't do this |
153 | 153 | // for properties that the class has declared, because otherwise it would |
154 | 154 | // be possible to modify and then unset protected class properties. |
155 | - if ( ! $is_protected_property ) { |
|
155 | + if ( ! $is_protected_property) { |
|
156 | 156 | $this->allow_set = true; |
157 | 157 | $this->$var = $sub; |
158 | 158 | $this->allow_set = false; |
@@ -168,25 +168,25 @@ discard block |
||
168 | 168 | * @param WordPoints_Class_RegistryI|WordPoints_Class_Registry_ChildrenI |
169 | 169 | * $registry The registry object. |
170 | 170 | */ |
171 | - do_action( "wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub ); |
|
171 | + do_action("wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub); |
|
172 | 172 | |
173 | 173 | // Because this property was public, it's possible that it might have |
174 | 174 | // been modified inadvertently. If this happens we give a warning. |
175 | - if ( $sub !== $this->$var ) { |
|
175 | + if ($sub !== $this->$var) { |
|
176 | 176 | _doing_it_wrong( |
177 | 177 | __METHOD__ |
178 | - , esc_html( "Do not modify the {$var} property directly." ) |
|
178 | + , esc_html("Do not modify the {$var} property directly.") |
|
179 | 179 | , '1.0.0' |
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! $is_protected_property ) { |
|
183 | + if ( ! $is_protected_property) { |
|
184 | 184 | $this->allow_set = true; |
185 | - unset( $this->$var ); |
|
185 | + unset($this->$var); |
|
186 | 186 | $this->allow_set = false; |
187 | 187 | } |
188 | 188 | |
189 | - $this->did_init[ $var ] = true; |
|
189 | + $this->did_init[$var] = true; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | return $sub; |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * @since 1.0.0 |
197 | 197 | */ |
198 | - public function __set( $var, $value ) { |
|
198 | + public function __set($var, $value) { |
|
199 | 199 | |
200 | - if ( $this->allow_set ) { |
|
200 | + if ($this->allow_set) { |
|
201 | 201 | $this->$var = $value; |
202 | 202 | } else { |
203 | 203 | _doing_it_wrong( |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | /** |
212 | 212 | * @since 1.0.0 |
213 | 213 | */ |
214 | - public function __unset( $var ) { |
|
214 | + public function __unset($var) { |
|
215 | 215 | |
216 | - if ( $this->allow_set ) { |
|
217 | - unset( $this->$var ); |
|
216 | + if ($this->allow_set) { |
|
217 | + unset($this->$var); |
|
218 | 218 | } else { |
219 | 219 | _doing_it_wrong( |
220 | 220 | __METHOD__ |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @return bool Whether to call the init action or not. |
235 | 235 | */ |
236 | - protected function should_do_registry_init( $registry ) { |
|
236 | + protected function should_do_registry_init($registry) { |
|
237 | 237 | return ( |
238 | 238 | $registry instanceof WordPoints_Class_RegistryI |
239 | 239 | || $registry instanceof WordPoints_Class_Registry_ChildrenI |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @param WordPoints_App $app The app object. |
259 | 259 | */ |
260 | - do_action( "wordpoints_init_app-{$this->full_slug}", $this ); |
|
260 | + do_action("wordpoints_init_app-{$this->full_slug}", $this); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * @since 1.0.0 |
39 | 39 | */ |
40 | - public function __construct( $slug, WordPoints_Hook_ActionI $action = null ) { |
|
40 | + public function __construct($slug, WordPoints_Hook_ActionI $action = null) { |
|
41 | 41 | |
42 | - parent::__construct( $slug, $action ); |
|
42 | + parent::__construct($slug, $action); |
|
43 | 43 | |
44 | - $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
|
44 | + $parts = wordpoints_parse_dynamic_slug($this->slug); |
|
45 | 45 | |
46 | - if ( $parts['dynamic'] ) { |
|
46 | + if ($parts['dynamic']) { |
|
47 | 47 | $this->arg_slug = $parts['generic']; |
48 | 48 | } else { |
49 | 49 | $this->arg_slug = $this->slug; |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | $value = parent::get_value(); |
60 | 60 | |
61 | 61 | // If not, then we check for an arg with the generic name. |
62 | - if ( null === $value && $this->action instanceof WordPoints_Hook_ActionI ) { |
|
63 | - $value = $this->action->get_arg_value( $this->arg_slug ); |
|
62 | + if (null === $value && $this->action instanceof WordPoints_Hook_ActionI) { |
|
63 | + $value = $this->action->get_arg_value($this->arg_slug); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $value; |
@@ -46,17 +46,17 @@ |
||
46 | 46 | */ |
47 | 47 | protected function get_entity_title() { |
48 | 48 | |
49 | - $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
|
49 | + $parts = wordpoints_parse_dynamic_slug($this->slug); |
|
50 | 50 | |
51 | - if ( $parts['dynamic'] ) { |
|
51 | + if ($parts['dynamic']) { |
|
52 | 52 | $entity_slug = "{$this->generic_entity_slug}\\{$parts['dynamic']}"; |
53 | 53 | } else { |
54 | 54 | $entity_slug = $this->generic_entity_slug; |
55 | 55 | } |
56 | 56 | |
57 | - $entity = wordpoints_entities()->get( $entity_slug ); |
|
57 | + $entity = wordpoints_entities()->get($entity_slug); |
|
58 | 58 | |
59 | - if ( ! $entity instanceof WordPoints_Entity ) { |
|
59 | + if ( ! $entity instanceof WordPoints_Entity) { |
|
60 | 60 | return $this->slug; |
61 | 61 | } |
62 | 62 |
@@ -17,20 +17,20 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | - public function __construct( $slug ) { |
|
20 | + public function __construct($slug) { |
|
21 | 21 | |
22 | - parent::__construct( $slug ); |
|
22 | + parent::__construct($slug); |
|
23 | 23 | |
24 | - $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
|
24 | + $parts = wordpoints_parse_dynamic_slug($this->slug); |
|
25 | 25 | |
26 | - if ( $parts['dynamic'] ) { |
|
26 | + if ($parts['dynamic']) { |
|
27 | 27 | |
28 | - $parsed = $this->parse_slug( $this->related_entity_slug ); |
|
28 | + $parsed = $this->parse_slug($this->related_entity_slug); |
|
29 | 29 | |
30 | 30 | $this->primary_entity_slug = "{$this->primary_entity_slug}\\{$parts['dynamic']}"; |
31 | 31 | $this->related_entity_slug = "{$parsed['slug']}\\{$parts['dynamic']}"; |
32 | 32 | |
33 | - if ( $parsed['is_array'] ) { |
|
33 | + if ($parsed['is_array']) { |
|
34 | 34 | $this->related_entity_slug .= '{}'; |
35 | 35 | } |
36 | 36 | } |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function get_title() { |
43 | 43 | |
44 | - $parsed = $this->parse_slug( $this->related_entity_slug ); |
|
44 | + $parsed = $this->parse_slug($this->related_entity_slug); |
|
45 | 45 | |
46 | - $entity = wordpoints_entities()->get( $parsed['slug'] ); |
|
46 | + $entity = wordpoints_entities()->get($parsed['slug']); |
|
47 | 47 | |
48 | - if ( $entity instanceof WordPoints_Entity ) { |
|
48 | + if ($entity instanceof WordPoints_Entity) { |
|
49 | 49 | return $entity->get_title(); |
50 | 50 | } else { |
51 | 51 | return $this->related_entity_slug; |
@@ -7,17 +7,17 @@ |
||
7 | 7 | * @since 1.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps' ); |
|
10 | +add_action('wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps'); |
|
11 | 11 | |
12 | -add_action( 'admin_menu', 'wordpoints_hooks_api_admin_menu' ); |
|
12 | +add_action('admin_menu', 'wordpoints_hooks_api_admin_menu'); |
|
13 | 13 | |
14 | -if ( is_wordpoints_network_active() ) { |
|
15 | - add_action( 'network_admin_menu', 'wordpoints_hooks_api_admin_menu' ); |
|
14 | +if (is_wordpoints_network_active()) { |
|
15 | + add_action('network_admin_menu', 'wordpoints_hooks_api_admin_menu'); |
|
16 | 16 | } |
17 | 17 | |
18 | -add_action( 'admin_init', 'wordpoints_hooks_admin_register_scripts' ); |
|
19 | -add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' ); |
|
18 | +add_action('admin_init', 'wordpoints_hooks_admin_register_scripts'); |
|
19 | +add_action('admin_init', 'wordpoints_hooks_admin_ajax'); |
|
20 | 20 | |
21 | -add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 ); |
|
21 | +add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2); |
|
22 | 22 | |
23 | 23 | // EOF |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | public function hooks() { |
63 | 63 | |
64 | 64 | /* Load the JavaScript needed for the settings screen. */ |
65 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
66 | - add_action( "admin_footer-{$this->id}", array( $this, 'footer_scripts' ) ); |
|
65 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
66 | + add_action("admin_footer-{$this->id}", array($this, 'footer_scripts')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | |
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | - <h1><?php echo esc_html( $this->get_title() ); ?></h1> |
|
101 | + <h1><?php echo esc_html($this->get_title()); ?></h1> |
|
102 | 102 | |
103 | 103 | <?php settings_errors(); ?> |
104 | 104 | |
105 | - <?php if ( ! empty( $this->tabs ) ) : ?> |
|
106 | - <?php wordpoints_admin_show_tabs( $this->tabs, false ); ?> |
|
105 | + <?php if ( ! empty($this->tabs)) : ?> |
|
106 | + <?php wordpoints_admin_show_tabs($this->tabs, false); ?> |
|
107 | 107 | <?php endif; ?> |
108 | 108 | |
109 | 109 | <?php $this->display_content(); ?> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'current_screen', array( $this, 'set_current_screen' ) ); |
|
30 | + add_action('current_screen', array($this, 'set_current_screen')); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param WP_Screen $current_screen The WP_Screen object for the current screen. |
39 | 39 | */ |
40 | - public function set_current_screen( $current_screen ) { |
|
40 | + public function set_current_screen($current_screen) { |
|
41 | 41 | |
42 | 42 | $screen_id = $current_screen->id; |
43 | 43 | |
44 | - if ( is_network_admin() ) { |
|
45 | - $screen_id = substr( $screen_id, 0, -8 /* -network */ ); |
|
44 | + if (is_network_admin()) { |
|
45 | + $screen_id = substr($screen_id, 0, -8 /* -network */); |
|
46 | 46 | } |
47 | 47 | |
48 | - $screen = $this->get( $screen_id ); |
|
48 | + $screen = $this->get($screen_id); |
|
49 | 49 | |
50 | - if ( ! ( $screen instanceof WordPoints_Admin_Screen ) ) { |
|
50 | + if ( ! ($screen instanceof WordPoints_Admin_Screen)) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | 54 | $this->current_screen = $screen; |
55 | 55 | |
56 | - add_action( "load-{$screen_id}", array( $this->current_screen, 'load' ) ); |
|
56 | + add_action("load-{$screen_id}", array($this->current_screen, 'load')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function get_current_id() { |
23 | 23 | |
24 | - if ( ! is_multisite() ) { |
|
24 | + if ( ! is_multisite()) { |
|
25 | 25 | return 1; |
26 | 26 | } |
27 | 27 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | - public function __construct( $slug ) { |
|
29 | + public function __construct($slug) { |
|
30 | 30 | |
31 | 31 | $this->slug = $slug; |
32 | 32 | } |