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,58 @@
#rev_addon_snow_settings_slideout h3 span {
border-radius: 50%;
border: 2px solid #22a2ad;
color: #FFF;
font-size: 17px;
font-weight: 700;
width: 40px;
height: 40px;
line-height: 37px;
text-align: center;
display: block;
margin: 0 auto;
margin-bottom: 10px;
background: #22a2ad;
}
#rev_addon_snow_settings_slideout h3 {
font-size: 20px;
text-align: center;
}
#rev_addon_snow_settings_slideout .featuretext {
margin-top: 10px;
}
#rev_addon_snow_settings_slideout .documentation {
text-align: center;
margin-bottom: 20px;
}
#rev_addon_snow_settings_slideout .documentation a {
display: inline-block;
background: #22a2ad;
color: #FFF;
font-size: 14px;
font-weight: 600;
padding: 0 20px;
border-radius: 4px;
text-decoration: none;
line-height: 40px;
transition: opacity 0.2s ease-out;
}
#rev_addon_snow_settings_slideout .documentation a:hover {
opacity: 0.75;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -0,0 +1,84 @@
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2016 ThemePunch
*/
;(function($) {
if(!$) {
console.log('core jQuery library not loading correctly');
return;
}
if(typeof punchgs === 'undefined') {
console.log('punchgs not available');
return;
}
var win,
timer,
display,
scrollable;
function openPanel() {
clearTimeout(timer);
punchgs.TweenLite.to(jQuery('.rs-sbs-slideout-wrapper').not(display), 0.4, {xPercent: '+100%', autoAlpha: 0, display: 'none', overwrite: 'auto', ease: punchgs.Power3.easeInOut});
punchgs.TweenLite.to(display, 0.4, {xPercent: '0%', autoAlpha: 1, display: 'block', overwrite: 'auto', ease: punchgs.Power3.easeOut});
scrollable.css('max-height', win.height() - 300);
timer = setTimeout(updateScroll, 400);
}
function closePanel() {
punchgs.TweenLite.to(display, 0.4, {xPercent: '+100%', autoAlpha: 0, display: 'none', overwrite: 'auto', ease: punchgs.Power3.easeInOut});
}
function onResize() {
scrollable.css('max-height', win.height() - 300).perfectScrollbar('update');
}
function updateScroll() {
scrollable.perfectScrollbar('update');
}
$(function() {
display = jQuery('#rev_addon_snow_settings_slideout');
scrollable = display.children('.rs-sbs-slideout-inner');
win = $(window).on('resize', onResize);
$('body').on(
'click',
'#rs-dash-addons-slide-out-trigger_revslider-snow-addon',
openPanel
).on('click', '#rev_addon_snow_settings_slideout .rs-sbs-close', closePanel);
punchgs.TweenLite.set(display, {xPercent: '+100%', autoAlpha: 0, display: 'none'});
scrollable.perfectScrollbar({wheelPropagation: true, suppressScrollX: true});
});
})(typeof jQuery !== 'undefined' ? jQuery : false);

View File

