| @@ -514,7 +514,7 @@ discard block | ||
| 514 | 514 | |
| 515 | 515 | if ( | 
| 516 | 516 | ! array_intersect_key( | 
| 517 | - $event_action_types[ $slug ] | |
| 517 | + $event_action_types[$slug] | |
| 518 | 518 | , $reactor_action_types | 
| 519 | 519 | ) | 
| 520 | 520 |  			) { | 
| @@ -567,13 +567,13 @@ discard block | ||
| 567 | 567 | |
| 568 | 568 |  		foreach ( $this->event_args->get_children( $event_slug ) as $slug => $arg ) { | 
| 569 | 569 | |
| 570 | - $event_data['args'][ $slug ] = array( | |
| 570 | + $event_data['args'][$slug] = array( | |
| 571 | 571 | 'slug' => $slug, | 
| 572 | 572 | ); | 
| 573 | 573 | |
| 574 | 574 |  			if ( $arg instanceof WordPoints_Hook_ArgI ) { | 
| 575 | - $event_data['args'][ $slug ]['title'] = $arg->get_title(); | |
| 576 | - $event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful(); | |
| 575 | + $event_data['args'][$slug]['title'] = $arg->get_title(); | |
| 576 | + $event_data['args'][$slug]['is_stateful'] = $arg->is_stateful(); | |
| 577 | 577 | } | 
| 578 | 578 | } | 
| 579 | 579 | |
| @@ -628,7 +628,7 @@ discard block | ||
| 628 | 628 | $tabs = array(); | 
| 629 | 629 | |
| 630 | 630 |  		foreach ( $points_types as $slug => $settings ) { | 
| 631 | - $tabs[ $slug ] = $settings['name']; | |
| 631 | + $tabs[$slug] = $settings['name']; | |
| 632 | 632 | } | 
| 633 | 633 | |
| 634 | 634 | $tabs['add-new'] = __( 'Add New', 'wordpoints' ); | 
| @@ -43,18 +43,18 @@ | ||
| 43 | 43 | return; | 
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | -	if ( isset( $_GET['message'] ) && isset( $messages[ (int) $_GET['message'] ] ) ) { // WPCS: CSRF OK. | |
| 46 | +	if ( isset( $_GET['message'] ) && isset( $messages[(int) $_GET['message']] ) ) { // WPCS: CSRF OK. | |
| 47 | 47 | |
| 48 | 48 | wordpoints_show_admin_message( | 
| 49 | - esc_html( $messages[ (int) $_GET['message'] ] ) // WPCS: CSRF OK. | |
| 49 | + esc_html( $messages[(int) $_GET['message']] ) // WPCS: CSRF OK. | |
| 50 | 50 | , 'success' | 
| 51 | 51 | , array( 'dismissible' => true ) | 
| 52 | 52 | ); | 
| 53 | 53 | |
| 54 | -	} elseif ( isset( $_GET['error'] ) && isset( $errors[ (int) $_GET['error'] ] ) ) { // WPCS: CSRF OK. | |
| 54 | +	} elseif ( isset( $_GET['error'] ) && isset( $errors[(int) $_GET['error']] ) ) { // WPCS: CSRF OK. | |
| 55 | 55 | |
| 56 | 56 | wordpoints_show_admin_error( | 
| 57 | - esc_html( $errors[ (int) $_GET['error'] ] ) // WPCS: CSRF OK. | |
| 57 | + esc_html( $errors[(int) $_GET['error']] ) // WPCS: CSRF OK. | |
| 58 | 58 | , array( 'dismissible' => true ) | 
| 59 | 59 | ); | 
| 60 | 60 | } | 
| @@ -39,8 +39,8 @@ discard block | ||
| 39 | 39 | $points_types_hooks = WordPoints_Points_Hooks::get_defaults(); | 
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | -if ( isset( $points_types_hooks[ $points_type_id ] ) ) { | |
| 43 | - $points_type_hooks = $points_types_hooks[ $points_type_id ]; | |
| 42 | +if ( isset( $points_types_hooks[$points_type_id] ) ) { | |
| 43 | + $points_type_hooks = $points_types_hooks[$points_type_id]; | |
| 44 | 44 |  } else { | 
| 45 | 45 | $points_type_hooks = array(); | 
| 46 | 46 | } | 
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | // Remove the hook from this points type. | 
| 62 | - $points_types_hooks[ $points_type_id ] = array_diff( $points_type_hooks, array( $hook_id ) ); | |
| 62 | + $points_types_hooks[$points_type_id] = array_diff( $points_type_hooks, array( $hook_id ) ); | |
| 63 | 63 | |
| 64 | 64 | $hook->delete_callback( $hook_id ); | 
| 65 | 65 | |
| @@ -83,8 +83,8 @@ discard block | ||
| 83 | 83 | |
| 84 | 84 |  	} else { | 
| 85 | 85 | |
| 86 | -		if ( isset( $_POST[ 'hook-' . $id_base ] ) && is_array( $_POST[ 'hook-' . $id_base ] ) ) { | |
| 87 | - $new_instance = wp_unslash( reset( $_POST[ 'hook-' . $id_base ] ) ); // WPCS sanitization OK. | |
| 86 | +		if ( isset( $_POST['hook-' . $id_base] ) && is_array( $_POST['hook-' . $id_base] ) ) { | |
| 87 | + $new_instance = wp_unslash( reset( $_POST['hook-' . $id_base] ) ); // WPCS sanitization OK. | |
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | 90 | $number = $hook->get_number_by_id( $hook_id ); | 
| @@ -102,15 +102,15 @@ discard block | ||
| 102 | 102 |  	if ( ! in_array( $hook_id, $points_type_hooks, true ) ) { | 
| 103 | 103 | |
| 104 | 104 | $points_type_hooks[] = $hook_id; | 
| 105 | - $points_types_hooks[ $points_type_id ] = $points_type_hooks; | |
| 105 | + $points_types_hooks[$points_type_id] = $points_type_hooks; | |
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | 108 | // Remove from old points type if it has changed. | 
| 109 | 109 | $old_points_type = WordPoints_Points_Hooks::get_points_type( $hook_id ); | 
| 110 | 110 | |
| 111 | -	if ( $old_points_type && $old_points_type !== $points_type_id && is_array( $points_types_hooks[ $old_points_type ] ) ) { | |
| 111 | +	if ( $old_points_type && $old_points_type !== $points_type_id && is_array( $points_types_hooks[$old_points_type] ) ) { | |
| 112 | 112 | |
| 113 | - $points_types_hooks[ $old_points_type ] = array_diff( $points_types_hooks[ $old_points_type ], array( $hook_id ) ); | |
| 113 | + $points_types_hooks[$old_points_type] = array_diff( $points_types_hooks[$old_points_type], array( $hook_id ) ); | |
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | 116 |  } else { | 
| @@ -47,7 +47,7 @@ | ||
| 47 | 47 | |
| 48 | 48 |  		foreach ( $points_types as $slug => $settings ) { | 
| 49 | 49 | |
| 50 | - $tabs[ $slug ] = $settings['name']; | |
| 50 | + $tabs[$slug] = $settings['name']; | |
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | 53 | wordpoints_admin_show_tabs( $tabs, false ); | 
| @@ -46,11 +46,11 @@ discard block | ||
| 46 | 46 | |
| 47 | 47 |  	foreach ( array_keys( wordpoints_get_points_types() ) as $points_type ) { | 
| 48 | 48 | |
| 49 | -		if ( empty( $_POST['points_types'][ $points_type ] ) ) { | |
| 49 | +		if ( empty( $_POST['points_types'][$points_type] ) ) { | |
| 50 | 50 | continue; | 
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | - $hooks = sanitize_text_field( wp_unslash( $_POST['points_types'][ $points_type ] ) ); | |
| 53 | + $hooks = sanitize_text_field( wp_unslash( $_POST['points_types'][$points_type] ) ); | |
| 54 | 54 | |
| 55 | 55 | $points_type_hooks = array(); | 
| 56 | 56 | |
| @@ -62,10 +62,10 @@ discard block | ||
| 62 | 62 | continue; | 
| 63 | 63 | } | 
| 64 | 64 | |
| 65 | - $points_type_hooks[ $order ] = substr( $hook_id, strpos( $hook_id, '_' ) + 1 ); | |
| 65 | + $points_type_hooks[$order] = substr( $hook_id, strpos( $hook_id, '_' ) + 1 ); | |
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | - $points_types_hooks[ $points_type ] = $points_type_hooks; | |
| 68 | + $points_types_hooks[$points_type] = $points_type_hooks; | |
| 69 | 69 | } | 
| 70 | 70 | |
| 71 | 71 | WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks ); | 
| @@ -189,14 +189,14 @@ discard block | ||
| 189 | 189 | |
| 190 | 190 | $settings = false; | 
| 191 | 191 | |
| 192 | -		if ( isset( $_POST[ 'hook-' . $id_base ] ) && is_array( $_POST[ 'hook-' . $id_base ] ) ) { | |
| 193 | - $settings = wp_unslash( $_POST[ 'hook-' . $id_base ] ); // WPCS: sanitization OK. | |
| 192 | +		if ( isset( $_POST['hook-' . $id_base] ) && is_array( $_POST['hook-' . $id_base] ) ) { | |
| 193 | + $settings = wp_unslash( $_POST['hook-' . $id_base] ); // WPCS: sanitization OK. | |
| 194 | 194 | } | 
| 195 | 195 | |
| 196 | 196 | $points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks(); | 
| 197 | 197 | |
| 198 | 198 | // Get the hooks for this points type. | 
| 199 | - $points_type_hooks = ( isset( $points_types_hooks[ $points_type_id ] ) ) ? $points_types_hooks[ $points_type_id ] : array(); | |
| 199 | + $points_type_hooks = ( isset( $points_types_hooks[$points_type_id] ) ) ? $points_types_hooks[$points_type_id] : array(); | |
| 200 | 200 | |
| 201 | 201 |  		if ( ! empty( $_POST['delete_hook'] ) ) { | 
| 202 | 202 | |
| @@ -209,7 +209,7 @@ discard block | ||
| 209 | 209 | $hook->delete_callback( $number ); | 
| 210 | 210 | |
| 211 | 211 | // Remove this instance of the hook, and reset the positions (keys). | 
| 212 | - $points_types_hooks[ $points_type_id ] = array_diff( $points_type_hooks, array( $hook_id ) ); | |
| 212 | + $points_types_hooks[$points_type_id] = array_diff( $points_type_hooks, array( $hook_id ) ); | |
| 213 | 213 | |
| 214 | 214 | WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks ); | 
| 215 | 215 | |
| @@ -230,7 +230,7 @@ discard block | ||
| 230 | 230 | |
| 231 | 231 | // Save the points types-hooks associations. | 
| 232 | 232 | $points_type_hooks[] = $hook->get_id( $number ); | 
| 233 | - $points_types_hooks[ $points_type_id ] = $points_type_hooks; | |
| 233 | + $points_types_hooks[$points_type_id] = $points_type_hooks; | |
| 234 | 234 | WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks ); | 
| 235 | 235 | |
| 236 | 236 |  		} else { | 
| @@ -438,17 +438,17 @@ | ||
| 438 | 438 | |
| 439 | 439 | if ( | 
| 440 | 440 | isset( | 
| 441 | -				$_POST[ "wordpoints_points_set-{$slug}" ] | |
| 442 | -				, $_POST[ "wordpoints_points-{$slug}" ] | |
| 443 | -				, $_POST[ "wordpoints_points_old-{$slug}" ] | |
| 441 | +				$_POST["wordpoints_points_set-{$slug}"] | |
| 442 | +				, $_POST["wordpoints_points-{$slug}"] | |
| 443 | +				, $_POST["wordpoints_points_old-{$slug}"] | |
| 444 | 444 | ) | 
| 445 | -			&& false !== wordpoints_int( $_POST[ "wordpoints_points-{$slug}" ] ) | |
| 446 | -			&& false !== wordpoints_int( $_POST[ "wordpoints_points_old-{$slug}" ] ) | |
| 445 | +			&& false !== wordpoints_int( $_POST["wordpoints_points-{$slug}"] ) | |
| 446 | +			&& false !== wordpoints_int( $_POST["wordpoints_points_old-{$slug}"] ) | |
| 447 | 447 |  		) { | 
| 448 | 448 | |
| 449 | 449 | wordpoints_alter_points( | 
| 450 | 450 | $user_id | 
| 451 | -				, (int) $_POST[ "wordpoints_points-{$slug}" ] - (int) $_POST[ "wordpoints_points_old-{$slug}" ] | |
| 451 | +				, (int) $_POST["wordpoints_points-{$slug}"] - (int) $_POST["wordpoints_points_old-{$slug}"] | |
| 452 | 452 | , $slug | 
| 453 | 453 | , 'profile_edit' | 
| 454 | 454 | , array( | 
| @@ -65,8 +65,8 @@ discard block | ||
| 65 | 65 | */ | 
| 66 | 66 |  	protected function get_points_logs_to_be_reversed( WordPoints_Hook_Fire $fire ) { | 
| 67 | 67 | |
| 68 | -		if ( isset( $fire->data[ $this->slug ]['points_logs'] ) ) { | |
| 69 | - return $fire->data[ $this->slug ]['points_logs']; | |
| 68 | +		if ( isset( $fire->data[$this->slug]['points_logs'] ) ) { | |
| 69 | + return $fire->data[$this->slug]['points_logs']; | |
| 70 | 70 | } | 
| 71 | 71 | |
| 72 | 72 | $meta_queries = array( | 
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | $entities = $fire->event_args->get_signature_args(); | 
| 86 | 86 | |
| 87 | 87 |  			if ( ! $entities ) { | 
| 88 | - $fire->data[ $this->slug ]['points_logs'] = array(); | |
| 88 | + $fire->data[$this->slug]['points_logs'] = array(); | |
| 89 | 89 | return array(); | 
| 90 | 90 | } | 
| 91 | 91 | |
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | $logs = array(); | 
| 118 | 118 | } | 
| 119 | 119 | |
| 120 | - $fire->data[ $this->slug ]['points_logs'] = $logs; | |
| 120 | + $fire->data[$this->slug]['points_logs'] = $logs; | |
| 121 | 121 | |
| 122 | 122 | return $logs; | 
| 123 | 123 | } | 
| @@ -145,8 +145,8 @@ | ||
| 145 | 145 | $meta = array( 'hook_hit_id' => $fire->hit_id ); | 
| 146 | 146 | |
| 147 | 147 |  		foreach ( $fire->event_args->get_entities() as $entity ) { | 
| 148 | - $meta[ $entity->get_slug() ] = $entity->get_the_id(); | |
| 149 | - $meta[ $entity->get_slug() . '_guid' ] = $entity->get_the_guid(); | |
| 148 | + $meta[$entity->get_slug()] = $entity->get_the_id(); | |
| 149 | + $meta[$entity->get_slug() . '_guid'] = $entity->get_the_guid(); | |
| 150 | 150 | } | 
| 151 | 151 | |
| 152 | 152 | wordpoints_alter_points( | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | */ | 
| 92 | 92 |  	public static function register_query( $slug, array $args, array $data = array() ) { | 
| 93 | 93 | |
| 94 | -		if ( empty( $slug ) || isset( self::$queries[ $slug ] ) ) { | |
| 94 | +		if ( empty( $slug ) || isset( self::$queries[$slug] ) ) { | |
| 95 | 95 | return false; | 
| 96 | 96 | } | 
| 97 | 97 | |
| @@ -101,8 +101,8 @@ discard block | ||
| 101 | 101 | 'network_wide' => false, | 
| 102 | 102 | ); | 
| 103 | 103 | |
| 104 | - self::$queries[ $slug ] = array_merge( $defaults, $data ); | |
| 105 | - self::$queries[ $slug ]['args'] = $args; | |
| 104 | + self::$queries[$slug] = array_merge( $defaults, $data ); | |
| 105 | + self::$queries[$slug]['args'] = $args; | |
| 106 | 106 | |
| 107 | 107 | return true; | 
| 108 | 108 | } | 
| @@ -120,7 +120,7 @@ discard block | ||
| 120 | 120 | |
| 121 | 121 | self::init(); | 
| 122 | 122 | |
| 123 | - return isset( self::$queries[ $slug ] ); | |
| 123 | + return isset( self::$queries[$slug] ); | |
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 | /** | 
| @@ -166,12 +166,12 @@ discard block | ||
| 166 | 166 | |
| 167 | 167 | self::init(); | 
| 168 | 168 | |
| 169 | -		if ( isset( self::$queries[ $query_slug ] ) ) { | |
| 169 | +		if ( isset( self::$queries[$query_slug] ) ) { | |
| 170 | 170 | |
| 171 | 171 |  			if ( empty( $data ) ) { | 
| 172 | - return self::$queries[ $query_slug ]; | |
| 173 | -			} elseif ( isset( self::$queries[ $query_slug ][ $data ] ) ) { | |
| 174 | - return self::$queries[ $query_slug ][ $data ]; | |
| 172 | + return self::$queries[$query_slug]; | |
| 173 | +			} elseif ( isset( self::$queries[$query_slug][$data] ) ) { | |
| 174 | + return self::$queries[$query_slug][$data]; | |
| 175 | 175 | } | 
| 176 | 176 | } | 
| 177 | 177 | |