init(); } add_action('plugins_loaded', 'allsource_init'); /** * Plugin activation hook */ function allsource_activate() { if (version_compare(PHP_VERSION, '7.0.0', '<')) { deactivate_plugins(plugin_basename(__FILE__)); wp_die( sprintf( /* translators: %s: PHP version number */ esc_html__('Allsource requires PHP version 7.0 or higher. Your server is running PHP version %s.', 'allsource'), esc_html(PHP_VERSION) ) ); } $wp_version = get_bloginfo('version'); if (version_compare($wp_version, '5.0', '<')) { deactivate_plugins(plugin_basename(__FILE__)); wp_die( sprintf( /* translators: %s: WordPress version number */ esc_html__('Allsource requires WordPress version 5.0 or higher. Your site is running WordPress version %s.', 'allsource'), esc_html($wp_version) ) ); } update_option('allsource_version', ALLSOURCE_VERSION); if (!get_option(ALLSOURCE_OPTION_PIXEL_CLIENT_ID)) { update_option(ALLSOURCE_OPTION_PIXEL_CLIENT_ID, ''); } } /** * Plugin Deactivation hook */ function allsource_deactivate() { wp_cache_flush(); } /** * Plugin removal Hook */ function allsource_uninstall() { delete_option(ALLSOURCE_OPTION_PIXEL_CLIENT_ID); delete_option('allsource_version'); } register_activation_hook(__FILE__, 'allsource_activate'); register_deactivation_hook(__FILE__, 'allsource_deactivate'); register_uninstall_hook(__FILE__, 'allsource_uninstall');