| Current Path : /home/ereika83/www/wp-content/plugins/genesis-club-pro/classes/ |
| Current File : /home/ereika83/www/wp-content/plugins/genesis-club-pro/classes/class-background-widgets.php |
<?php
class Genesis_Club_Backstretch_Widget extends Genesis_Club_Widget {
private $tips = array(
'location' => array('heading' => 'HTML Element', 'tip' => 'This is the element to which you want to apply the background. Examples are: body, .site-container, #welcome, etc.'),
'src' => array('heading' => 'Image Source URL', 'tip' => 'If you want a slideshow in the background rather than a single image then use a comma separated list of images.'),
'once' => array('heading' => 'Show Images Once', 'tip' => 'When specifying more than one background image, click to show the slideshow just once.'),
'bgcolor' => array('heading' => 'Temp Background', 'tip' => 'The background color appears only briefly while the background image is loading. Examples are: #FFFFFF, white, #000000.'),
'fade' => array('heading' => 'Fade', 'tip' => 'Time in seconds to fade in the image.'),
'duration' => array('heading' => 'Duration', 'tip' => 'Duration to display each image if using more than one image.'),
'centeredX' => array('heading' => 'Center Horizontally', 'tip' => 'Click to center the background horizontally'),
'centeredY' => array('heading' => 'Center Vertically', 'tip' => 'Click to center the background vertically.'),
'cbgelement' => array('heading' => 'Content Container', 'tip' => 'Identify the element(s) on which you want to set the background opacity. Examples are: .entry, .post, .widget, etc.'),
'opacity' => array('heading' => 'Opacity', 'tip' => 'Set the opacity the content background. We recommend something around 0.8. Use an opacity of 1.0 to have no transparency of the website content.'),
'cbgcolor' => array('heading' => 'Background Color', 'tip' => 'If the website content has no background other than the image, you can set a background color. For example #FFFFFF is white.'),
);
private $backstretch;
function __construct() {
$widget_ops = array('description' => __('Adds a backstretch image to the chosen element', GENESIS_CLUB_DOMAIN) );
$control_ops = array('width' => 360, 'height' => 480);
parent::__construct('genesis-club-backstretch', __('Genesis Club Backstretch', GENESIS_CLUB_DOMAIN), $widget_ops, $control_ops);
$this->background = $this->plugin->get_module('background');
$this->set_defaults($this->background->get_defaults('backstretch'));
}
function widget( $args, $instance ) {
$args = $this->override_args($args, $instance) ;
$this->background->add_backstretch($instance);
}
function update( $new_instance, $old_instance ) {
$instance = $this->update_instance( $new_instance, $old_instance );
$instance['location'] = trim($new_instance['location']);
$instance['src'] = trim($new_instance['src']) ;
$instance['once'] = !empty($new_instance['once']);
$instance['bgcolor'] = strtoupper(trim($new_instance['bgcolor']));
$instance['centeredX'] = !empty($new_instance['centeredX']);
$instance['centeredY'] = !empty($new_instance['centeredY']);
$instance['fade'] = $new_instance['fade'];
$instance['duration'] = $new_instance['duration'];
$instance['cbgelement'] = trim($new_instance['cbgelement']);
$instance['opacity'] = trim($new_instance['opacity']);
$instance['cbgcolor'] = strtoupper(trim($new_instance['cbgcolor']));
return $instance;
}
function form( $instance ) {
$this->form_init ($instance, $this->tips, false);
print('<h4>Location</h4>');
$this->print_form_field('location', 'text', array(), array('size' => '20' ));
print('<h4>Background</h4>');
$this->print_form_field('src', 'textarea', array(), array( 'rows' => 3, 'cols' => 40, 'class' => 'widefat'));
$this->print_form_field('bgcolor', 'text', array(), array('size' => 8, 'class' => 'color-picker' ));
$this->print_form_field('once', 'checkbox');
print('<h4>Positioning</h4>');
$this->print_form_field('centeredX', 'checkbox');
$this->print_form_field('centeredY', 'checkbox');
print('<h4>Transitions</h4>');
$this->print_form_field('fade', 'text', array(), array('size' => 4, 'suffix' => 'seconds'));
$this->print_form_field('duration', 'text', array(), array('size' => 4, 'suffix' => 'seconds'));
print('<h4>Content Opacity</h4>');
$this->print_form_field('cbgelement', 'text', array(), array('size' => '20' ));
$this->print_form_field('opacity', 'text', array(), array('size' => 4 ));
$this->print_form_field('cbgcolor', 'text', array(), array('size' => 8, 'class' => 'color-picker' ));
}
}
class Genesis_Club_BigVideo_Widget extends Genesis_Club_Widget {
private $background;
private $tips = array(
'url' => array('heading' => 'Video URL', 'tip' => 'Full URL of the video'),
'start' => array('heading' => 'Start At', 'tip' => 'How many seconds at the start of the video do you want to skip'),
'stop' => array('heading' => 'Stop At', 'tip' => 'Enter the time in seconds when you want the video to stop, or leave blank to play until the end.'),
'loop' => array('heading' => 'Loop', 'tip' => 'Click to play the video on a continuous loop.'),
'sound' => array('heading' => 'Play Sound', 'tip' => 'Click to enable sound'),
'controls' => array('heading' => 'Show Player', 'tip' => 'Click to show video player at the bottom of the screen. Normally you will want to do this if you are playing a video with sound.'),
'splash' => array('heading' => 'Splash Image', 'tip' => 'Background image to display while video is loading.'),
'splash_end' => array('heading' => 'Ending Image', 'tip' => 'Background image to display when video has finished.'),
'fallback' => array('heading' => 'Fallback Image', 'tip' => 'Background images to display on mobile device in place of video. You can use a single image or a comma delimited list of image URLs'),
'fallback_duration' => array('heading' => 'Fallback Image Duration', 'tip' => 'Duration to display each fallback image if using more than one image.'),
'enabled' => array('heading' => 'Background Video Enabled', 'tip' => 'Click to enable a background video on this page'),
'override' => array('heading' => 'Video URL', 'tip' => 'Leave blank to play the same video as the home page video or enter the URL of a different video here.'),
'bgcolor' => array('heading' => 'Site Background', 'tip' => 'Add a background color to the video which will show if you do not set a splash image. For example #00FF00 is green'),
'cbgcolor' => array('heading' => 'Content Background', 'tip' => 'If the website content has no background other than the video, you can set a background color. For example #FFFFFF is white'),
'opacity' => array('heading' => 'Opacity', 'tip' => 'Set the opacity the web site content. We recommend something around 0.8. Use an opacity of 1.0 to have no transparency of the website content.'),
);
function __construct() {
$widget_ops = array('description' => __('Adds a video background to the page', GENESIS_CLUB_DOMAIN) );
$control_ops = array('width' => 360, 'height' => 480);
parent::__construct('genesis-club-bigvideo', __('Genesis Club BigVideo', GENESIS_CLUB_DOMAIN), $widget_ops, $control_ops );
$this->background = $this->plugin->get_module('background');
$this->set_defaults($this->background->get_defaults('bigvideo'));
add_action('wp', array($this,'enqueue_scripts'));
}
function enqueue_scripts() {
if ($instances = $this->get_settings())
foreach ($instances as $key => $instance)
if (is_array($instance)
&& (count($instance) > 0)
&& is_active_widget( false, $this->id_base.'-'.$key, $this->id_base, true )) {
$instance = wp_parse_args( $instance, $this->get_defaults() );
$this->background->maybe_enqueue_bigvideo($instance);
}
}
function widget( $args, $instance ) {
$this->background->add_bigvideo($instance);
}
function update( $new_instance, $old_instance ) {
$instance = $this->update_instance( $new_instance, $old_instance );
$instance['url'] = trim($new_instance['url']);
$instance['start'] = trim($new_instance['start']) ;
$instance['stop'] = trim($new_instance['stop']) ;
$instance['loop'] = !empty($new_instance['loop']);
$instance['sound'] = !empty($new_instance['sound']);
$instance['controls'] = !empty($new_instance['controls']);
$instance['splash'] = $new_instance['splash'];
$instance['splash_end'] = $new_instance['splash_end'];
$instance['fallback'] = trim($new_instance['fallback']);
$instance['fallback_duration'] = $new_instance['fallback_duration'];
$instance['bgcolor'] = strtoupper(trim($new_instance['bgcolor']));
$instance['cbgcolor'] = strtoupper(trim($new_instance['cbgcolor']));
$instance['opacity'] = trim($new_instance['opacity']);
return $instance;
}
function form( $instance ) {
$this->form_init ($instance, $this->tips, false);
$this->print_form_field('url', 'text', array(), array('size' => 40, 'class' => 'widefat'));
print ('<h4>Timing</h4>');
$this->print_form_field('start', 'text', array(), array('size' => 3, 'suffix' => 's'));
$this->print_form_field('stop', 'text', array(), array('size' => 3, 'suffix' => 's'));
$this->print_form_field('loop', 'checkbox');
print ('<h4>Controls</h4>');
$this->print_form_field( 'sound', 'checkbox');
$this->print_form_field( 'controls', 'checkbox');
print ('<h4>Images</h4>');
$this->print_form_field( 'splash', 'text', array(), array('size' => 40, 'class' => 'widefat'));
$this->print_form_field( 'splash_end', 'text', array(), array('size' => 40, 'class' => 'widefat'));
$this->print_form_field( 'fallback', 'textarea', array(), array( 'rows' => 3, 'cols' => 40, 'class' => 'widefat'));
$this->print_form_field( 'fallback_duration', 'text', array(), array('size' => 4, 'suffix' => 'seconds'));
print ('<h4>Opacity</h4>');
$this->print_form_field( 'bgcolor', 'text', array(), array('class' => 'color-picker'));
$this->print_form_field( 'cbgcolor', 'text', array(), array('class' => 'color-picker'));
$this->print_form_field( 'opacity', 'text', array(), array('size' => 4));
}
}
class Genesis_Club_SectionVideo_Widget extends Genesis_Club_Widget {
private $background;
private $tips = array(
'location' => array('heading' => 'Location', 'tip' => 'HTML element where the video plays'),
'url' => array('heading' => 'Video URL', 'tip' => 'Full URL of the video'),
'splash' => array('heading' => 'Splash Image', 'tip' => 'Background image to display while video is loading.'),
'splash_end' => array('heading' => 'Ending Image', 'tip' => 'Background image to display when video has finished.'),
'start' => array('heading' => 'Start At', 'tip' => 'How many seconds at the start of the video do you want to skip'),
'stop' => array('heading' => 'Stop At', 'tip' => 'Enter the time in seconds when you want the video to stop, or leave blank to play until the end.'),
'loop' => array('heading' => 'Loop', 'tip' => 'Click to play the video on a continuous loop.'),
'sound' => array('heading' => 'Play Sound', 'tip' => 'Click to enable sound'),
'controls' => array('heading' => 'Show Controls', 'tip' => 'Click to show the control bar that allows the user to change the sound settings or go full screen'),
'veil' => array('heading' => 'Video Veil', 'tip' => 'You can add a veil to darken the video. Valid range is between 0 and 0.95.'),
'fallback' => array('heading' => 'Fallback Image', 'tip' => 'Background images to display on mobile device in place of video. You can use a single image or a comma delimited list of image URLs'),
'fallback_duration' => array('heading' => 'Fallback Image Duration', 'tip' => 'Duration to display each fallback image if using more than one image.'),
'enabled' => array('heading' => 'Background Video Enabled', 'tip' => 'Click to enable a background video on this page'),
);
function __construct() {
$widget_ops = array('description' => __('Adds a video background to the page section', GENESIS_CLUB_DOMAIN) );
$control_ops = array('width' => 360, 'height' => 480);
parent::__construct('genesis-club-sectionvideo', __('Genesis Club SectionVideo', GENESIS_CLUB_DOMAIN), $widget_ops, $control_ops );
$this->background = $this->plugin->get_module('background');
$this->set_defaults($this->background->get_defaults('bigvideo'));
add_action('wp_enqueue_scripts', array($this,'enqueue_scripts'));
}
function enqueue_scripts() {
if ($instances = $this->get_settings())
foreach ($instances as $key => $instance)
if (is_array($instance)
&& (count($instance) > 0)
&& is_active_widget( false, $this->id_base.'-'.$key, $this->id_base )) {
$instance = wp_parse_args( $instance, $this->get_defaults() );
$this->background->maybe_enqueue_bigvideo($instance);
}
}
function widget( $args, $instance ) {
$this->background->add_bigvideo($instance);
}
function update( $new_instance, $old_instance ) {
$instance = $this->update_instance( $new_instance, $old_instance );
$instance['location'] = trim($new_instance['location']);
$instance['url'] = trim($new_instance['url']);
$instance['splash'] = $new_instance['splash'];
$instance['splash_end'] = $new_instance['splash_end'];
$instance['start'] = trim($new_instance['start']) ;
$instance['stop'] = trim($new_instance['stop']) ;
$instance['loop'] = !empty($new_instance['loop']);
$instance['sound'] = !empty($new_instance['sound']);
$instance['controls'] = !empty($new_instance['controls']);
$instance['veil'] = trim($new_instance['veil']);
$instance['fallback'] = trim($new_instance['fallback']);
$instance['fallback_duration'] = $new_instance['fallback_duration'];
return $instance;
}
function form( $instance ) {
$this->form_init ($instance, $this->tips, false);
print('<h4>Location</h4>');
$this->print_form_field('location', 'text', array(), array('size' => '20' ));
print('<h4>Video</h4>');
$this->print_form_field('url', 'text', array(), array('size' => 40, 'class' => 'widefat'));
print ('<h4>Timing</h4>');
$this->print_form_field('start', 'text', array(), array('size' => 3, 'suffix' => 's'));
$this->print_form_field('stop', 'text', array(), array('size' => 3, 'suffix' => 's'));
$this->print_form_field('loop', 'checkbox');
print ('<h4>Controls</h4>');
$this->print_form_field( 'sound', 'checkbox');
$this->print_form_field( 'controls', 'checkbox');
print ('<h4>Images</h4>');
$this->print_form_field( 'splash', 'text', array(), array('size' => 40, 'class' => 'widefat'));
$this->print_form_field( 'splash_end', 'text', array(), array('size' => 40, 'class' => 'widefat'));
$this->print_form_field( 'fallback', 'textarea', array(), array( 'rows' => 3, 'cols' => 40, 'class' => 'widefat'));
$this->print_form_field( 'fallback_duration', 'text', array(), array('size' => 4, 'suffix' => 'seconds'));
$this->print_form_field( 'veil', 'text', array(), array('size' => 4, 'suffix' => '(range is 0 to 0.9)'));
}
}