@@ -0,0 +1,164 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2016 ThemePunch
*/
if( !defined( 'ABSPATH') ) exit();
require_once(RS_SNOW_PLUGIN_PATH . 'framework/slider.admin.class.php');
class RsSnowSliderAdmin extends RsAddonSnowSliderAdmin {
protected static $_Icon,
$_Title,
$_Markup,
$_JavaScript;
public function __construct($_title) {
static::$_Title = $_title;
parent::init();
}
protected static function _init($_slider) {
$_enabled = RevSliderFunctions::getVal($_slider, 'snow_enabled', false) == 'true' ? ' checked' : '';
$_startSlide = RevSliderFunctions::getVal($_slider, 'snow_start_slide', 'first');
$_endSlide = RevSliderFunctions::getVal($_slider, 'snow_end_slide', 'last');
$_maxFlakes = RevSliderFunctions::getVal($_slider, 'snow_max_num', '400');
$_minSize = RevSliderFunctions::getVal($_slider, 'snow_min_size', '0.2');
$_maxSize = RevSliderFunctions::getVal($_slider, 'snow_max_size', '6');
$_minOpacity = RevSliderFunctions::getVal($_slider, 'snow_min_opacity', '0.3');
$_maxOpacity = RevSliderFunctions::getVal($_slider, 'snow_max_opacity', '1');
$_minSpeed = RevSliderFunctions::getVal($_slider, 'snow_min_speed', '30');
$_maxSpeed = RevSliderFunctions::getVal($_slider, 'snow_max_speed', '100');
$_minSinus = RevSliderFunctions::getVal($_slider, 'snow_min_sinus', '1');
$_maxSinus = RevSliderFunctions::getVal($_slider, 'snow_max_sinus', '100');
$_alias = RevSliderFunctions::getVal($_slider, 'alias', '');
$_showSettings = $_enabled ? 'block' : 'none';
$_textDomain = 'rs_' . static::$_Title;
$_total = 2;
if($_alias) {
$_clas = new RevSlider();
$_rev_sliders = $_clas->getArrSliders();
foreach($_rev_sliders as $_rev_slider) {
if($_alias === $_rev_slider->getAlias()) $_total = $_rev_slider->getNumSlides();
}
}
static::$_Markup =
'<span class="label" id="label_snow_enabled" origtitle="' . __("Enable/Disable Holiday Snow for this Slider", $_textDomain) . '">' . __('Add Holiday Snow', $_textDomain) . '</span>
<input type="checkbox" class="tp-moderncheckbox withlabel" id="snow_enabled" name="snow_enabled"' . $_enabled . '
onchange="document.getElementById(\'snow-settings\').style.display=this.checked ? \'block\' : \'none\'" />
<div id="snow-settings" style="display: ' . $_showSettings . '">
<h4>General Settings</h4>
<span class="label" id="label_snow_start_slide" origtitle="' . __('Start Snowing on Slide Number X', $_textDomain) . '">' . __("Start on Slide", $_textDomain) . '</span>
<select class="withlabel" id="snow_start_slide" name="snow_start_slide" data-default="0">
<option value="first"';
if($_startSlide === 'first') static::$_Markup .= ' selected';
static::$_Markup .= '>First Slide</option>';
for($i = 2; $i < $_total + 1; $i++) {
static::$_Markup .= '<option value="' . $i . '"';
if($_startSlide == $i) static::$_Markup .= ' selected';
static::$_Markup .= '>' . $i . '</option>';
}
static::$_Markup .= '</select>
<br>
<span class="label" id="label_snow_end_slide" origtitle="' . __('End Snowing on Slide Number X', $_textDomain) . '">' . __("End on Slide", $_textDomain) . '</span>
<select class="withlabel" id="snow_end_slide" name="snow_end_slide" data-default="0">
<option value="last"';
if($_endSlide === 'last') static::$_Markup .= ' selected';
static::$_Markup .= '>Last Slide</option>';
for($i = 1; $i < $_total; $i++) {
static::$_Markup .= '<option value="' . $i . '"';
if($_endSlide == $i) static::$_Markup .= ' selected';
static::$_Markup .= '>' . $i . '</option>';
}
static::$_Markup .= '</select>
<br>
<h4>Snowflake Settings</h4>
<span class="label" id="label_snow_max" origtitle="' . __('Maximum Number of Snowflakes', $_textDomain) . '">' . __("Max Snowflakes", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_max_num" name="snow_max_num" value="' . $_maxFlakes . '" data-default="400" />
<br>
<span class="label" id="label_snow_min_size" origtitle="' . __('Minimum Snowflake Size in pixels', $_textDomain) . '">' . __("Min Snowflake Size", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_min_size" name="snow_min_size" value="' . $_minSize . '" data-default="0.2" />
<span>px</span>
<br>
<span class="label" id="label_snow_max_size" origtitle="' . __('Maximum Snowflake Size in pixels', $_textDomain) . '">' . __("Max Snowflake Size", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_max_size" name="snow_max_size" value="' . $_maxSize . '" data-default="6" />
<span>px</span>
<br>
<span class="label" id="label_snow_min_opacity" origtitle="' . __('Minimum Snowflake Transparency (0-1)', $_textDomain) . '">' . __("Min Opacity (0-1)", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_min_opacity" name="snow_min_opacity" value="' . $_minOpacity . '" data-default="0.3" />
<br>
<span class="label" id="label_snow_max_opacity" origtitle="' . __('Maximum Snowflake Transparency (0-1)', $_textDomain) . '">' . __("Max Opacity (0-1)", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_max_opacity" name="snow_max_opacity" value="' . $_maxOpacity . '" data-default="1" />
<br>
<span class="label" id="label_snow_min_speed" origtitle="' . __('Higher the number, the faster the speed', $_textDomain) . '">' . __("Min Speed", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_min_speed" name="snow_min_speed" value="' . $_minSpeed . '" data-default="30" />
<br>
<span class="label" id="label_snow_max_speed" origtitle="' . __('Higher the number, the faster the speed', $_textDomain) . '">' . __("Max Speed", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_max_speed" name="snow_max_speed" value="' . $_maxSpeed . '" data-default="100" />
<br>
<span class="label" id="label_snow_min_sinus" origtitle="' . __('Applies additional variation to the falling snow', $_textDomain) . '">' . __("Min Amplitude", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_min_sinus" name="snow_min_sinus" value="' . $_minSinus . '" data-default="1" />
<br>
<span class="label" id="label_snow_min_sinus" origtitle="' . __('Applies additional variation to the falling snow', $_textDomain) . '">' . __("Max Amplitude", $_textDomain) . '</span>
<input type="text" class="text-sidebar withlabel" id="snow_max_sinus" name="snow_max_sinus" value="' . $_maxSinus . '" data-default="100" />
<br>
<div class="toggle-custom-navigation-style visible" onclick="resetSnowDefaults()">Reset to Default Values</div>
</div>';
static::$_Icon = 'eg-icon-magic';
static::$_JavaScript = 'function resetSnowDefaults() {
if(window.confirm("Reset Settings to their Defaults?")) {
jQuery("#snow-settings").children("select, input").each(function() {
this[this.type === "text" ? "value" : "selectedIndex"] = this.getAttribute("data-default");
});
}
}';
}
}
?>

