@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @since 1.0.0 |
32 | 32 | */ |
33 | - do_action( 'wordpoints_admin_configure_head' ); |
|
33 | + do_action('wordpoints_admin_configure_head'); |
|
34 | 34 | |
35 | 35 | wordpoints_admin_show_tabs( |
36 | 36 | array( |
37 | - 'general' => __( 'General Settings', 'wordpoints' ), |
|
38 | - 'components' => __( 'Components', 'wordpoints' ), |
|
37 | + 'general' => __('General Settings', 'wordpoints'), |
|
38 | + 'components' => __('Components', 'wordpoints'), |
|
39 | 39 | ) |
40 | 40 | ); |
41 | 41 | |
42 | - if ( 'components' === wordpoints_admin_get_current_tab() ) { |
|
42 | + if ('components' === wordpoints_admin_get_current_tab()) { |
|
43 | 43 | /** |
44 | 44 | * The Components screen. |
45 | 45 | * |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @since 1.0.0 |
62 | 62 | */ |
63 | - do_action( 'wordpoints_admin_configure_foot' ); |
|
63 | + do_action('wordpoints_admin_configure_foot'); |
|
64 | 64 | |
65 | 65 | ?> |
66 | 66 |
@@ -7,37 +7,37 @@ |
||
7 | 7 | * @since 2.1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps' ); |
|
10 | +add_action('wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps'); |
|
11 | 11 | |
12 | -add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' ); |
|
13 | -add_action( 'admin_init', 'wordpoints_register_admin_scripts' ); |
|
12 | +add_action('admin_init', 'wordpoints_hooks_admin_ajax'); |
|
13 | +add_action('admin_init', 'wordpoints_register_admin_scripts'); |
|
14 | 14 | |
15 | -add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 ); |
|
15 | +add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2); |
|
16 | 16 | |
17 | -add_action( 'admin_menu', 'wordpoints_admin_menu' ); |
|
18 | -add_action( 'network_admin_menu', 'wordpoints_admin_menu' ); |
|
17 | +add_action('admin_menu', 'wordpoints_admin_menu'); |
|
18 | +add_action('network_admin_menu', 'wordpoints_admin_menu'); |
|
19 | 19 | |
20 | -add_action( 'load-wordpoints_page_wordpoints_modules', 'wordpoints_admin_screen_modules_load' ); |
|
21 | -add_action( 'load-toplevel_page_wordpoints_modules', 'wordpoints_admin_screen_modules_load' ); |
|
20 | +add_action('load-wordpoints_page_wordpoints_modules', 'wordpoints_admin_screen_modules_load'); |
|
21 | +add_action('load-toplevel_page_wordpoints_modules', 'wordpoints_admin_screen_modules_load'); |
|
22 | 22 | |
23 | -add_action( 'load-toplevel_page_wordpoints_configure', 'wordpoints_admin_screen_configure_load' ); |
|
23 | +add_action('load-toplevel_page_wordpoints_configure', 'wordpoints_admin_screen_configure_load'); |
|
24 | 24 | |
25 | -add_action( 'load-toplevel_page_wordpoints_configure', 'wordpoints_admin_activate_components' ); |
|
25 | +add_action('load-toplevel_page_wordpoints_configure', 'wordpoints_admin_activate_components'); |
|
26 | 26 | |
27 | -add_action( 'wordpoints_install_modules-upload', 'wordpoints_install_modules_upload' ); |
|
27 | +add_action('wordpoints_install_modules-upload', 'wordpoints_install_modules_upload'); |
|
28 | 28 | |
29 | -add_action( 'update-custom_upload-wordpoints-module', 'wordpoints_upload_module_zip' ); |
|
29 | +add_action('update-custom_upload-wordpoints-module', 'wordpoints_upload_module_zip'); |
|
30 | 30 | |
31 | -add_action( 'upgrader_source_selection', 'wordpoints_plugin_upload_error_filter', 5 ); |
|
32 | -add_action( 'upgrader_source_selection', 'wordpoints_plugin_upload_error_filter', 20 ); |
|
31 | +add_action('upgrader_source_selection', 'wordpoints_plugin_upload_error_filter', 5); |
|
32 | +add_action('upgrader_source_selection', 'wordpoints_plugin_upload_error_filter', 20); |
|
33 | 33 | |
34 | -add_action( 'wordpoints_admin_configure_foot', 'wordpoints_admin_settings_screen_sidebar', 5 ); |
|
34 | +add_action('wordpoints_admin_configure_foot', 'wordpoints_admin_settings_screen_sidebar', 5); |
|
35 | 35 | |
36 | -add_action( 'admin_notices', 'wordpoints_admin_notices' ); |
|
36 | +add_action('admin_notices', 'wordpoints_admin_notices'); |
|
37 | 37 | |
38 | -add_action( 'set-screen-option', 'wordpoints_admin_set_screen_option', 10, 3 ); |
|
38 | +add_action('set-screen-option', 'wordpoints_admin_set_screen_option', 10, 3); |
|
39 | 39 | |
40 | -add_action( 'wp_ajax_nopriv_wordpoints_breaking_module_check', 'wordpoints_admin_ajax_breaking_module_check' ); |
|
41 | -add_action( 'wp_ajax_wordpoints-delete-admin-notice-option', 'wordpoints_delete_admin_notice_option' ); |
|
40 | +add_action('wp_ajax_nopriv_wordpoints_breaking_module_check', 'wordpoints_admin_ajax_breaking_module_check'); |
|
41 | +add_action('wp_ajax_wordpoints-delete-admin-notice-option', 'wordpoints_delete_admin_notice_option'); |
|
42 | 42 | |
43 | 43 | // EOF |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @type string $title Text for H2 title used by WP_Upgrader_Skin::header(). |
51 | 51 | * } |
52 | 52 | */ |
53 | - public function __construct( $args = array() ) { |
|
53 | + public function __construct($args = array()) { |
|
54 | 54 | |
55 | 55 | $defaults = array( |
56 | 56 | 'type' => 'upload', |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | 'title' => '', |
60 | 60 | ); |
61 | 61 | |
62 | - $args = array_merge( $defaults, $args ); |
|
62 | + $args = array_merge($defaults, $args); |
|
63 | 63 | |
64 | 64 | $this->type = $args['type']; |
65 | 65 | |
66 | - parent::__construct( $args ); |
|
66 | + parent::__construct($args); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function after() { |
75 | 75 | |
76 | - if ( ! $this->upgrader instanceof WordPoints_Module_Installer ) { |
|
76 | + if ( ! $this->upgrader instanceof WordPoints_Module_Installer) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | 79 | |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | |
82 | 82 | $install_actions = array(); |
83 | 83 | |
84 | - if ( $this->result && ! is_wp_error( $this->result ) ) { |
|
84 | + if ($this->result && ! is_wp_error($this->result)) { |
|
85 | 85 | |
86 | - if ( is_multisite() && current_user_can( 'manage_network_wordpoints_modules' ) ) { |
|
86 | + if (is_multisite() && current_user_can('manage_network_wordpoints_modules')) { |
|
87 | 87 | |
88 | - $install_actions['network_activate'] = '<a class="button button-primary" href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=activate&networkwide=1&module=' . urlencode( $module_file ) ), "activate-module_{$module_file}" ) . '" target="_parent">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
88 | + $install_actions['network_activate'] = '<a class="button button-primary" href="' . wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=activate&networkwide=1&module=' . urlencode($module_file)), "activate-module_{$module_file}") . '" target="_parent">' . esc_html__('Network Activate', 'wordpoints') . '</a>'; |
|
89 | 89 | |
90 | - } elseif ( current_user_can( 'activate_wordpoints_modules' ) ) { |
|
90 | + } elseif (current_user_can('activate_wordpoints_modules')) { |
|
91 | 91 | |
92 | - $install_actions['activate_module'] = '<a class="button button-primary" href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=activate&module=' . urlencode( $module_file ) ), "activate-module_{$module_file}" ) . '" target="_parent">' . esc_html__( 'Activate Module', 'wordpoints' ) . '</a>'; |
|
92 | + $install_actions['activate_module'] = '<a class="button button-primary" href="' . wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=activate&module=' . urlencode($module_file)), "activate-module_{$module_file}") . '" target="_parent">' . esc_html__('Activate Module', 'wordpoints') . '</a>'; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - $install_actions['modules_page'] = '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_modules' ) ) . '" target="_parent">' . esc_html__( 'Return to Modules page', 'wordpoints' ) . '</a>'; |
|
97 | - $install_actions['install_page'] = '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_install_modules' ) ) . '" target="_parent">' . esc_html__( 'Return to Module Installer', 'wordpoints' ) . '</a>'; |
|
96 | + $install_actions['modules_page'] = '<a href="' . esc_url(self_admin_url('admin.php?page=wordpoints_modules')) . '" target="_parent">' . esc_html__('Return to Modules page', 'wordpoints') . '</a>'; |
|
97 | + $install_actions['install_page'] = '<a href="' . esc_url(self_admin_url('admin.php?page=wordpoints_install_modules')) . '" target="_parent">' . esc_html__('Return to Module Installer', 'wordpoints') . '</a>'; |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * The install module action links. |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | * } |
113 | 113 | * @param string $module_file The main module file. |
114 | 114 | */ |
115 | - $install_actions = apply_filters( 'wordpoints_install_module_complete_actions', $install_actions, $module_file ); |
|
115 | + $install_actions = apply_filters('wordpoints_install_module_complete_actions', $install_actions, $module_file); |
|
116 | 116 | |
117 | - if ( ! empty( $install_actions ) ) { |
|
118 | - $this->feedback( implode( ' ', (array) $install_actions ) ); |
|
117 | + if ( ! empty($install_actions)) { |
|
118 | + $this->feedback(implode(' ', (array) $install_actions)); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | } // function after() |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param array $args {@see WP_List_Table::__construct()}. |
43 | 43 | */ |
44 | - public function __construct( $args = array() ) { |
|
44 | + public function __construct($args = array()) { |
|
45 | 45 | |
46 | 46 | global $status, $page; |
47 | 47 | |
48 | 48 | parent::__construct( |
49 | 49 | array( |
50 | 50 | 'plural' => 'modules', |
51 | - 'screen' => ( isset( $args['screen'] ) ) ? $args['screen'] : null, |
|
51 | + 'screen' => (isset($args['screen'])) ? $args['screen'] : null, |
|
52 | 52 | ) |
53 | 53 | ); |
54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $status = 'all'; |
58 | 58 | |
59 | - $module_statuses = array( 'active', 'inactive', 'recently_activated', 'search' ); |
|
59 | + $module_statuses = array('active', 'inactive', 'recently_activated', 'search'); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Filter the module statuses on the modules administration panel. |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @param array $statuses The module statuses. The defaults are 'active', |
67 | 67 | * 'inactive', 'recently_activated', and 'search'. |
68 | 68 | */ |
69 | - $module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses ); |
|
69 | + $module_statuses = apply_filters('wordpoints_module_statuses', $module_statuses); |
|
70 | 70 | |
71 | - if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses ) ) { |
|
72 | - $status = sanitize_key( $_REQUEST['module_status'] ); |
|
71 | + if (isset($_REQUEST['module_status']) && in_array(wp_unslash($_REQUEST['module_status']), $module_statuses)) { |
|
72 | + $status = sanitize_key($_REQUEST['module_status']); |
|
73 | 73 | } |
74 | 74 | |
75 | - if ( isset( $_REQUEST['s'] ) ) { |
|
76 | - $_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); |
|
75 | + if (isset($_REQUEST['s'])) { |
|
76 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', sanitize_text_field(wp_unslash($_REQUEST['s']))); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $page = $this->get_pagenum(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function get_table_classes() { |
90 | 90 | |
91 | - return array( 'widefat', $this->_args['plural'], 'plugins' ); |
|
91 | + return array('widefat', $this->_args['plural'], 'plugins'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function ajax_user_can() { |
102 | 102 | |
103 | - return current_user_can( 'activate_wordpoints_modules' ); |
|
103 | + return current_user_can('activate_wordpoints_modules'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | global $status, $modules, $totals, $page, $orderby, $order, $s; |
114 | 114 | |
115 | - wp_reset_vars( array( 'orderby', 'order', 's' ) ); |
|
115 | + wp_reset_vars(array('orderby', 'order', 's')); |
|
116 | 116 | |
117 | 117 | $modules = array( |
118 | 118 | /** |
@@ -122,70 +122,70 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param array $modules All of the installed modules. |
124 | 124 | */ |
125 | - 'all' => apply_filters( 'all_wordpoints_modules', wordpoints_get_modules() ), |
|
125 | + 'all' => apply_filters('all_wordpoints_modules', wordpoints_get_modules()), |
|
126 | 126 | 'search' => array(), |
127 | 127 | 'active' => array(), |
128 | 128 | 'inactive' => array(), |
129 | 129 | 'recently_activated' => array(), |
130 | 130 | ); |
131 | 131 | |
132 | - if ( ! $this->screen->in_admin( 'network' ) ) { |
|
132 | + if ( ! $this->screen->in_admin('network')) { |
|
133 | 133 | |
134 | - $recently_activated = get_option( 'wordpoints_recently_activated_modules' ); |
|
134 | + $recently_activated = get_option('wordpoints_recently_activated_modules'); |
|
135 | 135 | |
136 | - if ( ! is_array( $recently_activated ) ) { |
|
137 | - add_option( 'wordpoints_recently_activated_modules', array(), '', 'no' ); |
|
136 | + if ( ! is_array($recently_activated)) { |
|
137 | + add_option('wordpoints_recently_activated_modules', array(), '', 'no'); |
|
138 | 138 | $recently_activated = array(); |
139 | 139 | } |
140 | 140 | |
141 | - foreach ( $recently_activated as $key => $time ) { |
|
141 | + foreach ($recently_activated as $key => $time) { |
|
142 | 142 | |
143 | - if ( $time + WEEK_IN_SECONDS < time() ) { |
|
144 | - unset( $recently_activated[ $key ] ); |
|
143 | + if ($time + WEEK_IN_SECONDS < time()) { |
|
144 | + unset($recently_activated[$key]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - update_option( 'wordpoints_recently_activated_modules', $recently_activated ); |
|
148 | + update_option('wordpoints_recently_activated_modules', $recently_activated); |
|
149 | 149 | } |
150 | 150 | |
151 | - foreach ( (array) $modules['all'] as $module_file => $module_data ) { |
|
151 | + foreach ((array) $modules['all'] as $module_file => $module_data) { |
|
152 | 152 | |
153 | 153 | // Filter into individual sections. |
154 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && is_network_only_wordpoints_module( $module_file ) ) { |
|
154 | + if (is_multisite() && ! $this->screen->in_admin('network') && is_network_only_wordpoints_module($module_file)) { |
|
155 | 155 | |
156 | - unset( $modules['all'][ $module_file ] ); |
|
156 | + unset($modules['all'][$module_file]); |
|
157 | 157 | |
158 | - } elseif ( ! $this->screen->in_admin( 'network' ) && is_wordpoints_module_active_for_network( $module_file ) ) { |
|
158 | + } elseif ( ! $this->screen->in_admin('network') && is_wordpoints_module_active_for_network($module_file)) { |
|
159 | 159 | |
160 | - unset( $modules['all'][ $module_file ] ); |
|
160 | + unset($modules['all'][$module_file]); |
|
161 | 161 | |
162 | 162 | } elseif ( |
163 | 163 | ( |
164 | - ! $this->screen->in_admin( 'network' ) |
|
165 | - && is_wordpoints_module_active( $module_file ) |
|
164 | + ! $this->screen->in_admin('network') |
|
165 | + && is_wordpoints_module_active($module_file) |
|
166 | 166 | ) || ( |
167 | - $this->screen->in_admin( 'network' ) |
|
168 | - && is_wordpoints_module_active_for_network( $module_file ) |
|
167 | + $this->screen->in_admin('network') |
|
168 | + && is_wordpoints_module_active_for_network($module_file) |
|
169 | 169 | ) |
170 | 170 | ) { |
171 | 171 | |
172 | - $modules['active'][ $module_file ] = $module_data; |
|
172 | + $modules['active'][$module_file] = $module_data; |
|
173 | 173 | |
174 | 174 | } else { |
175 | 175 | |
176 | 176 | // Was the module recently activated? |
177 | - if ( ! $this->screen->in_admin( 'network' ) && isset( $recently_activated[ $module_file ] ) ) { |
|
178 | - $modules['recently_activated'][ $module_file ] = $module_data; |
|
177 | + if ( ! $this->screen->in_admin('network') && isset($recently_activated[$module_file])) { |
|
178 | + $modules['recently_activated'][$module_file] = $module_data; |
|
179 | 179 | } |
180 | 180 | |
181 | - $modules['inactive'][ $module_file ] = $module_data; |
|
181 | + $modules['inactive'][$module_file] = $module_data; |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - if ( $s ) { |
|
185 | + if ($s) { |
|
186 | 186 | |
187 | 187 | $status = 'search'; |
188 | - $modules['search'] = array_filter( $modules['all'], array( $this, '_search_callback' ) ); |
|
188 | + $modules['search'] = array_filter($modules['all'], array($this, '_search_callback')); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -203,42 +203,42 @@ discard block |
||
203 | 203 | * @type array $recently_activated Modules that were recently active. |
204 | 204 | * } |
205 | 205 | */ |
206 | - $modules = apply_filters( 'wordpoints_modules_list_table_items', $modules ); |
|
206 | + $modules = apply_filters('wordpoints_modules_list_table_items', $modules); |
|
207 | 207 | |
208 | 208 | // Calculate the totals. |
209 | 209 | $totals = array(); |
210 | 210 | |
211 | - foreach ( $modules as $type => $list ) { |
|
212 | - $totals[ $type ] = count( $list ); |
|
211 | + foreach ($modules as $type => $list) { |
|
212 | + $totals[$type] = count($list); |
|
213 | 213 | } |
214 | 214 | |
215 | - if ( empty( $modules[ $status ] ) && ! in_array( $status, array( 'all', 'search' ) ) ) { |
|
215 | + if (empty($modules[$status]) && ! in_array($status, array('all', 'search'))) { |
|
216 | 216 | $status = 'all'; |
217 | 217 | } |
218 | 218 | |
219 | 219 | $this->items = array(); |
220 | 220 | |
221 | - foreach ( $modules[ $status ] as $module_file => $module_data ) { |
|
221 | + foreach ($modules[$status] as $module_file => $module_data) { |
|
222 | 222 | |
223 | - $this->items[ $module_file ] = wordpoints_get_module_data( wordpoints_modules_dir() . '/' . $module_file, false ); |
|
223 | + $this->items[$module_file] = wordpoints_get_module_data(wordpoints_modules_dir() . '/' . $module_file, false); |
|
224 | 224 | } |
225 | 225 | |
226 | - $total_this_page = $totals[ $status ]; |
|
226 | + $total_this_page = $totals[$status]; |
|
227 | 227 | |
228 | - if ( ! $orderby ) { |
|
228 | + if ( ! $orderby) { |
|
229 | 229 | $orderby = 'name'; |
230 | 230 | } |
231 | 231 | |
232 | - $order = strtoupper( $order ); |
|
232 | + $order = strtoupper($order); |
|
233 | 233 | |
234 | - uasort( $this->items, array( $this, '_order_callback' ) ); |
|
234 | + uasort($this->items, array($this, '_order_callback')); |
|
235 | 235 | |
236 | - $modules_per_page = $this->get_items_per_page( str_replace( '-', '_', $this->screen->id . '_per_page' ), 999 ); |
|
236 | + $modules_per_page = $this->get_items_per_page(str_replace('-', '_', $this->screen->id . '_per_page'), 999); |
|
237 | 237 | |
238 | - $start = ( $page - 1 ) * $modules_per_page; |
|
238 | + $start = ($page - 1) * $modules_per_page; |
|
239 | 239 | |
240 | - if ( $total_this_page > $modules_per_page ) { |
|
241 | - $this->items = array_slice( $this->items, $start, $modules_per_page ); |
|
240 | + if ($total_this_page > $modules_per_page) { |
|
241 | + $this->items = array_slice($this->items, $start, $modules_per_page); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $this->set_pagination_args( |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return bool Whether any of the module's data matches the search. |
260 | 260 | */ |
261 | - private function _search_callback( $module_data ) { |
|
261 | + private function _search_callback($module_data) { |
|
262 | 262 | |
263 | 263 | static $term; |
264 | 264 | |
265 | - if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { |
|
266 | - $term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); |
|
265 | + if (is_null($term) && isset($_REQUEST['s'])) { |
|
266 | + $term = sanitize_text_field(wp_unslash($_REQUEST['s'])); |
|
267 | 267 | } |
268 | 268 | |
269 | - foreach ( $module_data as $value ) { |
|
269 | + foreach ($module_data as $value) { |
|
270 | 270 | |
271 | - if ( false !== stripos( strip_tags( $value ), $term ) ) { |
|
271 | + if (false !== stripos(strip_tags($value), $term)) { |
|
272 | 272 | return true; |
273 | 273 | } |
274 | 274 | } |
@@ -288,21 +288,21 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return int How the modules compare. |
290 | 290 | */ |
291 | - private function _order_callback( $module_a, $module_b ) { |
|
291 | + private function _order_callback($module_a, $module_b) { |
|
292 | 292 | |
293 | 293 | global $orderby, $order; |
294 | 294 | |
295 | - $a = $module_a[ $orderby ]; |
|
296 | - $b = $module_b[ $orderby ]; |
|
295 | + $a = $module_a[$orderby]; |
|
296 | + $b = $module_b[$orderby]; |
|
297 | 297 | |
298 | - if ( $a === $b ) { |
|
298 | + if ($a === $b) { |
|
299 | 299 | return 0; |
300 | 300 | } |
301 | 301 | |
302 | - if ( 'DESC' === $order ) { |
|
303 | - return strcasecmp( $b, $a ); |
|
302 | + if ('DESC' === $order) { |
|
303 | + return strcasecmp($b, $a); |
|
304 | 304 | } else { |
305 | - return strcasecmp( $a, $b ); |
|
305 | + return strcasecmp($a, $b); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | |
316 | 316 | global $modules; |
317 | 317 | |
318 | - if ( ! empty( $modules['all'] ) ) { |
|
319 | - esc_html_e( 'No modules found.', 'wordpoints' ); |
|
318 | + if ( ! empty($modules['all'])) { |
|
319 | + esc_html_e('No modules found.', 'wordpoints'); |
|
320 | 320 | } else { |
321 | - esc_html_e( 'There are not any modules installed.', 'wordpoints' ); |
|
321 | + esc_html_e('There are not any modules installed.', 'wordpoints'); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | |
334 | 334 | return array( |
335 | 335 | 'cb' => '<input type="checkbox" />', |
336 | - 'name' => esc_html__( 'Module', 'wordpoints' ), |
|
337 | - 'description' => esc_html__( 'Description', 'wordpoints' ), |
|
336 | + 'name' => esc_html__('Module', 'wordpoints'), |
|
337 | + 'description' => esc_html__('Description', 'wordpoints'), |
|
338 | 338 | ); |
339 | 339 | } |
340 | 340 | |
@@ -351,39 +351,39 @@ discard block |
||
351 | 351 | |
352 | 352 | $status_links = array(); |
353 | 353 | |
354 | - foreach ( $totals as $type => $count ) { |
|
354 | + foreach ($totals as $type => $count) { |
|
355 | 355 | |
356 | - if ( ! $count ) { |
|
356 | + if ( ! $count) { |
|
357 | 357 | continue; |
358 | 358 | } |
359 | 359 | |
360 | - switch ( $type ) { |
|
360 | + switch ($type) { |
|
361 | 361 | |
362 | 362 | case 'all': |
363 | 363 | // translators: Count. |
364 | - $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'modules', 'wordpoints' ); |
|
364 | + $text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'modules', 'wordpoints'); |
|
365 | 365 | break; |
366 | 366 | |
367 | 367 | case 'active': |
368 | 368 | // translators: Count. |
369 | - $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count, 'wordpoints' ); |
|
369 | + $text = _n('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count, 'wordpoints'); |
|
370 | 370 | break; |
371 | 371 | |
372 | 372 | case 'recently_activated': |
373 | 373 | // translators: Count. |
374 | - $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count, 'wordpoints' ); |
|
374 | + $text = _n('Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count, 'wordpoints'); |
|
375 | 375 | break; |
376 | 376 | |
377 | 377 | case 'inactive': |
378 | 378 | // translators: Count. |
379 | - $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count, 'wordpoints' ); |
|
379 | + $text = _n('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count, 'wordpoints'); |
|
380 | 380 | break; |
381 | 381 | |
382 | 382 | default: |
383 | 383 | $text = $type; |
384 | 384 | } |
385 | 385 | |
386 | - if ( 'search' !== $type ) { |
|
386 | + if ('search' !== $type) { |
|
387 | 387 | |
388 | 388 | /** |
389 | 389 | * Filter the text for a module status link for the module list table. |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | * @param string $text The link text. |
394 | 394 | * @param int $count The number of modules matching this filter. |
395 | 395 | */ |
396 | - $text = apply_filters( "wordpoints_modules_status_link_text-{$type}", $text, $count ); |
|
396 | + $text = apply_filters("wordpoints_modules_status_link_text-{$type}", $text, $count); |
|
397 | 397 | |
398 | - $status_links[ $type ] = sprintf( |
|
398 | + $status_links[$type] = sprintf( |
|
399 | 399 | "<a href='%s' %s>%s</a>" |
400 | - , esc_url( add_query_arg( 'module_status', $type, self_admin_url( 'admin.php?page=wordpoints_modules' ) ) ) |
|
401 | - , ( $type === $status ) ? ' class="current"' : '' |
|
402 | - , sprintf( $text, number_format_i18n( $count ) ) |
|
400 | + , esc_url(add_query_arg('module_status', $type, self_admin_url('admin.php?page=wordpoints_modules'))) |
|
401 | + , ($type === $status) ? ' class="current"' : '' |
|
402 | + , sprintf($text, number_format_i18n($count)) |
|
403 | 403 | ); |
404 | 404 | } |
405 | 405 | |
@@ -428,20 +428,20 @@ discard block |
||
428 | 428 | |
429 | 429 | $actions = array(); |
430 | 430 | |
431 | - if ( 'active' !== $status ) { |
|
432 | - $actions['activate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' ); |
|
431 | + if ('active' !== $status) { |
|
432 | + $actions['activate-selected'] = ($this->screen->in_admin('network')) ? esc_html__('Network Activate', 'wordpoints') : esc_html__('Activate', 'wordpoints'); |
|
433 | 433 | } |
434 | 434 | |
435 | - if ( 'inactive' !== $status && 'recent' !== $status ) { |
|
436 | - $actions['deactivate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' ); |
|
435 | + if ('inactive' !== $status && 'recent' !== $status) { |
|
436 | + $actions['deactivate-selected'] = ($this->screen->in_admin('network')) ? esc_html__('Network Deactivate', 'wordpoints') : esc_html__('Deactivate', 'wordpoints'); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | if ( |
440 | - ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) |
|
441 | - && current_user_can( 'delete_wordpoints_modules' ) |
|
440 | + ( ! is_multisite() || $this->screen->in_admin('network')) |
|
441 | + && current_user_can('delete_wordpoints_modules') |
|
442 | 442 | && 'active' !== $status |
443 | 443 | ) { |
444 | - $actions['delete-selected'] = esc_html__( 'Delete', 'wordpoints' ); |
|
444 | + $actions['delete-selected'] = esc_html__('Delete', 'wordpoints'); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * @param array $actions The bulk action links. |
453 | 453 | * @param string $status The current module status being displayed. |
454 | 454 | */ |
455 | - $actions = apply_filters( 'wordpoints_module_bulk_actions', $actions, $status ); |
|
455 | + $actions = apply_filters('wordpoints_module_bulk_actions', $actions, $status); |
|
456 | 456 | |
457 | 457 | return $actions; |
458 | 458 | } |
@@ -464,18 +464,18 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @param string $which Not used. |
466 | 466 | */ |
467 | - public function extra_tablenav( $which ) { |
|
467 | + public function extra_tablenav($which) { |
|
468 | 468 | |
469 | 469 | global $status; |
470 | 470 | |
471 | - if ( 'recently_activated' !== $status ) { |
|
471 | + if ('recently_activated' !== $status) { |
|
472 | 472 | return; |
473 | 473 | } |
474 | 474 | |
475 | 475 | echo '<div class="alignleft actions">'; |
476 | 476 | |
477 | - if ( ! $this->screen->in_admin( 'network' ) ) { |
|
478 | - submit_button( __( 'Clear List', 'wordpoints' ), 'button', 'clear-recent-list', false ); |
|
477 | + if ( ! $this->screen->in_admin('network')) { |
|
478 | + submit_button(__('Clear List', 'wordpoints'), 'button', 'clear-recent-list', false); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | echo '</div>'; |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | */ |
489 | 489 | public function display_rows() { |
490 | 490 | |
491 | - foreach ( $this->items as $module_file => $module_data ) { |
|
491 | + foreach ($this->items as $module_file => $module_data) { |
|
492 | 492 | |
493 | - $this->single_row( array( $module_file, $module_data ) ); |
|
493 | + $this->single_row(array($module_file, $module_data)); |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
@@ -501,20 +501,20 @@ discard block |
||
501 | 501 | * |
502 | 502 | * @param array $item The module file and the module data. |
503 | 503 | */ |
504 | - public function single_row( $item ) { |
|
504 | + public function single_row($item) { |
|
505 | 505 | |
506 | 506 | global $status; |
507 | 507 | |
508 | - list( $module_file, $module_data ) = $item; |
|
508 | + list($module_file, $module_data) = $item; |
|
509 | 509 | $context = $status; |
510 | 510 | |
511 | - if ( $this->screen->in_admin( 'network' ) ) { |
|
512 | - $is_active = is_wordpoints_module_active_for_network( $module_file ); |
|
511 | + if ($this->screen->in_admin('network')) { |
|
512 | + $is_active = is_wordpoints_module_active_for_network($module_file); |
|
513 | 513 | } else { |
514 | - $is_active = is_wordpoints_module_active( $module_file ); |
|
514 | + $is_active = is_wordpoints_module_active($module_file); |
|
515 | 515 | } |
516 | 516 | |
517 | - $class = ( $is_active ) ? 'active' : 'inactive'; |
|
517 | + $class = ($is_active) ? 'active' : 'inactive'; |
|
518 | 518 | |
519 | 519 | /** |
520 | 520 | * Filter the class of a row of the module's list table. |
@@ -526,88 +526,88 @@ discard block |
||
526 | 526 | * @param string $module_data The module's data. |
527 | 527 | * @param string $context The current status context in which the modules are being displayed. |
528 | 528 | */ |
529 | - $class = apply_filters( 'wordpoints_module_list_row_class', $class, $module_file, $module_data, $context ); |
|
529 | + $class = apply_filters('wordpoints_module_list_row_class', $class, $module_file, $module_data, $context); |
|
530 | 530 | |
531 | 531 | ?> |
532 | - <tr id="<?php echo esc_attr( sanitize_title( $module_data['name'] ) ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
532 | + <tr id="<?php echo esc_attr(sanitize_title($module_data['name'])); ?>" class="<?php echo esc_attr($class); ?>"> |
|
533 | 533 | <?php |
534 | 534 | |
535 | - list( $columns, $hidden ) = $this->get_column_info(); |
|
535 | + list($columns, $hidden) = $this->get_column_info(); |
|
536 | 536 | |
537 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
537 | + foreach ($columns as $column_name => $column_display_name) { |
|
538 | 538 | |
539 | - $is_hidden = in_array( $column_name, $hidden ); |
|
539 | + $is_hidden = in_array($column_name, $hidden); |
|
540 | 540 | |
541 | - switch ( $column_name ) { |
|
541 | + switch ($column_name) { |
|
542 | 542 | |
543 | 543 | case 'cb': |
544 | - $checkbox_id = 'checkbox_' . sanitize_key( $module_file ); |
|
544 | + $checkbox_id = 'checkbox_' . sanitize_key($module_file); |
|
545 | 545 | |
546 | 546 | ?> |
547 | 547 | <th scope="row" class="check-column"> |
548 | - <label class="screen-reader-text" for="<?php echo esc_attr( $checkbox_id ); ?>"> |
|
548 | + <label class="screen-reader-text" for="<?php echo esc_attr($checkbox_id); ?>"> |
|
549 | 549 | <?php |
550 | 550 | |
551 | 551 | echo esc_html( |
552 | 552 | sprintf( |
553 | 553 | // translators: Module name. |
554 | - __( 'Select %s', 'wordpoints' ) |
|
554 | + __('Select %s', 'wordpoints') |
|
555 | 555 | , $module_data['name'] |
556 | 556 | ) |
557 | 557 | ); |
558 | 558 | |
559 | 559 | ?> |
560 | 560 | </label> |
561 | - <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_file ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" /> |
|
561 | + <input type="checkbox" name="checked[]" value="<?php echo esc_attr($module_file); ?>" id="<?php echo esc_attr($checkbox_id); ?>" /> |
|
562 | 562 | </th> |
563 | 563 | <?php |
564 | 564 | break; |
565 | 565 | |
566 | 566 | case 'name': |
567 | 567 | ?> |
568 | - <td class="module-title<?php echo ( $is_hidden ) ? ' hidden' : ''; ?>"> |
|
569 | - <strong><?php echo esc_html( $module_data['name'] ); ?></strong> |
|
570 | - <?php echo $this->row_actions( $this->get_module_row_actions( $module_file, $module_data, $is_active ), true ); // XSS OK WPCS ?> |
|
568 | + <td class="module-title<?php echo ($is_hidden) ? ' hidden' : ''; ?>"> |
|
569 | + <strong><?php echo esc_html($module_data['name']); ?></strong> |
|
570 | + <?php echo $this->row_actions($this->get_module_row_actions($module_file, $module_data, $is_active), true); // XSS OK WPCS ?> |
|
571 | 571 | </td> |
572 | 572 | <?php |
573 | 573 | break; |
574 | 574 | |
575 | 575 | case 'description': |
576 | 576 | ?> |
577 | - <td class="column-description desc<?php echo ( $is_hidden ) ? ' hidden' : ''; ?>"> |
|
577 | + <td class="column-description desc<?php echo ($is_hidden) ? ' hidden' : ''; ?>"> |
|
578 | 578 | <div class="module-description"> |
579 | 579 | <p> |
580 | - <?php if ( ! empty( $module_data['description'] ) ) : ?> |
|
581 | - <?php echo wp_kses( $module_data['description'] , 'wordpoints_module_description' ); ?> |
|
580 | + <?php if ( ! empty($module_data['description'])) : ?> |
|
581 | + <?php echo wp_kses($module_data['description'], 'wordpoints_module_description'); ?> |
|
582 | 582 | <?php else : ?> |
583 | 583 | |
584 | 584 | <?php endif; ?> |
585 | 585 | </p> |
586 | 586 | </div> |
587 | - <div class="<?php echo esc_attr( $class ); ?> second module-version-author-uri"> |
|
587 | + <div class="<?php echo esc_attr($class); ?> second module-version-author-uri"> |
|
588 | 588 | <?php |
589 | 589 | |
590 | 590 | $module_meta = array(); |
591 | 591 | |
592 | - if ( ! empty( $module_data['version'] ) ) { |
|
592 | + if ( ! empty($module_data['version'])) { |
|
593 | 593 | // translators: Module version. |
594 | - $module_meta[] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data['version'] ); |
|
594 | + $module_meta[] = sprintf(esc_html__('Version %s', 'wordpoints'), $module_data['version']); |
|
595 | 595 | } |
596 | 596 | |
597 | - if ( ! empty( $module_data['author'] ) ) { |
|
597 | + if ( ! empty($module_data['author'])) { |
|
598 | 598 | |
599 | 599 | $author = $module_data['author']; |
600 | 600 | |
601 | - if ( ! empty( $module_data['author_uri'] ) ) { |
|
602 | - $author = '<a href="' . esc_url( $module_data['author_uri'] ) . '">' . esc_html( $module_data['author'] ) . '</a>'; |
|
601 | + if ( ! empty($module_data['author_uri'])) { |
|
602 | + $author = '<a href="' . esc_url($module_data['author_uri']) . '">' . esc_html($module_data['author']) . '</a>'; |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | // translators: Author name. |
606 | - $module_meta[] = sprintf( __( 'By %s', 'wordpoints' ), $author ); |
|
606 | + $module_meta[] = sprintf(__('By %s', 'wordpoints'), $author); |
|
607 | 607 | } |
608 | 608 | |
609 | - if ( ! empty( $module_data['module_uri'] ) ) { |
|
610 | - $module_meta[] = '<a href="' . esc_url( $module_data['module_uri'] ) . '">' . esc_html__( 'Visit module site', 'wordpoints' ) . '</a>'; |
|
609 | + if ( ! empty($module_data['module_uri'])) { |
|
610 | + $module_meta[] = '<a href="' . esc_url($module_data['module_uri']) . '">' . esc_html__('Visit module site', 'wordpoints') . '</a>'; |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -623,9 +623,9 @@ discard block |
||
623 | 623 | * @param array $module_data The info about the module. |
624 | 624 | * @param string $status The module status being displayed. |
625 | 625 | */ |
626 | - $module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_file, $module_data, $status ); |
|
626 | + $module_meta = apply_filters('wordpoints_module_row_meta', $module_meta, $module_file, $module_data, $status); |
|
627 | 627 | |
628 | - echo wp_kses( implode( ' | ', $module_meta ), 'data' ); |
|
628 | + echo wp_kses(implode(' | ', $module_meta), 'data'); |
|
629 | 629 | |
630 | 630 | ?> |
631 | 631 | </div> |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | |
636 | 636 | default: |
637 | 637 | ?> |
638 | - <td class="<?php echo sanitize_html_class( $column_name ); ?> column-<?php echo sanitize_html_class( $column_name ); ?><?php echo ( $is_hidden ) ? ' hidden' : ''; ?>"> |
|
638 | + <td class="<?php echo sanitize_html_class($column_name); ?> column-<?php echo sanitize_html_class($column_name); ?><?php echo ($is_hidden) ? ' hidden' : ''; ?>"> |
|
639 | 639 | <?php |
640 | 640 | /** |
641 | 641 | * Display the row contents for a custom column in the module list table. |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @param string $module_file The main file of the current module. |
647 | 647 | * @param array $module_data The module's info. |
648 | 648 | */ |
649 | - do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_file, $module_data ); |
|
649 | + do_action('wordpoints_manage_modules_custom_column', $column_name, $module_file, $module_data); |
|
650 | 650 | ?> |
651 | 651 | </td> |
652 | 652 | <?php |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | * @param array $module_data The module's info. |
669 | 669 | * @param string $status The status of the module's being displayed. |
670 | 670 | */ |
671 | - do_action( 'wordpoints_after_module_row', $module_file, $module_data, $status ); |
|
671 | + do_action('wordpoints_after_module_row', $module_file, $module_data, $status); |
|
672 | 672 | |
673 | 673 | /** |
674 | 674 | * After row for a module is displayed in the list table. |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | * |
678 | 678 | * @since 1.1.0 |
679 | 679 | */ |
680 | - do_action( "wordpoints_after_module_row_{$module_file}", $module_file, $module_data, $status ); |
|
680 | + do_action("wordpoints_after_module_row_{$module_file}", $module_file, $module_data, $status); |
|
681 | 681 | |
682 | 682 | } // function single_row() |
683 | 683 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | * |
693 | 693 | * @return string[] The action links for this module. |
694 | 694 | */ |
695 | - private function get_module_row_actions( $module_file, $module_data, $is_active ) { |
|
695 | + private function get_module_row_actions($module_file, $module_data, $is_active) { |
|
696 | 696 | |
697 | 697 | global $page, $s, $status; |
698 | 698 | |
@@ -705,51 +705,51 @@ discard block |
||
705 | 705 | 'delete' => '', |
706 | 706 | ); |
707 | 707 | |
708 | - $url = self_admin_url( 'admin.php?page=wordpoints_modules&module=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ); |
|
708 | + $url = self_admin_url('admin.php?page=wordpoints_modules&module=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s); |
|
709 | 709 | |
710 | - if ( $this->screen->in_admin( 'network' ) ) { |
|
710 | + if ($this->screen->in_admin('network')) { |
|
711 | 711 | |
712 | - if ( $is_active ) { |
|
712 | + if ($is_active) { |
|
713 | 713 | |
714 | - if ( current_user_can( 'manage_network_wordpoints_modules' ) ) { |
|
714 | + if (current_user_can('manage_network_wordpoints_modules')) { |
|
715 | 715 | // translators: Module name. |
716 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Network Deactivate', 'wordpoints' ) . '</a>'; |
|
716 | + $actions['deactivate'] = '<a href="' . wp_nonce_url(add_query_arg('action', 'deactivate', $url), "deactivate-module_{$module_file}") . '" aria-label="' . esc_attr(sprintf(__('Network deactivate %s', 'wordpoints'), $module_data['name'])) . '">' . esc_html__('Network Deactivate', 'wordpoints') . '</a>'; |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | } else { |
720 | 720 | |
721 | - if ( current_user_can( 'manage_network_wordpoints_modules' ) ) { |
|
721 | + if (current_user_can('manage_network_wordpoints_modules')) { |
|
722 | 722 | // translators: Module name. |
723 | - $actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
723 | + $actions['activate'] = '<a href="' . wp_nonce_url(add_query_arg('action', 'activate', $url), "activate-module_{$module_file}") . '" aria-label="' . esc_attr(sprintf(__('Network activate %s', 'wordpoints'), $module_data['name'])) . '" class="edit">' . esc_html__('Network Activate', 'wordpoints') . '</a>'; |
|
724 | 724 | } |
725 | 725 | |
726 | - if ( current_user_can( 'delete_wordpoints_modules' ) && ! is_wordpoints_module_active( $module_file ) ) { |
|
726 | + if (current_user_can('delete_wordpoints_modules') && ! is_wordpoints_module_active($module_file)) { |
|
727 | 727 | // translators: Module name. |
728 | - $actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
728 | + $actions['delete'] = '<a href="' . wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s), 'bulk-modules') . '" aria-label="' . esc_attr(sprintf(__('Delete %s', 'wordpoints'), $module_data['name'])) . '" class="delete">' . esc_html__('Delete', 'wordpoints') . '</a>'; |
|
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
732 | 732 | } else { |
733 | 733 | |
734 | - if ( $is_active ) { |
|
734 | + if ($is_active) { |
|
735 | 735 | |
736 | 736 | // translators: Module name. |
737 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Deactivate', 'wordpoints' ) . '</a>'; |
|
737 | + $actions['deactivate'] = '<a href="' . wp_nonce_url(add_query_arg('action', 'deactivate', $url), "deactivate-module_{$module_file}") . '" aria-label="' . esc_attr(sprintf(__('Deactivate %s', 'wordpoints'), $module_data['name'])) . '">' . esc_html__('Deactivate', 'wordpoints') . '</a>'; |
|
738 | 738 | |
739 | 739 | } else { |
740 | 740 | |
741 | 741 | // translators: Module name. |
742 | - $actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Activate', 'wordpoints' ) . '</a>'; |
|
742 | + $actions['activate'] = '<a href="' . wp_nonce_url(add_query_arg('action', 'activate', $url), "activate-module_{$module_file}") . '" aria-label="' . esc_attr(sprintf(__('Activate %s', 'wordpoints'), $module_data['name'])) . '" class="edit">' . esc_html__('Activate', 'wordpoints') . '</a>'; |
|
743 | 743 | |
744 | - if ( ! is_multisite() && current_user_can( 'delete_wordpoints_modules' ) ) { |
|
744 | + if ( ! is_multisite() && current_user_can('delete_wordpoints_modules')) { |
|
745 | 745 | // translators: Module name. |
746 | - $actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
746 | + $actions['delete'] = '<a href="' . wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s), 'bulk-modules') . '" aria-label="' . esc_attr(sprintf(__('Delete %s', 'wordpoints'), $module_data['name'])) . '" class="delete">' . esc_html__('Delete', 'wordpoints') . '</a>'; |
|
747 | 747 | } |
748 | 748 | } |
749 | 749 | |
750 | 750 | } // End if ( network admin ) {} else {}. |
751 | 751 | |
752 | - $prefix = $this->screen->in_admin( 'network' ) ? 'network_admin_' : ''; |
|
752 | + $prefix = $this->screen->in_admin('network') ? 'network_admin_' : ''; |
|
753 | 753 | |
754 | 754 | /** |
755 | 755 | * Filter the module action links. |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | * @param array $module_data The module's info. |
772 | 772 | * @param string $context The status of the modules being displayed. |
773 | 773 | */ |
774 | - $actions = apply_filters( $prefix . 'wordpoints_module_action_links', array_filter( $actions ), $module_file, $module_data, $context ); |
|
774 | + $actions = apply_filters($prefix . 'wordpoints_module_action_links', array_filter($actions), $module_file, $module_data, $context); |
|
775 | 775 | |
776 | 776 | /** |
777 | 777 | * Filter the action links for a specific module. |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | * |
781 | 781 | * @since 1.1.0 |
782 | 782 | */ |
783 | - return apply_filters( $prefix . "wordpoints_module_action_links_{$module_file}", $actions, $module_file, $module_data, $context ); |
|
783 | + return apply_filters($prefix . "wordpoints_module_action_links_{$module_file}", $actions, $module_file, $module_data, $context); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | } // class WordPoints_Modules_List_Table |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | private function install_strings() { |
50 | 50 | |
51 | 51 | $install_strings = array( |
52 | - 'no_package' => esc_html__( 'Install package not available.', 'wordpoints' ), |
|
53 | - 'unpack_package' => esc_html__( 'Unpacking the package…', 'wordpoints' ), |
|
54 | - 'installing_package' => esc_html__( 'Installing the module…', 'wordpoints' ), |
|
55 | - 'no_files' => esc_html__( 'The module contains no files.', 'wordpoints' ), |
|
56 | - 'process_failed' => esc_html__( 'Module install failed.', 'wordpoints' ), |
|
57 | - 'process_success' => esc_html__( 'Module installed successfully.', 'wordpoints' ), |
|
58 | - 'mkdir_failed_modules' => esc_html__( 'Could not create the modules directory.', 'wordpoints' ), |
|
52 | + 'no_package' => esc_html__('Install package not available.', 'wordpoints'), |
|
53 | + 'unpack_package' => esc_html__('Unpacking the package…', 'wordpoints'), |
|
54 | + 'installing_package' => esc_html__('Installing the module…', 'wordpoints'), |
|
55 | + 'no_files' => esc_html__('The module contains no files.', 'wordpoints'), |
|
56 | + 'process_failed' => esc_html__('Module install failed.', 'wordpoints'), |
|
57 | + 'process_success' => esc_html__('Module installed successfully.', 'wordpoints'), |
|
58 | + 'mkdir_failed_modules' => esc_html__('Could not create the modules directory.', 'wordpoints'), |
|
59 | 59 | ); |
60 | 60 | |
61 | - $this->strings = array_merge( $this->strings, $install_strings ); |
|
61 | + $this->strings = array_merge($this->strings, $install_strings); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // |
@@ -77,31 +77,31 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return array|WP_Error {@see WP_Upgrader::install_package()} |
79 | 79 | */ |
80 | - public function install_package( $args = array() ) { |
|
80 | + public function install_package($args = array()) { |
|
81 | 81 | |
82 | 82 | global $wp_filesystem, $wp_theme_directories; |
83 | 83 | |
84 | 84 | $modules_dir = wordpoints_modules_dir(); |
85 | 85 | |
86 | 86 | // Attempt to create the /wp-content/wordpoints-modules directory if needed. |
87 | - if ( ! $wp_filesystem->exists( $modules_dir ) ) { |
|
87 | + if ( ! $wp_filesystem->exists($modules_dir)) { |
|
88 | 88 | |
89 | - if ( $wp_filesystem->mkdir( $modules_dir, FS_CHMOD_DIR ) ) { |
|
90 | - $wp_filesystem->put_contents( $modules_dir . '/index.php', '<?php // Gold is silent.' ); |
|
89 | + if ($wp_filesystem->mkdir($modules_dir, FS_CHMOD_DIR)) { |
|
90 | + $wp_filesystem->put_contents($modules_dir . '/index.php', '<?php // Gold is silent.'); |
|
91 | 91 | } else { |
92 | - return new WP_Error( 'mkdir_failed_modules', $this->strings['mkdir_failed_modules'], $modules_dir ); |
|
92 | + return new WP_Error('mkdir_failed_modules', $this->strings['mkdir_failed_modules'], $modules_dir); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | 96 | $module_dir = wordpoints_modules_dir(); |
97 | 97 | $wp_theme_directories[] = $module_dir; |
98 | 98 | |
99 | - $result = parent::install_package( $args ); |
|
99 | + $result = parent::install_package($args); |
|
100 | 100 | |
101 | - $key = array_search( $module_dir, $wp_theme_directories ); |
|
101 | + $key = array_search($module_dir, $wp_theme_directories); |
|
102 | 102 | |
103 | - if ( false !== $key ) { |
|
104 | - unset( $wp_theme_directories[ $key ] ); |
|
103 | + if (false !== $key) { |
|
104 | + unset($wp_theme_directories[$key]); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $result; |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return bool|WP_Error True on success, false or a WP_Error on failure. |
118 | 118 | */ |
119 | - public function install( $package ) { |
|
119 | + public function install($package) { |
|
120 | 120 | |
121 | 121 | $this->init(); |
122 | 122 | $this->install_strings(); |
123 | 123 | |
124 | - add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); |
|
124 | + add_filter('upgrader_source_selection', array($this, 'check_package')); |
|
125 | 125 | |
126 | 126 | $result = $this->run( |
127 | 127 | array( |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | ) |
134 | 134 | ); |
135 | 135 | |
136 | - remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); |
|
136 | + remove_filter('upgrader_source_selection', array($this, 'check_package')); |
|
137 | 137 | |
138 | - if ( ! $result || is_wp_error( $result ) ) { |
|
138 | + if ( ! $result || is_wp_error($result)) { |
|
139 | 139 | return $result; |
140 | 140 | } |
141 | 141 | |
142 | - if ( ! $this->result || is_wp_error( $this->result ) ) { |
|
142 | + if ( ! $this->result || is_wp_error($this->result)) { |
|
143 | 143 | return $this->result; |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Force refresh of plugin update information. |
147 | - wp_cache_delete( 'wordpoints_modules', 'wordpoints_modules' ); |
|
147 | + wp_cache_delete('wordpoints_modules', 'wordpoints_modules'); |
|
148 | 148 | |
149 | 149 | return true; |
150 | 150 | } |
@@ -162,40 +162,40 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return string|WP_Error The path to the source package or a WP_Error. |
164 | 164 | */ |
165 | - public function check_package( $source ) { |
|
165 | + public function check_package($source) { |
|
166 | 166 | |
167 | 167 | global $wp_filesystem; |
168 | 168 | |
169 | - if ( is_wp_error( $source ) ) { |
|
169 | + if (is_wp_error($source)) { |
|
170 | 170 | return $source; |
171 | 171 | } |
172 | 172 | |
173 | - $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); |
|
173 | + $working_directory = str_replace($wp_filesystem->wp_content_dir(), trailingslashit(WP_CONTENT_DIR), $source); |
|
174 | 174 | |
175 | - if ( ! is_dir( $working_directory ) ) { |
|
175 | + if ( ! is_dir($working_directory)) { |
|
176 | 176 | return $source; |
177 | 177 | } |
178 | 178 | |
179 | 179 | $modules_found = false; |
180 | 180 | |
181 | - $files = glob( $working_directory . '*.php' ); |
|
181 | + $files = glob($working_directory . '*.php'); |
|
182 | 182 | |
183 | - if ( false === $files ) { |
|
183 | + if (false === $files) { |
|
184 | 184 | return $source; |
185 | 185 | } |
186 | 186 | |
187 | - foreach ( $files as $file ) { |
|
187 | + foreach ($files as $file) { |
|
188 | 188 | |
189 | - $module_data = wordpoints_get_module_data( $file, false, false ); |
|
189 | + $module_data = wordpoints_get_module_data($file, false, false); |
|
190 | 190 | |
191 | - if ( ! empty( $module_data['name'] ) ) { |
|
191 | + if ( ! empty($module_data['name'])) { |
|
192 | 192 | $modules_found = true; |
193 | 193 | break; |
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | - if ( ! $modules_found ) { |
|
198 | - return new WP_Error( 'incompatible_archive_no_modules', $this->strings['incompatible_archive'], esc_html__( 'No valid modules were found.', 'wordpoints' ) ); |
|
197 | + if ( ! $modules_found) { |
|
198 | + return new WP_Error('incompatible_archive_no_modules', $this->strings['incompatible_archive'], esc_html__('No valid modules were found.', 'wordpoints')); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | return $source; |
@@ -212,18 +212,18 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function module_info() { |
214 | 214 | |
215 | - if ( ! is_array( $this->result ) || empty( $this->result['destination_name'] ) ) { |
|
215 | + if ( ! is_array($this->result) || empty($this->result['destination_name'])) { |
|
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | |
219 | - $module = wordpoints_get_modules( '/' . $this->result['destination_name'] ); |
|
219 | + $module = wordpoints_get_modules('/' . $this->result['destination_name']); |
|
220 | 220 | |
221 | - if ( empty( $module ) ) { |
|
221 | + if (empty($module)) { |
|
222 | 222 | return false; |
223 | 223 | } |
224 | 224 | |
225 | 225 | // Assume the requested module is the first in the list. |
226 | - $module_files = array_keys( $module ); |
|
226 | + $module_files = array_keys($module); |
|
227 | 227 | |
228 | 228 | return $this->result['destination_name'] . '/' . $module_files[0]; |
229 | 229 | } |
@@ -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 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * the modules screen should be the main one (the configure menu is only for the |
49 | 49 | * network admin when network active). |
50 | 50 | */ |
51 | - if ( is_wordpoints_network_active() && 'admin_menu' === current_filter() ) { |
|
51 | + if (is_wordpoints_network_active() && 'admin_menu' === current_filter()) { |
|
52 | 52 | $slug = 'wordpoints_modules'; |
53 | 53 | } |
54 | 54 | |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | function wordpoints_admin_menu() { |
67 | 67 | |
68 | 68 | $main_menu = wordpoints_get_main_admin_menu(); |
69 | - $wordpoints = __( 'WordPoints', 'wordpoints' ); |
|
69 | + $wordpoints = __('WordPoints', 'wordpoints'); |
|
70 | 70 | |
71 | 71 | /* |
72 | 72 | * The settings page is always the main menu, except when the plugin is network |
73 | 73 | * active on multisite. Then it is only the main menu when in the network admin. |
74 | 74 | */ |
75 | - if ( 'wordpoints_configure' === $main_menu ) { |
|
75 | + if ('wordpoints_configure' === $main_menu) { |
|
76 | 76 | |
77 | 77 | // Main page. |
78 | 78 | add_menu_page( |
79 | 79 | $wordpoints |
80 | - ,esc_html( $wordpoints ) |
|
80 | + ,esc_html($wordpoints) |
|
81 | 81 | ,'manage_options' |
82 | 82 | ,'wordpoints_configure' |
83 | 83 | ,'wordpoints_admin_screen_configure' |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | // Settings page. |
87 | 87 | add_submenu_page( |
88 | 88 | 'wordpoints_configure' |
89 | - ,__( 'WordPoints — Configure', 'wordpoints' ) |
|
90 | - ,esc_html__( 'Configure', 'wordpoints' ) |
|
89 | + ,__('WordPoints — Configure', 'wordpoints') |
|
90 | + ,esc_html__('Configure', 'wordpoints') |
|
91 | 91 | ,'manage_options' |
92 | 92 | ,'wordpoints_configure' |
93 | 93 | ,'wordpoints_admin_screen_configure' |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // Main page. |
104 | 104 | add_menu_page( |
105 | 105 | $wordpoints |
106 | - ,esc_html( $wordpoints ) |
|
106 | + ,esc_html($wordpoints) |
|
107 | 107 | ,'activate_wordpoints_modules' |
108 | 108 | ,'wordpoints_modules' |
109 | 109 | ,'wordpoints_admin_screen_modules' |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | // Modules page. |
115 | 115 | add_submenu_page( |
116 | 116 | $main_menu |
117 | - ,__( 'WordPoints — Modules', 'wordpoints' ) |
|
118 | - ,esc_html__( 'Modules', 'wordpoints' ) |
|
117 | + ,__('WordPoints — Modules', 'wordpoints') |
|
118 | + ,esc_html__('Modules', 'wordpoints') |
|
119 | 119 | ,'activate_wordpoints_modules' |
120 | 120 | ,'wordpoints_modules' |
121 | 121 | ,'wordpoints_admin_screen_modules' |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | // Module install page. |
125 | 125 | add_submenu_page( |
126 | 126 | '_wordpoints_modules' // Fake menu. |
127 | - ,__( 'WordPoints — Install Modules', 'wordpoints' ) |
|
128 | - ,esc_html__( 'Install Modules', 'wordpoints' ) |
|
127 | + ,__('WordPoints — Install Modules', 'wordpoints') |
|
128 | + ,esc_html__('Install Modules', 'wordpoints') |
|
129 | 129 | ,'install_wordpoints_modules' |
130 | 130 | ,'wordpoints_install_modules' |
131 | 131 | ,'wordpoints_admin_screen_install_modules' |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | wp_register_style( |
254 | 254 | 'wordpoints-hooks-admin' |
255 | 255 | , "{$assets_url}/css/hooks{$suffix}.css" |
256 | - , array( 'dashicons', 'wp-jquery-ui-dialog' ) |
|
256 | + , array('dashicons', 'wp-jquery-ui-dialog') |
|
257 | 257 | , WORDPOINTS_VERSION |
258 | 258 | ); |
259 | 259 | |
260 | 260 | $styles = wp_styles(); |
261 | - $styles->add_data( 'wordpoints-hooks-admin', 'rtl', 'replace' ); |
|
261 | + $styles->add_data('wordpoints-hooks-admin', 'rtl', 'replace'); |
|
262 | 262 | |
263 | - if ( $suffix ) { |
|
264 | - $styles->add_data( 'wordpoints-hooks-admin', 'suffix', $suffix ); |
|
263 | + if ($suffix) { |
|
264 | + $styles->add_data('wordpoints-hooks-admin', 'suffix', $suffix); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | // JS |
@@ -269,21 +269,21 @@ discard block |
||
269 | 269 | wp_register_script( |
270 | 270 | 'wordpoints-admin-dismiss-notice' |
271 | 271 | , "{$assets_url}/js/dismiss-notice{$suffix}.js" |
272 | - , array( 'jquery', 'wp-util' ) |
|
272 | + , array('jquery', 'wp-util') |
|
273 | 273 | , WORDPOINTS_VERSION |
274 | 274 | ); |
275 | 275 | |
276 | 276 | wp_register_script( |
277 | 277 | 'wordpoints-hooks-models' |
278 | 278 | , "{$assets_url}/js/hooks/models{$manifested_suffix}.js" |
279 | - , array( 'backbone', 'jquery-ui-dialog', 'wp-util' ) |
|
279 | + , array('backbone', 'jquery-ui-dialog', 'wp-util') |
|
280 | 280 | , WORDPOINTS_VERSION |
281 | 281 | ); |
282 | 282 | |
283 | 283 | wp_register_script( |
284 | 284 | 'wordpoints-hooks-views' |
285 | 285 | , "{$assets_url}/js/hooks/views{$manifested_suffix}.js" |
286 | - , array( 'wordpoints-hooks-models' ) |
|
286 | + , array('wordpoints-hooks-models') |
|
287 | 287 | , WORDPOINTS_VERSION |
288 | 288 | ); |
289 | 289 | |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | 'wordpoints-hooks-views' |
292 | 292 | , 'WordPointsHooksAdminL10n' |
293 | 293 | , array( |
294 | - 'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
295 | - 'changesSaved' => __( 'Your changes have been saved.', 'wordpoints' ), |
|
294 | + 'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
295 | + 'changesSaved' => __('Your changes have been saved.', 'wordpoints'), |
|
296 | 296 | // translators: Form field name. |
297 | - 'emptyField' => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ), |
|
298 | - 'confirmDelete' => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ), |
|
299 | - 'confirmTitle' => __( 'Are you sure?', 'wordpoints' ), |
|
300 | - 'deleteText' => __( 'Delete', 'wordpoints' ), |
|
301 | - 'cancelText' => __( 'Cancel', 'wordpoints' ), |
|
297 | + 'emptyField' => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'), |
|
298 | + 'confirmDelete' => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'), |
|
299 | + 'confirmTitle' => __('Are you sure?', 'wordpoints'), |
|
300 | + 'deleteText' => __('Delete', 'wordpoints'), |
|
301 | + 'cancelText' => __('Cancel', 'wordpoints'), |
|
302 | 302 | 'separator' => is_rtl() ? ' « ' : ' » ', |
303 | - 'target_label' => __( 'Target', 'wordpoints' ), |
|
303 | + 'target_label' => __('Target', 'wordpoints'), |
|
304 | 304 | // translators: Form field. |
305 | - 'cannotBeChanged' => __( '(cannot be changed)', 'wordpoints' ), |
|
306 | - 'fieldsInvalid' => __( 'Error: the values of some fields are invalid. Please correct these and then try again.', 'wordpoints' ), |
|
305 | + 'cannotBeChanged' => __('(cannot be changed)', 'wordpoints'), |
|
306 | + 'fieldsInvalid' => __('Error: the values of some fields are invalid. Please correct these and then try again.', 'wordpoints'), |
|
307 | 307 | ) |
308 | 308 | ); |
309 | 309 | |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | <div class="view"> |
316 | 316 | <div class="title"></div> |
317 | 317 | <button type="button" class="edit button-secondary"> |
318 | - ' . esc_html__( 'Edit', 'wordpoints' ) . ' |
|
318 | + ' . esc_html__('Edit', 'wordpoints') . ' |
|
319 | 319 | </button> |
320 | 320 | <button type="button" class="close button-secondary"> |
321 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
321 | + ' . esc_html__('Close', 'wordpoints') . ' |
|
322 | 322 | </button> |
323 | 323 | </div> |
324 | 324 | <div class="form"> |
@@ -337,16 +337,16 @@ discard block |
||
337 | 337 | </div> |
338 | 338 | <div class="action-buttons"> |
339 | 339 | <button type="button" class="save button-primary" disabled> |
340 | - ' . esc_html__( 'Save', 'wordpoints' ) . ' |
|
340 | + ' . esc_html__('Save', 'wordpoints') . ' |
|
341 | 341 | </button> |
342 | 342 | <button type="button" class="cancel button-secondary"> |
343 | - ' . esc_html__( 'Cancel', 'wordpoints' ) . ' |
|
343 | + ' . esc_html__('Cancel', 'wordpoints') . ' |
|
344 | 344 | </button> |
345 | 345 | <button type="button" class="close button-secondary"> |
346 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
346 | + ' . esc_html__('Close', 'wordpoints') . ' |
|
347 | 347 | </button> |
348 | 348 | <button type="button" class="delete button-secondary"> |
349 | - ' . esc_html__( 'Delete', 'wordpoints' ) . ' |
|
349 | + ' . esc_html__('Delete', 'wordpoints') . ' |
|
350 | 350 | </button> |
351 | 351 | </div> |
352 | 352 | </div> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | wp_register_script( |
396 | 396 | 'wordpoints-hooks-extension-conditions' |
397 | 397 | , "{$assets_url}/js/hooks/extensions/conditions{$manifested_suffix}.js" |
398 | - , array( 'wordpoints-hooks-views' ) |
|
398 | + , array('wordpoints-hooks-views') |
|
399 | 399 | , WORDPOINTS_VERSION |
400 | 400 | ); |
401 | 401 | |
@@ -405,25 +405,25 @@ discard block |
||
405 | 405 | , ' |
406 | 406 | <script type="text/template" id="tmpl-wordpoints-hook-condition-groups"> |
407 | 407 | <div class="conditions-title section-title"> |
408 | - <h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4> |
|
408 | + <h4>' . esc_html__('Conditions', 'wordpoints') . '</h4> |
|
409 | 409 | <button type="button" class="add-new button-secondary button-link"> |
410 | - <span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span> |
|
410 | + <span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints') . '</span> |
|
411 | 411 | <span class="dashicons dashicons-plus"></span> |
412 | 412 | </button> |
413 | 413 | </div> |
414 | 414 | <div class="add-condition-form hidden"> |
415 | 415 | <div class="no-conditions hidden"> |
416 | - ' . esc_html__( 'No conditions available.', 'wordpoints' ) . ' |
|
416 | + ' . esc_html__('No conditions available.', 'wordpoints') . ' |
|
417 | 417 | </div> |
418 | 418 | <div class="condition-selectors"> |
419 | 419 | <div class="arg-selectors"></div> |
420 | 420 | <div class="condition-selector"></div> |
421 | 421 | </div> |
422 | - <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '"> |
|
423 | - ' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . ' |
|
422 | + <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints') . '"> |
|
423 | + ' . esc_html_x('Add', 'reaction condition', 'wordpoints') . ' |
|
424 | 424 | </button> |
425 | - <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '"> |
|
426 | - ' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . ' |
|
425 | + <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints') . '"> |
|
426 | + ' . esc_html_x('Cancel', 'reaction condition', 'wordpoints') . ' |
|
427 | 427 | </button> |
428 | 428 | </div> |
429 | 429 | <div class="condition-groups section-content"></div> |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | <div class="condition-controls"> |
438 | 438 | <div class="condition-title"></div> |
439 | 439 | <button type="button" class="delete button-secondary button-link"> |
440 | - <span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span> |
|
440 | + <span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints') . '</span> |
|
441 | 441 | <span class="dashicons dashicons-no"></span> |
442 | 442 | </button> |
443 | 443 | </div> |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | wp_register_script( |
457 | 457 | 'wordpoints-hooks-extension-periods' |
458 | 458 | , "{$assets_url}/js/hooks/extensions/periods{$manifested_suffix}.js" |
459 | - , array( 'wordpoints-hooks-views' ) |
|
459 | + , array('wordpoints-hooks-views') |
|
460 | 460 | , WORDPOINTS_VERSION |
461 | 461 | ); |
462 | 462 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | <script type="text/template" id="tmpl-wordpoints-hook-periods"> |
468 | 468 | <div class="wordpoints-hook-periods"> |
469 | 469 | <div class="periods-title section-title"> |
470 | - <h4>' . esc_html__( 'Rate Limit', 'wordpoints' ) . '</h4> |
|
470 | + <h4>' . esc_html__('Rate Limit', 'wordpoints') . '</h4> |
|
471 | 471 | </div> |
472 | 472 | <div class="periods section-content"></div> |
473 | 473 | </div> |
@@ -480,11 +480,11 @@ discard block |
||
480 | 480 | <p class="description description-thin"> |
481 | 481 | <legend>{{ data.length_in_units_label }}</legend> |
482 | 482 | <label> |
483 | - <span class="screen-reader-text">' . esc_html__( 'Time Units:', 'wordpoints' ) . '</span> |
|
483 | + <span class="screen-reader-text">' . esc_html__('Time Units:', 'wordpoints') . '</span> |
|
484 | 484 | <select class="widefat wordpoints-hook-period-sync wordpoints-hook-period-units"></select> |
485 | 485 | </label> |
486 | 486 | <label> |
487 | - <span class="screen-reader-text">' . esc_html__( 'Number:', 'wordpoints' ) . '</span> |
|
487 | + <span class="screen-reader-text">' . esc_html__('Number:', 'wordpoints') . '</span> |
|
488 | 488 | <input type="number" value="{{ data.length_in_units }}" class="widefat wordpoints-hook-period-sync wordpoints-hook-period-length-in-units" /> |
489 | 489 | </label> |
490 | 490 | </p> |
@@ -505,12 +505,12 @@ discard block |
||
505 | 505 | $hooks = wordpoints_hooks(); |
506 | 506 | |
507 | 507 | $extensions_data = wordpoints_hooks_ui_get_script_data_from_objects( |
508 | - $hooks->get_sub_app( 'extensions' )->get_all() |
|
508 | + $hooks->get_sub_app('extensions')->get_all() |
|
509 | 509 | , 'extension' |
510 | 510 | ); |
511 | 511 | |
512 | 512 | $reactor_data = wordpoints_hooks_ui_get_script_data_from_objects( |
513 | - $hooks->get_sub_app( 'reactors' )->get_all() |
|
513 | + $hooks->get_sub_app('reactors')->get_all() |
|
514 | 514 | , 'reactor' |
515 | 515 | ); |
516 | 516 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * |
537 | 537 | * @param array $data The data. |
538 | 538 | */ |
539 | - $data = apply_filters( 'wordpoints_hooks_ui_data', $data ); |
|
539 | + $data = apply_filters('wordpoints_hooks_ui_data', $data); |
|
540 | 540 | |
541 | 541 | wp_localize_script( |
542 | 542 | 'wordpoints-hooks-models' |
@@ -556,18 +556,18 @@ discard block |
||
556 | 556 | * |
557 | 557 | * @return array The data extracted from the objects. |
558 | 558 | */ |
559 | -function wordpoints_hooks_ui_get_script_data_from_objects( $objects, $type ) { |
|
559 | +function wordpoints_hooks_ui_get_script_data_from_objects($objects, $type) { |
|
560 | 560 | |
561 | 561 | $data = array(); |
562 | 562 | |
563 | - foreach ( $objects as $slug => $object ) { |
|
563 | + foreach ($objects as $slug => $object) { |
|
564 | 564 | |
565 | - if ( $object instanceof WordPoints_Hook_UI_Script_Data_ProviderI ) { |
|
566 | - $data[ $slug ] = $object->get_ui_script_data(); |
|
565 | + if ($object instanceof WordPoints_Hook_UI_Script_Data_ProviderI) { |
|
566 | + $data[$slug] = $object->get_ui_script_data(); |
|
567 | 567 | } |
568 | 568 | |
569 | - if ( wp_script_is( "wordpoints-hooks-{$type}-{$slug}", 'registered' ) ) { |
|
570 | - wp_enqueue_script( "wordpoints-hooks-{$type}-{$slug}" ); |
|
569 | + if (wp_script_is("wordpoints-hooks-{$type}-{$slug}", 'registered')) { |
|
570 | + wp_enqueue_script("wordpoints-hooks-{$type}-{$slug}"); |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | |
@@ -588,31 +588,31 @@ discard block |
||
588 | 588 | $entities_data = array(); |
589 | 589 | |
590 | 590 | /** @var WordPoints_Class_Registry_Children $entity_children */ |
591 | - $entity_children = $entities->get_sub_app( 'children' ); |
|
591 | + $entity_children = $entities->get_sub_app('children'); |
|
592 | 592 | |
593 | 593 | /** @var WordPoints_Entity $entity */ |
594 | - foreach ( $entities->get_all() as $slug => $entity ) { |
|
594 | + foreach ($entities->get_all() as $slug => $entity) { |
|
595 | 595 | |
596 | 596 | $child_data = array(); |
597 | 597 | |
598 | 598 | /** @var WordPoints_EntityishI $child */ |
599 | - foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) { |
|
599 | + foreach ($entity_children->get_children($slug) as $child_slug => $child) { |
|
600 | 600 | |
601 | - $child_data[ $child_slug ] = array( |
|
601 | + $child_data[$child_slug] = array( |
|
602 | 602 | 'slug' => $child_slug, |
603 | 603 | 'title' => $child->get_title(), |
604 | 604 | ); |
605 | 605 | |
606 | - if ( $child instanceof WordPoints_Entity_Attr ) { |
|
606 | + if ($child instanceof WordPoints_Entity_Attr) { |
|
607 | 607 | |
608 | - $child_data[ $child_slug ]['_type'] = 'attr'; |
|
609 | - $child_data[ $child_slug ]['data_type'] = $child->get_data_type(); |
|
608 | + $child_data[$child_slug]['_type'] = 'attr'; |
|
609 | + $child_data[$child_slug]['data_type'] = $child->get_data_type(); |
|
610 | 610 | |
611 | - } elseif ( $child instanceof WordPoints_Entity_Relationship ) { |
|
611 | + } elseif ($child instanceof WordPoints_Entity_Relationship) { |
|
612 | 612 | |
613 | - $child_data[ $child_slug ]['_type'] = 'relationship'; |
|
614 | - $child_data[ $child_slug ]['primary'] = $child->get_primary_entity_slug(); |
|
615 | - $child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug(); |
|
613 | + $child_data[$child_slug]['_type'] = 'relationship'; |
|
614 | + $child_data[$child_slug]['primary'] = $child->get_primary_entity_slug(); |
|
615 | + $child_data[$child_slug]['secondary'] = $child->get_related_entity_slug(); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | /** |
@@ -623,14 +623,14 @@ discard block |
||
623 | 623 | * @param array $data The data for the entity child. |
624 | 624 | * @param WordPoints_Entityish $child The child's object. |
625 | 625 | */ |
626 | - $child_data[ $child_slug ] = apply_filters( |
|
626 | + $child_data[$child_slug] = apply_filters( |
|
627 | 627 | 'wordpoints_hooks_ui_data_entity_child' |
628 | - , $child_data[ $child_slug ] |
|
628 | + , $child_data[$child_slug] |
|
629 | 629 | , $child |
630 | 630 | ); |
631 | 631 | } |
632 | 632 | |
633 | - $entities_data[ $slug ] = array( |
|
633 | + $entities_data[$slug] = array( |
|
634 | 634 | 'slug' => $slug, |
635 | 635 | 'title' => $entity->get_title(), |
636 | 636 | 'children' => $child_data, |
@@ -638,12 +638,12 @@ discard block |
||
638 | 638 | '_type' => 'entity', |
639 | 639 | ); |
640 | 640 | |
641 | - if ( $entity instanceof WordPoints_Entity_EnumerableI ) { |
|
641 | + if ($entity instanceof WordPoints_Entity_EnumerableI) { |
|
642 | 642 | |
643 | 643 | $values = array(); |
644 | 644 | |
645 | - foreach ( $entity->get_enumerated_values() as $value ) { |
|
646 | - if ( $entity->set_the_value( $value ) ) { |
|
645 | + foreach ($entity->get_enumerated_values() as $value) { |
|
646 | + if ($entity->set_the_value($value)) { |
|
647 | 647 | $values[] = array( |
648 | 648 | 'value' => $entity->get_the_id(), |
649 | 649 | 'label' => $entity->get_the_human_id(), |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | } |
652 | 652 | } |
653 | 653 | |
654 | - $entities_data[ $slug ]['values'] = $values; |
|
654 | + $entities_data[$slug]['values'] = $values; |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | /** |
@@ -660,9 +660,9 @@ discard block |
||
660 | 660 | * @param array $data The data for the entity. |
661 | 661 | * @param WordPoints_Entity $entity The entity object. |
662 | 662 | */ |
663 | - $entities_data[ $slug ] = apply_filters( |
|
663 | + $entities_data[$slug] = apply_filters( |
|
664 | 664 | 'wordpoints_hooks_ui_data_entity' |
665 | - , $entities_data[ $slug ] |
|
665 | + , $entities_data[$slug] |
|
666 | 666 | , $entity |
667 | 667 | ); |
668 | 668 | |
@@ -683,19 +683,19 @@ discard block |
||
683 | 683 | // We want a list of the action types for each event. We can start with this list |
684 | 684 | // but it is indexed by action slug and then action type and then event slug, so |
685 | 685 | // we ned to do some processing. |
686 | - $event_index = wordpoints_hooks()->get_sub_app( 'router' )->get_event_index(); |
|
686 | + $event_index = wordpoints_hooks()->get_sub_app('router')->get_event_index(); |
|
687 | 687 | |
688 | 688 | // We don't care about the action slugs, so first we get rid of that bottom level |
689 | 689 | // of the array. |
690 | - $event_index = call_user_func_array( 'array_merge_recursive', $event_index ); |
|
690 | + $event_index = call_user_func_array('array_merge_recursive', $event_index); |
|
691 | 691 | |
692 | 692 | $event_action_types = array(); |
693 | 693 | |
694 | 694 | // This leaves us the event indexed by action type. But we actually need to flip |
695 | 695 | // this, so that we have the action types indexed by event slug. |
696 | - foreach ( $event_index as $action_type => $events ) { |
|
697 | - foreach ( $events as $event => $unused ) { |
|
698 | - $event_action_types[ $event ][ $action_type ] = true; |
|
696 | + foreach ($event_index as $action_type => $events) { |
|
697 | + foreach ($events as $event => $unused) { |
|
698 | + $event_action_types[$event][$action_type] = true; |
|
699 | 699 | } |
700 | 700 | } |
701 | 701 | |
@@ -718,13 +718,13 @@ discard block |
||
718 | 718 | * |
719 | 719 | * @return string The HTML with templates appended. |
720 | 720 | */ |
721 | -function wordpoints_script_templates_filter( $html, $handle ) { |
|
721 | +function wordpoints_script_templates_filter($html, $handle) { |
|
722 | 722 | |
723 | 723 | global $wp_scripts; |
724 | 724 | |
725 | - $templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' ); |
|
725 | + $templates = $wp_scripts->get_data($handle, 'wordpoints-templates'); |
|
726 | 726 | |
727 | - if ( $templates ) { |
|
727 | + if ($templates) { |
|
728 | 728 | $html .= $templates; |
729 | 729 | } |
730 | 730 | |
@@ -742,9 +742,9 @@ discard block |
||
742 | 742 | * @param string $message The text for the error message. |
743 | 743 | * @param array $args Other optional arguments. |
744 | 744 | */ |
745 | -function wordpoints_show_admin_error( $message, array $args = array() ) { |
|
745 | +function wordpoints_show_admin_error($message, array $args = array()) { |
|
746 | 746 | |
747 | - wordpoints_show_admin_message( $message, 'error', $args ); |
|
747 | + wordpoints_show_admin_message($message, 'error', $args); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
@@ -774,16 +774,16 @@ discard block |
||
774 | 774 | * Required when $dismissible is true. |
775 | 775 | * } |
776 | 776 | */ |
777 | -function wordpoints_show_admin_message( $message, $type = 'success', array $args = array() ) { |
|
777 | +function wordpoints_show_admin_message($message, $type = 'success', array $args = array()) { |
|
778 | 778 | |
779 | 779 | $defaults = array( |
780 | 780 | 'dismissible' => false, |
781 | 781 | 'option' => '', |
782 | 782 | ); |
783 | 783 | |
784 | - $args = array_merge( $defaults, $args ); |
|
784 | + $args = array_merge($defaults, $args); |
|
785 | 785 | |
786 | - if ( isset( $args['dismissable'] ) ) { |
|
786 | + if (isset($args['dismissable'])) { |
|
787 | 787 | |
788 | 788 | $args['dismissible'] = $args['dismissable']; |
789 | 789 | |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | ); |
795 | 795 | } |
796 | 796 | |
797 | - if ( 'updated' === $type ) { |
|
797 | + if ('updated' === $type) { |
|
798 | 798 | |
799 | 799 | $type = 'success'; |
800 | 800 | |
@@ -805,27 +805,27 @@ discard block |
||
805 | 805 | ); |
806 | 806 | } |
807 | 807 | |
808 | - if ( $args['dismissible'] && $args['option'] ) { |
|
809 | - wp_enqueue_script( 'wordpoints-admin-dismiss-notice' ); |
|
808 | + if ($args['dismissible'] && $args['option']) { |
|
809 | + wp_enqueue_script('wordpoints-admin-dismiss-notice'); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | ?> |
813 | 813 | |
814 | 814 | <div |
815 | - class="notice notice-<?php echo sanitize_html_class( $type, 'success' ); ?><?php echo ( $args['dismissible'] ) ? ' is-dismissible' : ''; ?>" |
|
816 | - <?php if ( $args['dismissible'] && $args['option'] ) : ?> |
|
817 | - data-nonce="<?php echo esc_attr( wp_create_nonce( "wordpoints_dismiss_notice-{$args['option']}" ) ); ?>" |
|
818 | - data-option="<?php echo esc_attr( $args['option'] ); ?>" |
|
815 | + class="notice notice-<?php echo sanitize_html_class($type, 'success'); ?><?php echo ($args['dismissible']) ? ' is-dismissible' : ''; ?>" |
|
816 | + <?php if ($args['dismissible'] && $args['option']) : ?> |
|
817 | + data-nonce="<?php echo esc_attr(wp_create_nonce("wordpoints_dismiss_notice-{$args['option']}")); ?>" |
|
818 | + data-option="<?php echo esc_attr($args['option']); ?>" |
|
819 | 819 | <?php endif; ?> |
820 | 820 | > |
821 | 821 | <p> |
822 | - <?php echo wp_kses( $message, 'wordpoints_admin_message' ); ?> |
|
822 | + <?php echo wp_kses($message, 'wordpoints_admin_message'); ?> |
|
823 | 823 | </p> |
824 | - <?php if ( $args['dismissible'] && $args['option'] ) : ?> |
|
824 | + <?php if ($args['dismissible'] && $args['option']) : ?> |
|
825 | 825 | <form method="post" class="wordpoints-notice-dismiss-form" style="padding-bottom: 5px;"> |
826 | - <input type="hidden" name="wordpoints_notice" value="<?php echo esc_html( $args['option'] ); ?>" /> |
|
827 | - <?php wp_nonce_field( "wordpoints_dismiss_notice-{$args['option']}" ); ?> |
|
828 | - <?php submit_button( __( 'Hide This Notice', 'wordpoints' ), 'secondary', 'wordpoints_dismiss_notice', false ); ?> |
|
826 | + <input type="hidden" name="wordpoints_notice" value="<?php echo esc_html($args['option']); ?>" /> |
|
827 | + <?php wp_nonce_field("wordpoints_dismiss_notice-{$args['option']}"); ?> |
|
828 | + <?php submit_button(__('Hide This Notice', 'wordpoints'), 'secondary', 'wordpoints_dismiss_notice', false); ?> |
|
829 | 829 | </form> |
830 | 830 | <?php endif; ?> |
831 | 831 | </div> |
@@ -843,19 +843,19 @@ discard block |
||
843 | 843 | * |
844 | 844 | * @return string |
845 | 845 | */ |
846 | -function wordpoints_admin_get_current_tab( array $tabs = null ) { |
|
846 | +function wordpoints_admin_get_current_tab(array $tabs = null) { |
|
847 | 847 | |
848 | 848 | $tab = ''; |
849 | 849 | |
850 | - if ( isset( $_GET['tab'] ) ) { |
|
850 | + if (isset($_GET['tab'])) { |
|
851 | 851 | |
852 | - $tab = sanitize_key( $_GET['tab'] ); |
|
852 | + $tab = sanitize_key($_GET['tab']); |
|
853 | 853 | } |
854 | 854 | |
855 | - if ( isset( $tabs ) && ! isset( $tabs[ $tab ] ) ) { |
|
855 | + if (isset($tabs) && ! isset($tabs[$tab])) { |
|
856 | 856 | |
857 | - reset( $tabs ); |
|
858 | - $tab = key( $tabs ); |
|
857 | + reset($tabs); |
|
858 | + $tab = key($tabs); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | return $tab; |
@@ -872,29 +872,29 @@ discard block |
||
872 | 872 | * @param bool $show_heading Whether to show an <h1> element using the current |
873 | 873 | * tab. Default is true. |
874 | 874 | */ |
875 | -function wordpoints_admin_show_tabs( $tabs, $show_heading = true ) { |
|
875 | +function wordpoints_admin_show_tabs($tabs, $show_heading = true) { |
|
876 | 876 | |
877 | - $current = wordpoints_admin_get_current_tab( $tabs ); |
|
877 | + $current = wordpoints_admin_get_current_tab($tabs); |
|
878 | 878 | |
879 | - if ( $show_heading ) { |
|
879 | + if ($show_heading) { |
|
880 | 880 | |
881 | 881 | // translators: Current tab name. |
882 | - echo '<h1>', esc_html( sprintf( __( 'WordPoints — %s', 'wordpoints' ), $tabs[ $current ] ) ), '</h1>'; |
|
882 | + echo '<h1>', esc_html(sprintf(__('WordPoints — %s', 'wordpoints'), $tabs[$current])), '</h1>'; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | echo '<h2 class="nav-tab-wrapper">'; |
886 | 886 | |
887 | 887 | $page = ''; |
888 | 888 | |
889 | - if ( isset( $_GET['page'] ) ) { |
|
890 | - $page = sanitize_key( $_GET['page'] ); |
|
889 | + if (isset($_GET['page'])) { |
|
890 | + $page = sanitize_key($_GET['page']); |
|
891 | 891 | } |
892 | 892 | |
893 | - foreach ( $tabs as $tab => $name ) { |
|
893 | + foreach ($tabs as $tab => $name) { |
|
894 | 894 | |
895 | - $class = ( $tab === $current ) ? ' nav-tab-active' : ''; |
|
895 | + $class = ($tab === $current) ? ' nav-tab-active' : ''; |
|
896 | 896 | |
897 | - echo '<a class="nav-tab ', sanitize_html_class( $class ), '" href="?page=', rawurlencode( $page ), '&tab=', rawurlencode( $tab ), '">', esc_html( $name ), '</a>'; |
|
897 | + echo '<a class="nav-tab ', sanitize_html_class($class), '" href="?page=', rawurlencode($page), '&tab=', rawurlencode($tab), '">', esc_html($name), '</a>'; |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | echo '</h2>'; |
@@ -918,12 +918,12 @@ discard block |
||
918 | 918 | </style> |
919 | 919 | |
920 | 920 | <div class="upload-plugin wordpoints-upload-module"> |
921 | - <p class="install-help"><?php esc_html_e( 'If you have a module in a .zip format, you may install it by uploading it here.', 'wordpoints' ); ?></p> |
|
922 | - <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo esc_url( self_admin_url( 'update.php?action=upload-wordpoints-module' ) ); ?>"> |
|
923 | - <?php wp_nonce_field( 'wordpoints-module-upload' ); ?> |
|
924 | - <label class="screen-reader-text" for="modulezip"><?php esc_html_e( 'Module zip file', 'wordpoints' ); ?></label> |
|
921 | + <p class="install-help"><?php esc_html_e('If you have a module in a .zip format, you may install it by uploading it here.', 'wordpoints'); ?></p> |
|
922 | + <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo esc_url(self_admin_url('update.php?action=upload-wordpoints-module')); ?>"> |
|
923 | + <?php wp_nonce_field('wordpoints-module-upload'); ?> |
|
924 | + <label class="screen-reader-text" for="modulezip"><?php esc_html_e('Module zip file', 'wordpoints'); ?></label> |
|
925 | 925 | <input type="file" id="modulezip" name="modulezip" /> |
926 | - <?php submit_button( __( 'Install Now', 'wordpoints' ), 'button', 'install-module-submit', false ); ?> |
|
926 | + <?php submit_button(__('Install Now', 'wordpoints'), 'button', 'install-module-submit', false); ?> |
|
927 | 927 | </form> |
928 | 928 | </div> |
929 | 929 | |
@@ -941,15 +941,15 @@ discard block |
||
941 | 941 | |
942 | 942 | global $title, $parent_file, $submenu_file; |
943 | 943 | |
944 | - if ( ! current_user_can( 'install_wordpoints_modules' ) ) { |
|
945 | - wp_die( esc_html__( 'Sorry, you are not allowed to install WordPoints modules on this site.', 'wordpoints' ), '', array( 'response' => 403 ) ); |
|
944 | + if ( ! current_user_can('install_wordpoints_modules')) { |
|
945 | + wp_die(esc_html__('Sorry, you are not allowed to install WordPoints modules on this site.', 'wordpoints'), '', array('response' => 403)); |
|
946 | 946 | } |
947 | 947 | |
948 | - check_admin_referer( 'wordpoints-module-upload' ); |
|
948 | + check_admin_referer('wordpoints-module-upload'); |
|
949 | 949 | |
950 | - $file_upload = new File_Upload_Upgrader( 'modulezip', 'package' ); |
|
950 | + $file_upload = new File_Upload_Upgrader('modulezip', 'package'); |
|
951 | 951 | |
952 | - $title = esc_html__( 'Upload WordPoints Module', 'wordpoints' ); |
|
952 | + $title = esc_html__('Upload WordPoints Module', 'wordpoints'); |
|
953 | 953 | $parent_file = 'admin.php'; |
954 | 954 | $submenu_file = 'admin.php'; |
955 | 955 | |
@@ -959,17 +959,17 @@ discard block |
||
959 | 959 | new WordPoints_Module_Installer_Skin( |
960 | 960 | array( |
961 | 961 | // translators: File name. |
962 | - 'title' => sprintf( esc_html__( 'Installing Module from uploaded file: %s', 'wordpoints' ), esc_html( basename( $file_upload->filename ) ) ), |
|
962 | + 'title' => sprintf(esc_html__('Installing Module from uploaded file: %s', 'wordpoints'), esc_html(basename($file_upload->filename))), |
|
963 | 963 | 'nonce' => 'wordpoints-module-upload', |
964 | - 'url' => add_query_arg( array( 'package' => $file_upload->id ), self_admin_url( 'update.php?action=upload-wordpoints-module' ) ), |
|
964 | + 'url' => add_query_arg(array('package' => $file_upload->id), self_admin_url('update.php?action=upload-wordpoints-module')), |
|
965 | 965 | 'type' => 'upload', |
966 | 966 | ) |
967 | 967 | ) |
968 | 968 | ); |
969 | 969 | |
970 | - $result = $upgrader->install( $file_upload->package ); |
|
970 | + $result = $upgrader->install($file_upload->package); |
|
971 | 971 | |
972 | - if ( $result || is_wp_error( $result ) ) { |
|
972 | + if ($result || is_wp_error($result)) { |
|
973 | 973 | $file_upload->cleanup(); |
974 | 974 | } |
975 | 975 | |
@@ -993,11 +993,11 @@ discard block |
||
993 | 993 | * |
994 | 994 | * @return string|WP_Error The filtered module source. |
995 | 995 | */ |
996 | -function wordpoints_plugin_upload_error_filter( $source ) { |
|
996 | +function wordpoints_plugin_upload_error_filter($source) { |
|
997 | 997 | |
998 | 998 | static $_source; |
999 | 999 | |
1000 | - if ( ! isset( $_source ) ) { |
|
1000 | + if ( ! isset($_source)) { |
|
1001 | 1001 | |
1002 | 1002 | $_source = $source; |
1003 | 1003 | |
@@ -1006,33 +1006,33 @@ discard block |
||
1006 | 1006 | global $wp_filesystem; |
1007 | 1007 | |
1008 | 1008 | if ( |
1009 | - ! is_wp_error( $_source ) |
|
1010 | - && is_wp_error( $source ) |
|
1009 | + ! is_wp_error($_source) |
|
1010 | + && is_wp_error($source) |
|
1011 | 1011 | && 'incompatible_archive_no_plugins' === $source->get_error_code() |
1012 | 1012 | ) { |
1013 | 1013 | |
1014 | 1014 | $working_directory = str_replace( |
1015 | 1015 | $wp_filesystem->wp_content_dir() |
1016 | - , trailingslashit( WP_CONTENT_DIR ) |
|
1016 | + , trailingslashit(WP_CONTENT_DIR) |
|
1017 | 1017 | , $_source |
1018 | 1018 | ); |
1019 | 1019 | |
1020 | - if ( is_dir( $working_directory ) ) { |
|
1020 | + if (is_dir($working_directory)) { |
|
1021 | 1021 | |
1022 | - $files = glob( $working_directory . '*.php' ); |
|
1022 | + $files = glob($working_directory . '*.php'); |
|
1023 | 1023 | |
1024 | - if ( is_array( $files ) ) { |
|
1024 | + if (is_array($files)) { |
|
1025 | 1025 | |
1026 | 1026 | // Check if the folder contains a module. |
1027 | - foreach ( $files as $file ) { |
|
1027 | + foreach ($files as $file) { |
|
1028 | 1028 | |
1029 | - $info = wordpoints_get_module_data( $file, false, false ); |
|
1029 | + $info = wordpoints_get_module_data($file, false, false); |
|
1030 | 1030 | |
1031 | - if ( ! empty( $info['name'] ) ) { |
|
1031 | + if ( ! empty($info['name'])) { |
|
1032 | 1032 | $source = new WP_Error( |
1033 | 1033 | 'wordpoints_module_archive_not_plugin' |
1034 | 1034 | , $source->get_error_message() |
1035 | - , __( 'This appears to be a WordPoints module archive. Try installing it on the WordPoints module install screen instead.', 'wordpoints' ) |
|
1035 | + , __('This appears to be a WordPoints module archive. Try installing it on the WordPoints module install screen instead.', 'wordpoints') |
|
1036 | 1036 | ); |
1037 | 1037 | |
1038 | 1038 | break; |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | } |
1044 | 1044 | |
1045 | - unset( $_source ); |
|
1045 | + unset($_source); |
|
1046 | 1046 | |
1047 | 1047 | } // End if ( ! isset( $_source ) ) else. |
1048 | 1048 | |
@@ -1062,16 +1062,16 @@ discard block |
||
1062 | 1062 | |
1063 | 1063 | <div style="height: 120px;border: none;padding: 1px 12px;background-color: #fff;border-left: 4px solid rgb(122, 208, 58);box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);margin-top: 50px;"> |
1064 | 1064 | <div style="width:48%;float:left;"> |
1065 | - <h3><?php esc_html_e( 'Like this plugin?', 'wordpoints' ); ?></h3> |
|
1065 | + <h3><?php esc_html_e('Like this plugin?', 'wordpoints'); ?></h3> |
|
1066 | 1066 | <?php // translators: URL for leaving a review of WordPoints on WordPress.org. ?> |
1067 | - <p><?php echo wp_kses( sprintf( __( 'If you think WordPoints is great, let everyone know by giving it a <a href="%s">5 star rating</a>.', 'wordpoints' ), 'https://wordpress.org/support/view/plugin-reviews/wordpoints?rate=5#postform' ), array( 'a' => array( 'href' => true ) ) ); ?></p> |
|
1068 | - <p><?php esc_html_e( 'If you don’t think this plugin deserves 5 stars, please let us know how we can improve it.', 'wordpoints' ); ?></p> |
|
1067 | + <p><?php echo wp_kses(sprintf(__('If you think WordPoints is great, let everyone know by giving it a <a href="%s">5 star rating</a>.', 'wordpoints'), 'https://wordpress.org/support/view/plugin-reviews/wordpoints?rate=5#postform'), array('a' => array('href' => true))); ?></p> |
|
1068 | + <p><?php esc_html_e('If you don’t think this plugin deserves 5 stars, please let us know how we can improve it.', 'wordpoints'); ?></p> |
|
1069 | 1069 | </div> |
1070 | 1070 | <div style="width:48%;float:left;"> |
1071 | - <h3><?php esc_html_e( 'Need help?', 'wordpoints' ); ?></h3> |
|
1071 | + <h3><?php esc_html_e('Need help?', 'wordpoints'); ?></h3> |
|
1072 | 1072 | <?php // translators: URL of WordPoints plugin support forums WordPress.org. ?> |
1073 | - <p><?php echo wp_kses( sprintf( __( 'Post your feature request or support question in the <a href="%s">support forums</a>', 'wordpoints' ), 'https://wordpress.org/support/plugin/wordpoints' ), array( 'a' => array( 'href' => true ) ) ); ?></p> |
|
1074 | - <p><em><?php esc_html_e( 'Thank you for using WordPoints!', 'wordpoints' ); ?></em></p> |
|
1073 | + <p><?php echo wp_kses(sprintf(__('Post your feature request or support question in the <a href="%s">support forums</a>', 'wordpoints'), 'https://wordpress.org/support/plugin/wordpoints'), array('a' => array('href' => true))); ?></p> |
|
1074 | + <p><em><?php esc_html_e('Thank you for using WordPoints!', 'wordpoints'); ?></em></p> |
|
1075 | 1075 | </div> |
1076 | 1076 | </div> |
1077 | 1077 | |
@@ -1089,19 +1089,19 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | wordpoints_delete_admin_notice_option(); |
1091 | 1091 | |
1092 | - if ( current_user_can( 'activate_wordpoints_modules' ) ) { |
|
1092 | + if (current_user_can('activate_wordpoints_modules')) { |
|
1093 | 1093 | |
1094 | - if ( is_network_admin() ) { |
|
1094 | + if (is_network_admin()) { |
|
1095 | 1095 | |
1096 | - $deactivated_modules = get_site_option( 'wordpoints_breaking_deactivated_modules' ); |
|
1096 | + $deactivated_modules = get_site_option('wordpoints_breaking_deactivated_modules'); |
|
1097 | 1097 | |
1098 | - if ( is_array( $deactivated_modules ) ) { |
|
1098 | + if (is_array($deactivated_modules)) { |
|
1099 | 1099 | wordpoints_show_admin_error( |
1100 | 1100 | sprintf( |
1101 | 1101 | // translators: 1. Plugin version; 2. List of modules. |
1102 | - __( 'WordPoints has deactivated the following modules because of incompatibilities with WordPoints %1$s: %2$s', 'wordpoints' ) |
|
1102 | + __('WordPoints has deactivated the following modules because of incompatibilities with WordPoints %1$s: %2$s', 'wordpoints') |
|
1103 | 1103 | , WORDPOINTS_VERSION |
1104 | - , implode( ', ', $deactivated_modules ) |
|
1104 | + , implode(', ', $deactivated_modules) |
|
1105 | 1105 | ) |
1106 | 1106 | , array( |
1107 | 1107 | 'dismissible' => true, |
@@ -1110,15 +1110,15 @@ discard block |
||
1110 | 1110 | ); |
1111 | 1111 | } |
1112 | 1112 | |
1113 | - $incompatible_modules = get_site_option( 'wordpoints_incompatible_modules' ); |
|
1113 | + $incompatible_modules = get_site_option('wordpoints_incompatible_modules'); |
|
1114 | 1114 | |
1115 | - if ( is_array( $incompatible_modules ) ) { |
|
1115 | + if (is_array($incompatible_modules)) { |
|
1116 | 1116 | wordpoints_show_admin_error( |
1117 | 1117 | sprintf( |
1118 | 1118 | // translators: 1. Plugin version; 2. List of modules. |
1119 | - __( 'WordPoints has deactivated the following network-active modules because of incompatibilities with WordPoints %1$s: %2$s', 'wordpoints' ) |
|
1119 | + __('WordPoints has deactivated the following network-active modules because of incompatibilities with WordPoints %1$s: %2$s', 'wordpoints') |
|
1120 | 1120 | , WORDPOINTS_VERSION |
1121 | - , implode( ', ', $incompatible_modules ) |
|
1121 | + , implode(', ', $incompatible_modules) |
|
1122 | 1122 | ) |
1123 | 1123 | , array( |
1124 | 1124 | 'dismissible' => true, |
@@ -1129,15 +1129,15 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | } else { |
1131 | 1131 | |
1132 | - $incompatible_modules = get_option( 'wordpoints_incompatible_modules' ); |
|
1132 | + $incompatible_modules = get_option('wordpoints_incompatible_modules'); |
|
1133 | 1133 | |
1134 | - if ( is_array( $incompatible_modules ) ) { |
|
1134 | + if (is_array($incompatible_modules)) { |
|
1135 | 1135 | wordpoints_show_admin_error( |
1136 | 1136 | sprintf( |
1137 | 1137 | // translators: 1. Plugin version; 2. List of modules. |
1138 | - __( 'WordPoints has deactivated the following modules on this site because of incompatibilities with WordPoints %1$s: %2$s', 'wordpoints' ) |
|
1138 | + __('WordPoints has deactivated the following modules on this site because of incompatibilities with WordPoints %1$s: %2$s', 'wordpoints') |
|
1139 | 1139 | , WORDPOINTS_VERSION |
1140 | - , implode( ', ', $incompatible_modules ) |
|
1140 | + , implode(', ', $incompatible_modules) |
|
1141 | 1141 | ) |
1142 | 1142 | , array( |
1143 | 1143 | 'dismissible' => true, |
@@ -1164,23 +1164,23 @@ discard block |
||
1164 | 1164 | $is_notice_dismissed = wordpoints_verify_nonce( |
1165 | 1165 | '_wpnonce' |
1166 | 1166 | , 'wordpoints_dismiss_notice-%s' |
1167 | - , array( 'wordpoints_notice' ) |
|
1167 | + , array('wordpoints_notice') |
|
1168 | 1168 | , 'post' |
1169 | 1169 | ); |
1170 | 1170 | |
1171 | - if ( $is_notice_dismissed && isset( $_POST['wordpoints_notice'] ) ) { |
|
1171 | + if ($is_notice_dismissed && isset($_POST['wordpoints_notice'])) { |
|
1172 | 1172 | |
1173 | - $option = sanitize_key( $_POST['wordpoints_notice'] ); |
|
1173 | + $option = sanitize_key($_POST['wordpoints_notice']); |
|
1174 | 1174 | |
1175 | - if ( ! is_network_admin() && 'wordpoints_incompatible_modules' === $option ) { |
|
1176 | - delete_option( $option ); |
|
1175 | + if ( ! is_network_admin() && 'wordpoints_incompatible_modules' === $option) { |
|
1176 | + delete_option($option); |
|
1177 | 1177 | } else { |
1178 | - wordpoints_delete_maybe_network_option( $option ); |
|
1178 | + wordpoints_delete_maybe_network_option($option); |
|
1179 | 1179 | } |
1180 | 1180 | } |
1181 | 1181 | |
1182 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
1183 | - wp_die( '', 200 ); |
|
1182 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1183 | + wp_die('', 200); |
|
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1197,14 +1197,14 @@ discard block |
||
1197 | 1197 | * |
1198 | 1198 | * @return mixed The option value, sanitized if it is for one of the plugin's screens. |
1199 | 1199 | */ |
1200 | -function wordpoints_admin_set_screen_option( $sanitized, $option, $value ) { |
|
1200 | +function wordpoints_admin_set_screen_option($sanitized, $option, $value) { |
|
1201 | 1201 | |
1202 | - switch ( $option ) { |
|
1202 | + switch ($option) { |
|
1203 | 1203 | |
1204 | 1204 | case 'wordpoints_page_wordpoints_modules_per_page': |
1205 | 1205 | case 'wordpoints_page_wordpoints_modules_network_per_page': |
1206 | 1206 | case 'toplevel_page_wordpoints_modules_per_page': |
1207 | - $sanitized = wordpoints_posint( $value ); |
|
1207 | + $sanitized = wordpoints_posint($value); |
|
1208 | 1208 | break; |
1209 | 1209 | } |
1210 | 1210 | |
@@ -1225,18 +1225,18 @@ discard block |
||
1225 | 1225 | */ |
1226 | 1226 | function wordpoints_admin_ajax_breaking_module_check() { |
1227 | 1227 | |
1228 | - if ( ! isset( $_GET['wordpoints_module_check'] ) ) { |
|
1229 | - wp_die( '', 400 ); |
|
1228 | + if ( ! isset($_GET['wordpoints_module_check'])) { |
|
1229 | + wp_die('', 400); |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | - if ( is_network_admin() ) { |
|
1233 | - $nonce = get_site_option( 'wordpoints_module_check_nonce' ); |
|
1232 | + if (is_network_admin()) { |
|
1233 | + $nonce = get_site_option('wordpoints_module_check_nonce'); |
|
1234 | 1234 | } else { |
1235 | - $nonce = get_option( 'wordpoints_module_check_nonce' ); |
|
1235 | + $nonce = get_option('wordpoints_module_check_nonce'); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { |
|
1239 | - wp_die( '', 403 ); |
|
1238 | + if ( ! $nonce || ! hash_equals($nonce, sanitize_key($_GET['wordpoints_module_check']))) { |
|
1239 | + wp_die('', 403); |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | // The list table constructor calls WP_Screen::get(), which expects this. |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | |
1245 | 1245 | wordpoints_admin_screen_modules(); |
1246 | 1246 | |
1247 | - wp_die( '', 200 ); |
|
1247 | + wp_die('', 200); |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | /** |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | */ |
1257 | 1257 | function wordpoints_hooks_admin_ajax() { |
1258 | 1258 | |
1259 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
1259 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1260 | 1260 | new WordPoints_Admin_Ajax_Hooks; |
1261 | 1261 | } |
1262 | 1262 | } |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.7.0 |
40 | 40 | */ |
41 | - public function __construct( array $args ) { |
|
41 | + public function __construct(array $args) { |
|
42 | 42 | |
43 | - parent::__construct( $args ); |
|
43 | + parent::__construct($args); |
|
44 | 44 | |
45 | - $this->name = _x( 'Points', 'rank type', 'wordpoints' ); |
|
45 | + $this->name = _x('Points', 'rank type', 'wordpoints'); |
|
46 | 46 | |
47 | - if ( ! isset( $args['points_type'] ) ) { |
|
47 | + if ( ! isset($args['points_type'])) { |
|
48 | 48 | _doing_it_wrong( |
49 | 49 | __METHOD__ |
50 | 50 | , 'WordPoints Error: The "points_type" argument is required.' |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | - $this->meta_fields['points']['label'] = _x( 'Points', 'form label', 'wordpoints' ); |
|
56 | + $this->meta_fields['points']['label'] = _x('Points', 'form label', 'wordpoints'); |
|
57 | 57 | $this->meta_fields['points_type']['default'] = $args['points_type']; |
58 | 58 | |
59 | - add_action( 'wordpoints_points_altered', array( $this, 'hook' ), 10, 3 ); |
|
59 | + add_action('wordpoints_points_altered', array($this, 'hook'), 10, 3); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function destruct() { |
68 | 68 | |
69 | - remove_action( 'wordpoints_points_altered', array( $this, 'hook' ), 10 ); |
|
69 | + remove_action('wordpoints_points_altered', array($this, 'hook'), 10); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -78,47 +78,47 @@ discard block |
||
78 | 78 | * @param int $points The number of points. |
79 | 79 | * @param string $points_type The type of points. |
80 | 80 | */ |
81 | - public function hook( $user_id, $points, $points_type ) { |
|
81 | + public function hook($user_id, $points, $points_type) { |
|
82 | 82 | |
83 | - if ( $points_type !== $this->meta_fields['points_type']['default'] ) { |
|
83 | + if ($points_type !== $this->meta_fields['points_type']['default']) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
87 | - $this->maybe_transition_user_ranks( $user_id, $points > 0 ); |
|
87 | + $this->maybe_transition_user_ranks($user_id, $points > 0); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @since 1.7.0 |
92 | 92 | */ |
93 | - public function validate_rank_meta( array $meta ) { |
|
93 | + public function validate_rank_meta(array $meta) { |
|
94 | 94 | |
95 | - if ( ! isset( $meta['points'] ) || false === wordpoints_int( $meta['points'] ) ) { |
|
95 | + if ( ! isset($meta['points']) || false === wordpoints_int($meta['points'])) { |
|
96 | 96 | return new WP_Error( |
97 | 97 | 'wordpoints_points_rank_type_invalid_points' |
98 | - , __( 'The amount of points is required, and must be a valid number.', 'wordpoints' ) |
|
99 | - , array( 'field' => 'points' ) |
|
98 | + , __('The amount of points is required, and must be a valid number.', 'wordpoints') |
|
99 | + , array('field' => 'points') |
|
100 | 100 | ); |
101 | 101 | } |
102 | 102 | |
103 | 103 | if ( |
104 | - ! isset( $meta['points_type'] ) |
|
105 | - || ! wordpoints_is_points_type( $meta['points_type'] ) |
|
104 | + ! isset($meta['points_type']) |
|
105 | + || ! wordpoints_is_points_type($meta['points_type']) |
|
106 | 106 | ) { |
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | |
110 | - $minimum = wordpoints_get_points_minimum( $meta['points_type'] ); |
|
110 | + $minimum = wordpoints_get_points_minimum($meta['points_type']); |
|
111 | 111 | |
112 | - if ( $meta['points'] < $minimum ) { |
|
112 | + if ($meta['points'] < $minimum) { |
|
113 | 113 | |
114 | 114 | return new WP_Error( |
115 | 115 | 'wordpoints_points_rank_type_points_less_than_minimum' |
116 | 116 | , sprintf( |
117 | 117 | // translators: Minimum number of points. |
118 | - __( 'The number of points must be more than the minimum (%s).', 'wordpoints' ) |
|
119 | - , wordpoints_format_points( $minimum, $meta['points_type'], 'points_rank_error' ) |
|
118 | + __('The number of points must be more than the minimum (%s).', 'wordpoints') |
|
119 | + , wordpoints_format_points($minimum, $meta['points_type'], 'points_rank_error') |
|
120 | 120 | ) |
121 | - , array( 'field' => 'points' ) |
|
121 | + , array('field' => 'points') |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 | |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return bool Whether the user meets the requirements for this rank. |
143 | 143 | */ |
144 | - protected function can_transition_user_rank( $user_id, $rank, array $args ) { |
|
144 | + protected function can_transition_user_rank($user_id, $rank, array $args) { |
|
145 | 145 | |
146 | - if ( $rank->points_type !== $this->meta_fields['points_type']['default'] ) { |
|
146 | + if ($rank->points_type !== $this->meta_fields['points_type']['default']) { |
|
147 | 147 | return false; |
148 | 148 | } |
149 | 149 | |
150 | - $user_points = wordpoints_get_points( $user_id, $rank->points_type ); |
|
150 | + $user_points = wordpoints_get_points($user_id, $rank->points_type); |
|
151 | 151 | |
152 | - if ( $rank->points > $user_points ) { |
|
152 | + if ($rank->points > $user_points) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @WordPress\filter wordpoints_points_widget_text 30 After esc_html(). |
16 | 16 | */ |
17 | -function wordpoints_ranks_points_widget_text_filter( $text, $instance ) { |
|
17 | +function wordpoints_ranks_points_widget_text_filter($text, $instance) { |
|
18 | 18 | |
19 | - if ( is_user_logged_in() ) { |
|
19 | + if (is_user_logged_in()) { |
|
20 | 20 | |
21 | 21 | $rank = wordpoints_get_formatted_user_rank( |
22 | 22 | get_current_user_id() |
23 | 23 | , "points_type-{$instance['points_type']}" |
24 | 24 | , 'my-points-widget' |
25 | - , array( 'widget_settings' => $instance ) |
|
25 | + , array('widget_settings' => $instance) |
|
26 | 26 | ); |
27 | 27 | |
28 | - $text = str_replace( '%rank%', $rank, $text ); |
|
28 | + $text = str_replace('%rank%', $rank, $text); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | return $text; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ?> |
44 | 44 | <br /> |
45 | 45 | <?php // translators: Placeholder name. ?> |
46 | - <small><i><?php echo esc_html( sprintf( __( '%s will be replaced with the rank of the logged in user', 'wordpoints' ), '%rank%' ) ); ?></i></small> |
|
46 | + <small><i><?php echo esc_html(sprintf(__('%s will be replaced with the rank of the logged in user', 'wordpoints'), '%rank%')); ?></i></small> |
|
47 | 47 | <?php |
48 | 48 | } |
49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @WordPress\filter wordpoints_points_top_users_username |
56 | 56 | */ |
57 | -function wordpoints_ranks_points_top_users_username_filter( $name, $user_id, $points_type, $context ) { |
|
57 | +function wordpoints_ranks_points_top_users_username_filter($name, $user_id, $points_type, $context) { |
|
58 | 58 | |
59 | 59 | $rank = wordpoints_get_formatted_user_rank( |
60 | 60 | $user_id |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @WordPress\filter shortcode_atts_wordpoints_user_rank |
76 | 76 | */ |
77 | -function wordpoints_user_rank_shortcode_points_type_attr( $out, $pairs, $atts ) { |
|
77 | +function wordpoints_user_rank_shortcode_points_type_attr($out, $pairs, $atts) { |
|
78 | 78 | |
79 | - if ( empty( $out['rank_group'] ) ) { |
|
79 | + if (empty($out['rank_group'])) { |
|
80 | 80 | |
81 | - if ( isset( $atts['points_type'] ) ) { |
|
81 | + if (isset($atts['points_type'])) { |
|
82 | 82 | |
83 | 83 | $out['rank_group'] = "points_type-{$atts['points_type']}"; |
84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $points_type = wordpoints_get_default_points_type(); |
88 | 88 | |
89 | - if ( $points_type ) { |
|
89 | + if ($points_type) { |
|
90 | 90 | $out['rank_group'] = "points_type-{$points_type}"; |
91 | 91 | } |
92 | 92 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function wordpoints_register_points_ranks() { |
106 | 106 | |
107 | - foreach ( wordpoints_get_points_types() as $slug => $points_type ) { |
|
107 | + foreach (wordpoints_get_points_types() as $slug => $points_type) { |
|
108 | 108 | |
109 | 109 | WordPoints_Rank_Groups::register_group( |
110 | 110 | "points_type-{$slug}" |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'name' => $points_type['name'], |
113 | 113 | 'description' => sprintf( |
114 | 114 | // translators: Points type name. |
115 | - __( 'This rank group is associated with the “%s” points type.', 'wordpoints' ) |
|
115 | + __('This rank group is associated with the “%s” points type.', 'wordpoints') |
|
116 | 116 | , $points_type['name'] |
117 | 117 | ), |
118 | 118 | ) |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | WordPoints_Rank_Types::register_type( |
122 | 122 | "points-{$slug}" |
123 | 123 | , 'WordPoints_Points_Rank_Type' |
124 | - , array( 'points_type' => $slug ) |
|
124 | + , array('points_type' => $slug) |
|
125 | 125 | ); |
126 | 126 | |
127 | 127 | WordPoints_Rank_Groups::register_type_for_group( |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | |
146 | 146 | $tab = wordpoints_admin_get_current_tab(); |
147 | 147 | |
148 | - if ( 'add-new' === $tab ) { |
|
148 | + if ('add-new' === $tab) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | 152 | add_meta_box( |
153 | 153 | 'ranks' |
154 | - , _x( 'Ranks', 'Points Types screen meta box title', 'wordpoints' ) |
|
154 | + , _x('Ranks', 'Points Types screen meta box title', 'wordpoints') |
|
155 | 155 | , 'wordpoints_ranks_display_points_types_meta_box_ranks' |
156 | 156 | , 'wordpoints_page_wordpoints_points_types' |
157 | 157 | , 'side' |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @param array $points_type The data for the points type being edited. |
168 | 168 | */ |
169 | -function wordpoints_ranks_display_points_types_meta_box_ranks( $points_type ) { |
|
169 | +function wordpoints_ranks_display_points_types_meta_box_ranks($points_type) { |
|
170 | 170 | |
171 | 171 | ?> |
172 | 172 | |
173 | - <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_ranks&tab=points_type-' . $points_type['slug'] ) ); ?>"> |
|
174 | - <?php esc_html_e( 'Go to the ranks for this points type.', 'wordpoints' ); ?> |
|
173 | + <a href="<?php echo esc_url(self_admin_url('admin.php?page=wordpoints_ranks&tab=points_type-' . $points_type['slug'])); ?>"> |
|
174 | + <?php esc_html_e('Go to the ranks for this points type.', 'wordpoints'); ?> |
|
175 | 175 | </a> |
176 | 176 | |
177 | 177 | <?php |
@@ -9,25 +9,25 @@ discard block |
||
9 | 9 | |
10 | 10 | $rank_groups = WordPoints_Rank_Groups::get(); |
11 | 11 | |
12 | -if ( empty( $rank_groups ) ) { |
|
12 | +if (empty($rank_groups)) { |
|
13 | 13 | |
14 | 14 | ?> |
15 | 15 | <div class="wrap"> |
16 | - <?php wordpoints_show_admin_error( esc_html__( 'No rank groups are currently available.', 'wordpoints' ) ); ?> |
|
16 | + <?php wordpoints_show_admin_error(esc_html__('No rank groups are currently available.', 'wordpoints')); ?> |
|
17 | 17 | </div> |
18 | 18 | <?php |
19 | 19 | |
20 | 20 | return; |
21 | 21 | } |
22 | 22 | |
23 | -$rank_group = $rank_groups[ wordpoints_admin_get_current_tab( $rank_groups ) ]; |
|
23 | +$rank_group = $rank_groups[wordpoints_admin_get_current_tab($rank_groups)]; |
|
24 | 24 | |
25 | 25 | ?> |
26 | 26 | |
27 | 27 | <div class="wrap"> |
28 | - <h1><?php esc_html_e( 'Ranks', 'wordpoints' ); ?></h1> |
|
28 | + <h1><?php esc_html_e('Ranks', 'wordpoints'); ?></h1> |
|
29 | 29 | |
30 | - <?php wordpoints_admin_show_tabs( wp_list_pluck( $rank_groups, 'name' ), false ) ?> |
|
30 | + <?php wordpoints_admin_show_tabs(wp_list_pluck($rank_groups, 'name'), false) ?> |
|
31 | 31 | |
32 | 32 | <div id="ranks-error-message" class="notice notice-error hidden"> |
33 | 33 | <p></p> |
@@ -42,34 +42,34 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param WordPoints_Rank_Group $rank_group The rank group being displayed. |
44 | 44 | */ |
45 | - do_action( 'wordpoints_ranks_admin_screen_top', $rank_group ); |
|
45 | + do_action('wordpoints_ranks_admin_screen_top', $rank_group); |
|
46 | 46 | |
47 | 47 | ?> |
48 | 48 | |
49 | 49 | <div class="wordpoints-rank-group-container"> |
50 | - <p class="description group-description"><?php echo esc_html( $rank_group->description ); ?></p> |
|
50 | + <p class="description group-description"><?php echo esc_html($rank_group->description); ?></p> |
|
51 | 51 | <ul |
52 | - id="wordpoints-rank-group_<?php echo esc_attr( $rank_group->slug ); ?>" |
|
52 | + id="wordpoints-rank-group_<?php echo esc_attr($rank_group->slug); ?>" |
|
53 | 53 | class="wordpoints-rank-group" |
54 | - data-slug="<?php echo esc_attr( $rank_group->slug ); ?>" |
|
55 | - data-nonce="<?php echo esc_attr( wp_create_nonce( "wordpoints_get_ranks-{$rank_group->slug}" ) ); ?>" |
|
54 | + data-slug="<?php echo esc_attr($rank_group->slug); ?>" |
|
55 | + data-nonce="<?php echo esc_attr(wp_create_nonce("wordpoints_get_ranks-{$rank_group->slug}")); ?>" |
|
56 | 56 | > |
57 | 57 | </ul> |
58 | 58 | <div class="spinner-overlay" style="display: block;"> |
59 | 59 | <span class="spinner is-active"></span> |
60 | 60 | </div> |
61 | 61 | <div class="controls"> |
62 | - <button class="add-rank button-primary"><?php esc_html_e( 'Add Rank', 'wordpoints' ); ?></button> |
|
62 | + <button class="add-rank button-primary"><?php esc_html_e('Add Rank', 'wordpoints'); ?></button> |
|
63 | 63 | <label class="wordpoints-rank-types"> |
64 | - <?php esc_html_e( 'Rank Type:', 'wordpoints' ); ?> |
|
64 | + <?php esc_html_e('Rank Type:', 'wordpoints'); ?> |
|
65 | 65 | <select> |
66 | - <?php foreach ( $rank_group->get_types() as $rank_type ) : ?> |
|
67 | - <?php if ( 'base' !== $rank_type ) : ?> |
|
66 | + <?php foreach ($rank_group->get_types() as $rank_type) : ?> |
|
67 | + <?php if ('base' !== $rank_type) : ?> |
|
68 | 68 | <option |
69 | - value="<?php echo esc_attr( $rank_type ); ?>" |
|
70 | - data-nonce="<?php echo esc_attr( wp_create_nonce( "wordpoints_create_rank|{$rank_group->slug}|{$rank_type}" ) ); ?>" |
|
69 | + value="<?php echo esc_attr($rank_type); ?>" |
|
70 | + data-nonce="<?php echo esc_attr(wp_create_nonce("wordpoints_create_rank|{$rank_group->slug}|{$rank_type}")); ?>" |
|
71 | 71 | > |
72 | - <?php echo esc_html( WordPoints_Rank_Types::get_type( $rank_type )->get_name() ); ?> |
|
72 | + <?php echo esc_html(WordPoints_Rank_Types::get_type($rank_type)->get_name()); ?> |
|
73 | 73 | </option> |
74 | 74 | <?php endif; ?> |
75 | 75 | <?php endforeach; ?> |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param WordPoints_Rank_Group $rank_group The rank group being displayed. |
88 | 88 | */ |
89 | - do_action( 'wordpoints_ranks_admin_screen_bottom', $rank_group ); |
|
89 | + do_action('wordpoints_ranks_admin_screen_bottom', $rank_group); |
|
90 | 90 | |
91 | 91 | ?> |
92 | 92 | </div> |
93 | 93 | |
94 | -<?php foreach ( $rank_group->get_types() as $rank_type ) : ?> |
|
95 | - <script type="text/template" class="rank-template_<?php echo sanitize_html_class( $rank_type ); ?>"> |
|
94 | +<?php foreach ($rank_group->get_types() as $rank_type) : ?> |
|
95 | + <script type="text/template" class="rank-template_<?php echo sanitize_html_class($rank_type); ?>"> |
|
96 | 96 | <div class="view"> |
97 | 97 | <div> |
98 | 98 | <%- name %> |
@@ -100,31 +100,31 @@ discard block |
||
100 | 100 | |
101 | 101 | $field = key( |
102 | 102 | wp_list_filter( |
103 | - WordPoints_Rank_Types::get_type( $rank_type )->get_meta_fields() |
|
104 | - , array( 'in_title' => true ) |
|
103 | + WordPoints_Rank_Types::get_type($rank_type)->get_meta_fields() |
|
104 | + , array('in_title' => true) |
|
105 | 105 | ) |
106 | 106 | ); |
107 | 107 | |
108 | 108 | ?> |
109 | - <?php if ( $field ) : ?> |
|
110 | - <span><% if ( typeof <?php echo preg_replace( '/[^a-z0-9_]/i', '', $field ); // WPCS: XSS OK ?> !== "undefined" ) { print( <?php echo preg_replace( '/[^a-z0-9_]/i', '', $field ); // WPCS: XSS OK ?> ); } %></span> |
|
109 | + <?php if ($field) : ?> |
|
110 | + <span><% if ( typeof <?php echo preg_replace('/[^a-z0-9_]/i', '', $field); // WPCS: XSS OK ?> !== "undefined" ) { print( <?php echo preg_replace('/[^a-z0-9_]/i', '', $field); // WPCS: XSS OK ?> ); } %></span> |
|
111 | 111 | <?php endif; ?> |
112 | 112 | </div> |
113 | - <a class="edit"><?php echo esc_html_x( 'Edit', 'rank', 'wordpoints' ); ?></a> |
|
114 | - <a class="close"><?php esc_html_e( 'Close', 'wordpoints' ); ?></a> |
|
113 | + <a class="edit"><?php echo esc_html_x('Edit', 'rank', 'wordpoints'); ?></a> |
|
114 | + <a class="close"><?php esc_html_e('Close', 'wordpoints'); ?></a> |
|
115 | 115 | </div> |
116 | 116 | <form> |
117 | 117 | <div class="fields"> |
118 | 118 | <p class="description description-thin"> |
119 | 119 | <label> |
120 | - <?php echo esc_html_x( 'Title', 'rank', 'wordpoints' ); ?> |
|
120 | + <?php echo esc_html_x('Title', 'rank', 'wordpoints'); ?> |
|
121 | 121 | <input class="widefat" type="text" value="<%- name %>" name="name" /> |
122 | 122 | </label> |
123 | 123 | </p> |
124 | - <input type="hidden" name="type" value="<?php echo esc_attr( $rank_type ); ?>" /> |
|
124 | + <input type="hidden" name="type" value="<?php echo esc_attr($rank_type); ?>" /> |
|
125 | 125 | <input type="hidden" name="order" value="<%- order %>" /> |
126 | 126 | <input type="hidden" name="nonce" value="<%- nonce %>" /> |
127 | - <?php WordPoints_Rank_Types::get_type( $rank_type )->display_rank_meta_form_fields( array(), array( 'placeholders' => true ) ); ?> |
|
127 | + <?php WordPoints_Rank_Types::get_type($rank_type)->display_rank_meta_form_fields(array(), array('placeholders' => true)); ?> |
|
128 | 128 | </div> |
129 | 129 | <div class="messages"> |
130 | 130 | <div class="success"></div> |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | <span class="spinner is-active"></span> |
136 | 136 | </div> |
137 | 137 | <div class="action-buttons"> |
138 | - <button class="save button-primary" disabled><?php esc_html_e( 'Save', 'wordpoints' ); ?></button> |
|
139 | - <button class="cancel button-secondary"><?php esc_html_e( 'Cancel', 'wordpoints' ); ?></button> |
|
140 | - <button class="close button-secondary"><?php esc_html_e( 'Close', 'wordpoints' ); ?></button> |
|
141 | - <?php if ( 'base' !== $rank_type ) : ?> |
|
142 | - <button class="delete button-secondary"><?php esc_html_e( 'Delete', 'wordpoints' ); ?></button> |
|
138 | + <button class="save button-primary" disabled><?php esc_html_e('Save', 'wordpoints'); ?></button> |
|
139 | + <button class="cancel button-secondary"><?php esc_html_e('Cancel', 'wordpoints'); ?></button> |
|
140 | + <button class="close button-secondary"><?php esc_html_e('Close', 'wordpoints'); ?></button> |
|
141 | + <?php if ('base' !== $rank_type) : ?> |
|
142 | + <button class="delete button-secondary"><?php esc_html_e('Delete', 'wordpoints'); ?></button> |
|
143 | 143 | <?php endif; ?> |
144 | 144 | </div> |
145 | 145 | </div> |