| @@ -1,26 +1,21 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Module Name: Extra Sidebar Widgets |
| 4 | - * Module Description: Provides additional widgets for use on your site. | |
| 4 | + * Module Description: Add images, Twitter streams, and more to your sidebar. | |
| 5 | 5 | * Sort Order: 4 |
| 6 | 6 | * First Introduced: 1.2 |
| 7 | 7 | * Requires Connection: No |
| 8 | - * Auto Activate: No | |
| 8 | + * Auto Activate: Yes | |
| 9 | 9 | * Module Tags: Social, Appearance |
| 10 | 10 | * Feature: Appearance |
| 11 | 11 | * Additional Search Queries: widget, widgets, facebook, gallery, twitter, gravatar, image, rss |
| 12 | - * | |
| 13 | - * @package automattic/jetpack | |
| 14 | 12 | */ |
| 15 | 13 | |
| 16 | -/** | |
| 17 | - * Load Jetpack widget files. | |
| 18 | - */ | |
| 19 | 14 | function jetpack_load_widgets() { |
| 20 | 15 | $widgets_include = array(); |
| 21 | 16 | |
| 22 | - foreach ( Jetpack::glob_php( __DIR__ . '/widgets' ) as $file ) { | |
| 17 | + foreach ( Jetpack::glob_php( dirname( __FILE__ ) . '/widgets' ) as $file ) { | |
| 23 | 18 | $widgets_include[] = $file; |
| 24 | 19 | } |
| 25 | 20 | /** |
| 26 | 21 | * Modify which Jetpack Widgets to register. |
| @@ -32,25 +27,29 @@ | ||
| 32 | 27 | * @param array $widgets_include An array of widgets to be registered. |
| 33 | 28 | */ |
| 34 | 29 | $widgets_include = apply_filters( 'jetpack_widgets_to_include', $widgets_include ); |
| 35 | 30 | |
| 36 | - foreach ( $widgets_include as $include ) { | |
| 31 | + foreach( $widgets_include as $include ) { | |
| 37 | 32 | include_once $include; |
| 38 | 33 | } |
| 39 | 34 | |
| 40 | - include_once __DIR__ . '/widgets/migrate-to-core/image-widget.php'; | |
| 41 | - include_once __DIR__ . '/widgets/migrate-to-core/gallery-widget.php'; | |
| 35 | + include_once dirname( __FILE__ ) . '/widgets/migrate-to-core/image-widget.php'; | |
| 36 | + include_once dirname( __FILE__ ) . '/widgets/migrate-to-core/gallery-widget.php'; | |
| 42 | 37 | } |
| 43 | 38 | |
| 44 | 39 | add_action( 'jetpack_modules_loaded', 'jetpack_widgets_loaded' ); |
| 45 | -/** | |
| 46 | - * Actions to perform after Jetpack widgets are loaded. | |
| 47 | - */ | |
| 40 | + | |
| 48 | 41 | function jetpack_widgets_loaded() { |
| 49 | 42 | Jetpack::enable_module_configurable( __FILE__ ); |
| 43 | + Jetpack::module_configuration_load( __FILE__, 'jetpack_widgets_configuration_load' ); | |
| 50 | 44 | add_filter( 'jetpack_module_configuration_url_widgets', 'jetpack_widgets_configuration_url' ); |
| 51 | 45 | } |
| 52 | 46 | |
| 47 | +function jetpack_widgets_configuration_load() { | |
| 48 | + wp_safe_redirect( admin_url( 'widgets.php' ) ); | |
| 49 | + exit; | |
| 50 | +} | |
| 51 | + | |
| 53 | 52 | /** |
| 54 | 53 | * Overrides default configuration url |
| 55 | 54 | * |
| 56 | 55 | * @uses admin_url |
| @@ -67,15 +66,9 @@ | ||
| 67 | 66 | * |
| 68 | 67 | * @since 4.4.0 |
| 69 | 68 | */ |
| 70 | 69 | function jetpack_widgets_customizer_assets_preview() { |
| 71 | - wp_enqueue_script( | |
| 72 | - 'jetpack-customizer-widget-utils', | |
| 73 | - plugins_url( '/widgets/customizer-utils.js', __FILE__ ), | |
| 74 | - array( 'jquery', 'customize-base' ), | |
| 75 | - JETPACK__VERSION, | |
| 76 | - false | |
| 77 | - ); | |
| 70 | + wp_enqueue_script( 'jetpack-customizer-widget-utils', plugins_url( '/widgets/customizer-utils.js', __FILE__ ), array( 'customize-base' ) ); | |
| 78 | 71 | } |
| 79 | 72 | add_action( 'customize_preview_init', 'jetpack_widgets_customizer_assets_preview' ); |
| 80 | 73 | |
| 81 | 74 | /** |
| @@ -83,20 +76,12 @@ | ||
| 83 | 76 | * |
| 84 | 77 | * @since 4.4.0 |
| 85 | 78 | */ |
| 86 | 79 | function jetpack_widgets_customizer_assets_controls() { |
| 87 | - wp_enqueue_style( | |
| 88 | - 'jetpack-customizer-widget-controls', | |
| 89 | - plugins_url( '/widgets/customizer-controls.css', __FILE__ ), | |
| 90 | - array( 'customize-widgets' ), | |
| 91 | - JETPACK__VERSION | |
| 92 | - ); | |
| 80 | + wp_enqueue_style( 'jetpack-customizer-widget-controls', plugins_url( '/widgets/customizer-controls.css', __FILE__ ), array( 'customize-widgets' ) ); | |
| 93 | 81 | } |
| 94 | 82 | add_action( 'customize_controls_enqueue_scripts', 'jetpack_widgets_customizer_assets_controls' ); |
| 95 | 83 | |
| 96 | -/** | |
| 97 | - * Cleanup old Jetpack widgets data. | |
| 98 | - */ | |
| 99 | 84 | function jetpack_widgets_remove_old_widgets() { |
| 100 | 85 | $old_widgets = array( |
| 101 | 86 | 'googleplus-badge', |
| 102 | 87 | ); |