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,109 @@
<?php
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
if(!defined('ABSPATH')) exit();
class RsAddOnPolyfoldBase {
const MINIMUM_VERSION = '5.4.6';
protected function systemsCheck() {
if(!class_exists('RevSliderFront')) {
return 'add_notice_plugin';
}
else if(!version_compare(RevSliderGlobals::SLIDER_REVISION, RsAddOnPolyfoldBase::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 RevAddOnPolyfoldUpdate(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 RsPolyfoldSliderAdmin(static::$_PluginTitle, static::$_Version);
}
/*
frontend scripts always enqueued for admin previews
*/
require_once(static::$_PluginPath . 'public/includes/slider.class.php');
new RsPolyfoldSliderFront(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 === '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);
}
}
}
?>

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 RsAddOnPolyfoldNotice {
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 ' . RsAddOnPolyfoldBase::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,36 @@
<?php
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
if( !defined( 'ABSPATH') ) exit();
class RsAddonPolyfoldSliderAdmin {
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' => ucfirst(static::$_Title),
'icon' => static::$_Icon,
'markup' => static::$_Markup,
'javascript' => static::$_JavaScript
);
return $_settings;
}
}
?>

View File

@@ -0,0 +1,175 @@
<?php
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
if( !defined( 'ABSPATH') ) exit();
class RsAddonPolyfoldSliderFront {
protected function enqueueScripts() {
// add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
add_action('revslider_slide_initByData', array($this, 'enqueue_scripts'), 10, 1);
}
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($_record) {
if(empty($_record)) return $_record;
$_params = RevSliderFunctions::getVal($_record, 'params', false);
$_sliderId = RevSliderFunctions::getVal($_record, 'slider_id', false);
if(empty($_params) || empty($_sliderId)) return $_record;
$_params = json_decode($_params);
if(empty($_params)) return $_record;
$_slider = new RevSlider();
$_slider->initByID($_sliderId);
if(empty($_slider)) return $_record;
$_settings = $_slider->getParams();
if(empty($_settings)) return $_record;
$_enabled = RevSliderFunctions::getVal($_settings, static::$_PluginTitle . '_top_enabled', false) == 'true';
if(empty($_enabled)) $_enabled = RevSliderFunctions::getVal($_settings, static::$_PluginTitle . '_bottom_enabled', false) == 'true';
if(empty($_enabled)) return $_record;
$_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,
true
);
return $_record;
}
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) {
$_topEnabled = $_slider->getParam('polyfold_top_enabled', false) == 'true';
$_bottomEnabled = $_slider->getParam('polyfold_bottom_enabled', false) == 'true';
if(wp_is_mobile()) {
if($_topEnabled) $_topEnabled = $_slider->getParam('polyfold_top_hide_mobile', false) == 'false';
if($_bottomEnabled) $_bottomEnabled = $_slider->getParam('polyfold_bottom_hide_mobile', false) == 'false';
}
$_title = static::$_PluginTitle;
$_id = $_slider->getID();
for($i = 0; $i < 2; $i++) {
if($i === 0) {
if(!$_topEnabled) continue;
$alias = 'top';
}
else {
if(!$_bottomEnabled) break;
$alias = 'bottom';
}
$_scroll = $_slider->getParam('polyfold_' . $alias . '_scroll', true) == 'true' ? 'true' : 'false';
$_responsive = $_slider->getParam('polyfold_' . $alias . '_responsive', true) == 'true' ? 'true' : 'false';
$_negative = $_slider->getParam('polyfold_' . $alias . '_negative', false) == 'true' ? 'true' : 'false';
$_animated = $_slider->getParam('polyfold_' . $alias . '_animated', false) == 'true' ? 'true' : 'false';
$_inverted = $_slider->getParam('polyfold_' . $alias . '_inverted', false) == 'true' ? 'true' : 'false';
$_color = $_slider->getParam('polyfold_' . $alias . '_color', '#ffffff');
$_range = $_slider->getParam('polyfold_' . $alias . '_range', 'slider');
$_point = $_slider->getParam('polyfold_' . $alias . '_point', 'sides');
$_placement = intval($_slider->getParam('polyfold_' . $alias . '_placement', 1));
$_height = abs(intval($_slider->getParam('polyfold_' . $alias . '_height', 100)));
$_leftWidth = abs(intval($_slider->getParam('polyfold_' . $alias . '_left_width', 50)) * .01);
$_rightWidth = abs(intval($_slider->getParam('polyfold_' . $alias . '_right_width', 50)) * .01);
if(!$_color) $_color = '#ffffff';
$_maxWidth = $_point === 'sides' ? 1 : 0.5;
$_leftWidth = max(min($_leftWidth, $_maxWidth), 0);
$_rightWidth = max(min($_rightWidth, $_maxWidth), 0);
echo ' Rs' . ucfirst($_title) . 'AddOn(tpj, revapi' . $_id . ',{';
echo 'position: "' . $alias . '", ';
echo 'color: "' . $_color . '", ';
echo 'scroll: ' . $_scroll . ', ';
echo 'height: ' . $_height . ', ';
echo 'range: "' . $_range . '", ';
echo 'point: "' . $_point . '", ';
echo 'placement: ' . $_placement . ', ';
echo 'responsive: ' . $_responsive . ', ';
echo 'negative: ' . $_negative . ', ';
echo 'leftWidth: ' . $_leftWidth . ', ';
echo 'rightWidth: ' . $_rightWidth;
if($_scroll === 'true') {
echo ', inverted: ' . $_inverted . ', ';
echo 'animated: ' . $_animated;
if($_animated === 'true') {
echo ', ease: "' . $_slider->getParam('polyfold_' . $alias . '_ease', 'ease-out') . '", ';
echo 'time: ' . abs(floatval($_slider->getParam('polyfold_' . $alias . '_time', 0.3)));
}
}
echo '});' . "\n";
}
}
}
?>