View File

@@ -0,0 +1,224 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2016 ThemePunch
*/
if( !defined( 'ABSPATH') ) exit();
class rs_snow_update {
private $plugin_url = 'http://codecanyon.net/item/slider-revolution-responsive-wordpress-plugin/2751380';
private $remote_url = 'http://updates.themepunch.tools/check_for_updates.php';
private $remote_url_info = 'http://updates.themepunch.tools/addons/revslider-snow-addon/revslider-snow-addon.php';
private $plugin_slug = 'revslider-snow-addon';
private $plugin_path = 'revslider-snow-addon/revslider-snow-addon.php';
private $version;
private $plugins;
private $option;
public function __construct($version) {
$this->option = $this->plugin_slug . '_update_info';
$this->version = $version;
$this->_retrieve_version_info();
}
public function delete_update_transients() {
delete_transient( 'update_themes' );
delete_transient( 'update_plugins' );
delete_site_transient( 'update_plugins' );
delete_site_transient( 'update_themes' );
}
public function add_update_checks(){
add_filter('pre_set_site_transient_update_plugins', array(&$this, 'set_update_transient'));
add_filter('plugins_api', array(&$this, 'set_updates_api_results'), 10, 3);
}
public function set_update_transient($transient) {
$this->_check_updates();
if(isset($transient) && !isset($transient->response)) {
$transient->response = array();
}
if(!empty($this->data->basic) && is_object($this->data->basic)) {
if(version_compare($this->version, $this->data->basic->version, '<')) {
$this->data->basic->new_version = $this->data->basic->version;
$transient->response[$this->plugin_path] = $this->data->basic;
}
}
return $transient;
}
public function set_updates_api_results($result, $action, $args) {
$this->_check_updates();
if(isset($args->slug) && $args->slug == $this->plugin_slug && $action == 'plugin_information') {
if(is_object($this->data->full) && !empty($this->data->full)) {
$result = $this->data->full;
}
}
return $result;
}
protected function _check_updates() {
$force_check = false;
if( (isset($_GET['checkforupdates']) && $_GET['checkforupdates'] == 'true') || isset($_GET["force-check"])) $force_check = true;
// Get data
if(empty($this->data)) {
$data = get_option($this->option, false);
$data = $data ? $data : new stdClass;
$this->data = is_object($data) ? $data : maybe_unserialize($data);
}
$last_check = get_option('rs_snow-update-check');
if($last_check == false){ //first time called
$last_check = time();
update_option('rs_snow-update-check', $last_check);
}
// Check for updates
if(time() - $last_check > 172800 || $force_check == true){
$data = $this->_retrieve_update_info();
if(isset($data->basic)) {
update_option('rs_snow-update-check', time());
$this->data->checked = time();
$this->data->basic = $data->basic;
$this->data->full = $data->full;
//update_option('rs_snow-stable-version', $data->full->stable);
update_option('rs_snow-latest-version', $data->full->version);
}
}
// Save results
update_option($this->option, $this->data);
}
public function _retrieve_update_info() {
global $wp_version;
$data = new stdClass;
// Build request
$validated = get_option('rs_snow-valid', 'false');
$purchase = (get_option('revslider-valid', 'false') == 'true') ? get_option('revslider-code', '') : '';
$rattr = array(
'code' => urlencode($purchase),
'version' => urlencode($this->version)
);
$request = wp_remote_post($this->remote_url_info, array(
'user-agent' => 'WordPress/'.$wp_version.'; '.get_bloginfo('url'),
'body' => $rattr
));
if(!is_wp_error($request)) {
if($response = maybe_unserialize($request['body'])) {
if(is_object($response)) {
$data = $response;
$data->basic->url = $this->plugin_url;
$data->full->url = $this->plugin_url;
$data->full->external = 1;
}
}
}
return $data;
}
public function _retrieve_version_info($force_check = false) {
global $wp_version;
$last_check = get_option('rs_snow-update-check-short');
if($last_check == false){ //first time called
$last_check = time();
update_option('rs_snow-update-check-short', $last_check);
}
// Check for updates
if(time() - $last_check > 172800 || $force_check == true){
update_option('rs_snow-update-check-short', time());
$purchase = (get_option('revslider-valid', 'false') == 'true') ? get_option('revslider-code', '') : '';
$response = wp_remote_post($this->remote_url, array(
'user-agent' => 'WordPress/'.$wp_version.'; '.get_bloginfo('url'),
'body' => array(
'item' => urlencode('revslider-snow-addon'),
'version' => urlencode($this->version),
'code' => urlencode($purchase)
)
));
$response_code = wp_remote_retrieve_response_code( $response );
$version_info = wp_remote_retrieve_body( $response );
if ( $response_code != 200 || is_wp_error( $version_info ) ) {
update_option('rs_snow-connection', false);
return false;
}else{
update_option('rs_snow-connection', true);
}
/*
$version_info = json_decode($version_info);
if(isset($version_info->version)){
update_option('rs_snow-latest-version', $version_info->version);
}
if(isset($version_info->notices)){
update_option('rs_snow-notices', $version_info->notices);
}
if(isset($version_info->dashboard)){
update_option('rs_snow-dashboard', $version_info->dashboard);
}
if(isset($version_info->deactivated) && $version_info->deactivated === true){
if(get_option('rs_snow-valid', 'false') == 'true'){
//remove validation, add notice
update_option('rs_snow-valid', 'false');
update_option('rs_snow-deact-notice', true);
}
}
*/
}
if($force_check == true){ //force that the update will be directly searched
update_option('rs_snow-update-check', '');
}
}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2016 ThemePunch
*/
/*
create fake "Add-On" block to test this widget
http://pastebin.com/J0wB676U
*/
if(!defined('ABSPATH')) exit();
?>
<div id="rev_addon_snow_settings_slideout" class="rs-sbs-slideout-wrapper" style="display:none">
<div class="rs-sbs-header">
<div class="rs-sbs-step"><i class="eg-icon-cog"></i></div>
<div class="rs-sbs-title"><?php _e('How to use the Snow Add-On', 'rs_snow'); ?></div>
<div class="rs-sbs-close"><i class="eg-icon-cancel"></i></div>
</div>
<div class="tp-clearfix"></div>
<div class="rs-sbs-slideout-inner">
<h3><span>1</span> <?php _e('"Enable" the Snow','rs_snow'); ?></h3>
<img src="<?php echo RS_SNOW_PLUGIN_URL . "admin/assets/images/tutorial0.jpg"; ?>">
<h3><span>2</span> <?php _e('"Adjust" the Options','rs_snow'); ?></h3>
<img src="<?php echo RS_SNOW_PLUGIN_URL . "admin/assets/images/tutorial1.jpg"; ?>">
<h3><span>3</span> <?php _e('"Watch it snow!','rs_snow'); ?></h3>
<img src="<?php echo RS_SNOW_PLUGIN_URL . "admin/assets/images/tutorial2.jpg"; ?>">
</div>
</div>

View File

@@ -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);
}
}
}
?>

