grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026register(); } add_action( 'rest_api_init', 'wpseo_local_init_rest_api' ); } if ( ! function_exists( 'wpseo_local_seo_init_widgets' ) ) { /** * Register all widgets used for Local SEO plugin * * @since 3.1 */ function wpseo_local_seo_init_widgets() { $widgets = [ 'WPSEO_Show_Address', 'WPSEO_Show_Map', 'WPSEO_Show_OpeningHours', 'WPSEO_Show_Open_Closed', ]; if ( wpseo_has_multiple_locations() ) { $widgets[] = 'WPSEO_Storelocator_Form'; $widgets[] = 'WPSEO_Show_Locations_By_Category'; } foreach ( $widgets as $widget ) { register_widget( $widget ); } } } if ( ! function_exists( 'wpseo_local_missing_error' ) ) { /** * Throw an error if Yoast SEO is not installed. * * @since 0.2 */ function wpseo_local_missing_error() { echo '

'; printf( /* translators: %1$s resolves to the link to search the plugin directory for Yoast SEO, %2$s resolves to the closing tag for this link, %3$s resolves to Local SEO */ esc_html__( 'Please %1$sinstall & activate Yoast SEO%2$s to allow the %3$s module to work.', 'yoast-local-seo' ), '', '', 'Local SEO' ); echo '

'; } } if ( ! function_exists( 'yoast_wpseo_local_upgrade_error' ) ) { /** * Throw an error if Yoast SEO is out of date. * * @since 1.5.4 */ function yoast_wpseo_local_upgrade_error() { /* translators: %1$s resolves to Yoast SEO, %2$s resolves to Local SEO */ echo '

' . sprintf( esc_html__( 'Please upgrade the %1$s plugin to the latest version to allow the %2$s module to work.', 'yoast-local-seo' ), 'Yoast SEO', 'Local SEO' ) . '

'; } } if ( ! function_exists( 'yoast_wpseo_local_activate_license' ) ) { /** * Instantiate the plugin license manager for the current plugin and activate it's license. * * @deprecated 10.1 * @codeCoverageIgnore */ function yoast_wpseo_local_activate_license() { _deprecated_function( __FUNCTION__, '10.0' ); } } /* ***************************** PLUGIN (DE-)ACTIVATION *************************** */ if ( ! function_exists( 'yoast_wpseo_local_activate' ) ) { /** * Run single site / network-wide activation of the plugin. * * @param bool $networkwide Whether the plugin is being activated network-wide. */ function yoast_wpseo_local_activate( $networkwide = false ) { if ( file_exists( WPSEO_LOCAL_PATH . 'vendor/autoload.php' ) ) { require_once WPSEO_LOCAL_PATH . 'vendor/autoload.php'; } if ( ! is_multisite() || ! $networkwide ) { _yoast_wpseo_local_activate(); } else { /* Multi-site network activation - activate the plugin for all blogs */ yoast_wpseo_local_network_activate_deactivate( true ); } // Enable tracking. if ( class_exists( 'WPSEO_Options' ) && method_exists( 'WPSEO_Options', 'set' ) ) { WPSEO_Options::set( 'tracking', true ); } } } if ( ! function_exists( 'yoast_wpseo_local_deactivate' ) ) { /** * Run single site / network-wide de-activation of the plugin. * * @param bool $networkwide Whether the plugin is being de-activated network-wide. */ function yoast_wpseo_local_deactivate( $networkwide = false ) { if ( ! is_multisite() || ! $networkwide ) { _yoast_wpseo_local_deactivate(); } else { /* Multi-site network activation - de-activate the plugin for all blogs */ yoast_wpseo_local_network_activate_deactivate( false ); } // Clean up notifications set bij Local SEO from Yoast Notification Center. if ( class_exists( 'Yoast_Notification_Center' ) ) { $notifications = [ 'LocalSEOBrowserKey', 'PersonOrCompanySettingUpdate', 'PersonOrCompanySettingError', ]; $notification_center = Yoast_Notification_Center::get(); foreach ( $notifications as $notification_id ) { $notification = $notification_center->get_notification_by_id( $notification_id ); if ( $notification instanceof Yoast_Notification ) { $notification_center->remove_notification( $notification ); } } } } } if ( ! function_exists( 'yoast_wpseo_local_network_activate_deactivate' ) ) { /** * Run network-wide (de-)activation of the plugin * * @param bool $activate True for plugin activation, false for de-activation. */ function yoast_wpseo_local_network_activate_deactivate( $activate = true ) { global $wpdb; $network_blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d", $wpdb->siteid ) ); if ( is_array( $network_blogs ) && $network_blogs !== [] ) { foreach ( $network_blogs as $blog_id ) { switch_to_blog( $blog_id ); if ( $activate === true ) { _yoast_wpseo_local_activate(); } else { _yoast_wpseo_local_deactivate(); } restore_current_blog(); } } } } if ( ! function_exists( '_yoast_wpseo_local_activate' ) ) { /** * Runs on activation of the plugin. */ function _yoast_wpseo_local_activate() { WPSEO_Local_Core::update_sitemap(); if ( method_exists( 'WPSEO_Sitemaps_Cache', 'clear' ) ) { WPSEO_Sitemaps_Cache::clear( [ WPSEO_Sitemaps::SITEMAP_INDEX_TYPE ] ); } } } if ( ! function_exists( '_yoast_wpseo_local_deactivate' ) ) { /** * Runs on deactivation of the plugin. */ function _yoast_wpseo_local_deactivate() { if ( file_exists( WPSEO_LOCAL_PATH . 'vendor/autoload.php' ) ) { require_once WPSEO_LOCAL_PATH . 'vendor/autoload.php'; } WPSEO_Local_Core::update_sitemap(); if ( method_exists( 'WPSEO_Sitemaps_Cache', 'clear' ) ) { WPSEO_Sitemaps_Cache::clear( [ WPSEO_Sitemaps::SITEMAP_INDEX_TYPE ] ); } } } if ( ! function_exists( 'yoast_wpseo_local_on_activate_blog' ) ) { /** * Run yoast wpseo local activation routine on creation / activation of a multisite blog if Yoast WPSEO Local is activated * network-wide. * * Will only be called by multisite actions. * * @internal Unfortunately will fail if the plugin is in the must-use directory * @see https://core.trac.wordpress.org/ticket/24205 * * @param int $blog_id Blog ID. */ function yoast_wpseo_local_on_activate_blog( $blog_id ) { if ( ! function_exists( 'is_plugin_active_for_network' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } if ( is_plugin_active_for_network( plugin_basename( WPSEO_FILE ) ) ) { switch_to_blog( $blog_id ); yoast_wpseo_local_activate( false ); restore_current_blog(); } } } // Activation and de-activation hooks. if ( function_exists( 'yoast_wpseo_local_activate' ) ) { register_activation_hook( WPSEO_LOCAL_FILE, 'yoast_wpseo_local_activate' ); } if ( function_exists( 'yoast_wpseo_local_deactivate' ) ) { register_deactivation_hook( WPSEO_LOCAL_FILE, 'yoast_wpseo_local_deactivate' ); } if ( function_exists( 'yoast_wpseo_local_on_activate_blog' ) ) { add_action( 'wpmu_new_blog', 'yoast_wpseo_local_on_activate_blog' ); add_action( 'activate_blog', 'yoast_wpseo_local_on_activate_blog' ); }