@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * @deprecated 2.3.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -_deprecated_file( __FILE__, '2.3.0', 'classes/breaking/updater.php' ); |
|
| 11 | +_deprecated_file(__FILE__, '2.3.0', 'classes/breaking/updater.php'); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * The WordPoints breaking updater class. |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | * @since 1.8.0 |
| 24 | 24 | */ |
| 25 | 25 | protected $updates = array( |
| 26 | - '1.3.0' => array( 'single' => true, /* - */ /* - */ ), |
|
| 26 | + '1.3.0' => array('single' => true, /* - */ /* - */), |
|
| 27 | 27 | '1.5.0' => array( /* - */ 'site' => true, /* - */ ), |
| 28 | 28 | '1.8.0' => array( /* - */ 'site' => true, /* - */ ), |
| 29 | - '1.10.3' => array( 'single' => true, /* - */ 'network' => true ), |
|
| 30 | - '2.1.0-alpha-3' => array( 'single' => true, /* - */ 'network' => true ), |
|
| 31 | - '2.3.0-alpha-2' => array( 'single' => true, /* - */ 'network' => true ), |
|
| 29 | + '1.10.3' => array('single' => true, /* - */ 'network' => true), |
|
| 30 | + '2.1.0-alpha-3' => array('single' => true, /* - */ 'network' => true), |
|
| 31 | + '2.3.0-alpha-2' => array('single' => true, /* - */ 'network' => true), |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -112,24 +112,24 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * @since 1.8.0 |
| 114 | 114 | */ |
| 115 | - public function install( $network ) { |
|
| 115 | + public function install($network) { |
|
| 116 | 116 | |
| 117 | - $filter_func = ( $network ) ? '__return_true' : '__return_false'; |
|
| 118 | - add_filter( 'is_wordpoints_network_active', $filter_func ); |
|
| 117 | + $filter_func = ($network) ? '__return_true' : '__return_false'; |
|
| 118 | + add_filter('is_wordpoints_network_active', $filter_func); |
|
| 119 | 119 | |
| 120 | 120 | // Check if the plugin has been activated/installed before. |
| 121 | - $installed = (bool) wordpoints_get_maybe_network_option( 'wordpoints_data' ); |
|
| 121 | + $installed = (bool) wordpoints_get_maybe_network_option('wordpoints_data'); |
|
| 122 | 122 | |
| 123 | - parent::install( $network ); |
|
| 123 | + parent::install($network); |
|
| 124 | 124 | |
| 125 | 125 | // Activate the Points component, if this is the first activation. |
| 126 | - if ( false === $installed ) { |
|
| 126 | + if (false === $installed) { |
|
| 127 | 127 | $wordpoints_components = WordPoints_Components::instance(); |
| 128 | 128 | $wordpoints_components->load(); |
| 129 | - $wordpoints_components->activate( 'points' ); |
|
| 129 | + $wordpoints_components->activate('points'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - remove_filter( 'is_wordpoints_network_active', $filter_func ); |
|
| 132 | + remove_filter('is_wordpoints_network_active', $filter_func); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | parent::before_update(); |
| 141 | 141 | |
| 142 | - if ( $this->network_wide ) { |
|
| 143 | - unset( $this->updates['1_8_0'] ); |
|
| 142 | + if ($this->network_wide) { |
|
| 143 | + unset($this->updates['1_8_0']); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | protected function install_network() { |
| 151 | 151 | |
| 152 | - $data = wordpoints_get_maybe_network_option( 'wordpoints_data' ); |
|
| 152 | + $data = wordpoints_get_maybe_network_option('wordpoints_data'); |
|
| 153 | 153 | |
| 154 | 154 | // Add plugin data. |
| 155 | - if ( ! is_array( $data ) ) { |
|
| 155 | + if ( ! is_array($data)) { |
|
| 156 | 156 | |
| 157 | 157 | wordpoints_update_maybe_network_option( |
| 158 | 158 | 'wordpoints_data', |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | // corrupted somehow. |
| 171 | 171 | $data['version'] = WORDPOINTS_VERSION; |
| 172 | 172 | |
| 173 | - wordpoints_update_maybe_network_option( 'wordpoints_data', $data ); |
|
| 173 | + wordpoints_update_maybe_network_option('wordpoints_data', $data); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $this->install_db_schema(); |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | protected function uninstall_modules() { |
| 221 | 221 | |
| 222 | 222 | wordpoints_deactivate_modules( |
| 223 | - wordpoints_get_array_option( 'wordpoints_active_modules', 'site' ) |
|
| 223 | + wordpoints_get_array_option('wordpoints_active_modules', 'site') |
|
| 224 | 224 | ); |
| 225 | 225 | |
| 226 | - foreach ( array_keys( wordpoints_get_modules() ) as $module ) { |
|
| 227 | - wordpoints_uninstall_module( $module ); |
|
| 226 | + foreach (array_keys(wordpoints_get_modules()) as $module) { |
|
| 227 | + wordpoints_uninstall_module($module); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | $this->delete_modules_dir(); |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | global $wp_filesystem; |
| 241 | 241 | |
| 242 | - if ( $wp_filesystem instanceof WP_Filesystem_Base ) { |
|
| 243 | - $wp_filesystem->delete( wordpoints_modules_dir(), true ); |
|
| 242 | + if ($wp_filesystem instanceof WP_Filesystem_Base) { |
|
| 243 | + $wp_filesystem->delete(wordpoints_modules_dir(), true); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -252,13 +252,13 @@ discard block |
||
| 252 | 252 | protected function uninstall_components() { |
| 253 | 253 | |
| 254 | 254 | /** This filter is documented in classes/components.php */ |
| 255 | - do_action( 'wordpoints_components_register' ); |
|
| 255 | + do_action('wordpoints_components_register'); |
|
| 256 | 256 | |
| 257 | 257 | $components = WordPoints_Components::instance(); |
| 258 | 258 | |
| 259 | 259 | // Uninstall the components. |
| 260 | - foreach ( $components->get() as $component => $data ) { |
|
| 261 | - WordPoints_Installables::uninstall( 'component', $component ); |
|
| 260 | + foreach ($components->get() as $component => $data) { |
|
| 261 | + WordPoints_Installables::uninstall('component', $component); |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @since 1.8.0 |
| 269 | 269 | */ |
| 270 | 270 | protected function update_single_to_1_3_0() { |
| 271 | - wordpoints_add_custom_caps( $this->custom_caps ); |
|
| 271 | + wordpoints_add_custom_caps($this->custom_caps); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * @since 1.8.0 |
| 278 | 278 | */ |
| 279 | 279 | protected function update_site_to_1_5_0() { |
| 280 | - wordpoints_add_custom_caps( $this->custom_caps ); |
|
| 280 | + wordpoints_add_custom_caps($this->custom_caps); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -309,14 +309,14 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $modules_dir = wordpoints_modules_dir(); |
| 311 | 311 | |
| 312 | - if ( ! WP_Filesystem( false, $modules_dir ) ) { |
|
| 312 | + if ( ! WP_Filesystem(false, $modules_dir)) { |
|
| 313 | 313 | return; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | $index_file = $modules_dir . '/index.php'; |
| 317 | 317 | |
| 318 | - if ( ! $wp_filesystem->exists( $index_file ) ) { |
|
| 319 | - $wp_filesystem->put_contents( $index_file, '<?php // Gold is silent.' ); |
|
| 318 | + if ( ! $wp_filesystem->exists($index_file)) { |
|
| 319 | + $wp_filesystem->put_contents($index_file, '<?php // Gold is silent.'); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @since 2.1.0 |
| 327 | 327 | */ |
| 328 | 328 | protected function update_network_to_2_1_0_alpha_3() { |
| 329 | - $this->map_shortcuts( 'schema' ); |
|
| 329 | + $this->map_shortcuts('schema'); |
|
| 330 | 330 | $this->install_db_schema(); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * @since 2.1.0 |
| 337 | 337 | */ |
| 338 | 338 | protected function update_single_to_2_1_0_alpha_3() { |
| 339 | - $this->map_shortcuts( 'schema' ); |
|
| 339 | + $this->map_shortcuts('schema'); |
|
| 340 | 340 | $this->install_db_schema(); |
| 341 | 341 | } |
| 342 | 342 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | // We don't need to update the table if the new schema has just been used to |
| 351 | 351 | // install it. |
| 352 | - if ( version_compare( $this->get_db_version(), '2.1.0-alpha-3', '<' ) ) { |
|
| 352 | + if (version_compare($this->get_db_version(), '2.1.0-alpha-3', '<')) { |
|
| 353 | 353 | return; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * @deprecated 2.3.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -_deprecated_file( __FILE__, '2.3.0', 'classes/shortcode.php' ); |
|
| 11 | +_deprecated_file(__FILE__, '2.3.0', 'classes/shortcode.php'); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * The shortcode class. |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * @deprecated 2.3.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -_deprecated_file( __FILE__, '2.3.0', 'classes/components.php' ); |
|
| 11 | +_deprecated_file(__FILE__, '2.3.0', 'classes/components.php'); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * The components class. |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * @deprecated 2.3.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -_deprecated_file( __FILE__, '2.3.0', 'classes/un/installer/base.php' ); |
|
| 11 | +_deprecated_file(__FILE__, '2.3.0', 'classes/un/installer/base.php'); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * The base un/installer class. |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * @deprecated 2.3.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -_deprecated_file( __FILE__, '2.3.0', 'classes/modules.php' ); |
|
| 11 | +_deprecated_file(__FILE__, '2.3.0', 'classes/modules.php'); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * The modules class. |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * @deprecated 2.3.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -_deprecated_file( __FILE__, '2.3.0', 'classes/installables.php' ); |
|
| 11 | +_deprecated_file(__FILE__, '2.3.0', 'classes/installables.php'); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * The installables class. |
@@ -10,17 +10,17 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if we aren't being uninstalled. |
| 13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -require_once( dirname( __FILE__ ) . '/includes/constants.php' ); |
|
| 18 | -require_once( WORDPOINTS_DIR . '/includes/functions.php' ); |
|
| 19 | -require_once( WORDPOINTS_DIR . '/classes/installables.php' ); |
|
| 20 | -require_once( WORDPOINTS_DIR . '/classes/un/installer/base.php' ); |
|
| 17 | +require_once(dirname(__FILE__) . '/includes/constants.php'); |
|
| 18 | +require_once(WORDPOINTS_DIR . '/includes/functions.php'); |
|
| 19 | +require_once(WORDPOINTS_DIR . '/classes/installables.php'); |
|
| 20 | +require_once(WORDPOINTS_DIR . '/classes/un/installer/base.php'); |
|
| 21 | 21 | |
| 22 | 22 | wordpoints_register_installer(); |
| 23 | 23 | |
| 24 | -WordPoints_Installables::uninstall( 'plugin', 'wordpoints' ); |
|
| 24 | +WordPoints_Installables::uninstall('plugin', 'wordpoints'); |
|
| 25 | 25 | |
| 26 | 26 | // EOF |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @since 2.1.0 |
| 29 | 29 | */ |
| 30 | - protected $action_types = array( 'fire', 'toggle_on', 'toggle_off' ); |
|
| 30 | + protected $action_types = array('fire', 'toggle_on', 'toggle_off'); |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * @since 2.1.0 |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function get_settings_fields() { |
| 60 | 60 | |
| 61 | - $this->settings_fields['points']['label'] = _x( 'Points', 'form label', 'wordpoints' ); |
|
| 62 | - $this->settings_fields['log_text']['label'] = _x( 'Log Text', 'form label', 'wordpoints' ); |
|
| 63 | - $this->settings_fields['description']['label'] = _x( 'Description', 'form label', 'wordpoints' ); |
|
| 61 | + $this->settings_fields['points']['label'] = _x('Points', 'form label', 'wordpoints'); |
|
| 62 | + $this->settings_fields['log_text']['label'] = _x('Log Text', 'form label', 'wordpoints'); |
|
| 63 | + $this->settings_fields['description']['label'] = _x('Description', 'form label', 'wordpoints'); |
|
| 64 | 64 | |
| 65 | 65 | return parent::get_settings_fields(); |
| 66 | 66 | } |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $data = parent::get_ui_script_data(); |
| 74 | 74 | |
| 75 | - $data['target_label'] = __( 'Award To', 'wordpoints' ); |
|
| 76 | - $data['periods_label'] = __( 'Award each user no more than once in:', 'wordpoints' ); |
|
| 75 | + $data['target_label'] = __('Award To', 'wordpoints'); |
|
| 76 | + $data['periods_label'] = __('Award each user no more than once in:', 'wordpoints'); |
|
| 77 | 77 | |
| 78 | 78 | return $data; |
| 79 | 79 | } |
@@ -87,23 +87,23 @@ discard block |
||
| 87 | 87 | WordPoints_Hook_Event_Args $event_args |
| 88 | 88 | ) { |
| 89 | 89 | |
| 90 | - if ( ! isset( $settings['points'] ) || false === wordpoints_int( $settings['points'] ) ) { |
|
| 91 | - $validator->add_error( __( 'Points must be an integer.', 'wordpoints' ), 'points' ); |
|
| 90 | + if ( ! isset($settings['points']) || false === wordpoints_int($settings['points'])) { |
|
| 91 | + $validator->add_error(__('Points must be an integer.', 'wordpoints'), 'points'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if ( ! isset( $settings['points_type'] ) || ! wordpoints_is_points_type( $settings['points_type'] ) ) { |
|
| 95 | - $validator->add_error( __( 'Invalid points type.', 'wordpoints' ), 'points_type' ); |
|
| 94 | + if ( ! isset($settings['points_type']) || ! wordpoints_is_points_type($settings['points_type'])) { |
|
| 95 | + $validator->add_error(__('Invalid points type.', 'wordpoints'), 'points_type'); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if ( ! isset( $settings['description'] ) ) { |
|
| 99 | - $validator->add_error( __( 'Description is required.', 'wordpoints' ), 'description' ); |
|
| 98 | + if ( ! isset($settings['description'])) { |
|
| 99 | + $validator->add_error(__('Description is required.', 'wordpoints'), 'description'); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if ( ! isset( $settings['log_text'] ) ) { |
|
| 103 | - $validator->add_error( __( 'Log Text is required.', 'wordpoints' ), 'log_text' ); |
|
| 102 | + if ( ! isset($settings['log_text'])) { |
|
| 103 | + $validator->add_error(__('Log Text is required.', 'wordpoints'), 'log_text'); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - return parent::validate_settings( $settings, $validator, $event_args ); |
|
| 106 | + return parent::validate_settings($settings, $validator, $event_args); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -114,59 +114,59 @@ discard block |
||
| 114 | 114 | array $settings |
| 115 | 115 | ) { |
| 116 | 116 | |
| 117 | - parent::update_settings( $reaction, $settings ); |
|
| 117 | + parent::update_settings($reaction, $settings); |
|
| 118 | 118 | |
| 119 | - $reaction->update_meta( 'points', $settings['points'] ); |
|
| 120 | - $reaction->update_meta( 'points_type', $settings['points_type'] ); |
|
| 121 | - $reaction->update_meta( 'description', $settings['description'] ); |
|
| 122 | - $reaction->update_meta( 'log_text', $settings['log_text'] ); |
|
| 119 | + $reaction->update_meta('points', $settings['points']); |
|
| 120 | + $reaction->update_meta('points_type', $settings['points_type']); |
|
| 121 | + $reaction->update_meta('description', $settings['description']); |
|
| 122 | + $reaction->update_meta('log_text', $settings['log_text']); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * @since 2.1.0 |
| 127 | 127 | */ |
| 128 | - public function hit( WordPoints_Hook_Fire $fire ) { |
|
| 128 | + public function hit(WordPoints_Hook_Fire $fire) { |
|
| 129 | 129 | |
| 130 | - if ( 'toggle_off' === $fire->action_type ) { |
|
| 131 | - $this->reverse_hit( $fire ); |
|
| 130 | + if ('toggle_off' === $fire->action_type) { |
|
| 131 | + $this->reverse_hit($fire); |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $reaction = $fire->reaction; |
| 136 | 136 | |
| 137 | 137 | $target = $fire->event_args->get_from_hierarchy( |
| 138 | - $reaction->get_meta( 'target' ) |
|
| 138 | + $reaction->get_meta('target') |
|
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | - if ( ! $target instanceof WordPoints_Entity ) { |
|
| 141 | + if ( ! $target instanceof WordPoints_Entity) { |
|
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $meta = array( 'hook_hit_id' => $fire->hit_id ); |
|
| 145 | + $meta = array('hook_hit_id' => $fire->hit_id); |
|
| 146 | 146 | |
| 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(); |
|
| 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(); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | wordpoints_alter_points( |
| 153 | 153 | $target->get_the_id() |
| 154 | - , $this->get_points_to_award( $fire ) |
|
| 155 | - , $reaction->get_meta( 'points_type' ) |
|
| 154 | + , $this->get_points_to_award($fire) |
|
| 155 | + , $reaction->get_meta('points_type') |
|
| 156 | 156 | , $reaction->get_event_slug() |
| 157 | 157 | , $meta |
| 158 | - , $reaction->get_meta( 'log_text' ) |
|
| 158 | + , $reaction->get_meta('log_text') |
|
| 159 | 159 | ); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * @since 2.1.0 |
| 164 | 164 | */ |
| 165 | - public function reverse_hit( WordPoints_Hook_Fire $fire ) { |
|
| 165 | + public function reverse_hit(WordPoints_Hook_Fire $fire) { |
|
| 166 | 166 | |
| 167 | - $hit_ids = $this->get_hit_ids_to_be_reversed( $fire ); |
|
| 167 | + $hit_ids = $this->get_hit_ids_to_be_reversed($fire); |
|
| 168 | 168 | |
| 169 | - if ( empty( $hit_ids ) ) { |
|
| 169 | + if (empty($hit_ids)) { |
|
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $logs = $query->get(); |
| 186 | 186 | |
| 187 | - if ( ! $logs ) { |
|
| 187 | + if ( ! $logs) { |
|
| 188 | 188 | return; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $this->reverse_logs( $logs, $fire ); |
|
| 191 | + $this->reverse_logs($logs, $fire); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @return array The IDs of the hits to be reversed. |
| 202 | 202 | */ |
| 203 | - protected function get_hit_ids_to_be_reversed( WordPoints_Hook_Fire $fire ) { |
|
| 203 | + protected function get_hit_ids_to_be_reversed(WordPoints_Hook_Fire $fire) { |
|
| 204 | 204 | |
| 205 | 205 | // We closely integrate with the reversals extension to get the hit IDs. |
| 206 | - if ( ! isset( $fire->data['reversals']['hit_ids'] ) ) { |
|
| 206 | + if ( ! isset($fire->data['reversals']['hit_ids'])) { |
|
| 207 | 207 | return array(); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -218,28 +218,28 @@ discard block |
||
| 218 | 218 | * @param object[] $logs The logs to reverse. |
| 219 | 219 | * @param WordPoints_Hook_Fire $fire The fire object. |
| 220 | 220 | */ |
| 221 | - protected function reverse_logs( $logs, WordPoints_Hook_Fire $fire ) { |
|
| 221 | + protected function reverse_logs($logs, WordPoints_Hook_Fire $fire) { |
|
| 222 | 222 | |
| 223 | - $event = wordpoints_hooks()->get_sub_app( 'events' )->get( |
|
| 223 | + $event = wordpoints_hooks()->get_sub_app('events')->get( |
|
| 224 | 224 | $fire->reaction->get_event_slug() |
| 225 | 225 | ); |
| 226 | 226 | |
| 227 | - if ( $event instanceof WordPoints_Hook_Event_ReversingI ) { |
|
| 227 | + if ($event instanceof WordPoints_Hook_Event_ReversingI) { |
|
| 228 | 228 | |
| 229 | 229 | // translators: 1. Log text for reversed transaction; 2. Reason for reversal. |
| 230 | - $template = __( 'Reversed “%1$s” (%2$s)', 'wordpoints' ); |
|
| 230 | + $template = __('Reversed “%1$s” (%2$s)', 'wordpoints'); |
|
| 231 | 231 | |
| 232 | 232 | $event_description = $event->get_reversal_text(); |
| 233 | 233 | |
| 234 | 234 | } else { |
| 235 | 235 | |
| 236 | 236 | // translators: 1. Log text for reversed transaction. |
| 237 | - $template = __( 'Reversed “%1$s”', 'wordpoints' ); |
|
| 237 | + $template = __('Reversed “%1$s”', 'wordpoints'); |
|
| 238 | 238 | |
| 239 | 239 | $event_description = ''; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - foreach ( $logs as $log ) { |
|
| 242 | + foreach ($logs as $log) { |
|
| 243 | 243 | |
| 244 | 244 | $log_id = wordpoints_alter_points( |
| 245 | 245 | $log->user_id |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | 'original_log_id' => $log->id, |
| 251 | 251 | 'hook_hit_id' => $fire->hit_id, |
| 252 | 252 | ) |
| 253 | - , sprintf( $template, $log->text, $event_description ) |
|
| 253 | + , sprintf($template, $log->text, $event_description) |
|
| 254 | 254 | ); |
| 255 | 255 | |
| 256 | 256 | // Mark the old log as reversed by this one. |
| 257 | - wordpoints_update_points_log_meta( $log->id, 'auto_reversed', $log_id ); |
|
| 257 | + wordpoints_update_points_log_meta($log->id, 'auto_reversed', $log_id); |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | * |
| 268 | 268 | * @return int The number of points to award. |
| 269 | 269 | */ |
| 270 | - protected function get_points_to_award( WordPoints_Hook_Fire $fire ) { |
|
| 270 | + protected function get_points_to_award(WordPoints_Hook_Fire $fire) { |
|
| 271 | 271 | |
| 272 | - $points = $fire->reaction->get_meta( 'points' ); |
|
| 272 | + $points = $fire->reaction->get_meta('points'); |
|
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | 275 | * Filters the number of points to award in the Points hook reactor. |