View File

@@ -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
}
}
?>

View File

@@ -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;
}
}
?>

View File

@@ -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";
}
}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2016 ThemePunch
*/
if(!defined('ABSPATH')) exit();
require_once(RS_SNOW_PLUGIN_PATH . 'framework/base.class.php');
class RsSnowBase extends RsAddOnSnowBase {
protected static $_PluginPath = RS_SNOW_PLUGIN_PATH,
$_PluginUrl = RS_SNOW_PLUGIN_URL,
$_PluginTitle = 'snow',
$_FilePath = __FILE__,
$_Version = '1.0.3';
public function __construct() {
//load the textdomain, if the plugin should be translateable
parent::_loadPluginTextDomain();
// check to make sure all requirements are met
$notice = $this->systemsCheck();
if($notice) {
require_once(RS_SNOW_PLUGIN_PATH . 'framework/notices.class.php');
new RsAddOnSnowNotice($notice, static::$_PluginTitle);
return;
}
parent::loadClasses();
}
}
?>

View File

@@ -0,0 +1,171 @@
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2016 ThemePunch
* @version 1.0.0
*/
// Args: jQuery, Slider API reference
var RsSnowAddOn = function($, slider) {
// bounce if slider didn't initialize
if(!slider) return;
// inject styles to solve pointer-event issues
var style = document.createElement('style');
style.innerHTML = '.snowflakes_wrapper {pointer-events: none} .snowflakes_wrapper_inner {position: absolute !important}';
document.getElementsByTagName('head')[0].appendChild(style);
// inject a static layers div if it doesn't exist
if(!slider.children('.tp-static-layers').length) {
var staticDiv = document.createElement('div');
staticDiv.className = 'tp-static-layers';
slider[0].appendChild(staticDiv);
}
var options = slider[0].opt.snow,
startSlide = options.startSlide,
endSlide = options.endSlide,
isPlaying,
inited;
options = {
selector: '.tp-static-layers',
dimension: 'self',
particleMaxPer: parseInt(options.maxNum, 10),
particlaSize: [parseFloat(options.minSize), parseFloat(options.maxSize)],
particleOpacity: [parseFloat(options.minOpacity), parseFloat(options.maxOpacity)],
particleSpeed: [parseInt(options.minSpeed, 10), parseInt(options.maxSpeed, 10)],
particleSinus: [parseInt(options.minSinus, 10), parseInt(options.maxSinus, 10)]
};
// play snow based on "startAt" and "endAt" settings
// function will fire on first load and also every time the slides change
slider.on('revolution.slide.onchange', function(event, data) {
var index = data.slideIndex;
if(startSlide === 'first') startSlide = 1;
if(endSlide === 'last') endSlide = slider.revmaxslide();
if(index >= startSlide && index <= endSlide) {
if(!inited) {
slider.letItSnow(options);
inited = true;
}
else if(!isPlaying) {
slider.letItSnow('winter');
}
isPlaying = true;
}
else if(inited) {
slider.letItSnow('summer');
isPlaying = false;
}
});
};
/* the magic */
(function(e, s) {
"use strict";
function a(e) {
e.pause = !0, e.sc.find(".snowflakes_wrapper").remove(), e.c.removeData("snowflakes"), e = {}
}
function n(e) {
e.snowflakes = [];
for (var s = e.w * e.h / 15e5; e.snowflakes.length < e.particleMaxPer * s;) e.snowflakes.push(i(e))
}
function t(e) {
window.requestAnimationFrame(function() {
r(e)
})
}
function r(e) {
if (e == s || e.ctx == s || 1 == e.destroyed || 1 == e.pause) return !1;
e.ctx.clearRect(0, 0, 2700, 2500);
var a = e.h / 3,
n = e.h / 3 * 2;
for (var r in e.snowflakes)
if (e.snowflakes[r].y + .1 * e.snowflakes[r].r < 0 && 1 == e.summer || e.snowflakes[r].y > e.h + e.snowflakes[r].r && 1 == e.summer) {}
else {
e.snowflakes[r].delta += e.snowflakes[r].delta == Math.PI / 2 ? -e.snowflakes[r].delta : Math.random() / 500 - .01, e.summer ? e.snowflakes[r].y += e.snowflakes[r].speed / 50 + .1 * e.snowflakes[r].r : e.snowflakes[r].y += e.snowflakes[r].speed / 100 + .1 * e.snowflakes[r].r, e.snowflakes[r].x += Math.sin(e.snowflakes[r].delta) * (.1 * e.snowflakes[r].r), e.snowflakes[r].y > e.h + e.snowflakes[r].r && 1 != e.summer && (e.snowflakes[r] = i(e), e.snowflakes[r].y = 0 - e.snowflakes[r].r);
var l = e.snowflakes[r].y - a,
o = e.snowflakes[r].r,
c = e.snowflakes[r].alpha;
if (l > 0 || 1 == e.summer) {
var w = 1 - l / n;
o = e.snowflakes[r].r * w, c = e.snowflakes[r].alpha * w
}
o = .1 > o ? .1 : o, c = .1 > c ? .1 : c, e.snowflakes[r].x = e.snowflakes[r].x > e.w + e.snowflakes[r].r ? 0 : e.snowflakes[r].x < -o ? e.w : e.snowflakes[r].x, e.ctx.beginPath(), e.ctx.arc(e.snowflakes[r].x, e.snowflakes[r].y, o, 2 * Math.PI, !1), e.ctx.fillStyle = "rgba(255,255,255," + c + ")", e.ctx.fill()
}
t(e)
}
function i(e) {
var s = new Object;
return s.delta = (e.particleSinus[0] + Math.random() * (e.particleSinus[1] - e.particleSinus[0])) * Math.round(2 * Math.random() - 1), s.r = e.particlaSize[0] + Math.random() * (e.particlaSize[1] - e.particlaSize[0]), s.alpha = e.particleOpacity[0] + Math.random() * (e.particleOpacity[1] - e.particleOpacity[0]), s.speed = (e.particleSpeed[0] + Math.random() * (e.particleSpeed[1] - e.particleSpeed[0])) * s.r / 3, s.x = Math.random() * e.w, s.y = Math.random() * -e.h, s
}
e.fn.extend({
letItSnow: function(r) {
var i = {
particleMaxPer: 400,
particlaSize: [.2, 6],
particleOpacity: [.3, 1],
particleSpeed: [30, 100],
particleSinus: [1, 100]
};
return "destroy" != r && "stop" != r && "play" != r && "summer" != r && "winter" != r && (r = e.extend(!0, {}, i, r)), this.each(function() {
if (-1 != e.inArray(r, ["destroy", "stop", "play", "winter", "summer"])) {
switch (r) {
case "destroy":
r = e(this).data("snowflakes"), r != s && a(r);
break;
case "stop":
r = e(this).data("snowflakes"), r != s && (r.pause = !0);
break;
case "play":
r = e(this).data("snowflakes"), r != s && (r.pause = !1, t(r));
break;
case "summer":
r = e(this).data("snowflakes"), r != s && (r.summer = !0);
break;
case "winter":
r = e(this).data("snowflakes"), r != s && (r.summer = !1)
}
return !1
}
return r.c = e(this), r.sc = r.selector != s ? e(this).find(r.selector) : r.c, 0 == r.sc.length ? !1 : r.c.data("snowflakes") != s ? !1 : (r.sc.find(".snowflakes_wrapper").remove(), r.sc.append('<div class="snowflakes_wrapper" style="position:relative;z-index:0"><div class="snowflakes_wrapper_inner" style="overflow:hidden;position:relative"><canvas width="2700" height="2500" style="position:relative;" class="snowflake_canvas"></canvas></div></div>'), r.sw = r.sc.find(".snowflakes_wrapper_inner"), r.sw.data("caller_container", r.c), r.canvas = r.sc.find(".snowflake_canvas"), r.dimension != self ? r.sizer = r.c : r.sizer = r.sc, r.w = r.sizer.width(), r.h = r.sizer.height(), r.sc.find(".snowflakes_wrapper_inner").css({
width: r.w,
height: r.h
}), r.canvas = r.canvas[0], r.snowflakes = [], r.ctx = r.canvas.getContext("2d"), n(r), t(r), r.c.data("snowflakes", r), void e(window).resize(function() {
clearTimeout(r.timer), r.timer = setTimeout(function() {
r.w = r.sizer.width(), r.h = r.sizer.height(), r.sc.find(".snowflakes_wrapper_inner").css({
width: r.w,
height: r.h
}), n(r)
}, 50)
}))
})
}
});
})(jQuery);

