@@ -68,7 +68,7 @@ |
||
| 68 | 68 | $new_rank_users = array(); |
| 69 | 69 | |
| 70 | 70 | foreach ( $new_ranks as $user_id => $new_rank ) { |
| 71 | - $new_rank_users[ $new_rank ][] = $user_id; |
|
| 71 | + $new_rank_users[$new_rank][] = $user_id; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | unset( $new_ranks ); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | if ( ! is_multisite() ) { |
| 123 | 123 | |
| 124 | 124 | foreach ( $duplicates as $duplicate ) { |
| 125 | - $rank_groups[ $duplicate->rank_group ][ $duplicate->user_id ] = $duplicate->user_id; |
|
| 125 | + $rank_groups[$duplicate->rank_group][$duplicate->user_id] = $duplicate->user_id; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $this->regenerate_user_ranks( $rank_groups ); |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | foreach ( $duplicates as $duplicate ) { |
| 133 | 133 | |
| 134 | 134 | $rank_groups |
| 135 | - [ $duplicate->site_id ] |
|
| 136 | - [ $duplicate->blog_id ] |
|
| 137 | - [ $duplicate->rank_group ] |
|
| 138 | - [ $duplicate->user_id ] = $duplicate->user_id; |
|
| 135 | + [$duplicate->site_id] |
|
| 136 | + [$duplicate->blog_id] |
|
| 137 | + [$duplicate->rank_group] |
|
| 138 | + [$duplicate->user_id] = $duplicate->user_id; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** @var WordPoints_Entity_Contexts $switcher */ |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | if ( isset( $this->$key ) ) { |
| 85 | 85 | return $this->$key; |
| 86 | - } elseif ( isset( $this->data[ $key ] ) ) { |
|
| 87 | - return $this->data[ $key ]; |
|
| 86 | + } elseif ( isset( $this->data[$key] ) ) { |
|
| 87 | + return $this->data[$key]; |
|
| 88 | 88 | } else { |
| 89 | 89 | return null; |
| 90 | 90 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - return isset( $this->types[ $type ] ); |
|
| 131 | + return isset( $this->types[$type] ); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | return false; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if ( isset( $this->types[ $type ] ) ) { |
|
| 149 | + if ( isset( $this->types[$type] ) ) { |
|
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $this->types[ $type ] = $type; |
|
| 153 | + $this->types[$type] = $type; |
|
| 154 | 154 | |
| 155 | 155 | return true; |
| 156 | 156 | } |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( ! isset( $this->types[ $type ] ) ) { |
|
| 179 | + if ( ! isset( $this->types[$type] ) ) { |
|
| 180 | 180 | return false; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - unset( $this->types[ $type ] ); |
|
| 183 | + unset( $this->types[$type] ); |
|
| 184 | 184 | |
| 185 | 185 | return true; |
| 186 | 186 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | $ranks = $this->get_ranks(); |
| 252 | 252 | |
| 253 | - unset( $ranks[ $current_position ] ); |
|
| 253 | + unset( $ranks[$current_position] ); |
|
| 254 | 254 | |
| 255 | 255 | ksort( $ranks ); |
| 256 | 256 | |
@@ -295,16 +295,16 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | $ranks = $this->get_ranks(); |
| 297 | 297 | |
| 298 | - unset( $ranks[ $position ] ); |
|
| 298 | + unset( $ranks[$position] ); |
|
| 299 | 299 | |
| 300 | 300 | if ( ! $this->save_ranks( $ranks ) ) { |
| 301 | 301 | return false; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // Assign the previous rank to users who have this rank. |
| 305 | - if ( isset( $ranks[ $position - 1 ] ) ) { |
|
| 305 | + if ( isset( $ranks[$position - 1] ) ) { |
|
| 306 | 306 | |
| 307 | - $this->move_users_from_rank_to_rank( $rank_id, $ranks[ $position - 1 ] ); |
|
| 307 | + $this->move_users_from_rank_to_rank( $rank_id, $ranks[$position - 1] ); |
|
| 308 | 308 | |
| 309 | 309 | } else { |
| 310 | 310 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | ); |
| 317 | 317 | |
| 318 | 318 | $group_ranks = wp_cache_get( $this->slug, 'wordpoints_user_ranks' ); |
| 319 | - unset( $group_ranks[ $rank_id ] ); |
|
| 319 | + unset( $group_ranks[$rank_id] ); |
|
| 320 | 320 | wp_cache_set( $this->slug, $group_ranks, 'wordpoints_user_ranks' ); |
| 321 | 321 | |
| 322 | 322 | unset( $group_ranks ); |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $ranks = $this->get_ranks(); |
| 390 | 390 | |
| 391 | - if ( ! isset( $ranks[ $position ] ) ) { |
|
| 391 | + if ( ! isset( $ranks[$position] ) ) { |
|
| 392 | 392 | return false; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - return $ranks[ $position ]; |
|
| 395 | + return $ranks[$position]; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | if ( $count === $position ) { |
| 436 | 436 | |
| 437 | - $ranks[ $position ] = $rank_id; |
|
| 437 | + $ranks[$position] = $rank_id; |
|
| 438 | 438 | |
| 439 | 439 | } elseif ( $count < $position ) { |
| 440 | 440 | |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | $group_ranks = wp_cache_get( $this->slug, 'wordpoints_user_ranks' ); |
| 475 | 475 | |
| 476 | - unset( $group_ranks[ $rank_from_id ], $group_ranks[ $rank_to_id ] ); |
|
| 476 | + unset( $group_ranks[$rank_from_id], $group_ranks[$rank_to_id] ); |
|
| 477 | 477 | |
| 478 | 478 | wp_cache_set( $this->slug, $group_ranks, 'wordpoints_user_ranks' ); |
| 479 | 479 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public static function is_type_registered( $type ) { |
| 39 | 39 | |
| 40 | - return isset( self::$types[ $type ] ); |
|
| 40 | + return isset( self::$types[$type] ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $args['slug'] = $type; |
| 64 | 64 | |
| 65 | - self::$types[ $type ] = new $class( $args ); |
|
| 65 | + self::$types[$type] = new $class( $args ); |
|
| 66 | 66 | |
| 67 | 67 | return true; |
| 68 | 68 | } |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | return false; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - self::$types[ $type ]->destruct(); |
|
| 91 | + self::$types[$type]->destruct(); |
|
| 92 | 92 | |
| 93 | 93 | foreach ( WordPoints_Rank_Groups::get() as $group ) { |
| 94 | 94 | $group->remove_type( $type ); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - unset( self::$types[ $type ] ); |
|
| 97 | + unset( self::$types[$type] ); |
|
| 98 | 98 | |
| 99 | 99 | return true; |
| 100 | 100 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | return false; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - return self::$types[ $type ]; |
|
| 137 | + return self::$types[$type]; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public static function is_group_registered( $slug ) { |
| 36 | 36 | |
| 37 | - return isset( self::$groups[ $slug ] ); |
|
| 37 | + return isset( self::$groups[$slug] ); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | return false; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - self::$groups[ $slug ] = new WordPoints_Rank_Group( $slug, $data ); |
|
| 56 | + self::$groups[$slug] = new WordPoints_Rank_Group( $slug, $data ); |
|
| 57 | 57 | |
| 58 | 58 | // If this is a brand new group, create the base rank. |
| 59 | - if ( ! self::$groups[ $slug ]->get_base_rank() ) { |
|
| 59 | + if ( ! self::$groups[$slug]->get_base_rank() ) { |
|
| 60 | 60 | wordpoints_add_rank( '', 'base', $slug, 0 ); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - unset( self::$groups[ $slug ] ); |
|
| 81 | + unset( self::$groups[$slug] ); |
|
| 82 | 82 | |
| 83 | 83 | return true; |
| 84 | 84 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | return false; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - return self::$groups[ $group ]; |
|
| 121 | + return self::$groups[$group]; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - return self::$groups[ $group ]->has_type( $type ); |
|
| 144 | + return self::$groups[$group]->has_type( $type ); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - return self::$groups[ $group ]->add_type( $type ); |
|
| 165 | + return self::$groups[$group]->add_type( $type ); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | return false; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - return self::$groups[ $group ]->remove_type( $type ); |
|
| 189 | + return self::$groups[$group]->remove_type( $type ); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $group_ranks = wp_cache_get( $group, 'wordpoints_user_ranks' ); |
| 462 | 462 | |
| 463 | 463 | foreach ( (array) $group_ranks as $_rank_id => $user_ids ) { |
| 464 | - if ( isset( $user_ids[ $user_id ] ) ) { |
|
| 464 | + if ( isset( $user_ids[$user_id] ) ) { |
|
| 465 | 465 | $rank_id = $_rank_id; |
| 466 | 466 | break; |
| 467 | 467 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $rank_id = $rank_group->get_base_rank(); |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - $group_ranks[ $rank_id ][ $user_id ] = $user_id; |
|
| 493 | + $group_ranks[$rank_id][$user_id] = $user_id; |
|
| 494 | 494 | |
| 495 | 495 | wp_cache_set( $group, $group_ranks, 'wordpoints_user_ranks' ); |
| 496 | 496 | } |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | $group_ranks = wp_cache_get( $rank->rank_group, 'wordpoints_user_ranks' ); |
| 580 | 580 | |
| 581 | 581 | foreach ( $group_ranks as $_rank_id => $user_ids ) { |
| 582 | - unset( $group_ranks[ $_rank_id ][ $user_id ] ); |
|
| 582 | + unset( $group_ranks[$_rank_id][$user_id] ); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | wp_cache_set( $rank->rank_group, $group_ranks, 'wordpoints_user_ranks' ); |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | |
| 662 | 662 | $group_ranks = wp_cache_get( $rank->rank_group, 'wordpoints_user_ranks' ); |
| 663 | 663 | |
| 664 | - unset( $group_ranks[ $from_rank_id ], $group_ranks[ $to_rank_id ] ); |
|
| 664 | + unset( $group_ranks[$from_rank_id], $group_ranks[$to_rank_id] ); |
|
| 665 | 665 | |
| 666 | 666 | wp_cache_set( $rank->rank_group, $group_ranks, 'wordpoints_user_ranks' ); |
| 667 | 667 | |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | foreach ( $group_ranks as $rank_id => $user_ids ) { |
| 857 | - unset( $group_ranks[ $rank_id ][ $user_id ] ); |
|
| 857 | + unset( $group_ranks[$rank_id][$user_id] ); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | wp_cache_set( $rank_group->slug, $group_ranks, 'wordpoints_user_ranks' ); |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function register( $type, $slug, $loader, $version, $network_wide = false ) { |
| 63 | 63 | |
| 64 | - $this->loaders[ $type ][ $slug ] = $loader; |
|
| 64 | + $this->loaders[$type][$slug] = $loader; |
|
| 65 | 65 | |
| 66 | 66 | if ( $network_wide ) { |
| 67 | - $this->network_versions[ $type ][ $slug ] = $version; |
|
| 67 | + $this->network_versions[$type][$slug] = $version; |
|
| 68 | 68 | } else { |
| 69 | - $this->versions[ $type ][ $slug ] = $version; |
|
| 69 | + $this->versions[$type][$slug] = $version; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | foreach ( $versions as $type => $installables ) { |
| 110 | 110 | |
| 111 | - if ( isset( $last_checked[ $type ] ) ) { |
|
| 111 | + if ( isset( $last_checked[$type] ) ) { |
|
| 112 | 112 | |
| 113 | - if ( $installables === $last_checked[ $type ] ) { |
|
| 113 | + if ( $installables === $last_checked[$type] ) { |
|
| 114 | 114 | continue; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $diff = array_diff_assoc( $installables, $last_checked[ $type ] ); |
|
| 117 | + $diff = array_diff_assoc( $installables, $last_checked[$type] ); |
|
| 118 | 118 | |
| 119 | 119 | } else { |
| 120 | 120 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | protected function get_installable( $type, $slug ) { |
| 205 | 205 | |
| 206 | - $loader = $this->loaders[ $type ][ $slug ]; |
|
| 206 | + $loader = $this->loaders[$type][$slug]; |
|
| 207 | 207 | |
| 208 | 208 | // May be a loader function or the class name itself. |
| 209 | 209 | if ( is_callable( $loader ) ) { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public static function register( $shortcode, $class ) { |
| 49 | 49 | |
| 50 | - self::$shortcodes[ $shortcode ] = $class; |
|
| 50 | + self::$shortcodes[$shortcode] = $class; |
|
| 51 | 51 | |
| 52 | 52 | add_shortcode( $shortcode, array( __CLASS__, 'do_shortcode' ) ); |
| 53 | 53 | } |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | if ( isset( $shortcode ) ) { |
| 77 | 77 | |
| 78 | - if ( isset( self::$shortcodes[ $shortcode ] ) ) { |
|
| 79 | - return new self::$shortcodes[ $shortcode ]( $atts, $content, $shortcode ); |
|
| 78 | + if ( isset( self::$shortcodes[$shortcode] ) ) { |
|
| 79 | + return new self::$shortcodes[$shortcode]( $atts, $content, $shortcode ); |
|
| 80 | 80 | } else { |
| 81 | 81 | return false; |
| 82 | 82 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public static function do_shortcode( $atts, $content, $shortcode ) { |
| 107 | 107 | |
| 108 | - if ( ! isset( self::$shortcodes[ $shortcode ] ) ) { |
|
| 108 | + if ( ! isset( self::$shortcodes[$shortcode] ) ) { |
|
| 109 | 109 | return wordpoints_shortcode_error( |
| 110 | 110 | sprintf( |
| 111 | 111 | // translators: Shortcode name. |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** @var WordPoints_Shortcode $shortcode */ |
| 119 | - $shortcode = new self::$shortcodes[ $shortcode ]( $atts, $content, $shortcode ); |
|
| 119 | + $shortcode = new self::$shortcodes[$shortcode]( $atts, $content, $shortcode ); |
|
| 120 | 120 | return $shortcode->expand(); |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $settings = $this->get_settings(); |
| 47 | 47 | |
| 48 | - if ( ! is_array( $settings ) || ! isset( $settings[ $key ] ) ) { |
|
| 48 | + if ( ! is_array( $settings ) || ! isset( $settings[$key] ) ) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - return $settings[ $key ]; |
|
| 52 | + return $settings[$key]; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $settings = $this->get_settings(); |
| 61 | 61 | |
| 62 | - if ( ! is_array( $settings ) || isset( $settings[ $key ] ) ) { |
|
| 62 | + if ( ! is_array( $settings ) || isset( $settings[$key] ) ) { |
|
| 63 | 63 | return false; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $settings[ $key ] = $value; |
|
| 66 | + $settings[$key] = $value; |
|
| 67 | 67 | |
| 68 | 68 | return $this->update_settings( $settings ); |
| 69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $settings[ $key ] = $value; |
|
| 82 | + $settings[$key] = $value; |
|
| 83 | 83 | |
| 84 | 84 | return $this->update_settings( $settings ); |
| 85 | 85 | } |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $settings = $this->get_settings(); |
| 93 | 93 | |
| 94 | - if ( ! is_array( $settings ) || ! isset( $settings[ $key ] ) ) { |
|
| 94 | + if ( ! is_array( $settings ) || ! isset( $settings[$key] ) ) { |
|
| 95 | 95 | return false; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - unset( $settings[ $key ] ); |
|
| 98 | + unset( $settings[$key] ); |
|
| 99 | 99 | |
| 100 | 100 | return $this->update_settings( $settings ); |
| 101 | 101 | } |