PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 4.2.5
Jetpack – WP Security, Backup, Speed, & Growth v4.2.5
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / widgets.php

widgets.php in Jetpack – WP Security, Backup, Speed, & Growth 4.2.5, at modules/widgets.php

67 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Module Name: Extra Sidebar Widgets
4 * Module Description: Add images, Twitter streams, your site’s RSS links, and more to your sidebar.
5 * Sort Order: 4
6 * First Introduced: 1.2
7 * Requires Connection: No
8 * Auto Activate: Yes
9 * Module Tags: Social, Appearance
10 * Additional Search Queries: widget, widgets, facebook, gallery, twitter, gravatar, image, rss
11 */
12
13 function jetpack_load_widgets() {
14 $widgets_include = array();
15
16 foreach ( Jetpack::glob_php( dirname( __FILE__ ) . '/widgets' ) as $file ) {
17 $widgets_include[] = $file;
18 }
19 /**
20 * Modify which Jetpack Widgets to register.
21 *
22 * @module widgets
23 *
24 * @since 2.2.1
25 *
26 * @param array $widgets_include An array of widgets to be registered.
27 */
28 $widgets_include = apply_filters( 'jetpack_widgets_to_include', $widgets_include );
29
30 foreach( $widgets_include as $include ) {
31 include $include;
32 }
33 }
34
35 add_action( 'jetpack_modules_loaded', 'jetpack_widgets_loaded' );
36
37 function jetpack_widgets_loaded() {
38 Jetpack::enable_module_configurable( __FILE__ );
39 Jetpack::module_configuration_load( __FILE__, 'jetpack_widgets_configuration_load' );
40 }
41
42 function jetpack_widgets_configuration_load() {
43 wp_safe_redirect( admin_url( 'widgets.php' ) );
44 exit;
45 }
46
47 /**
48 * Add the "(Jetpack)" suffix to the widget names
49 */
50 function jetpack_widgets_add_suffix( $widget_name ) {
51 return sprintf( __( '%s (Jetpack)', 'jetpack' ), $widget_name );
52 }
53 add_filter( 'jetpack_widget_name', 'jetpack_widgets_add_suffix' );
54
55
56
57 jetpack_load_widgets();
58
59 /**
60 * Enqueue utilities to work with widgets in Customizer.
61 *
62 * @since 4.0.0
63 */
64 function jetpack_widgets_customizer_assets() {
65 wp_enqueue_script( 'jetpack-customizer-widget-utils', plugins_url( '/widgets/customizer-utils.js', __FILE__ ), array( 'customize-base' ) );
66 }
67 add_action( 'customize_preview_init', 'jetpack_widgets_customizer_assets' );