$notice_end_time){ return; }*/ $softwp_upgrade = get_option('pfx_templates_softwp_upgrade', 0); if(empty($softwp_upgrade) || $softwp_upgrade < 0){ return; } echo '
'.esc_html__('Dismiss Forever', 'popularfx_templates').'

' . esc_html__('Hey, you are eligible for a Free Upgrade to Pagelayer Pro!', 'popularfx_templates').' ' . esc_html__('Install Pagelayer Pro Now', 'popularfx_templates') . '. '.esc_html__('Pagelayer Free plugin will also be updated to the latest version. For any queries contact us at', 'popularfx_templates').' support@pagelayer.com

'; wp_register_script('pfx_templates_softwp_alert', '', ['jquery'], PFX_VERSION, true); wp_enqueue_script('pfx_templates_softwp_alert'); wp_add_inline_script('pfx_templates_softwp_alert', ' jQuery("#pfx_templates-softwp-promo-close").on("click", function(){ jQuery(this).closest("#pfx_templates_softwp_notice").slideToggle(); var data = new Object(); data["action"] = "pfx_templates_dismiss_softwp_alert"; data["security"] = "'.wp_create_nonce('pfx_templates_softwp_notice').'"; var admin_url = "'.admin_url().'"+"admin-ajax.php"; jQuery.post(admin_url, data, function(response){ }); });'); wp_add_inline_script('pfx_templates_softwp_alert', ' jQuery("#pfx_templates-softwp-install-pro").on("click", function(){ var pfx_progress = \' \'; jQuery(this).closest("#pfx_templates_softwp_notice").find("p").html(pfx_progress+"Installing Pagelayer Pro. Please do not leave this page."); var data = new Object(); data["action"] = "pfx_templates_dismiss_softwp_alert"; data["install-pro"] = "1"; data["security"] = "'.wp_create_nonce('pfx_templates_softwp_notice').'"; var pfx_softwp_notice = jQuery(this); var admin_url = "'.admin_url().'"+"admin-ajax.php"; jQuery.post(admin_url, data, function(response){ jQuery("#pfx_templates_softwp_notice").find("p").text("Pagelayer Pro has been installed and activated successfully!"); jQuery("#pfx_templates_softwp_notice").removeClass("notice-warning").addClass("notice-success"); }); });'); } function pfx_templates_dismiss_softwp_alert(){ // Some AJAX security check_ajax_referer('pfx_templates_softwp_notice', 'security'); if(!current_user_can('activate_plugins')){ wp_die(__('Sorry, but you do not have permissions to change settings.', 'popularfx_templates')); } if(!empty($_REQUEST['install-pro'])){ $softwp_lic = get_option('softaculous_pro_license', []); if(!empty($softwp_lic['license']) && preg_match('/^softwp/is', $softwp_lic['license'])){ pfx_softwp_install_pagelayer_pro($softwp_lic['license']); } } update_option('pfx_templates_softwp_upgrade', (0 - time()), false); die('DONE'); } // Install Pagelayer Pro function pfx_softwp_install_pagelayer_pro($license){ global $pagelayer; // Include the necessary stuff include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); // Includes necessary for Plugin_Upgrader and Plugin_Installer_Skin include_once( ABSPATH . 'wp-admin/includes/file.php' ); include_once( ABSPATH . 'wp-admin/includes/misc.php' ); include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Filter to prevent the activate text add_filter('install_plugin_complete_actions', 'pfx_install_pagelayer_complete_actions', 10, 3); echo '

Install Pagelayer Pro

'; $installer = new Plugin_Upgrader( new Plugin_Installer_Skin( ) ); $installed = $installer->install(PFX_PAGELAYER_API.'download.php?version=latest&license='.$license.'&url='.rawurlencode(site_url())); if(is_wp_error( $installed ) || empty($installed)){ return $installed; } if ( !is_wp_error( $installed ) && $installed ) { wp_update_plugins(); // Check if update is available $updates = get_site_transient('update_plugins'); if (isset($updates->response['pagelayer/pagelayer.php'])) { // Update free plugin if necessary $upgrader = new Plugin_Upgrader(); $upgraded = $upgrader->upgrade('pagelayer/pagelayer.php'); echo 'Updating Pagelayer Free'; if(!is_wp_error( $upgraded ) && $upgraded && !is_plugin_active('pagelayer/pagelayer.php')){ echo 'Activating Pagelayer Free !'; $installed_free = activate_plugin('pagelayer/pagelayer.php'); } } if(!is_wp_error( $installed ) && $installed){ echo 'Activating Pagelayer Pro !'; $installed = activate_plugin('pagelayer-pro/pagelayer-pro.php'); } if ( is_null($installed)) { $installed = true; echo '

'. __('Done! Pagelayer Pro is now installed and activated.', 'popularfx_templates'). '


'; echo '

Done! Pagelayer Pro is now installed and activated.'; } } return $installed; }