calypsoify
6 years ago
carousel
6 years ago
comment-likes
7 years ago
comments
6 years ago
contact-form
6 years ago
custom-css
6 years ago
custom-post-types
6 years ago
geo-location
6 years ago
google-analytics
6 years ago
infinite-scroll
6 years ago
lazy-images
6 years ago
likes
6 years ago
markdown
6 years ago
masterbar
6 years ago
memberships
6 years ago
photon
6 years ago
photon-cdn
6 years ago
plugin-search
7 years ago
post-by-email
6 years ago
protect
6 years ago
publicize
6 years ago
pwa
6 years ago
related-posts
6 years ago
scan
6 years ago
search
6 years ago
seo-tools
6 years ago
sharedaddy
6 years ago
shortcodes
6 years ago
simple-payments
6 years ago
site-icon
6 years ago
sitemaps
6 years ago
sso
6 years ago
subscriptions
6 years ago
theme-tools
6 years ago
tiled-gallery
6 years ago
verification-tools
6 years ago
videopress
6 years ago
widget-visibility
6 years ago
widgets
6 years ago
woocommerce-analytics
6 years ago
wordads
6 years ago
wpcom-block-editor
6 years ago
wpcom-tos
6 years ago
.eslintrc.js
6 years ago
after-the-deadline.php
7 years ago
carousel.php
7 years ago
comment-likes.php
6 years ago
comments.php
6 years ago
contact-form.php
7 years ago
copy-post.php
6 years ago
custom-content-types.php
6 years ago
custom-css.php
7 years ago
enhanced-distribution.php
9 years ago
geo-location.php
7 years ago
google-analytics.php
8 years ago
gravatar-hovercards.php
6 years ago
infinite-scroll.php
6 years ago
json-api.php
9 years ago
latex.php
6 years ago
lazy-images.php
6 years ago
likes.php
6 years ago
markdown.php
9 years ago
masterbar.php
7 years ago
minileven.php
6 years ago
mobile-push.php
10 years ago
module-extras.php
6 years ago
module-headings.php
6 years ago
module-info.php
6 years ago
monitor.php
6 years ago
notes.php
6 years ago
photon-cdn.php
6 years ago
photon.php
6 years ago
plugin-search.php
6 years ago
post-by-email.php
6 years ago
protect.php
6 years ago
publicize.php
6 years ago
pwa.php
6 years ago
related-posts.php
7 years ago
search.php
6 years ago
seo-tools.php
7 years ago
sharedaddy.php
6 years ago
shortcodes.php
6 years ago
shortlinks.php
7 years ago
sitemaps.php
7 years ago
sso.php
6 years ago
stats.php
6 years ago
subscriptions.php
6 years ago
theme-tools.php
6 years ago
tiled-gallery.php
7 years ago
vaultpress.php
7 years ago
verification-tools.php
7 years ago
videopress.php
7 years ago
widget-visibility.php
7 years ago
widgets.php
7 years ago
woocommerce-analytics.php
6 years ago
wordads.php
7 years ago
wpgroho.js
6 years ago
widgets.php
92 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Module Name: Extra Sidebar Widgets |
| 4 | * Module Description: Provides additional widgets for use on your site. |
| 5 | * Sort Order: 4 |
| 6 | * First Introduced: 1.2 |
| 7 | * Requires Connection: No |
| 8 | * Auto Activate: No |
| 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_once $include; |
| 33 | } |
| 34 | |
| 35 | include_once dirname( __FILE__ ) . '/widgets/migrate-to-core/image-widget.php'; |
| 36 | include_once dirname( __FILE__ ) . '/widgets/migrate-to-core/gallery-widget.php'; |
| 37 | } |
| 38 | |
| 39 | add_action( 'jetpack_modules_loaded', 'jetpack_widgets_loaded' ); |
| 40 | |
| 41 | function jetpack_widgets_loaded() { |
| 42 | Jetpack::enable_module_configurable( __FILE__ ); |
| 43 | add_filter( 'jetpack_module_configuration_url_widgets', 'jetpack_widgets_configuration_url' ); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Overrides default configuration url |
| 48 | * |
| 49 | * @uses admin_url |
| 50 | * @return string module settings URL |
| 51 | */ |
| 52 | function jetpack_widgets_configuration_url() { |
| 53 | return admin_url( 'customize.php?autofocus[panel]=widgets' ); |
| 54 | } |
| 55 | |
| 56 | jetpack_load_widgets(); |
| 57 | |
| 58 | /** |
| 59 | * Enqueue utilities to work with widgets in Customizer. |
| 60 | * |
| 61 | * @since 4.4.0 |
| 62 | */ |
| 63 | function jetpack_widgets_customizer_assets_preview() { |
| 64 | wp_enqueue_script( 'jetpack-customizer-widget-utils', plugins_url( '/widgets/customizer-utils.js', __FILE__ ), array( 'customize-base' ) ); |
| 65 | } |
| 66 | add_action( 'customize_preview_init', 'jetpack_widgets_customizer_assets_preview' ); |
| 67 | |
| 68 | /** |
| 69 | * Enqueue styles to stylize widgets in Customizer. |
| 70 | * |
| 71 | * @since 4.4.0 |
| 72 | */ |
| 73 | function jetpack_widgets_customizer_assets_controls() { |
| 74 | wp_enqueue_style( 'jetpack-customizer-widget-controls', plugins_url( '/widgets/customizer-controls.css', __FILE__ ), array( 'customize-widgets' ) ); |
| 75 | } |
| 76 | add_action( 'customize_controls_enqueue_scripts', 'jetpack_widgets_customizer_assets_controls' ); |
| 77 | |
| 78 | function jetpack_widgets_remove_old_widgets() { |
| 79 | $old_widgets = array( |
| 80 | 'googleplus-badge', |
| 81 | ); |
| 82 | |
| 83 | // Don't bother cleaning up the sidebars_widgets data. |
| 84 | // That will get cleaned up the next time a widget is |
| 85 | // added, removed, moved, etc. |
| 86 | foreach ( $old_widgets as $old_widget ) { |
| 87 | delete_option( "widget_{$old_widget}" ); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | add_action( 'updating_jetpack_version', 'jetpack_widgets_remove_old_widgets' ); |
| 92 |