View File

@@ -0,0 +1,16 @@
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2016 ThemePunch
* @version 1.0.0
*/
;var RsSnowAddOn=function(e,c){if(c){var f=document.createElement("style");f.innerHTML=".snowflakes_wrapper {pointer-events: none} .snowflakes_wrapper_inner {position: absolute !important}";document.getElementsByTagName("head")[0].appendChild(f);c.children(".tp-static-layers").length||(f=document.createElement("div"),f.className="tp-static-layers",c[0].appendChild(f));var d=c[0].opt.snow,k=d.startSlide,g=d.endSlide,a,m,d={selector:".tp-static-layers",dimension:"self",particleMaxPer:parseInt(d.maxNum,
10),particlaSize:[parseFloat(d.minSize),parseFloat(d.maxSize)],particleOpacity:[parseFloat(d.minOpacity),parseFloat(d.maxOpacity)],particleSpeed:[parseInt(d.minSpeed,10),parseInt(d.maxSpeed,10)],particleSinus:[parseInt(d.minSinus,10),parseInt(d.maxSinus,10)]};c.on("revolution.slide.onchange",function(e,b){var h=b.slideIndex;"first"===k&&(k=1);"last"===g&&(g=c.revmaxslide());h>=k&&h<=g?(m?a||c.letItSnow("winter"):(c.letItSnow(d),m=!0),a=!0):m&&(c.letItSnow("summer"),a=!1)})}};
(function(e,c){function f(a){a.pause=!0;a.sc.find(".snowflakes_wrapper").remove();a.c.removeData("snowflakes")}function d(a){a.snowflakes=[];for(var c=a.w*a.h/15E5;a.snowflakes.length<a.particleMaxPer*c;)a.snowflakes.push(g(a))}function k(a){window.requestAnimationFrame(function(){if(a!=c&&a.ctx!=c&&1!=a.destroyed&&1!=a.pause){a.ctx.clearRect(0,0,2700,2500);var d=a.h/3,e=a.h/3*2,b;for(b in a.snowflakes)if(!(0>a.snowflakes[b].y+.1*a.snowflakes[b].r&&1==a.summer||a.snowflakes[b].y>a.h+a.snowflakes[b].r&&
1==a.summer)){a.snowflakes[b].delta+=a.snowflakes[b].delta==Math.PI/2?-a.snowflakes[b].delta:Math.random()/500-.01;a.summer?a.snowflakes[b].y+=a.snowflakes[b].speed/50+.1*a.snowflakes[b].r:a.snowflakes[b].y+=a.snowflakes[b].speed/100+.1*a.snowflakes[b].r;a.snowflakes[b].x+=.1*Math.sin(a.snowflakes[b].delta)*a.snowflakes[b].r;a.snowflakes[b].y>a.h+a.snowflakes[b].r&&1!=a.summer&&(a.snowflakes[b]=g(a),a.snowflakes[b].y=0-a.snowflakes[b].r);var h=a.snowflakes[b].y-d,f=a.snowflakes[b].r,l=a.snowflakes[b].alpha;
if(0<h||1==a.summer)h=1-h/e,f=a.snowflakes[b].r*h,l=a.snowflakes[b].alpha*h;f=.1>f?.1:f;l=.1>l?.1:l;a.snowflakes[b].x=a.snowflakes[b].x>a.w+a.snowflakes[b].r?0:a.snowflakes[b].x<-f?a.w:a.snowflakes[b].x;a.ctx.beginPath();a.ctx.arc(a.snowflakes[b].x,a.snowflakes[b].y,f,2*Math.PI,!1);a.ctx.fillStyle="rgba(255,255,255,"+l+")";a.ctx.fill()}k(a)}})}function g(a){var c={};return c.delta=(a.particleSinus[0]+Math.random()*(a.particleSinus[1]-a.particleSinus[0]))*Math.round(2*Math.random()-1),c.r=a.particlaSize[0]+
Math.random()*(a.particlaSize[1]-a.particlaSize[0]),c.alpha=a.particleOpacity[0]+Math.random()*(a.particleOpacity[1]-a.particleOpacity[0]),c.speed=(a.particleSpeed[0]+Math.random()*(a.particleSpeed[1]-a.particleSpeed[0]))*c.r/3,c.x=Math.random()*a.w,c.y=Math.random()*-a.h,c}e.fn.extend({letItSnow:function(a){var g={particleMaxPer:400,particlaSize:[.2,6],particleOpacity:[.3,1],particleSpeed:[30,100],particleSinus:[1,100]};return"destroy"!=a&&"stop"!=a&&"play"!=a&&"summer"!=a&&"winter"!=a&&(a=e.extend(!0,
{},g,a)),this.each(function(){if(-1!=e.inArray(a,["destroy","stop","play","winter","summer"])){switch(a){case "destroy":a=e(this).data("snowflakes");a!=c&&f(a);break;case "stop":a=e(this).data("snowflakes");a!=c&&(a.pause=!0);break;case "play":a=e(this).data("snowflakes");a!=c&&(a.pause=!1,k(a));break;case "summer":a=e(this).data("snowflakes");a!=c&&(a.summer=!0);break;case "winter":a=e(this).data("snowflakes"),a!=c&&(a.summer=!1)}return!1}return a.c=e(this),a.sc=a.selector!=c?e(this).find(a.selector):
a.c,0==a.sc.length?!1:a.c.data("snowflakes")!=c?!1:(a.sc.find(".snowflakes_wrapper").remove(),a.sc.append('<div class="snowflakes_wrapper" style="position:relative;z-index:0"><div class="snowflakes_wrapper_inner" style="overflow:hidden;position:relative"><canvas width="2700" height="2500" style="position:relative;" class="snowflake_canvas"></canvas></div></div>'),a.sw=a.sc.find(".snowflakes_wrapper_inner"),a.sw.data("caller_container",a.c),a.canvas=a.sc.find(".snowflake_canvas"),a.dimension!=self?
a.sizer=a.c:a.sizer=a.sc,a.w=a.sizer.width(),a.h=a.sizer.height(),a.sc.find(".snowflakes_wrapper_inner").css({width:a.w,height:a.h}),a.canvas=a.canvas[0],a.snowflakes=[],a.ctx=a.canvas.getContext("2d"),d(a),k(a),a.c.data("snowflakes",a),void e(window).resize(function(){clearTimeout(a.timer);a.timer=setTimeout(function(){a.w=a.sizer.width();a.h=a.sizer.height();a.sc.find(".snowflakes_wrapper_inner").css({width:a.w,height:a.h});d(a)},50)}))})}})})(jQuery);

