@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | * @param WordPoints_Hook_Fire $fire The hook fire object. |
23 | 23 | */ |
24 | - public function after_hit( WordPoints_Hook_Fire $fire ); |
|
24 | + public function after_hit(WordPoints_Hook_Fire $fire); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // EOF |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | array $settings |
28 | 28 | ) { |
29 | 29 | |
30 | - if ( isset( $settings['legacy_log_type'] ) ) { |
|
30 | + if (isset($settings['legacy_log_type'])) { |
|
31 | 31 | $reaction->update_meta( |
32 | 32 | 'legacy_log_type', |
33 | 33 | $settings['legacy_log_type'] |
34 | 34 | ); |
35 | 35 | } |
36 | 36 | |
37 | - parent::update_settings( $reaction, $settings ); |
|
37 | + parent::update_settings($reaction, $settings); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @since 1.0.0 |
54 | 54 | */ |
55 | - public function reverse_hit( WordPoints_Hook_Fire $fire ) { |
|
55 | + public function reverse_hit(WordPoints_Hook_Fire $fire) { |
|
56 | 56 | |
57 | - if ( isset( $fire->data['reversals_legacy_points']['points_logs'] ) ) { |
|
57 | + if (isset($fire->data['reversals_legacy_points']['points_logs'])) { |
|
58 | 58 | |
59 | 59 | $this->reverse_logs( |
60 | 60 | $fire->data['reversals_legacy_points']['points_logs'] |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | ); |
63 | 63 | |
64 | 64 | } else { |
65 | - parent::reverse_hit( $fire ); |
|
65 | + parent::reverse_hit($fire); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @since 1.0.0 |
71 | 71 | */ |
72 | - protected function get_hit_ids_to_be_reversed( WordPoints_Hook_Fire $fire ) { |
|
72 | + protected function get_hit_ids_to_be_reversed(WordPoints_Hook_Fire $fire) { |
|
73 | 73 | |
74 | 74 | // We closely integrate with the legacy reversals extension to get the IDs. |
75 | - if ( ! isset( $fire->data['reversals_legacy_points']['hit_ids'] ) ) { |
|
75 | + if ( ! isset($fire->data['reversals_legacy_points']['hit_ids'])) { |
|
76 | 76 | return array(); |
77 | 77 | } |
78 | 78 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function get_title() { |
23 | 23 | |
24 | - return __( 'Upload Media', 'wordpoints' ); |
|
24 | + return __('Upload Media', 'wordpoints'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function get_description() { |
31 | 31 | |
32 | - return __( 'When a file is uploaded to the Media Library.', 'wordpoints' ); |
|
32 | + return __('When a file is uploaded to the Media Library.', 'wordpoints'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @since 1.0.0 |
37 | 37 | */ |
38 | 38 | public function get_reversal_text() { |
39 | - return __( 'Media file deleted.', 'wordpoints' ); |
|
39 | + return __('Media file deleted.', 'wordpoints'); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 |
@@ -20,21 +20,21 @@ |
||
20 | 20 | * @since 1.0.0 |
21 | 21 | */ |
22 | 22 | public function get_title() { |
23 | - return __( 'Register', 'wordpoints' ); |
|
23 | + return __('Register', 'wordpoints'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | 29 | public function get_description() { |
30 | - return __( 'Registering.', 'wordpoints' ); |
|
30 | + return __('Registering.', 'wordpoints'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @since 1.0.0 |
35 | 35 | */ |
36 | 36 | public function get_reversal_text() { |
37 | - return __( 'User removed.', 'wordpoints' ); |
|
37 | + return __('User removed.', 'wordpoints'); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function get_title() { |
28 | 28 | |
29 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
29 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
30 | 30 | |
31 | - switch ( $parsed['dynamic'] ) { |
|
31 | + switch ($parsed['dynamic']) { |
|
32 | 32 | |
33 | 33 | case 'post': |
34 | - return __( 'Publish Post', 'wordpoints' ); |
|
34 | + return __('Publish Post', 'wordpoints'); |
|
35 | 35 | |
36 | 36 | case 'page': |
37 | - return __( 'Publish Page', 'wordpoints' ); |
|
37 | + return __('Publish Page', 'wordpoints'); |
|
38 | 38 | |
39 | 39 | default: |
40 | 40 | return sprintf( |
41 | 41 | // translators: singular name of the post type |
42 | - __( 'Publish %s', 'wordpoints' ) |
|
42 | + __('Publish %s', 'wordpoints') |
|
43 | 43 | , $this->get_entity_title() |
44 | 44 | ); |
45 | 45 | } |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function get_description() { |
52 | 52 | |
53 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
53 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
54 | 54 | |
55 | - switch ( $parsed['dynamic'] ) { |
|
55 | + switch ($parsed['dynamic']) { |
|
56 | 56 | |
57 | 57 | case 'post': |
58 | - return __( 'When a Post is published.', 'wordpoints' ); |
|
58 | + return __('When a Post is published.', 'wordpoints'); |
|
59 | 59 | |
60 | 60 | case 'page': |
61 | - return __( 'When a Page is published.', 'wordpoints' ); |
|
61 | + return __('When a Page is published.', 'wordpoints'); |
|
62 | 62 | |
63 | 63 | default: |
64 | 64 | return sprintf( |
65 | 65 | // translators: singular name of the post type |
66 | - __( 'When a %s is published.', 'wordpoints' ) |
|
66 | + __('When a %s is published.', 'wordpoints') |
|
67 | 67 | , $this->get_entity_title() |
68 | 68 | ); |
69 | 69 | } |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function get_reversal_text() { |
76 | 76 | |
77 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
77 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
78 | 78 | |
79 | - switch ( $parsed['dynamic'] ) { |
|
79 | + switch ($parsed['dynamic']) { |
|
80 | 80 | |
81 | 81 | case 'post': |
82 | - return __( 'Post removed.', 'wordpoints' ); |
|
82 | + return __('Post removed.', 'wordpoints'); |
|
83 | 83 | |
84 | 84 | case 'page': |
85 | - return __( 'Page removed.', 'wordpoints' ); |
|
85 | + return __('Page removed.', 'wordpoints'); |
|
86 | 86 | |
87 | 87 | default: |
88 | 88 | return sprintf( |
89 | 89 | // translators: singular name of the post type |
90 | - _x( '%s removed.', 'post type', 'wordpoints' ) |
|
90 | + _x('%s removed.', 'post type', 'wordpoints') |
|
91 | 91 | , $this->get_entity_title() |
92 | 92 | ); |
93 | 93 | } |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function get_title() { |
28 | 28 | |
29 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
29 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
30 | 30 | |
31 | - switch ( $parsed['dynamic'] ) { |
|
31 | + switch ($parsed['dynamic']) { |
|
32 | 32 | |
33 | 33 | case 'post': |
34 | - return __( 'Comment on a Post', 'wordpoints' ); |
|
34 | + return __('Comment on a Post', 'wordpoints'); |
|
35 | 35 | |
36 | 36 | case 'page': |
37 | - return __( 'Comment on a Page', 'wordpoints' ); |
|
37 | + return __('Comment on a Page', 'wordpoints'); |
|
38 | 38 | |
39 | 39 | case 'attachment': |
40 | - return __( 'Comment on a Media Upload', 'wordpoints' ); |
|
40 | + return __('Comment on a Media Upload', 'wordpoints'); |
|
41 | 41 | |
42 | 42 | default: |
43 | 43 | return sprintf( |
44 | 44 | // translators: singular name of the post type |
45 | - __( 'Comment on a %s', 'wordpoints' ) |
|
45 | + __('Comment on a %s', 'wordpoints') |
|
46 | 46 | , $this->get_entity_title() |
47 | 47 | ); |
48 | 48 | } |
@@ -53,23 +53,23 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_description() { |
55 | 55 | |
56 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
56 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
57 | 57 | |
58 | - switch ( $parsed['dynamic'] ) { |
|
58 | + switch ($parsed['dynamic']) { |
|
59 | 59 | |
60 | 60 | case 'post': |
61 | - return __( 'When a user leaves a comment on a Post.', 'wordpoints' ); |
|
61 | + return __('When a user leaves a comment on a Post.', 'wordpoints'); |
|
62 | 62 | |
63 | 63 | case 'page': |
64 | - return __( 'When a user leaves a comment on a Page.', 'wordpoints' ); |
|
64 | + return __('When a user leaves a comment on a Page.', 'wordpoints'); |
|
65 | 65 | |
66 | 66 | case 'attachment': |
67 | - return __( 'When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints' ); |
|
67 | + return __('When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints'); |
|
68 | 68 | |
69 | 69 | default: |
70 | 70 | return sprintf( |
71 | 71 | // translators: singular name of the post type |
72 | - __( 'When a user leaves a comment on a %s.', 'wordpoints' ) |
|
72 | + __('When a user leaves a comment on a %s.', 'wordpoints') |
|
73 | 73 | , $this->get_entity_title() |
74 | 74 | ); |
75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @since 1.0.0 |
80 | 80 | */ |
81 | 81 | public function get_reversal_text() { |
82 | - return __( 'Comment removed.', 'wordpoints' ); |
|
82 | + return __('Comment removed.', 'wordpoints'); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | * @param WordPoints_Hook_Fire $fire The fire that was a miss. |
23 | 23 | */ |
24 | - public function after_miss( WordPoints_Hook_Fire $fire ); |
|
24 | + public function after_miss(WordPoints_Hook_Fire $fire); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // EOF |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @since 1.0.0 |
25 | 25 | */ |
26 | - public function should_hit( WordPoints_Hook_Fire $fire ) { |
|
26 | + public function should_hit(WordPoints_Hook_Fire $fire) { |
|
27 | 27 | |
28 | - if ( ! parent::should_hit( $fire ) ) { |
|
28 | + if ( ! parent::should_hit($fire)) { |
|
29 | 29 | |
30 | - $logs = $this->get_points_logs_to_be_reversed( $fire ); |
|
30 | + $logs = $this->get_points_logs_to_be_reversed($fire); |
|
31 | 31 | |
32 | - return count( $logs ) > 0; |
|
32 | + return count($logs) > 0; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return true; |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * @since 1.0.0 |
40 | 40 | */ |
41 | - public function after_miss( WordPoints_Hook_Fire $fire ) { |
|
41 | + public function after_miss(WordPoints_Hook_Fire $fire) { |
|
42 | 42 | |
43 | - parent::after_miss( $fire ); |
|
43 | + parent::after_miss($fire); |
|
44 | 44 | |
45 | - if ( ! $this->get_settings_from_fire( $fire ) ) { |
|
45 | + if ( ! $this->get_settings_from_fire($fire)) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | - foreach ( $this->get_points_logs_to_be_reversed( $fire ) as $log ) { |
|
50 | - wordpoints_add_points_log_meta( $log->id, 'auto_reversed', 0 ); |
|
49 | + foreach ($this->get_points_logs_to_be_reversed($fire) as $log) { |
|
50 | + wordpoints_add_points_log_meta($log->id, 'auto_reversed', 0); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return array The points logs to be reversed. |
62 | 62 | */ |
63 | - protected function get_points_logs_to_be_reversed( WordPoints_Hook_Fire $fire ) { |
|
63 | + protected function get_points_logs_to_be_reversed(WordPoints_Hook_Fire $fire) { |
|
64 | 64 | |
65 | - if ( isset( $fire->data[ $this->slug ]['points_logs'] ) ) { |
|
66 | - return $fire->data[ $this->slug ]['points_logs']; |
|
65 | + if (isset($fire->data[$this->slug]['points_logs'])) { |
|
66 | + return $fire->data[$this->slug]['points_logs']; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $entity = $fire->event_args->get_primary_arg(); |
70 | 70 | |
71 | - if ( ! $entity ) { |
|
72 | - $fire->data[ $this->slug ]['points_logs'] = array(); |
|
71 | + if ( ! $entity) { |
|
72 | + $fire->data[$this->slug]['points_logs'] = array(); |
|
73 | 73 | return array(); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $slug = $entity->get_slug(); |
77 | 77 | |
78 | - if ( ( $pos = strpos( $slug, '\\' ) ) ) { |
|
79 | - $slug = substr( $slug, 0, $pos ); |
|
78 | + if (($pos = strpos($slug, '\\'))) { |
|
79 | + $slug = substr($slug, 0, $pos); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $meta_queries = array( |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | ) |
93 | 93 | ); |
94 | 94 | |
95 | - $log_type = $fire->reaction->get_meta( 'legacy_log_type' ); |
|
95 | + $log_type = $fire->reaction->get_meta('legacy_log_type'); |
|
96 | 96 | |
97 | - if ( ! $log_type ) { |
|
97 | + if ( ! $log_type) { |
|
98 | 98 | $log_type = $fire->reaction->get_event_slug(); |
99 | 99 | } |
100 | 100 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | |
108 | 108 | $logs = $query->get(); |
109 | 109 | |
110 | - if ( ! $logs ) { |
|
110 | + if ( ! $logs) { |
|
111 | 111 | $logs = array(); |
112 | 112 | } |
113 | 113 | |
114 | - $fire->data[ $this->slug ]['points_logs'] = $logs; |
|
114 | + $fire->data[$this->slug]['points_logs'] = $logs; |
|
115 | 115 | |
116 | 116 | return $logs; |
117 | 117 | } |
@@ -106,7 +106,7 @@ |
||
106 | 106 | , 'WordPointsPointsTypesL10n' |
107 | 107 | , array( |
108 | 108 | 'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints' ) |
109 | - . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ), |
|
109 | + . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ), |
|
110 | 110 | 'confirmTitle' => esc_html__( 'Are you sure?', 'wordpoints' ), |
111 | 111 | 'deleteText' => esc_html__( 'Delete', 'wordpoints' ), |
112 | 112 | 'cancelText' => esc_html__( 'Cancel', 'wordpoints' ), |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param WordPoints_App $app The main WordPoints app. |
18 | 18 | */ |
19 | -function wordpoints_hooks_register_admin_apps( $app ) { |
|
19 | +function wordpoints_hooks_register_admin_apps($app) { |
|
20 | 20 | |
21 | 21 | $apps = $app->sub_apps(); |
22 | 22 | |
23 | - $apps->register( 'admin', 'WordPoints_App' ); |
|
23 | + $apps->register('admin', 'WordPoints_App'); |
|
24 | 24 | |
25 | 25 | /** @var WordPoints_App $admin */ |
26 | - $admin = $apps->get( 'admin' ); |
|
26 | + $admin = $apps->get('admin'); |
|
27 | 27 | |
28 | - $admin->sub_apps()->register( 'screen', 'WordPoints_Admin_Screens' ); |
|
28 | + $admin->sub_apps()->register('screen', 'WordPoints_Admin_Screens'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | $wordpoints_menu = wordpoints_get_main_admin_menu(); |
42 | 42 | |
43 | 43 | /** @var WordPoints_Admin_Screens $admin_screens */ |
44 | - $admin_screens = wordpoints_apps()->get_sub_app( 'admin' )->get_sub_app( |
|
44 | + $admin_screens = wordpoints_apps()->get_sub_app('admin')->get_sub_app( |
|
45 | 45 | 'screen' |
46 | 46 | ); |
47 | 47 | |
48 | 48 | // Hooks page. |
49 | 49 | $id = add_submenu_page( |
50 | 50 | $wordpoints_menu |
51 | - , __( 'WordPoints — Points Types', 'wordpoints' ) |
|
52 | - , __( 'Points Types', 'wordpoints' ) |
|
51 | + , __('WordPoints — Points Types', 'wordpoints') |
|
52 | + , __('Points Types', 'wordpoints') |
|
53 | 53 | , 'manage_options' |
54 | 54 | , 'wordpoints_points_types' |
55 | - , array( $admin_screens, 'display' ) |
|
55 | + , array($admin_screens, 'display') |
|
56 | 56 | ); |
57 | 57 | |
58 | - if ( $id ) { |
|
59 | - $admin_screens->register( $id, 'WordPoints_Admin_Screen_Points_Types' ); |
|
58 | + if ($id) { |
|
59 | + $admin_screens->register($id, 'WordPoints_Admin_Screen_Points_Types'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Remove the old hooks screen if not needed. |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | |
70 | 70 | // If all of the registered hooks have been imported and disabled, then there is |
71 | 71 | // no need to keep the old hooks screen. |
72 | - if ( ! array_diff_key( $hooks, $disabled_hooks ) ) { |
|
73 | - remove_submenu_page( $wordpoints_menu, 'wordpoints_points_hooks' ); |
|
72 | + if ( ! array_diff_key($hooks, $disabled_hooks)) { |
|
73 | + remove_submenu_page($wordpoints_menu, 'wordpoints_points_hooks'); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | */ |
84 | 84 | function wordpoints_hooks_admin_register_scripts() { |
85 | 85 | |
86 | - $assets_url = wordpoints_modules_url( '/assets', dirname( __FILE__ ) ); |
|
86 | + $assets_url = wordpoints_modules_url('/assets', dirname(__FILE__)); |
|
87 | 87 | |
88 | 88 | // CSS |
89 | 89 | |
90 | 90 | wp_register_style( |
91 | 91 | 'wordpoints-hooks-admin' |
92 | - , $assets_url . '/css/hooks.css' |
|
93 | - , array( 'dashicons', 'wp-jquery-ui-dialog' ) |
|
92 | + , $assets_url.'/css/hooks.css' |
|
93 | + , array('dashicons', 'wp-jquery-ui-dialog') |
|
94 | 94 | , WORDPOINTS_VERSION |
95 | 95 | ); |
96 | 96 | |
@@ -98,22 +98,22 @@ discard block |
||
98 | 98 | |
99 | 99 | wp_register_script( |
100 | 100 | 'wordpoints-admin-points-types' |
101 | - , $assets_url . '/js/points-types.js' |
|
102 | - , array( 'backbone', 'jquery-ui-dialog', 'wp-util' ) |
|
101 | + , $assets_url.'/js/points-types.js' |
|
102 | + , array('backbone', 'jquery-ui-dialog', 'wp-util') |
|
103 | 103 | , WORDPOINTS_VERSION |
104 | 104 | ); |
105 | 105 | |
106 | 106 | wp_register_script( |
107 | 107 | 'wordpoints-hooks-models' |
108 | - , $assets_url . '/js/hooks/models.js' |
|
109 | - , array( 'backbone', 'jquery-ui-dialog', 'wp-util' ) |
|
108 | + , $assets_url.'/js/hooks/models.js' |
|
109 | + , array('backbone', 'jquery-ui-dialog', 'wp-util') |
|
110 | 110 | , WORDPOINTS_VERSION |
111 | 111 | ); |
112 | 112 | |
113 | 113 | wp_register_script( |
114 | 114 | 'wordpoints-hooks-views' |
115 | - , $assets_url . '/js/hooks/views.js' |
|
116 | - , array( 'wordpoints-hooks-models' ) |
|
115 | + , $assets_url.'/js/hooks/views.js' |
|
116 | + , array('wordpoints-hooks-models') |
|
117 | 117 | , WORDPOINTS_VERSION |
118 | 118 | ); |
119 | 119 | |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | 'wordpoints-admin-points-types' |
122 | 122 | , 'WordPointsPointsTypesL10n' |
123 | 123 | , array( |
124 | - 'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints' ) |
|
125 | - . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ), |
|
126 | - 'confirmTitle' => esc_html__( 'Are you sure?', 'wordpoints' ), |
|
127 | - 'deleteText' => esc_html__( 'Delete', 'wordpoints' ), |
|
128 | - 'cancelText' => esc_html__( 'Cancel', 'wordpoints' ), |
|
124 | + 'confirmDelete' => esc_html__('Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints') |
|
125 | + . ' '.esc_html__('Once a points type has been deleted, you cannot bring it back.', 'wordpoints'), |
|
126 | + 'confirmTitle' => esc_html__('Are you sure?', 'wordpoints'), |
|
127 | + 'deleteText' => esc_html__('Delete', 'wordpoints'), |
|
128 | + 'cancelText' => esc_html__('Cancel', 'wordpoints'), |
|
129 | 129 | ) |
130 | 130 | ); |
131 | 131 | |
@@ -133,19 +133,19 @@ discard block |
||
133 | 133 | 'wordpoints-hooks-views' |
134 | 134 | , 'WordPointsHooksAdminL10n' |
135 | 135 | , array( |
136 | - 'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
137 | - 'changesSaved' => __( 'Your changes have been saved.', 'wordpoints' ), |
|
136 | + 'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
137 | + 'changesSaved' => __('Your changes have been saved.', 'wordpoints'), |
|
138 | 138 | /* translators: the name of the field that cannot be empty */ |
139 | - 'emptyField' => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ), |
|
140 | - 'confirmDelete' => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ), |
|
141 | - 'confirmTitle' => __( 'Are you sure?', 'wordpoints' ), |
|
142 | - 'deleteText' => __( 'Delete', 'wordpoints' ), |
|
143 | - 'cancelText' => __( 'Cancel', 'wordpoints' ), |
|
144 | - 'separator' => __( ' » ', 'wordpoints' ), |
|
145 | - 'target_label' => __( 'Target', 'wordpoints' ), |
|
139 | + 'emptyField' => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'), |
|
140 | + 'confirmDelete' => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'), |
|
141 | + 'confirmTitle' => __('Are you sure?', 'wordpoints'), |
|
142 | + 'deleteText' => __('Delete', 'wordpoints'), |
|
143 | + 'cancelText' => __('Cancel', 'wordpoints'), |
|
144 | + 'separator' => __(' » ', 'wordpoints'), |
|
145 | + 'target_label' => __('Target', 'wordpoints'), |
|
146 | 146 | // translators: form field |
147 | - 'cannotBeChanged' => __( '(cannot be changed)', 'wordpoints' ), |
|
148 | - 'fieldsInvalid' => __( 'Error: the values of some fields are invalid. Please correct these and then try again.', 'wordpoints' ), |
|
147 | + 'cannotBeChanged' => __('(cannot be changed)', 'wordpoints'), |
|
148 | + 'fieldsInvalid' => __('Error: the values of some fields are invalid. Please correct these and then try again.', 'wordpoints'), |
|
149 | 149 | ) |
150 | 150 | ); |
151 | 151 | |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | <div class="view"> |
158 | 158 | <div class="title"></div> |
159 | 159 | <button type="button" class="edit button-secondary"> |
160 | - ' . esc_html__( 'Edit', 'wordpoints' ) . ' |
|
160 | + ' . esc_html__('Edit', 'wordpoints').' |
|
161 | 161 | </button> |
162 | 162 | <button type="button" class="close button-secondary"> |
163 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
163 | + ' . esc_html__('Close', 'wordpoints').' |
|
164 | 164 | </button> |
165 | 165 | </div> |
166 | 166 | <div class="form"> |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | </div> |
180 | 180 | <div class="action-buttons"> |
181 | 181 | <button type="button" class="save button-primary" disabled> |
182 | - ' . esc_html__( 'Save', 'wordpoints' ) . ' |
|
182 | + ' . esc_html__('Save', 'wordpoints').' |
|
183 | 183 | </button> |
184 | 184 | <button type="button" class="cancel button-secondary"> |
185 | - ' . esc_html__( 'Cancel', 'wordpoints' ) . ' |
|
185 | + ' . esc_html__('Cancel', 'wordpoints').' |
|
186 | 186 | </button> |
187 | 187 | <button type="button" class="close button-secondary"> |
188 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
188 | + ' . esc_html__('Close', 'wordpoints').' |
|
189 | 189 | </button> |
190 | 190 | <button type="button" class="delete button-secondary"> |
191 | - ' . esc_html__( 'Delete', 'wordpoints' ) . ' |
|
191 | + ' . esc_html__('Delete', 'wordpoints').' |
|
192 | 192 | </button> |
193 | 193 | </div> |
194 | 194 | </div> |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | |
237 | 237 | wp_register_script( |
238 | 238 | 'wordpoints-hooks-reactor-points' |
239 | - , $assets_url . '/js/hooks/reactors/points.js' |
|
240 | - , array( 'wordpoints-hooks-views' ) |
|
239 | + , $assets_url.'/js/hooks/reactors/points.js' |
|
240 | + , array('wordpoints-hooks-views') |
|
241 | 241 | , WORDPOINTS_VERSION |
242 | 242 | ); |
243 | 243 | |
244 | 244 | wp_register_script( |
245 | 245 | 'wordpoints-hooks-extension-conditions' |
246 | - , $assets_url . '/js/hooks/extensions/conditions.js' |
|
247 | - , array( 'wordpoints-hooks-views' ) |
|
246 | + , $assets_url.'/js/hooks/extensions/conditions.js' |
|
247 | + , array('wordpoints-hooks-views') |
|
248 | 248 | , WORDPOINTS_VERSION |
249 | 249 | ); |
250 | 250 | |
@@ -254,25 +254,25 @@ discard block |
||
254 | 254 | , ' |
255 | 255 | <script type="text/template" id="tmpl-wordpoints-hook-condition-groups"> |
256 | 256 | <div class="conditions-title section-title"> |
257 | - <h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4> |
|
257 | + <h4>' . esc_html__('Conditions', 'wordpoints').'</h4> |
|
258 | 258 | <button type="button" class="add-new button-secondary button-link"> |
259 | - <span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span> |
|
259 | + <span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints').'</span> |
|
260 | 260 | <span class="dashicons dashicons-plus"></span> |
261 | 261 | </button> |
262 | 262 | </div> |
263 | 263 | <div class="add-condition-form hidden"> |
264 | 264 | <div class="no-conditions hidden"> |
265 | - ' . esc_html__( 'No conditions available.', 'wordpoints' ) . ' |
|
265 | + ' . esc_html__('No conditions available.', 'wordpoints').' |
|
266 | 266 | </div> |
267 | 267 | <div class="condition-selectors"> |
268 | 268 | <div class="arg-selectors"></div> |
269 | 269 | <div class="condition-selector"></div> |
270 | 270 | </div> |
271 | - <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '"> |
|
272 | - ' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . ' |
|
271 | + <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints').'"> |
|
272 | + ' . esc_html_x('Add', 'reaction condition', 'wordpoints').' |
|
273 | 273 | </button> |
274 | - <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '"> |
|
275 | - ' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . ' |
|
274 | + <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints').'"> |
|
275 | + ' . esc_html_x('Cancel', 'reaction condition', 'wordpoints').' |
|
276 | 276 | </button> |
277 | 277 | </div> |
278 | 278 | <div class="condition-groups section-content"></div> |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | <div class="condition-controls"> |
287 | 287 | <div class="condition-title"></div> |
288 | 288 | <button type="button" class="delete button-secondary button-link"> |
289 | - <span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span> |
|
289 | + <span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints').'</span> |
|
290 | 290 | <span class="dashicons dashicons-no"></span> |
291 | 291 | </button> |
292 | 292 | </div> |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | |
305 | 305 | wp_register_script( |
306 | 306 | 'wordpoints-hooks-extension-periods' |
307 | - , $assets_url . '/js/hooks/extensions/periods.js' |
|
308 | - , array( 'wordpoints-hooks-views' ) |
|
307 | + , $assets_url.'/js/hooks/extensions/periods.js' |
|
308 | + , array('wordpoints-hooks-views') |
|
309 | 309 | , WORDPOINTS_VERSION |
310 | 310 | ); |
311 | 311 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | , ' |
316 | 316 | <script type="text/template" id="tmpl-wordpoints-hook-periods"> |
317 | 317 | <div class="periods-title section-title"> |
318 | - <h4>' . esc_html__( 'Rate Limit', 'wordpoints' ) . '</h4> |
|
318 | + <h4>' . esc_html__('Rate Limit', 'wordpoints').'</h4> |
|
319 | 319 | </div> |
320 | 320 | <div class="periods section-content"></div> |
321 | 321 | </script> |
@@ -333,12 +333,12 @@ discard block |
||
333 | 333 | $hooks = wordpoints_hooks(); |
334 | 334 | |
335 | 335 | $extensions_data = wordpoints_hooks_ui_get_script_data_from_objects( |
336 | - $hooks->get_sub_app( 'extensions' )->get_all() |
|
336 | + $hooks->get_sub_app('extensions')->get_all() |
|
337 | 337 | , 'extension' |
338 | 338 | ); |
339 | 339 | |
340 | 340 | $reactor_data = wordpoints_hooks_ui_get_script_data_from_objects( |
341 | - $hooks->get_sub_app( 'reactors' )->get_all() |
|
341 | + $hooks->get_sub_app('reactors')->get_all() |
|
342 | 342 | , 'reactor' |
343 | 343 | ); |
344 | 344 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * |
365 | 365 | * @param array $data The data. |
366 | 366 | */ |
367 | - $data = apply_filters( 'wordpoints_hooks_ui_data', $data ); |
|
367 | + $data = apply_filters('wordpoints_hooks_ui_data', $data); |
|
368 | 368 | |
369 | 369 | wp_localize_script( |
370 | 370 | 'wordpoints-hooks-models' |
@@ -384,18 +384,18 @@ discard block |
||
384 | 384 | * |
385 | 385 | * @return array The data extracted from the objects. |
386 | 386 | */ |
387 | -function wordpoints_hooks_ui_get_script_data_from_objects( $objects, $type ) { |
|
387 | +function wordpoints_hooks_ui_get_script_data_from_objects($objects, $type) { |
|
388 | 388 | |
389 | 389 | $data = array(); |
390 | 390 | |
391 | - foreach ( $objects as $slug => $object ) { |
|
391 | + foreach ($objects as $slug => $object) { |
|
392 | 392 | |
393 | - if ( $object instanceof WordPoints_Hook_UI_Script_Data_ProviderI ) { |
|
394 | - $data[ $slug ] = $object->get_ui_script_data(); |
|
393 | + if ($object instanceof WordPoints_Hook_UI_Script_Data_ProviderI) { |
|
394 | + $data[$slug] = $object->get_ui_script_data(); |
|
395 | 395 | } |
396 | 396 | |
397 | - if ( wp_script_is( "wordpoints-hooks-{$type}-{$slug}", 'registered' ) ) { |
|
398 | - wp_enqueue_script( "wordpoints-hooks-{$type}-{$slug}" ); |
|
397 | + if (wp_script_is("wordpoints-hooks-{$type}-{$slug}", 'registered')) { |
|
398 | + wp_enqueue_script("wordpoints-hooks-{$type}-{$slug}"); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
@@ -416,31 +416,31 @@ discard block |
||
416 | 416 | $entities_data = array(); |
417 | 417 | |
418 | 418 | /** @var WordPoints_Class_Registry_Children $entity_children */ |
419 | - $entity_children = $entities->get_sub_app( 'children' ); |
|
419 | + $entity_children = $entities->get_sub_app('children'); |
|
420 | 420 | |
421 | 421 | /** @var WordPoints_Entity $entity */ |
422 | - foreach ( $entities->get_all() as $slug => $entity ) { |
|
422 | + foreach ($entities->get_all() as $slug => $entity) { |
|
423 | 423 | |
424 | 424 | $child_data = array(); |
425 | 425 | |
426 | 426 | /** @var WordPoints_EntityishI $child */ |
427 | - foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) { |
|
427 | + foreach ($entity_children->get_children($slug) as $child_slug => $child) { |
|
428 | 428 | |
429 | - $child_data[ $child_slug ] = array( |
|
429 | + $child_data[$child_slug] = array( |
|
430 | 430 | 'slug' => $child_slug, |
431 | 431 | 'title' => $child->get_title(), |
432 | 432 | ); |
433 | 433 | |
434 | - if ( $child instanceof WordPoints_Entity_Attr ) { |
|
434 | + if ($child instanceof WordPoints_Entity_Attr) { |
|
435 | 435 | |
436 | - $child_data[ $child_slug ]['_type'] = 'attr'; |
|
437 | - $child_data[ $child_slug ]['data_type'] = $child->get_data_type(); |
|
436 | + $child_data[$child_slug]['_type'] = 'attr'; |
|
437 | + $child_data[$child_slug]['data_type'] = $child->get_data_type(); |
|
438 | 438 | |
439 | - } elseif ( $child instanceof WordPoints_Entity_Relationship ) { |
|
439 | + } elseif ($child instanceof WordPoints_Entity_Relationship) { |
|
440 | 440 | |
441 | - $child_data[ $child_slug ]['_type'] = 'relationship'; |
|
442 | - $child_data[ $child_slug ]['primary'] = $child->get_primary_entity_slug(); |
|
443 | - $child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug(); |
|
441 | + $child_data[$child_slug]['_type'] = 'relationship'; |
|
442 | + $child_data[$child_slug]['primary'] = $child->get_primary_entity_slug(); |
|
443 | + $child_data[$child_slug]['secondary'] = $child->get_related_entity_slug(); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | /** |
@@ -451,14 +451,14 @@ discard block |
||
451 | 451 | * @param array $data The data for the entity child. |
452 | 452 | * @param WordPoints_Entityish $child The child's object. |
453 | 453 | */ |
454 | - $child_data[ $child_slug ] = apply_filters( |
|
454 | + $child_data[$child_slug] = apply_filters( |
|
455 | 455 | 'wordpoints_hooks_ui_data_entity_child' |
456 | - , $child_data[ $child_slug ] |
|
456 | + , $child_data[$child_slug] |
|
457 | 457 | , $child |
458 | 458 | ); |
459 | 459 | } |
460 | 460 | |
461 | - $entities_data[ $slug ] = array( |
|
461 | + $entities_data[$slug] = array( |
|
462 | 462 | 'slug' => $slug, |
463 | 463 | 'title' => $entity->get_title(), |
464 | 464 | 'children' => $child_data, |
@@ -466,12 +466,12 @@ discard block |
||
466 | 466 | '_type' => 'entity', |
467 | 467 | ); |
468 | 468 | |
469 | - if ( $entity instanceof WordPoints_Entity_EnumerableI ) { |
|
469 | + if ($entity instanceof WordPoints_Entity_EnumerableI) { |
|
470 | 470 | |
471 | 471 | $values = array(); |
472 | 472 | |
473 | - foreach ( $entity->get_enumerated_values() as $value ) { |
|
474 | - if ( $entity->set_the_value( $value ) ) { |
|
473 | + foreach ($entity->get_enumerated_values() as $value) { |
|
474 | + if ($entity->set_the_value($value)) { |
|
475 | 475 | $values[] = array( |
476 | 476 | 'value' => $entity->get_the_id(), |
477 | 477 | 'label' => $entity->get_the_human_id(), |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
482 | - $entities_data[ $slug ]['values'] = $values; |
|
482 | + $entities_data[$slug]['values'] = $values; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | * @param array $data The data for the entity. |
489 | 489 | * @param WordPoints_Entity $entity The entity object. |
490 | 490 | */ |
491 | - $entities_data[ $slug ] = apply_filters( |
|
491 | + $entities_data[$slug] = apply_filters( |
|
492 | 492 | 'wordpoints_hooks_ui_data_entity' |
493 | - , $entities_data[ $slug ] |
|
493 | + , $entities_data[$slug] |
|
494 | 494 | , $entity |
495 | 495 | ); |
496 | 496 | } |
@@ -510,19 +510,19 @@ discard block |
||
510 | 510 | // We want a list of the action types for each event. We can start with this list |
511 | 511 | // but it is indexed by action slug and then action type and then event slug, so |
512 | 512 | // we ned to do some processing. |
513 | - $event_index = wordpoints_hooks()->get_sub_app( 'router' )->get_event_index(); |
|
513 | + $event_index = wordpoints_hooks()->get_sub_app('router')->get_event_index(); |
|
514 | 514 | |
515 | 515 | // We don't care about the action slugs, so first we get rid of that bottom level |
516 | 516 | // of the array. |
517 | - $event_index = call_user_func_array( 'array_merge_recursive', $event_index ); |
|
517 | + $event_index = call_user_func_array('array_merge_recursive', $event_index); |
|
518 | 518 | |
519 | 519 | $event_action_types = array(); |
520 | 520 | |
521 | 521 | // This leaves us the event indexed by action type. But we actually need to flip |
522 | 522 | // this, so that we have the action types indexed by event slug. |
523 | - foreach ( $event_index as $action_type => $events ) { |
|
524 | - foreach ( $events as $event => $unused ) { |
|
525 | - $event_action_types[ $event ][ $action_type ] = true; |
|
523 | + foreach ($event_index as $action_type => $events) { |
|
524 | + foreach ($events as $event => $unused) { |
|
525 | + $event_action_types[$event][$action_type] = true; |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -545,13 +545,13 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @return string The HTML with templates appended. |
547 | 547 | */ |
548 | -function wordpoints_script_templates_filter( $html, $handle ) { |
|
548 | +function wordpoints_script_templates_filter($html, $handle) { |
|
549 | 549 | |
550 | 550 | global $wp_scripts; |
551 | 551 | |
552 | - $templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' ); |
|
552 | + $templates = $wp_scripts->get_data($handle, 'wordpoints-templates'); |
|
553 | 553 | |
554 | - if ( $templates ) { |
|
554 | + if ($templates) { |
|
555 | 555 | $html .= $templates; |
556 | 556 | } |
557 | 557 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | */ |
568 | 568 | function wordpoints_hooks_admin_ajax() { |
569 | 569 | |
570 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
570 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
571 | 571 | new WordPoints_Admin_Ajax_Hooks; |
572 | 572 | } |
573 | 573 | } |