PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 5.1.4
Jetpack – WP Security, Backup, Speed, & Growth v5.1.4
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 5.1.4, at modules/widgets.php

81 lines 2.3 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, 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 * Feature: Appearance
11 * Additional Search Queries: widget, widgets, facebook, gallery, twitter, gravatar, image, rss
12 */
13
14 function jetpack_load_widgets() {
15 $widgets_include = array();
16
17 foreach ( Jetpack::glob_php( dirname( __FILE__ ) . '/widgets' ) as $file ) {
18 $widgets_include[] = $file;
19 }
20 /**
21 * Modify which Jetpack Widgets to register.
22 *
23 * @module widgets
24 *
25 * @since 2.2.1
26 *
27 * @param array $widgets_include An array of widgets to be registered.
28 */
29 $widgets_include = apply_filters( 'jetpack_widgets_to_include', $widgets_include );
30
31 foreach( $widgets_include as $include ) {
32 include $include;
33 }
34
35 include_once dirname( __FILE__ ) . '/widgets/migrate-to-core/image-widget.php';
36 }
37
38 add_action( 'jetpack_modules_loaded', 'jetpack_widgets_loaded' );
39
40 function jetpack_widgets_loaded() {
41 Jetpack::enable_module_configurable( __FILE__ );
42 Jetpack::module_configuration_load( __FILE__, 'jetpack_widgets_configuration_load' );
43 }
44
45 function jetpack_widgets_configuration_load() {
46 wp_safe_redirect( admin_url( 'widgets.php' ) );
47 exit;
48 }
49
50 /**
51 * Add the "(Jetpack)" suffix to the widget names
52 */
53 function jetpack_widgets_add_suffix( $widget_name ) {
54 return sprintf( __( '%s (Jetpack)', 'jetpack' ), $widget_name );
55 }
56 add_filter( 'jetpack_widget_name', 'jetpack_widgets_add_suffix' );
57
58
59
60 jetpack_load_widgets();
61
62 /**
63 * Enqueue utilities to work with widgets in Customizer.
64 *
65 * @since 4.4.0
66 */
67 function jetpack_widgets_customizer_assets_preview() {
68 wp_enqueue_script( 'jetpack-customizer-widget-utils', plugins_url( '/widgets/customizer-utils.js', __FILE__ ), array( 'customize-base' ) );
69 }
70 add_action( 'customize_preview_init', 'jetpack_widgets_customizer_assets_preview' );
71
72 /**
73 * Enqueue styles to stylize widgets in Customizer.
74 *
75 * @since 4.4.0
76 */
77 function jetpack_widgets_customizer_assets_controls() {
78 wp_enqueue_style( 'jetpack-customizer-widget-controls', plugins_url( '/widgets/customizer-controls.css', __FILE__ ), array( 'customize-widgets' ) );
79 }
80 add_action( 'customize_controls_enqueue_scripts', 'jetpack_widgets_customizer_assets_controls' );
81