Initial Commit

This commit is contained in:
2019-11-21 12:25:31 +01:00
commit f4aabcb9b1
13959 changed files with 787761 additions and 0 deletions

View File

@@ -0,0 +1,131 @@
<?php
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
if(!defined('ABSPATH')) exit();
class RsAddOnParticlesBase {
const MINIMUM_VERSION = '5.2.0';
protected function systemsCheck() {
if(!class_exists('RevSliderFront')) {
return 'add_notice_plugin';
}
else if(!version_compare(RevSliderGlobals::SLIDER_REVISION, RsAddOnParticlesBase::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();
require_once(static::$_PluginPath . 'shared/svg.class.php');
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_particles_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 . 'shared/templates.class.php');
require_once(static::$_PluginPath . 'admin/includes/slider.class.php');
// admin init
new RsParticlesSliderAdmin(static::$_PluginTitle, static::$_Version);
}
/*
frontend scripts always enqueued for admin previews
*/
require_once(static::$_PluginPath . 'public/includes/slider.class.php');
new RsParticlesSliderFront(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 !== 'revslider' && $page !== 'rev_addon') return;
$_handle = 'rs-' . static::$_PluginTitle . '-admin';
$_base = static::$_PluginUrl . 'admin/assets/';
switch($page) {
case 'revslider':
if(isset($_GET['view']) && $_GET['view'] === 'slider') {
wp_enqueue_style($_handle, $_base . 'css/' . static::$_PluginTitle . '-admin.css', array(), static::$_Version);
wp_enqueue_script($_handle, $_base . 'js/' . static::$_PluginTitle . '-admin.js', array('jquery'), static::$_Version, true);
wp_localize_script($_handle, 'revslider_particles_data', array('revslider_particles_nonce' => wp_create_nonce('revslider-particles-nonce')));
}
break;
case 'rev_addon':
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);
break;
}
}
}
}
?>

View File

@@ -0,0 +1,66 @@
<?php
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
if(!defined('ABSPATH')) exit();
class RsAddOnParticlesNotice {
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 ' . RsAddOnParticlesBase::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
}
}
?>

View File

@@ -0,0 +1,123 @@
<?php
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
if( !defined( 'ABSPATH') ) exit();
class RsAddonParticlesSliderAdmin {
protected function init() {
add_filter('revslider_slider_addons', array($this, 'add_addon_settings'), 10, 2);
add_action('wp_ajax_revslider_particles', array($this, 'revslider_particles_ajax'));
}
public function add_addon_settings($_settings, $_slider){
static::_init($_slider);
$_settings[static::$_Title] = array(
'title' => ucfirst(static::$_Title),
'icon' => static::$_Icon,
'markup' => static::$_Markup,
'javascript' => static::$_JavaScript
);
return $_settings;
}
public function revslider_particles_ajax() {
if(!isset($_POST['revslider_particles_nonce']) || !wp_verify_nonce($_POST['revslider_particles_nonce'], 'revslider-particles-nonce')) {
die('Particles Templates Ajax Error');
}
$_custom = get_option('revslider_addon_particles_templates');
if(isset($_POST['name']) && isset($_POST['task'])) {
$_name = $_POST['name'];
switch($_POST['task']) {
case 'read':
$_core = RsParticlesTemplates::$_Templates;
if($_core && array_key_exists($_name, $_core)) {
echo json_encode($_core[$_name]);
}
else if($_custom && array_key_exists($_name, $_custom)) {
echo json_encode($_custom[$_name]);
}
break;
case 'write':
if(isset($_POST['settings'])) {
if($_custom) {
if(!array_key_exists($_name, $_custom)) {
$_custom[$_name] = json_decode(stripslashes($_POST['settings']), true);
update_option('revslider_addon_particles_templates', $_custom);
}
else {
_e('Particles Template Name already exists. Please choose another name.', $_textDomain);
}
}
else {
$_custom = array($_name => json_decode(stripslashes($_POST['settings']), true));
update_option('revslider_addon_particles_templates', $_custom);
}
}
else {
_e('Particles Template Failed to Save', $_textDomain);
}
break;
case 'remove':
if($_custom && array_key_exists($_name, $_custom)) {
unset($_custom[$_name]);
update_option('revslider_addon_particles_templates', $_custom);
}
else {
_e('Particles Template Failed to Delete', $_textDomain);
}
break;
}
}
else {
_e('Particles Templates Ajax Request Failed', $_textDomain);
}
die();
}
}
?>

View File

@@ -0,0 +1,87 @@
<?php
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
if( !defined( 'ABSPATH') ) exit();
class RsAddonParticlesSliderFront {
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_style(
$_handle,
$_base . 'css/revolution.addon.' . static::$_PluginTitle . '.css',
array(),
static::$_Version
);
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/';
?>
<link type="text/css" rel="stylesheet" href="<?php echo $_base . 'css/revolution.addon.' . static::$_PluginTitle . '.css'; ?>" />
<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(revapi' . $_id . ');' . "\n";
}
}
}
?>