ok

Mini Shell

Direktori : /var/softaculous/sitepad/editor/site-data/plugins/pagelayer-pro/
Upload File :
Current File : //var/softaculous/sitepad/editor/site-data/plugins/pagelayer-pro/init.php

<?php

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

define('PAGELAYER_PRO_BASE', plugin_basename(PAGELAYER_PRO_FILE));
define('PAGELAYER_PRO_VERSION', '1.8.5');
define('PAGELAYER_PRO_DIR', dirname(PAGELAYER_PRO_FILE));
define('PAGELAYER_PRO_SLUG', 'pagelayer-pro');
define('PAGELAYER_PRO_CSS', PAGELAYER_PRO_URL.'/css');
define('PAGELAYER_PRO_JS', PAGELAYER_PRO_URL.'/js');
define('PAGELAYER_PRO_DEV', file_exists(dirname(__FILE__).'/dev.php') ? 1 : 0);

include_once(PAGELAYER_PRO_DIR.'/main/functions.php');

// Ok so we are now ready to go
register_activation_hook(PAGELAYER_PRO_FILE, 'pagelayer_pro_activation');

// Is called when the ADMIN enables the plugin
function pagelayer_pro_activation(){

	global $wpdb;

	$sql = array();

	add_option('pagelayer_pro_version', PAGELAYER_VERSION);
	add_option('pagelayer_pro_options', array());

}

// Checks if we are to update ?
function pagelayer_pro_update_check(){

global $wpdb;

	$sql = array();
	$current_version = get_option('pagelayer_pro_version');
	$version = (int) str_replace('.', '', $current_version);

	// No update required
	if($current_version == PAGELAYER_PRO_VERSION){
		return true;
	}

	// Is it first run ?
	if(empty($current_version)){

		// Reinstall
		pagelayer_pro_activation();

		// Trick the following if conditions to not run
		$version = (int) str_replace('.', '', PAGELAYER_PRO_VERSION);

	}
	
	$pl_free_installed = get_option('pagelayer_free_installed');
		
	// If plugin runing reached here it means Pagelayer free installed 
	if(empty($pl_free_installed)){
		update_option('pagelayer_free_installed', time());
	}
	
	// Save the new Version
	update_option('pagelayer_pro_version', PAGELAYER_PRO_VERSION);

}

// Add the action to load the plugin
add_action('plugins_loaded', 'pagelayer_pro_load_plugin', 11);

// The function that will be called when the plugin is loaded
function pagelayer_pro_load_plugin(){

	global $pagelayer;

	// Check if the installed version is outdated
	pagelayer_pro_update_check();
	
	// Load the language
	load_plugin_textdomain('pagelayer-pro', false, PAGELAYER_PRO_SLUG.'/languages/');
	
	// Check for updates
	include_once(PAGELAYER_PRO_DIR.'/main/plugin-update-checker.php');
	$pagelayer_updater = Pagelayer_PucFactory::buildUpdateChecker(PAGELAYER_API.'updates.php?version='.PAGELAYER_PRO_VERSION, PAGELAYER_PRO_FILE);
	
	// Add the license key to query arguments
	$pagelayer_updater->addQueryArgFilter('pagelayer_pro_updater_filter_args');
	
	// Show the text to install the license key
	add_filter('puc_manual_final_check_link-pagelayer-pro', 'pagelayer_pro_updater_check_link', 10, 1);
	
	// Load the template builder
	include_once(PAGELAYER_PRO_DIR.'/main/template-builder.php');
	
	$pagelayer->allowed_mime_type = array(
		'otf' => 'font/otf',
		'ttf' => 'font/ttf',
		'woff' => 'font/woff|application/font-woff|application/x-font-woff',
		'woff2' => 'font/woff2|font/x-woff2'
	);
	
	// Load the pagelayer custom fonts
	include_once(PAGELAYER_PRO_DIR.'/main/custom_fonts.php');
	
	// Show the version notice
	add_action('admin_notices', 'pagelayer_pro_free_version_nag');

}

// Nag when plugins dont have same version.
function pagelayer_pro_free_version_nag(){
	if(!defined('PAGELAYER_VERSION')){
		return;
	}

	if(version_compare(PAGELAYER_VERSION, PAGELAYER_PRO_VERSION) > 0){
		echo '<div class="notice notice-warning">
		<p style="font-size:16px;">You are using an Older version of Pagelayer Pro. We suggest you upgrade Pagelayer Pro to be able to use Pagelayer without any issue.</p>
	</div>';
	}elseif(version_compare(PAGELAYER_VERSION, PAGELAYER_PRO_VERSION) < 0){
		echo '<div class="notice notice-warning">
		<p style="font-size:16px;">You are using an Older version of the Free version of Pagelayer. We suggest you update the free version of Pagelayer to be able to use Pagelayer without any issue.</p>
	</div>';
	}
}