View File

@@ -0,0 +1,67 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2016 ThemePunch
*/
if( !defined( 'ABSPATH') ) exit();
require_once(RS_SNOW_PLUGIN_PATH . 'framework/slider.front.class.php');
class RsSnowSliderFront extends RsAddonSnowSliderFront {
protected static $_Version,
$_PluginUrl,
$_PluginTitle;
public function __construct($_version, $_pluginUrl, $_pluginTitle, $_isAdmin = false) {
static::$_Version = $_version;
static::$_PluginUrl = $_pluginUrl;
static::$_PluginTitle = $_pluginTitle;
if(!$_isAdmin) {
parent::enqueueScripts();
}
else {
parent::enqueuePreview();
}
parent::writeInitScript();
add_action('revslider_fe_javascript_option_output', array($this, 'write_init_options'), 10, 1);
}
public function write_init_options($_slider) {
$_title = static::$_PluginTitle;
$tabs = "\t\t\t\t\t\t";
$tabsa = "\t\t\t\t\t\t\t";
if($_slider->getParam($_title . '_enabled', false) == 'true') {
echo $tabs . 'snow: {' . "\n";
echo $tabsa . 'startSlide: "' . $_slider->getParam('snow_start_slide', 'first') . '",' . "\n";
echo $tabsa . 'endSlide: "' . $_slider->getParam('snow_end_slide', 'last') . '",' . "\n";
echo $tabsa . 'maxNum: "' . $_slider->getParam('snow_max_num', '400') . '",' . "\n";
echo $tabsa . 'minSize: "' . $_slider->getParam('snow_min_size', '0.2') . '",' . "\n";
echo $tabsa . 'maxSize: "' . $_slider->getParam('snow_max_size', '6') . '",' . "\n";
echo $tabsa . 'minOpacity: "' . $_slider->getParam('snow_min_opacity', '0.3') . '",' . "\n";
echo $tabsa . 'maxOpacity: "' . $_slider->getParam('snow_max_opacity', '1') . '",' . "\n";
echo $tabsa . 'minSpeed: "' . $_slider->getParam('snow_min_speed', '30') . '",' . "\n";
echo $tabsa . 'maxSpeed: "' . $_slider->getParam('snow_max_speed', '100') . '",' . "\n";
echo $tabsa . 'minSinus: "' . $_slider->getParam('snow_min_sinus', '1') . '",' . "\n";
echo $tabsa . 'maxSinus: "' . $_slider->getParam('snow_max_sinus', '100') . '",' . "\n";
echo $tabs . '},' . "\n";
}
}
}
?>

