%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/var/softaculous/sitepad/editor/site-data/plugins/pagelayer-pro/
Upload File :
Create Path :
Current File : //proc/self/root/var/softaculous/sitepad/editor/site-data/plugins/pagelayer-pro/pagelayer-pro.php

<?php
/*
Plugin Name: Pagelayer Pro
Plugin URI: https://pagelayer.com/
Description: Pagelayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
Version: 1.8.5
Author: Pagelayer Team
Author URI: https://pagelayer.com/
Text Domain: pagelayer-pro
*/

// We need the ABSPATH
if (!defined('ABSPATH')) exit;

if(!function_exists('add_action')){
	echo 'You are not allowed to access this page directly.';
	exit;
}

// If PAGELAYER_VERSION exists then the plugin is loaded already !
if(defined('PAGELAYER_PRO_VERSION')) {
	return;
}

define('PAGELAYER_PREMIUM', plugin_basename(__FILE__));
define('PAGELAYER_PRO_FILE', __FILE__);
define('PAGELAYER_PRO_URL', plugins_url('', PAGELAYER_PRO_FILE));

$_tmp_plugins = get_option('active_plugins');

if(!defined('SITEPAD') && !in_array('pagelayer/pagelayer.php', $_tmp_plugins)){
	add_action('plugins_loaded', 'pagelayer_pro_load_plugin');

	function pagelayer_pro_load_plugin(){

		// Nag informing the user to install the free version.
		if(current_user_can('activate_plugins')){
			add_action('admin_notices', 'pagelayer_pro_free_version_nag', 9);
			add_action('admin_menu', 'pagelayer_pro_add_menu', 9);
			
			$pl_free_installed = get_option('pagelayer_free_installed');
			
			if(!empty($pl_free_installed)){
				return;
			}
			
			// Include the necessary stuff
			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
			include_once(ABSPATH . 'wp-admin/includes/plugin.php');
			include_once(ABSPATH . 'wp-admin/includes/file.php');
			
			if( file_exists( WP_PLUGIN_DIR . '/pagelayer/pagelayer.php' ) && is_plugin_inactive( '/pagelayer/pagelayer.php' ) ) {
				update_option('pagelayer_free_installed', time());
				activate_plugin('/pagelayer/pagelayer.php');
				remove_action('admin_notices', 'pagelayer_pro_free_version_nag', 9);
				remove_action('admin_menu', 'pagelayer_pro_add_menu', 9);
				return;
			}
			
			// Includes necessary for Plugin_Upgrader and Plugin_Installer_Skin
			include_once(ABSPATH . 'wp-admin/includes/misc.php');
			include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');

			// Filter to prevent the activate text
			add_filter('install_plugin_complete_actions', 'pagelayer_pro_prevent_activation_text', 10, 3);

			$upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin());
			$installed = $upgrader->install('https://downloads.wordpress.org/plugin/pagelayer.zip');
			
			if(!is_wp_error($installed) && $installed){
				update_option('pagelayer_free_installed', time());
				activate_plugin('pagelayer/pagelayer.php');
				remove_action('admin_notices', 'pagelayer_pro_free_version_nag', 9);
				remove_action('admin_menu', 'pagelayer_pro_add_menu', 9);
				//wp_safe_redirect(admin_url('/'));
			}
		}
	}
	
	// Do not shows the activation text if 
	function pagelayer_pro_prevent_activation_text($install_actions, $api, $plugin_file){
		if($plugin_file == 'pagelayer/pagelayer.php'){
			return array();
		}

		return $install_actions;
	}

	function pagelayer_pro_free_version_nag(){
		echo '<div class="notice notice-error">
			<p style="font-size:16px;">You have not installed the free version of Pagelayer. Pagelayer Pro depends on the free version, so you must install it first in order to use Pagelayer. <a href="'.admin_url('plugin-install.php?s=pagelayer&tab=search').'" class="button button-primary">Install Now</a></p>
		</div>';
	}

	function pagelayer_pro_add_menu(){
		add_menu_page('Pagelayer Dahsboard', 'Pagelayer', 'activate_plugins', 'pagelayer', 'pagelayer_pro_menu_page', PAGELAYER_PRO_URL.'/images/pagelayer-logo-19.png');
	}

	function pagelayer_pro_menu_page(){
		echo '<div style="color: #333;padding: 50px;text-align: center;">
			<h1 style="font-size: 2em;margin-bottom: 10px;">Pagelayer Free version is not installed!</h>
			<p style=" font-size: 16px;margin-bottom: 20px; font-weight:400;">Pagelayer Pro depends on the free version of Pagelayer, so you need to install the free version first.</p>
			<a href="'.admin_url('plugin-install.php?s=pagelayer&tab=search').'" style="text-decoration: none;font-size:16px;">Install Now</a>
		</div>';
	}
	
	return;
}

include_once(dirname(__FILE__).'/init.php');

Zerion Mini Shell 1.0