@@ -129,7 +129,7 @@ |
||
129 | 129 | 'type' => 'db', |
130 | 130 | 'info' => array( |
131 | 131 | 'type' => 'meta_table', |
132 | - 'table_name' => $GLOBALS['wpdb']->{$this->wpdb_table_name}, |
|
132 | + 'table_name' => $GLOBALS[ 'wpdb' ]->{$this->wpdb_table_name}, |
|
133 | 133 | 'meta_key' => $this->meta_key, |
134 | 134 | 'meta_key_field' => $this->meta_key_field, |
135 | 135 | 'meta_value_field' => $this->meta_value_field, |
@@ -64,7 +64,7 @@ |
||
64 | 64 | |
65 | 65 | foreach ( $restrictions as $restriction ) { |
66 | 66 | if ( $restriction->applies() ) { |
67 | - $this->restrictions[] = $restriction; |
|
67 | + $this->restrictions[ ] = $restriction; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $this->entity_id = $entity_id; |
53 | 53 | |
54 | - $entity = wordpoints_entities()->get( $hierarchy[0] ); |
|
54 | + $entity = wordpoints_entities()->get( $hierarchy[ 0 ] ); |
|
55 | 55 | |
56 | 56 | if ( ! $entity instanceof WordPoints_Entity ) { |
57 | 57 | return; |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * @since 2.2.0 |
32 | 32 | */ |
33 | 33 | public function __construct( $entity_id, array $hierarchy ) { |
34 | - $this->is_registered = wordpoints_entities()->is_registered( $hierarchy[0] ); |
|
34 | + $this->is_registered = wordpoints_entities()->is_registered( $hierarchy[ 0 ] ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -114,7 +114,7 @@ |
||
114 | 114 | array $args = array() |
115 | 115 | ) { |
116 | 116 | |
117 | - $pass_slugs = ( ! isset( $args['pass_slugs'] ) || $args['pass_slugs'] ); |
|
117 | + $pass_slugs = ( ! isset( $args[ 'pass_slugs' ] ) || $args[ 'pass_slugs' ] ); |
|
118 | 118 | |
119 | 119 | $objects = array(); |
120 | 120 |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | |
55 | 55 | $items = array(); |
56 | 56 | |
57 | - if ( $this->settings['pass_slugs'] ) { |
|
57 | + if ( $this->settings[ 'pass_slugs' ] ) { |
|
58 | 58 | array_unshift( $args, null ); |
59 | 59 | } |
60 | 60 | |
61 | 61 | foreach ( $this->classes as $parent_slug => $classes ) { |
62 | 62 | $items[ $parent_slug ] = WordPoints_Class_Registry::construct_with_args( |
63 | 63 | $classes |
64 | - , $this->settings['pass_slugs'] ? array( $parent_slug ) + $args : $args |
|
64 | + , $this->settings[ 'pass_slugs' ] ? array( $parent_slug ) + $args : $args |
|
65 | 65 | , $this->settings |
66 | 66 | ); |
67 | 67 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | if ( isset( $this->classes[ $parent_slug ] ) ) { |
87 | 87 | |
88 | - if ( $this->settings['pass_slugs'] ) { |
|
88 | + if ( $this->settings[ 'pass_slugs' ] ) { |
|
89 | 89 | array_unshift( $args, $parent_slug ); |
90 | 90 | } |
91 | 91 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | if ( empty( $args ) ) { |
128 | 128 | |
129 | - if ( $this->settings['pass_slugs'] ) { |
|
129 | + if ( $this->settings[ 'pass_slugs' ] ) { |
|
130 | 130 | return new $class( $slug, $parent_slug ); |
131 | 131 | } else { |
132 | 132 | return new $class(); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | } else { |
136 | 136 | |
137 | - if ( $this->settings['pass_slugs'] ) { |
|
137 | + if ( $this->settings[ 'pass_slugs' ] ) { |
|
138 | 138 | array_unshift( $args, $slug, $parent_slug ); |
139 | 139 | } |
140 | 140 |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | |
66 | 66 | $classes = $this->get_deep( $this->classes, $parent_slugs ); |
67 | 67 | |
68 | - if ( ! $classes || ! isset( $classes['_classes'] ) ) { |
|
68 | + if ( ! $classes || ! isset( $classes[ '_classes' ] ) ) { |
|
69 | 69 | return array(); |
70 | 70 | } |
71 | 71 | |
72 | - if ( $this->settings['pass_slugs'] ) { |
|
72 | + if ( $this->settings[ 'pass_slugs' ] ) { |
|
73 | 73 | array_unshift( $args, $parent_slugs ); |
74 | 74 | } |
75 | 75 | |
76 | 76 | return WordPoints_Class_Registry::construct_with_args( |
77 | - $classes['_classes'] |
|
77 | + $classes[ '_classes' ] |
|
78 | 78 | , $args |
79 | 79 | , $this->settings |
80 | 80 | ); |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | |
90 | 90 | $classes = $this->get_deep( $this->classes, $parent_slugs ); |
91 | 91 | |
92 | - if ( $classes && isset( $classes['_classes'] ) ) { |
|
93 | - $slugs = array_keys( $classes['_classes'] ); |
|
92 | + if ( $classes && isset( $classes[ '_classes' ] ) ) { |
|
93 | + $slugs = array_keys( $classes[ '_classes' ] ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $slugs; |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | |
113 | 113 | $classes = $this->get_deep( $this->classes, $parent_slugs ); |
114 | 114 | |
115 | - if ( ! $classes || ! isset( $classes['_classes'][ $slug ] ) ) { |
|
115 | + if ( ! $classes || ! isset( $classes[ '_classes' ][ $slug ] ) ) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
119 | - $class = $classes['_classes'][ $slug ]; |
|
119 | + $class = $classes[ '_classes' ][ $slug ]; |
|
120 | 120 | |
121 | 121 | if ( empty( $args ) ) { |
122 | 122 | |
123 | - if ( $this->settings['pass_slugs'] ) { |
|
123 | + if ( $this->settings[ 'pass_slugs' ] ) { |
|
124 | 124 | return new $class( $slug, $parent_slugs ); |
125 | 125 | } else { |
126 | 126 | return new $class(); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | } else { |
130 | 130 | |
131 | - if ( $this->settings['pass_slugs'] ) { |
|
131 | + if ( $this->settings[ 'pass_slugs' ] ) { |
|
132 | 132 | array_unshift( $args, $slug, $parent_slugs ); |
133 | 133 | } |
134 | 134 | |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | $classes[ $parent_slug ] = array(); |
155 | 155 | } |
156 | 156 | |
157 | - $classes =& $classes[ $parent_slug ]; |
|
157 | + $classes = & $classes[ $parent_slug ]; |
|
158 | 158 | } |
159 | 159 | |
160 | - $classes['_classes'][ $slug ] = $class; |
|
160 | + $classes[ '_classes' ][ $slug ] = $class; |
|
161 | 161 | |
162 | 162 | return true; |
163 | 163 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
176 | - unset( $classes['_classes'][ $slug ] ); |
|
176 | + unset( $classes[ '_classes' ][ $slug ] ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | return; |
188 | 188 | } |
189 | 189 | |
190 | - unset( $classes['_classes'] ); |
|
190 | + unset( $classes[ '_classes' ] ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function is_registered( $slug, array $parent_slugs = array() ) { |
197 | 197 | |
198 | - $parent_slugs[] = '_classes'; |
|
198 | + $parent_slugs[ ] = '_classes'; |
|
199 | 199 | |
200 | 200 | if ( null !== $slug ) { |
201 | - $parent_slugs[] = $slug; |
|
201 | + $parent_slugs[ ] = $slug; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | return (bool) $this->get_deep( $this->classes, $parent_slugs ); |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | $index = $this->get_reaction_index(); |
102 | 102 | |
103 | - if ( ! isset( $index[ $id ]['event'] ) ) { |
|
103 | + if ( ! isset( $index[ $id ][ 'event' ] ) ) { |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | |
107 | - return $index[ $id ]['event']; |
|
107 | + return $index[ $id ][ 'event' ]; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
130 | - $index[ $id ]['event'] = $event; |
|
130 | + $index[ $id ][ 'event' ] = $event; |
|
131 | 131 | |
132 | 132 | return $this->update_reaction_index( $index ); |
133 | 133 | } |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | |
148 | 148 | foreach ( $index as $reaction ) { |
149 | 149 | |
150 | - $object = $this->get_reaction( $reaction['id'] ); |
|
150 | + $object = $this->get_reaction( $reaction[ 'id' ] ); |
|
151 | 151 | |
152 | 152 | if ( ! $object ) { |
153 | 153 | continue; |
154 | 154 | } |
155 | 155 | |
156 | - $reactions[] = $object; |
|
156 | + $reactions[ ] = $object; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | return $reactions; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | // Return the first value, in case it is hooked to a filter. |
97 | 97 | $return = null; |
98 | - if ( isset( $args[0] ) ) { |
|
99 | - $return = $args[0]; |
|
98 | + if ( isset( $args[ 0 ] ) ) { |
|
99 | + $return = $args[ 0 ]; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | return $return; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $this->event_args = $this->events->get_sub_app( 'args' ); |
133 | 133 | } |
134 | 134 | |
135 | - foreach ( $this->action_index[ $name ]['actions'] as $slug => $data ) { |
|
135 | + foreach ( $this->action_index[ $name ][ 'actions' ] as $slug => $data ) { |
|
136 | 136 | |
137 | 137 | if ( ! isset( $this->event_index[ $slug ] ) ) { |
138 | 138 | continue; |
@@ -195,53 +195,53 @@ discard block |
||
195 | 195 | public function add_action( $slug, array $args ) { |
196 | 196 | |
197 | 197 | $priority = 10; |
198 | - if ( isset( $args['priority'] ) ) { |
|
199 | - $priority = $args['priority']; |
|
198 | + if ( isset( $args[ 'priority' ] ) ) { |
|
199 | + $priority = $args[ 'priority' ]; |
|
200 | 200 | } |
201 | 201 | |
202 | - if ( ! isset( $args['action'] ) ) { |
|
202 | + if ( ! isset( $args[ 'action' ] ) ) { |
|
203 | 203 | return; |
204 | 204 | } |
205 | 205 | |
206 | - $method = "{$args['action']},{$priority}"; |
|
206 | + $method = "{$args[ 'action' ]},{$priority}"; |
|
207 | 207 | |
208 | - $this->action_index[ $method ]['actions'][ $slug ] = array(); |
|
208 | + $this->action_index[ $method ][ 'actions' ][ $slug ] = array(); |
|
209 | 209 | |
210 | 210 | $arg_number = 1; |
211 | 211 | |
212 | - if ( isset( $args['data'] ) ) { |
|
212 | + if ( isset( $args[ 'data' ] ) ) { |
|
213 | 213 | |
214 | - if ( isset( $args['data']['arg_index'] ) ) { |
|
215 | - $arg_number = 1 + max( $args['data']['arg_index'] ); |
|
214 | + if ( isset( $args[ 'data' ][ 'arg_index' ] ) ) { |
|
215 | + $arg_number = 1 + max( $args[ 'data' ][ 'arg_index' ] ); |
|
216 | 216 | } |
217 | 217 | |
218 | - if ( isset( $args['data']['requirements'] ) ) { |
|
219 | - $requirements = 1 + max( array_keys( $args['data']['requirements'] ) ); |
|
218 | + if ( isset( $args[ 'data' ][ 'requirements' ] ) ) { |
|
219 | + $requirements = 1 + max( array_keys( $args[ 'data' ][ 'requirements' ] ) ); |
|
220 | 220 | |
221 | 221 | if ( $requirements > $arg_number ) { |
222 | 222 | $arg_number = $requirements; |
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - $this->action_index[ $method ]['actions'][ $slug ] = $args['data']; |
|
226 | + $this->action_index[ $method ][ 'actions' ][ $slug ] = $args[ 'data' ]; |
|
227 | 227 | } |
228 | 228 | |
229 | - if ( isset( $args['arg_number'] ) ) { |
|
230 | - $arg_number = $args['arg_number']; |
|
229 | + if ( isset( $args[ 'arg_number' ] ) ) { |
|
230 | + $arg_number = $args[ 'arg_number' ]; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // If this action is already being routed, and will have enough args, we |
234 | 234 | // don't need to hook to it again. |
235 | 235 | if ( |
236 | - isset( $this->action_index[ $method ]['arg_number'] ) |
|
237 | - && $this->action_index[ $method ]['arg_number'] >= $arg_number |
|
236 | + isset( $this->action_index[ $method ][ 'arg_number' ] ) |
|
237 | + && $this->action_index[ $method ][ 'arg_number' ] >= $arg_number |
|
238 | 238 | ) { |
239 | 239 | return; |
240 | 240 | } |
241 | 241 | |
242 | - $this->action_index[ $method ]['arg_number'] = $arg_number; |
|
242 | + $this->action_index[ $method ][ 'arg_number' ] = $arg_number; |
|
243 | 243 | |
244 | - add_action( $args['action'], array( $this, $method ), $priority, $arg_number ); |
|
244 | + add_action( $args[ 'action' ], array( $this, $method ), $priority, $arg_number ); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | public function remove_action( $slug ) { |
255 | 255 | |
256 | 256 | foreach ( $this->action_index as $method => $data ) { |
257 | - if ( isset( $data['actions'][ $slug ] ) ) { |
|
257 | + if ( isset( $data[ 'actions' ][ $slug ] ) ) { |
|
258 | 258 | |
259 | - unset( $this->action_index[ $method ]['actions'][ $slug ] ); |
|
259 | + unset( $this->action_index[ $method ][ 'actions' ][ $slug ] ); |
|
260 | 260 | |
261 | - if ( empty( $this->action_index[ $method ]['actions'] ) ) { |
|
261 | + if ( empty( $this->action_index[ $method ][ 'actions' ] ) ) { |
|
262 | 262 | |
263 | 263 | unset( $this->action_index[ $method ] ); |
264 | 264 |