View File

@@ -0,0 +1,22 @@
<div class="slider-revolution-update-list">
<h3 class="version-number">Version 1.0.3 (30th December 2016)</h3>
<div class="bugfix"><strong style="font-weight:700">BUGFIXES</strong></div>
<ul>
<li>Fixed issue where Snow could not be displayed on one slide only</li>
<li>Additional fix for update process applied</li>
</ul>
<h3 class="version-number">Version 1.0.2 (23th December 2016)</h3>
<div class="bugfix"><strong style="font-weight:700">BUGFIXES</strong></div>
<ul>
<li>Fixed update issue where update information was not always available</li>
</ul>
<h3 class="version-number">Version 1.0.1 (25th November 2016)</h3>
<div class="bugfix"><strong style="font-weight:700">BUGFIXES</strong></div>
<ul>
<li>Fixed issue where Static Layers were not always clickable</li>
</ul>
</div>

View File

@@ -0,0 +1,43 @@
<?php
/*
Plugin Name: Slider Revolution Holiday Snow
Plugin URI: http://www.themepunch.com/
Description: Add animated snow to any Slider
Author: ThemePunch
Version: 1.0.3
Author URI: http://themepunch.com
*/
/*
SCRIPT HANDLES:
'rs-snow-admin'
'rs-snow-front'
*/
// If this file is called directly, abort.
if(!defined('WPINC')) die;
define('RS_SNOW_PLUGIN_PATH', plugin_dir_path(__FILE__));
define('RS_SNOW_PLUGIN_URL', str_replace('index.php', '', plugins_url( 'index.php', __FILE__)));
require_once(RS_SNOW_PLUGIN_PATH . 'includes/base.class.php');
/**
* handle everyting by calling the following function *
**/
function rs_snow_init(){
new RsSnowBase();
}
/**
* call all needed functions on plugins loaded *
**/
add_action('plugins_loaded', 'rs_snow_init');
?>