// Add our license key if ANY
function pagelayer_pro_updater_filter_args($queryArgs) {
	
	global $pagelayer;
	
	if ( !empty($pagelayer->license['license']) ) {
		$queryArgs['license'] = $pagelayer->license['license'];
	}
	
	return $queryArgs;
}

// Handle the Check for update link and ask to install license key
function pagelayer_pro_updater_check_link($final_link){
	
	global $pagelayer;
	
	if(empty($pagelayer->license['license'])){
		return '<a href="'.admin_url('admin.php?page=pagelayer_license').'">Install Pagelayer Pro License Key</a>';
	}
	
	return $final_link;
}

// Add filter to load custom widgets functions
add_action('pagelayer_load_shortcode_functions', 'pagelayer_pro_load_shortcode_functions');
function pagelayer_pro_load_shortcode_functions(){
	include_once(PAGELAYER_PRO_DIR.'/main/freemium_functions.php');
	include_once(PAGELAYER_PRO_DIR.'/main/premium_functions.php');
}

// Apply filter to load custom widgets after shortcodes
add_action('pagelayer_after_add_shortcode', 'pagelayer_pro_after_add_shortcode');
function pagelayer_pro_after_add_shortcode(){
	include_once(PAGELAYER_PRO_DIR.'/main/freemium.php');
	include_once(PAGELAYER_PRO_DIR.'/main/premium.php');
}

// Load customizer setting
add_action('pagelayer_after_wc_customization', 'pagelayer_pro_after_wc_customization');
function pagelayer_pro_after_wc_customization(){
	include_once(PAGELAYER_PRO_DIR.'/main/premium-woocommerce.php');
}

// Load Local google fonts
add_action('pagelayer_google_fonts_url', 'pagelayer_pro_google_fonts_url');
function pagelayer_pro_google_fonts_url($fonts_url){
	
	// Is google font serve locally?
	if(get_option('pagelayer_local_gfont') != 1){
		return $fonts_url;
	}
	
	$upload_dir = wp_upload_dir();
	$local_font_md5 = md5($fonts_url);
	$_fonts_url = $upload_dir['baseurl'].'/pl-google-fonts/'.$local_font_md5.'.css';
	$_fonts_path = $upload_dir['basedir'].'/pl-google-fonts/'.$local_font_md5.'.css';
	
	if(!file_exists($_fonts_path) && file_exists(PAGELAYER_DIR.'/main/download_google_fonts.php')){
		include_once(PAGELAYER_DIR.'/main/download_google_fonts.php');
		pagelayer_download_google_fonts($fonts_url);
	}
	
	return $_fonts_url;
}

// Load js files for editor
add_action('pagelayer_editor_give_js', 'pagelayer_pro_editor_give_js');
function pagelayer_pro_editor_give_js($js){
	$js.= '&premium_dir='.dirname(PAGELAYER_PRO_BASE).'/js&premium=premium.js';
	return $js;
}

// Load js files
add_action('pagelayer_add_give_js', 'pagelayer_pro_add_give_js');
function pagelayer_pro_add_give_js($js){
	$js.= '&premium_dir='.dirname(PAGELAYER_PRO_BASE).'/js&premium=chart.min.js,premium-frontend.js,shuffle.min.js';
	return $js;
}

// Load css files
add_action('pagelayer_add_give_css', 'pagelayer_pro_add_give_css');
function pagelayer_pro_add_give_css($css){
	$css.= '&premium_dir='.dirname(PAGELAYER_PRO_BASE).'/css&premium=premium-frontend.css';
	return $css;
}

// Load this For audio widget
add_action('pagelayer_load_audio_widget', 'pagelayer_pro_load_audio_widget');
function pagelayer_pro_load_audio_widget($is_audio){
	global $pagelayer;
	
	if($is_audio || pagelayer_is_live_iframe()){
		wp_enqueue_script('wp-mediaelement');
		wp_enqueue_style( 'wp-mediaelement' );
		$pagelayer->sc_audio_enqueued = 1;
	}
}

// Load the langs
add_action('pagelayer_load_languages', 'pagelayer_pro_load_languages');
function pagelayer_pro_load_languages($langs){
	
	$_langs = @file_get_contents(PAGELAYER_PRO_DIR.'/languages/en.json');
	$_langs = @json_decode($_langs, true);
		
	if(!empty($_langs)){
		$langs = array_merge($langs, $_langs);
	}
	
	return $langs;
}

Zerion Mini Shell 1.0