flush_rules(); // Set transient for Welcome page set_transient( 'ampforwp_welcome_screen_activation_redirect', true, 30 ); } register_deactivation_hook( __FILE__, 'ampforwp_rewrite_deactivate', 20 ); function ampforwp_rewrite_deactivate() { // Flushing rewrite urls ONLY on deactivation global $wp_rewrite; $wp_rewrite->flush_rules(); // Remove transient for Welcome page delete_transient( 'ampforwp_welcome_screen_activation_redirect'); } add_action( 'admin_init','ampforwp_parent_plugin_check'); function ampforwp_parent_plugin_check() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); $amp_plugin_activation_check = is_plugin_active( 'amp/amp.php' ); if ( $amp_plugin_activation_check ) { // set_transient( 'ampforwp_parent_plugin_check', true, 30 ); } else { delete_option( 'ampforwp_parent_plugin_check'); } } // Redux panel inclusion code if ( !class_exists( 'ReduxFramework' ) ) { require_once dirname( __FILE__ ).'/includes/options/redux-core/framework.php'; } // Register all the main options require_once dirname( __FILE__ ).'/includes/options/admin-config.php'; require_once dirname( __FILE__ ).'/templates/report-bugs.php'; /* * Load Files only in the backend * As we don't need plugin activation code to run everytime the site loads */ if ( is_admin() ) { // Include Welcome page only on Admin pages require AMPFORWP_PLUGIN_DIR .'/includes/welcome.php'; add_action('init','ampforwp_plugin_notice'); function ampforwp_plugin_notice() { if ( ! defined( 'AMP__FILE__' ) ) { add_action( 'admin_notices', 'ampforwp_plugin_not_found_notice' ); function ampforwp_plugin_not_found_notice() { $current_screen = get_current_screen(); if( $current_screen ->id == "plugin-install" || $current_screen ->id == "dashboard_page_ampforwp-welcome-page" || $current_screen ->id == "ampforwp-welcome-page" ) { return; } ?>

|

'' . __('Settings', 'ampforwp') . ' | ' . __('Premium Support', 'ampforwp') . ''); include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( is_plugin_active( 'amp/amp.php' ) ) { //if parent plugin is activated $actions = array_merge( $actions, $settings ); } else{ if(is_plugin_active( 'amp/amp.php' )){ $actions = array_merge( $actions, $settings ); }else{ $please_activate_parent_plugin = array('Please Activate Parent plugin' => '' . __('Action Required: Continue Installation', 'ampforwp') . ''); $actions = array_merge( $please_activate_parent_plugin,$actions ); } } } return $actions; } } } // is_admin() closing // AMP endpoint Verifier function ampforwp_is_amp_endpoint() { return false !== get_query_var( 'amp', false ); } if ( ! class_exists( 'Ampforwp_Init', false ) ) { class Ampforwp_Init { public function __construct(){ // Load Files required for the plugin to run require AMPFORWP_PLUGIN_DIR .'/includes/includes.php'; // Redirection Code added require AMPFORWP_PLUGIN_DIR.'/includes/redirect.php'; require AMPFORWP_PLUGIN_DIR .'/classes/class-init.php'; new Ampforwp_Loader; } } } /* * Start the plugin. * Gentlemen start your engines */ function ampforwp_plugin_init() { if ( defined( 'AMP__FILE__' ) && defined('AMPFORWP_PLUGIN_DIR') ) { new Ampforwp_Init; } } add_action('init','ampforwp_plugin_init',9); /* * customized output widget * to be used be used in before or after Loop */ require AMPFORWP_PLUGIN_DIR.'/templates/widget.php';