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 11.9 11.9.1 11.9.2 11.9.3 12.0 12.0.1 12.0.2 12.1 12.1.1 12.1.2 12.2 12.2.1 12.2.2 12.3 12.3.1 12.4 12.4.1 12.5 12.5.1 12.6 12.6.1 12.6.2 12.6.3 12.7 12.7.1 12.7.2 12.8 12.8.1 12.8.2 12.9 12.9.1 12.9.2 12.9.3 12.9.4 13.0 13.0.1 13.1 13.1.1 13.1.2 13.1.3 13.1.4 13.2 13.2.1 13.2.2 13.2.3 13.3 13.3.1 13.3.2 13.4 13.4.1 13.4.2 13.4.3 13.4.4 13.5 13.5.1 13.6 13.6.1 13.7 13.7.1 13.8 13.8.1 13.8.2 13.9 13.9.1 14.0 14.1 14.2 14.2.1 14.3 14.4 14.4.1 14.5 14.6 14.7 14.8 14.9 14.9.1 15.0 15.0.1 15.0.2 15.1 15.1.1 15.2 15.3 15.3.1 15.4 15.5 15.6 15.7 15.7-a.1 15.7-a.3 15.7-a.5 15.7-a.7 15.7-beta
jetpack / class.jetpack-modules-list-table.php
jetpack Last commit date
3rd-party 2 months ago _inc 4 weeks ago css 4 weeks ago extensions 4 weeks ago images 1 month ago jetpack_vendor 4 weeks ago json-endpoints 4 weeks ago modules 4 weeks ago sal 4 weeks ago src 4 weeks ago vendor 4 weeks ago views 1 month ago CHANGELOG.md 4 weeks ago LICENSE.txt 5 months ago SECURITY.md 2 years ago class-jetpack-connection-status.php 2 years ago class-jetpack-gallery-settings.php 6 months ago class-jetpack-newsletter-dashboard-widget.php 6 months ago class-jetpack-pre-connection-jitms.php 2 years ago class-jetpack-stats-dashboard-widget.php 3 months ago class-jetpack-xmlrpc-methods.php 6 months ago class.frame-nonce-preview.php 6 months ago class.jetpack-admin.php 1 month ago class.jetpack-autoupdate.php 6 months ago class.jetpack-cli.php 5 months ago class.jetpack-client-server.php 2 years ago class.jetpack-gutenberg.php 2 months ago class.jetpack-heartbeat.php 3 months ago class.jetpack-modules-list-table.php 6 months ago class.jetpack-network-sites-list-table.php 6 months ago class.jetpack-network.php 1 month ago class.jetpack-plan.php 2 years ago class.jetpack-post-images.php 2 months ago class.jetpack-twitter-cards.php 3 months ago class.jetpack-user-agent.php 2 years ago class.jetpack.php 4 weeks ago class.json-api-endpoints.php 1 month ago class.json-api.php 5 months ago class.photon.php 3 years ago composer.json 4 weeks ago enhanced-open-graph.php 3 months ago functions.compat.php 3 months ago functions.cookies.php 2 years ago functions.global.php 1 month ago functions.is-mobile.php 2 years ago functions.opengraph.php 2 months ago functions.photon.php 2 years ago jetpack.php 4 weeks ago json-api-config.php 3 years ago json-endpoints.php 2 years ago load-jetpack.php 2 months ago locales.php 6 months ago readme.txt 4 weeks ago unauth-file-upload.php 6 months ago uninstall.php 6 months ago wpml-config.xml 3 years ago
class.jetpack-modules-list-table.php
480 lines
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * Jetpack modules list table.
4 *
5 * @package automattic/jetpack
6 */
7
8 use Automattic\Jetpack\Assets;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit( 0 );
12 }
13
14 if ( ! class_exists( 'WP_List_Table' ) ) {
15 require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
16 }
17
18 /**
19 * Jetpack modules list table.
20 */
21 class Jetpack_Modules_List_Table extends WP_List_Table {
22
23 /** Constructor. */
24 public function __construct() {
25 parent::__construct();
26
27 Jetpack::init();
28
29 if ( $this->compat_fields && is_array( $this->compat_fields ) ) {
30 array_push( $this->compat_fields, 'all_items' );
31 }
32
33 /**
34 * Filters the list of modules available to be displayed in the Jetpack Settings screen.
35 *
36 * @since 3.0.0
37 *
38 * @param array $modules Array of Jetpack modules.
39 */
40 $this->all_items = apply_filters( 'jetpack_modules_list_table_items', Jetpack_Admin::init()->get_modules() );
41 $this->items = $this->all_items;
42 $this->items = $this->filter_displayed_table_items( $this->items );
43 $this->_column_headers = array( $this->get_columns(), array(), array(), 'name' );
44 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Nonce: This is a view, not a model or controller. InputNotSanitized: Sanitized below via `$this->module_info_check()`.
45 $modal_info = isset( $_GET['info'] ) ? wp_unslash( $_GET['info'] ) : false;
46
47 // Adding in a hidden h1 heading for screen-readers.
48 ?>
49 <h1 class="screen-reader-text"><?php esc_html_e( 'Jetpack Modules List', 'jetpack' ); ?></h1>
50 <?php
51
52 wp_register_script(
53 'models.jetpack-modules',
54 Assets::get_file_url_for_environment(
55 '_inc/build/jetpack-modules.models.min.js',
56 '_inc/jetpack-modules.models.js'
57 ),
58 array( 'jquery', 'backbone' ),
59 JETPACK__VERSION,
60 false // @todo Can this be put in the footer?
61 );
62 wp_register_script(
63 'views.jetpack-modules',
64 Assets::get_file_url_for_environment(
65 '_inc/build/jetpack-modules.views.min.js',
66 '_inc/jetpack-modules.views.js'
67 ),
68 array( 'jquery', 'backbone', 'wp-util' ),
69 JETPACK__VERSION,
70 false // @todo Can this be put in the footer?
71 );
72 wp_register_script(
73 'jetpack-modules-list-table',
74 Assets::get_file_url_for_environment(
75 '_inc/build/jetpack-modules.min.js',
76 '_inc/jetpack-modules.js'
77 ),
78 array(
79 'views.jetpack-modules',
80 'models.jetpack-modules',
81 'jquery',
82 ),
83 JETPACK__VERSION,
84 true
85 );
86
87 wp_localize_script(
88 'jetpack-modules-list-table',
89 'jetpackModulesData',
90 array(
91 'modules' => Jetpack::get_translated_modules( $this->all_items ),
92 'i18n' => array(
93 'search_placeholder' => __( 'Search modules…', 'jetpack' ),
94 ),
95 'modalinfo' => $this->module_info_check( $modal_info, $this->all_items ),
96 'nonces' => array(
97 'bulk' => wp_create_nonce( 'bulk-jetpack_page_jetpack_modules' ),
98 ),
99 )
100 );
101
102 wp_enqueue_script( 'jetpack-modules-list-table' );
103
104 /**
105 * Filters the js_templates callback value.
106 *
107 * @since 3.6.0
108 *
109 * @param array array( $this, 'js_templates' ) js_templates callback.
110 */
111 add_action( 'admin_footer', apply_filters( 'jetpack_modules_list_table_js_template_callback', array( $this, 'js_templates' ) ), 9 );
112 }
113
114 /**
115 * Output row template.
116 */
117 public function js_templates() {
118 ?>
119 <script type="text/html" id="tmpl-Jetpack_Modules_List_Table_Template">
120 <# var i = 0;
121 if ( data.items.length ) {
122 _.each( data.items, function( item, key, list ) {
123 if ( item === undefined ) return; #>
124 <tr class="jetpack-module <# if ( ++i % 2 ) { #> alternate<# } #><# if ( item.activated ) { #> active<# } #><# if ( ! item.available ) { #> unavailable<# } #>" id="{{{ item.module }}}">
125 <th scope="row" class="check-column">
126 <input type="checkbox" name="modules[]" value="{{{ item.module }}}" {{{ item.disabled }}} />
127 </th>
128 <td class='name column-name'>
129 <p class='info'><a href="{{{item.learn_more_button}}}" target="blank" style="text-decoration: none;">{{{ item.name }}}</a></p>
130 <div class="row-actions">
131 <# if ( item.configurable ) { #>
132 <span class='configure'>{{{ item.configurable }}}</span>
133 <# } #>
134 <# if ( item.activated && 'vaultpress' !== item.module && item.available ) { #>
135 <span class='delete'><a class="dops-button is-compact" href="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>?page=jetpack&#038;action=deactivate&#038;module={{{ item.module }}}&#038;_wpnonce={{{ item.deactivate_nonce }}}"><?php esc_html_e( 'Deactivate', 'jetpack' ); ?></a></span>
136 <# } else if ( item.available ) { #>
137 <span class='activate'><a class="dops-button is-compact" href="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>?page=jetpack&#038;action=activate&#038;module={{{ item.module }}}&#038;_wpnonce={{{ item.activate_nonce }}}"><?php esc_html_e( 'Activate', 'jetpack' ); ?></a></span>
138 <# } #>
139 <# if ( ! item.available ) { #>
140 <p class='unavailable_reason'>{{{ item.unavailable_reason }}}</p>
141 <# } #>
142 </div>
143 </td>
144 </tr>
145 <#
146 });
147 } else {
148 #>
149 <tr class="no-modules-found">
150 <td colspan="2"><?php esc_html_e( 'No Modules Found', 'jetpack' ); ?></td>
151 </tr>
152 <#
153 }
154 #>
155 </script>
156 <?php
157 }
158
159 /**
160 * Get views data.
161 *
162 * @return array Maps identifier to display HTML.
163 */
164 public function get_views() {
165 /** This filter is already documented in class.jetpack-modules-list-table.php */
166 $modules = apply_filters( 'jetpack_modules_list_table_items', Jetpack_Admin::init()->get_modules() );
167 $array_of_module_tags = wp_list_pluck( $modules, 'module_tags' );
168 $module_tags = array_merge( ...array_values( $array_of_module_tags ) );
169 $module_tags = array_map( 'jetpack_get_module_i18n_tag', $module_tags );
170 $module_tags_unique = array_count_values( $module_tags );
171 ksort( $module_tags_unique );
172
173 $format = '<a href="%3$s" %4$s data-title="%1$s">%1$s</a> <span class="count">(%2$s)</span>';
174 $title = __( 'All', 'jetpack' );
175 $count = is_countable( $modules ) ? count( $modules ) : 0;
176 $url = esc_url( remove_query_arg( 'module_tag' ) );
177 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is a view, not a model or controller.
178 $views = array(
179 'all' => sprintf( $format, $title, $count, $url, 'class="all"' ),
180 );
181 foreach ( $module_tags_unique as $title => $count ) {
182 $key = sanitize_title( $title );
183 $display_title = esc_html( wptexturize( $title ) );
184 $url = esc_url( add_query_arg( 'module_tag', rawurlencode( $title ) ) );
185 $views[ $key ] = sprintf( $format, $display_title, $count, $url, '' );
186 }
187 return $views;
188 }
189
190 /**
191 * Output views HTML.
192 */
193 public function views() {
194 $views = $this->get_views();
195
196 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is a view, not a model or controller.
197 $module_tag = empty( $_GET['module_tag'] ) ? 'all' : sanitize_title( wp_unslash( $_GET['module_tag'] ) );
198
199 echo "<ul class='subsubsub'>\n";
200 foreach ( $views as $class => $view ) {
201 $class_name = $class;
202 if ( $class === $module_tag ) {
203 $class_name .= ' current';
204 }
205
206 $views[ $class ] = "\t<li class='$class_name'>$view</li>";
207 }
208 echo implode( "\n", $views ) . "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Is HTML. Escaping happens in get_views().
209 echo '</ul>';
210 }
211
212 /**
213 * Filter a modules array for displayed items.
214 *
215 * @param array $modules Modules.
216 * @return array Displayed modules.
217 */
218 public function filter_displayed_table_items( $modules ) {
219 return array_filter( $modules, array( $this, 'is_module_displayed' ) );
220 }
221
222 /**
223 * Determine if a module is displayed.
224 *
225 * @param array $module Module data.
226 * @return bool
227 */
228 public static function is_module_displayed( $module ) {
229 // Handle module tag based filtering.
230 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is a view, not a model or controller.
231 if ( ! empty( $_REQUEST['module_tag'] ) ) {
232 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is a view, not a model or controller.
233 $module_tag = sanitize_text_field( wp_unslash( $_REQUEST['module_tag'] ) );
234 if ( ! in_array( $module_tag, array_map( 'jetpack_get_module_i18n_tag', $module['module_tags'] ), true ) ) {
235 return false;
236 }
237 }
238
239 // If nothing rejected it, include it!
240 return true;
241 }
242
243 /**
244 * Sort callback to put modules with `requires_connection` last.
245 *
246 * @param array $module1 Module data.
247 * @param array $module2 Module data.
248 * @return int Indicating the relative ordering of module1 and module2.
249 */
250 public static function sort_requires_connection_last( $module1, $module2 ) {
251 if ( (bool) $module1['requires_connection'] === (bool) $module2['requires_connection'] ) {
252 return 0;
253 }
254 if ( $module1['requires_connection'] ) {
255 return 1;
256 }
257 if ( $module2['requires_connection'] ) {
258 return -1;
259 }
260
261 return 0;
262 }
263
264 /**
265 * Get table columns.
266 *
267 * @return string[] Column name to header HTML.
268 */
269 public function get_columns() {
270 $columns = array(
271 'cb' => '<input type="checkbox" />',
272 'name' => __( 'Name', 'jetpack' ),
273 );
274 return $columns;
275 }
276
277 /**
278 * Get bulk actions for the table.
279 *
280 * @return string[] Actions, code => text.
281 */
282 public function get_bulk_actions() {
283 $actions = array(
284 'bulk-activate' => __( 'Activate', 'jetpack' ),
285 'bulk-deactivate' => __( 'Deactivate', 'jetpack' ),
286 );
287 return $actions;
288 }
289
290 /**
291 * Print a single row of the table.
292 *
293 * @param object|array $item Item.
294 */
295 public function single_row( $item ) {
296 static $i = 0;
297 $row_class = ( ( ++$i ) % 2 ) ? ' alternate' : '';
298
299 if ( ! empty( $item['activated'] ) ) {
300 $row_class .= ' active';
301 }
302
303 if ( ! Jetpack_Admin::is_module_available( $item ) ) {
304 $row_class .= ' unavailable';
305 }
306
307 echo '<tr class="jetpack-module' . esc_attr( $row_class ) . '" id="' . esc_attr( $item['module'] ) . '">';
308 $this->single_row_columns( $item );
309 echo '</tr>';
310 }
311
312 /**
313 * Table classes.
314 *
315 * @return string[] HTML.
316 */
317 public function get_table_classes() {
318 return array( 'table', 'table-bordered', 'wp-list-table', 'widefat', 'fixed' );
319 }
320
321 /**
322 * Column checkbox.
323 *
324 * @param object|array $item Item.
325 * @return string HTML.
326 */
327 public function column_cb( $item ) {
328 if ( ! Jetpack_Admin::is_module_available( $item ) ) {
329 return '';
330 }
331
332 return sprintf( '<input type="checkbox" name="modules[]" value="%s" />', $item['module'] );
333 }
334
335 /**
336 * Column icon.
337 *
338 * @return string HTML.
339 */
340 public function column_icon() {
341 $badge_text = '';
342 $free_text = '';
343 ob_start();
344 ?>
345 <a href="#TB_inline?width=600&height=550&inlineId=more-info-module-settings-modal" class="thickbox">
346 <div class="module-image">
347 <p><span class="module-image-badge"><?php echo esc_html( $badge_text ); ?></span><span class="module-image-free" style="display: none"><?php echo esc_html( $free_text ); ?></span></p>
348 </div>
349 </a>
350 <?php
351 return ob_get_clean();
352 }
353
354 /**
355 * Column name.
356 *
357 * @param object|array $item Item.
358 * @return string HTML.
359 */
360 public function column_name( $item ) {
361 $actions = array(
362 'info' => sprintf( '<a href="%s" target="blank">%s</a>', esc_url( $item['learn_more_button'] ), esc_html__( 'Feature Info', 'jetpack' ) ),
363 );
364
365 if ( ! empty( $item['configurable'] ) ) {
366 $actions['configure'] = $item['configurable'];
367 }
368
369 if ( empty( $item['activated'] ) && Jetpack_Admin::is_module_available( $item ) ) {
370 $url = wp_nonce_url(
371 Jetpack::admin_url(
372 array(
373 'page' => 'jetpack',
374 'action' => 'activate',
375 'module' => $item['module'],
376 )
377 ),
378 'jetpack_activate-' . $item['module']
379 );
380 $actions['activate'] = sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html__( 'Activate', 'jetpack' ) );
381 } elseif ( ! empty( $item['activated'] ) ) {
382 $url = wp_nonce_url(
383 Jetpack::admin_url(
384 array(
385 'page' => 'jetpack',
386 'action' => 'deactivate',
387 'module' => $item['module'],
388 )
389 ),
390 'jetpack_deactivate-' . $item['module']
391 );
392 $actions['delete'] = sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html__( 'Deactivate', 'jetpack' ) );
393 }
394
395 return $this->row_actions( $actions ) . wptexturize( $item['name'] );
396 }
397
398 /**
399 * Column description.
400 *
401 * @param object|array $item Item.
402 * @return string HTML.
403 */
404 public function column_description( $item ) {
405 ob_start();
406 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
407 /** This action is documented in class.jetpack-admin.php */
408 echo apply_filters( 'jetpack_short_module_description', $item['description'], $item['module'] );
409 /** This action is documented in class.jetpack-admin.php */
410 do_action( 'jetpack_learn_more_button_' . $item['module'] );
411 echo '<div id="more-info-' . $item['module'] . '" class="more-info">';
412 /** This action is documented in class.jetpack-admin.php */
413 do_action( 'jetpack_module_more_info_' . $item['module'] );
414 echo '</div>';
415 // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
416 return ob_get_clean();
417 }
418
419 /**
420 * Return module tags HTML.
421 *
422 * @param object|array $item Item.
423 * @return string HTML.
424 */
425 public function column_module_tags( $item ) {
426 $module_tags = array();
427 foreach ( array_map( 'jetpack_get_module_i18n_tag', $item['module_tags'] ) as $module_tag ) {
428 $module_tags[] = sprintf( '<a href="%3$s" data-title="%2$s">%1$s</a>', esc_html( $module_tag ), esc_attr( $module_tag ), esc_url( add_query_arg( 'module_tag', rawurlencode( $module_tag ) ) ) );
429 }
430 return implode( ', ', $module_tags );
431 }
432
433 /**
434 * Column default value.
435 *
436 * @param object|array $item Item.
437 * @param string $column_name Column name.
438 * @return string
439 */
440 public function column_default( $item, $column_name ) {
441 switch ( $column_name ) {
442 case 'icon':
443 case 'name':
444 case 'description':
445 return '';
446 default:
447 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
448 return print_r( $item, true );
449 }
450 }
451
452 /**
453 * Check if the info parameter provided in the URL corresponds to an actual module.
454 *
455 * @param string|false $info Info parameter.
456 * @param array $modules Modules array.
457 * @return string|false
458 */
459 public function module_info_check( $info, $modules ) {
460 if ( ! $info ) {
461 return false;
462 } elseif ( array_key_exists( $info, $modules ) ) {
463 return $info;
464 }
465 }
466
467 /**
468 * Core switched their `display_tablenav()` method to protected, so we can't access it directly.
469 * Instead, let's include an access function to make it doable without errors!
470 *
471 * @see https://github.com/WordPress/WordPress/commit/d28f6344de97616de8ece543ed290c4ba2383622
472 *
473 * @param string $which Which nav table to display.
474 * @return mixed
475 */
476 public function unprotected_display_tablenav( $which = 'top' ) {
477 return $this->display_tablenav( $which );
478 }
479 }
480