@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | foreach ( $this->get() as $component ) { |
| 137 | 137 | |
| 138 | - if ( ! $this->is_active( $component['slug'] ) ) { |
|
| 138 | + if ( ! $this->is_active( $component[ 'slug' ] ) ) { |
|
| 139 | 139 | continue; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - include_once( $component['file'] ); |
|
| 142 | + include_once( $component[ 'file' ] ); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -261,22 +261,22 @@ discard block |
||
| 261 | 261 | $component = array_merge( $defaults, $args ); |
| 262 | 262 | |
| 263 | 263 | if ( |
| 264 | - empty( $component['name'] ) |
|
| 265 | - || empty( $component['file'] ) |
|
| 266 | - || empty( $component['slug'] ) |
|
| 267 | - || $this->is_registered( $component['slug'] ) |
|
| 264 | + empty( $component[ 'name' ] ) |
|
| 265 | + || empty( $component[ 'file' ] ) |
|
| 266 | + || empty( $component[ 'slug' ] ) |
|
| 267 | + || $this->is_registered( $component[ 'slug' ] ) |
|
| 268 | 268 | ) { |
| 269 | 269 | return false; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - $this->registered[ $component['slug'] ] = array_intersect_key( $component, $defaults ); |
|
| 272 | + $this->registered[ $component[ 'slug' ] ] = array_intersect_key( $component, $defaults ); |
|
| 273 | 273 | |
| 274 | 274 | WordPoints_Installables::register( |
| 275 | 275 | 'component' |
| 276 | - , $component['slug'] |
|
| 276 | + , $component[ 'slug' ] |
|
| 277 | 277 | , array( |
| 278 | - 'version' => $this->registered[ $component['slug'] ]['version'], |
|
| 279 | - 'un_installer' => $this->registered[ $component['slug'] ]['un_installer'], |
|
| 278 | + 'version' => $this->registered[ $component[ 'slug' ] ][ 'version' ], |
|
| 279 | + 'un_installer' => $this->registered[ $component[ 'slug' ] ][ 'un_installer' ], |
|
| 280 | 280 | 'network_wide' => is_wordpoints_network_active(), |
| 281 | 281 | ) |
| 282 | 282 | ); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | return false; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - include_once( $this->registered[ $slug ]['file'] ); |
|
| 345 | + include_once( $this->registered[ $slug ][ 'file' ] ); |
|
| 346 | 346 | |
| 347 | 347 | WordPoints_Installables::get_installer( 'component', $slug )->install( |
| 348 | 348 | is_wordpoints_network_active() |
@@ -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; |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $this->settings = $settings; |
| 121 | 121 | |
| 122 | - if ( isset( $this->settings['event'] ) ) { |
|
| 123 | - $this->event_slug = $this->settings['event']; |
|
| 122 | + if ( isset( $this->settings[ 'event' ] ) ) { |
|
| 123 | + $this->event_slug = $this->settings[ 'event' ]; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( isset( $this->settings['reactor'] ) ) { |
|
| 127 | - $this->reactor_slug = $this->settings['reactor']; |
|
| 126 | + if ( isset( $this->settings[ 'reactor' ] ) ) { |
|
| 127 | + $this->reactor_slug = $this->settings[ 'reactor' ]; |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | $field_stack = $this->field_stack; |
| 230 | 230 | |
| 231 | 231 | if ( null !== $field ) { |
| 232 | - $field_stack[] = $field; |
|
| 232 | + $field_stack[ ] = $field; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $this->errors[] = array( 'message' => $message, 'field' => $field_stack ); |
|
| 235 | + $this->errors[ ] = array( 'message' => $message, 'field' => $field_stack ); |
|
| 236 | 236 | |
| 237 | 237 | if ( $this->fail_fast ) { |
| 238 | 238 | throw new WordPoints_Hook_Validator_Exception; |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @param string $field The field. |
| 270 | 270 | */ |
| 271 | 271 | public function push_field( $field ) { |
| 272 | - $this->field_stack[] = $field; |
|
| 272 | + $this->field_stack[ ] = $field; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | $this->slug = $slug; |
| 89 | 89 | $this->args = $action_args; |
| 90 | 90 | |
| 91 | - if ( isset( $args['requirements'] ) ) { |
|
| 92 | - $this->requirements = $args['requirements']; |
|
| 91 | + if ( isset( $args[ 'requirements' ] ) ) { |
|
| 92 | + $this->requirements = $args[ 'requirements' ]; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if ( isset( $args['arg_index'] ) ) { |
|
| 96 | - $this->arg_index = $args['arg_index']; |
|
| 95 | + if ( isset( $args[ 'arg_index' ] ) ) { |
|
| 96 | + $this->arg_index = $args[ 'arg_index' ]; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $comparator = '='; |
| 115 | 115 | |
| 116 | - if ( is_array( $value ) && isset( $value['comparator'], $value['value'] ) ) { |
|
| 117 | - $comparator = $value['comparator']; |
|
| 118 | - $value = $value['value']; |
|
| 116 | + if ( is_array( $value ) && isset( $value[ 'comparator' ], $value[ 'value' ] ) ) { |
|
| 117 | + $comparator = $value[ 'comparator' ]; |
|
| 118 | + $value = $value[ 'value' ]; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | switch ( $comparator ) { |
@@ -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 | |
@@ -50,23 +50,23 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
| 52 | 52 | |
| 53 | - if ( ! $parts['dynamic'] ) { |
|
| 53 | + if ( ! $parts[ 'dynamic' ] ) { |
|
| 54 | 54 | return false; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $this->post_hierarchy = str_replace( |
| 58 | 58 | '\\post' |
| 59 | - , '\\' . $parts['dynamic'] |
|
| 59 | + , '\\' . $parts[ 'dynamic' ] |
|
| 60 | 60 | , $this->post_hierarchy |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - $entity = wordpoints_entities()->get( $this->post_hierarchy[0] ); |
|
| 63 | + $entity = wordpoints_entities()->get( $this->post_hierarchy[ 0 ] ); |
|
| 64 | 64 | |
| 65 | 65 | if ( ! $entity instanceof WordPoints_Entity ) { |
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $entity->set_the_value( $this->get_arg_value( $this->post_hierarchy[0] ) ); |
|
| 69 | + $entity->set_the_value( $this->get_arg_value( $this->post_hierarchy[ 0 ] ) ); |
|
| 70 | 70 | |
| 71 | 71 | if ( 1 === count( $this->post_hierarchy ) ) { |
| 72 | 72 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if ( $parts['dynamic'] !== $post_entity->get_the_attr_value( 'post_type' ) ) { |
|
| 86 | + if ( $parts[ 'dynamic' ] !== $post_entity->get_the_attr_value( 'post_type' ) ) { |
|
| 87 | 87 | return false; |
| 88 | 88 | } |
| 89 | 89 | |