Initial Commit
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* @author ThemePunch <info@themepunch.com>
|
||||
* @link http://www.themepunch.com/
|
||||
* @copyright 2016 ThemePunch
|
||||
*/
|
||||
|
||||
if(!defined('ABSPATH')) exit();
|
||||
|
||||
class RsAddOnSnowBase {
|
||||
|
||||
const MINIMUM_VERSION = '5.2.0';
|
||||
|
||||
protected function systemsCheck() {
|
||||
|
||||
if(!class_exists('RevSliderFront')) {
|
||||
|
||||
return 'add_notice_plugin';
|
||||
|
||||
}
|
||||
else if(!version_compare(RevSliderGlobals::SLIDER_REVISION, RsAddOnSnowBase::MINIMUM_VERSION, '>=')) {
|
||||
|
||||
return 'add_notice_version';
|
||||
|
||||
}
|
||||
else if(get_option('revslider-valid', 'false') == 'false') {
|
||||
|
||||
return 'add_notice_activation';
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
protected function loadClasses() {
|
||||
|
||||
$isAdmin = is_admin();
|
||||
|
||||
if($isAdmin) {
|
||||
|
||||
//handle update process, this uses the typical ThemePunch server process
|
||||
require_once(static::$_PluginPath . 'admin/includes/update.class.php');
|
||||
$update_admin = new rs_snow_update(static::$_Version);
|
||||
|
||||
add_filter( 'pre_set_site_transient_update_plugins', array ($update_admin ,'set_update_transient') );
|
||||
add_filter( 'plugins_api', array ($update_admin ,'set_updates_api_results'),10,3 );
|
||||
|
||||
// Add-Ons page
|
||||
add_filter('rev_addon_dash_slideouts', array($this, 'addons_page_content'));
|
||||
|
||||
// admin CSS/JS
|
||||
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
|
||||
|
||||
require_once(static::$_PluginPath . 'admin/includes/slider.class.php');
|
||||
|
||||
// admin init
|
||||
new RsSnowSliderAdmin(static::$_PluginTitle);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
frontend scripts always enqueued for admin previews
|
||||
*/
|
||||
require_once(static::$_PluginPath . 'public/includes/slider.class.php');
|
||||
|
||||
new RsSnowSliderFront(static::$_Version, static::$_PluginUrl, static::$_PluginTitle, $isAdmin);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the textdomain
|
||||
**/
|
||||
protected function _loadPluginTextDomain(){
|
||||
|
||||
load_plugin_textdomain('rs_' . static::$_PluginTitle, false, static::$_PluginPath . 'languages/');
|
||||
|
||||
}
|
||||
|
||||
// AddOn's page slideout panel
|
||||
public function addons_page_content() {
|
||||
|
||||
include_once(static::$_PluginPath . 'admin/views/admin-display.php');
|
||||
|
||||
}
|
||||
|
||||
// load admin scripts
|
||||
public function enqueue_admin_scripts($hook) {
|
||||
|
||||
if($hook === 'toplevel_page_revslider' || $hook === 'slider-revolution_page_rev_addon') {
|
||||
|
||||
if(!isset($_GET['page'])) return;
|
||||
|
||||
$page = $_GET['page'];
|
||||
if($page !== 'rev_addon') return;
|
||||
|
||||
$_handle = 'rs-' . static::$_PluginTitle . '-admin';
|
||||
$_base = static::$_PluginUrl . 'admin/assets/';
|
||||
|
||||
wp_enqueue_style($_handle, $_base . 'css/' . static::$_PluginTitle . '-dash-admin.css', array(), static::$_Version);
|
||||
wp_enqueue_script($_handle, $_base . 'js/' . static::$_PluginTitle . '-dash-admin.js', array('jquery'), static::$_Version, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @author ThemePunch <info@themepunch.com>
|
||||
* @link http://www.themepunch.com/
|
||||
* @copyright 2016 ThemePunch
|
||||
*/
|
||||
|
||||
if(!defined('ABSPATH')) exit();
|
||||
|
||||
class RsAddOnSnowNotice {
|
||||
|
||||
private $title,
|
||||
$notice,
|
||||
$txtDomain;
|
||||
|
||||
public function __construct($_notice, $_title) {
|
||||
|
||||
$this->notice = $_notice;
|
||||
$this->title = ucfirst($_title);
|
||||
$this->txtDomain = 'rs_' . $_title;
|
||||
|
||||
add_action('admin_notices', array($this, 'add_notice'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add notice
|
||||
**/
|
||||
public function add_notice() {
|
||||
|
||||
$_notice = $this->notice;
|
||||
$_title = $this->title;
|
||||
|
||||
switch($_notice) {
|
||||
|
||||
case 'add_notice_activation':
|
||||
|
||||
$_notice = 'The <a href="?page=rev_addon">' . $_title . ' Add-On</a> requires an active ' .
|
||||
'<a href="https://www.themepunch.com/revslider-doc/activate-copy-slider-revolution/" target="_blank">Purchase Code Registration</a>';
|
||||
|
||||
break;
|
||||
|
||||
case 'add_notice_plugin':
|
||||
|
||||
$_notice = '<a href="https://revolution.themepunch.com/" target="_blank">Slider Revolution</a> required to use the ' . $_title . ' Add-On';
|
||||
|
||||
break;
|
||||
|
||||
case 'add_notice_version':
|
||||
|
||||
$_notice = 'The ' . $_title . ' Add-On requires Slider Revolution ' . RsAddOnSnowBase::MINIMUM_VERSION .
|
||||
'+ <a href="https://www.themepunch.com/faq/how-to-update-the-slider/" target="_blank">Update Slider Revolution</a>';
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="error below-h2 soc-notice-wrap" id="message"><p><?php _e($_notice, $this->txtDomain); ?></p></div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @author ThemePunch <info@themepunch.com>
|
||||
* @link http://www.themepunch.com/
|
||||
* @copyright 2016 ThemePunch
|
||||
*/
|
||||
|
||||
if( !defined( 'ABSPATH') ) exit();
|
||||
|
||||
class RsAddonSnowSliderAdmin {
|
||||
|
||||
protected function init() {
|
||||
|
||||
add_filter('revslider_slider_addons', array($this, 'add_addon_settings'), 10, 2);
|
||||
|
||||
}
|
||||
|
||||
public function add_addon_settings($_settings, $_slider){
|
||||
|
||||
static::_init($_slider);
|
||||
|
||||
$_settings[static::$_Title] = array(
|
||||
|
||||
'title' => 'Holiday ' . ucfirst(static::$_Title),
|
||||
'icon' => static::$_Icon,
|
||||
'markup' => static::$_Markup,
|
||||
'javascript' => static::$_JavaScript
|
||||
|
||||
);
|
||||
|
||||
return $_settings;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* @author ThemePunch <info@themepunch.com>
|
||||
* @link http://www.themepunch.com/
|
||||
* @copyright 2016 ThemePunch
|
||||
*/
|
||||
|
||||
if( !defined( 'ABSPATH') ) exit();
|
||||
|
||||
class RsAddonSnowSliderFront {
|
||||
|
||||
protected function enqueueScripts() {
|
||||
|
||||
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
|
||||
|
||||
}
|
||||
|
||||
protected function enqueuePreview() {
|
||||
|
||||
add_action('revslider_preview_slider_head', array($this, 'enqueue_preview'));
|
||||
|
||||
}
|
||||
|
||||
protected function writeInitScript() {
|
||||
|
||||
add_action('revslider_fe_javascript_output', array($this, 'write_init_script'), 10, 2);
|
||||
|
||||
}
|
||||
|
||||
public function enqueue_scripts() {
|
||||
|
||||
$ops = new RevSliderOperations();
|
||||
$globals = $ops->getGeneralSettingsValues();
|
||||
|
||||
$putJsToFooter = RevSliderFunctions::getVal($globals, 'js_to_footer', 'off') === 'off';
|
||||
|
||||
$_handle = 'rs-' . static::$_PluginTitle . '-front';
|
||||
$_base = static::$_PluginUrl . 'public/assets/';
|
||||
|
||||
wp_enqueue_script(
|
||||
|
||||
$_handle,
|
||||
$_base . 'js/revolution.addon.' . static::$_PluginTitle . '.min.js',
|
||||
array('jquery', 'revmin'),
|
||||
static::$_Version,
|
||||
$putJsToFooter
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function enqueue_preview() {
|
||||
|
||||
$_base = static::$_PluginUrl . 'public/assets/';
|
||||
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo $_base . 'js/revolution.addon.' . static::$_PluginTitle . '.min.js'; ?>"></script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
public function write_init_script($_slider, $_id) {
|
||||
|
||||
$_title = static::$_PluginTitle;
|
||||
if($_slider->getParam($_title . '_enabled', false) == 'true') {
|
||||
|
||||
$_id = $_slider->getID();
|
||||
|
||||
echo "\n";
|
||||
echo ' Rs' . ucfirst($_title) . 'AddOn(tpj, revapi' . $_id . ');' . "\n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user