Your IP : 216.73.216.171


Current Path : /home/ereika83/www/wp-content/plugins/genesis-club-pro/classes/
Upload File :
Current File : /home/ereika83/www/wp-content/plugins/genesis-club-pro/classes/class-background-admin.php

<?php
class Genesis_Club_Background_Admin extends Genesis_Club_Admin {
   private $background;
	private $tips = array(
			'backstretch_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.'),
			'backstretch_src' => array('heading' => 'Image Source(s)', 'tip' => 'If you want a slideshow in the background rather than a single image then use a comma separated list of images.'),
			'backstretch_once' => array('heading' => 'Show Images Once', 'tip' => 'When specifying more than one background image, click to show the slideshow just once.'),
			'backstretch_bgcolor' => array('heading' => 'Temp Background', 'tip' => 'The background color appears only briefly while the background image is loading. Examples are: #FFFFFF, white, #000000.'),
			'backstretch_fade' => array('heading' => 'Fade', 'tip' => 'Time in seconds to fade in the image.'),
			'backstretch_duration' => array('heading' => 'Duration', 'tip' => 'Duration to display each image if using more than one image.'),
			'backstretch_centeredX' => array('heading' => 'Center Horizontally', 'tip' => 'Click to center the background horizontally'),
			'backstretch_centeredY' => array('heading' => 'Center Vertically', 'tip' => 'Click to center the background vertically.'),
			'backstretch_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.'),
			'backstretch_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.'),
			'backstretch_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.'),
			'bigvideo_setting' => array('heading' => 'Background Video', 'tip' => 'Where do you want the background video to be played?'),
			'bigvideo_none' => array('heading' => 'none', 'tip' => 'Disable Background Video.'),
			'bigvideo_home' => array('heading' => 'home', 'tip' => 'Show Background Video only on the home page.'),
			'bigvideo_home_demand' => array('heading' => 'home and on demand', 'tip' => 'Show Background Video only on the home page and on other pages where it is explicitly enabled.'),
			'bigvideo_demand' => array('heading' => 'on demand', 'tip' => 'Only show Background Video on pages where is is explicitly enabled.'),
			'bigvideo_all' => array('heading' => 'all', 'tip' => 'Include Background Video on all pages.'),
			'bigvideo_location' => array('heading' => 'Video Location', 'tip' => 'Element inside which the background video plays'),
			'bigvideo_url' => array('heading' => 'Video URL', 'tip' => 'Full URL of the video'),
			'bigvideo_start' => array('heading' => 'Start At', 'tip' => 'How many seconds at the start of the video do you want to skip'),
			'bigvideo_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.'),
			'bigvideo_loop' => array('heading' => 'Loop', 'tip' => 'Click to play the video on a continuous loop.'),
			'bigvideo_sound' => array('heading' => 'Play Sound', 'tip' => 'Click to enable sound'),
			'bigvideo_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.'),
			'bigvideo_splash' => array('heading' => 'Splash Image', 'tip' => 'Background image to display while video is loading.'),
			'bigvideo_splash_end' => array('heading' => 'Ending Image', 'tip' => 'Background image to display when video has finished.'),
			'bigvideo_fallback' => array('heading' => 'Fallback Image(s)', 'tip' => 'Background images to display on mobile device in place of video.'),
			'bigvideo_enabled' => array('heading' => 'Background Video Enabled', 'tip' => 'Click to enable a background video on this page'),
			'bigvideo_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.'),
			'bigvideo_veil' => array('heading' => 'Video Veil', 'tip' => 'You can add a veil to darken the video. Valid range is between 0 and 0.95.'),
			'bigvideo_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'),
			'bigvideo_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'),
			'bigvideo_opacity' => array('heading' => 'Content 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 init() {
	   $this->background = $this->plugin->get_module('background');
		//add_action('load-edit.php', array( $this, 'load_page'));
 		add_action('load-post.php', array( $this, 'load_page'));
 		add_action('load-post-new.php', array( $this, 'load_page'));
		add_action('do_meta_boxes', array( $this, 'do_meta_boxes'), 20, 2 );
		add_action('save_post', array( $this, 'save_post'));
	}

	function admin_menu() { }

	function page_content() { }

	function load_page() { 
		$this->set_tooltips($this->tips);	
	}

	
	function do_meta_boxes( $post_type, $context) {
		if ($this->is_metabox_active($post_type, $context)) {
         add_filter( 'genesis_club_post_settings', array($this, 'add_backstretch_panel'), 10, 2);	//add to plugin metabox	
         add_filter( 'genesis_club_post_settings', array($this, 'add_bigvideo_panel'), 10, 2);	//add to plugin metabox		    	
		}
	}

	function save_post($post_id) {
	   if ( wp_is_post_revision( $post_id ) ) return;
	   $keys = array(
			'genesis_club_bigvideo' => Genesis_Club_Background::BIGVIDEO_METAKEY, 
			'genesis_club_backstretch' => Genesis_Club_Background::BACKSTRETCH_METAKEY);
		$defaults = array(
			'genesis_club_bigvideo' => $this->background->get_defaults('bigvideo'), 
			'genesis_club_backstretch' => $this->background->get_defaults('backstretch'));

      $this->save_postmeta($post_id, $keys, $defaults);
	}
	
	function bigvideo_form_fields($bigvideo) {
		$v = __('<h4>Video</h4>', GENESIS_CLUB_DOMAIN) .	
         $this->bigvideo_form_field($bigvideo, 'location', 'text', array(), array('size' => 20, 'class' => 'large-text')).
         $this->bigvideo_form_field($bigvideo, 'url', 'text', array(), array('size' => 50, 'class' => 'large-text'));

		$t = __('<h4>Timing</h4>', GENESIS_CLUB_DOMAIN) .
         $this->bigvideo_form_field($bigvideo, 'start', 'text', array(), array('size' => 5)).
         $this->bigvideo_form_field($bigvideo, 'stop', 'text', array(), array('size' => 5)) .
         $this->bigvideo_form_field($bigvideo, 'loop', 'checkbox');
		
		$c = __('<h4>Controls</h4>') .
         $this->bigvideo_form_field($bigvideo, 'sound', 'checkbox').
         $this->bigvideo_form_field($bigvideo, 'controls', 'checkbox');

		$i = __('<h4>Images</h4>') .
		$this->bigvideo_form_field($bigvideo, 'splash', 'text', array(), array('size' => 50, 'class' => 'large-text')) .
		$this->bigvideo_form_field($bigvideo, 'splash_end', 'text', array(), array('size' => 50, 'class' => 'large-text')) .
		$this->bigvideo_form_field($bigvideo, 'fallback', 'text', array(), array('size' => 50, 'class' => 'large-text'));

		$o = __('<h4>Opacity</h4>') .
		$this->bigvideo_form_field($bigvideo, 'veil', 'text', array(), array('size' => 4)) .	
		$this->bigvideo_form_field($bigvideo, 'bgcolor', 'text', array(), array('class' => 'color-picker')) .
		$this->bigvideo_form_field($bigvideo, 'cbgcolor', 'text', array(), array('class' => 'color-picker')) .
		$this->bigvideo_form_field($bigvideo, 'opacity', 'text', array(), array('size' => 4));

 		return sprintf('<div class="diy-wrap">%1$s%2$s%3$s%4$s%5$s<p class="meta-options"><input type="hidden" name="genesis_club_bigvideo" value="1" /></p></div>', $v, $t, $c, $i, $o);
    }  

	function bigvideo_panel($post) {
		$values = $this->background->get_defaults('bigvideo');
		if ($meta = $this->utils->get_meta($post->ID, Genesis_Club_Background::BIGVIDEO_METAKEY))
			$values = $this->options->validate_options($values, $meta);	
		foreach ($values as $key => $val) {
			$bigvideo[$key] = array();
			$bigvideo[$key]['value'] = $val;
			$bigvideo[$key]['id'] = 'bigvideo_'.$key;
			$bigvideo[$key]['name'] = Genesis_Club_Background::BIGVIDEO_METAKEY. '[' . $key . ']';
		}
		return $this->bigvideo_form_fields($bigvideo);
    }  

	function add_bigvideo_panel($content, $post) {
		return $content + array ('Background Video' => $this->bigvideo_panel($post)) ;
   }	


	function backstretch_panel($post) {
		$values = $this->background->get_defaults('backstretch');
		if ($meta = $this->utils->get_meta($post->ID, Genesis_Club_Background::BACKSTRETCH_METAKEY))
			$values = $this->options->validate_options($values, $meta);	
		foreach ($values as $key => $val) {
			$backstretch[$key] = array();
			$backstretch[$key]['value'] = $val;
			$backstretch[$key]['id'] = 'backstretch_'.$key;
			$backstretch[$key]['name'] = Genesis_Club_Background::BACKSTRETCH_METAKEY. '[' . $key . ']';
		}
		return $this->backstretch_form_fields($backstretch);
    }  

	function add_backstretch_panel($content, $post) {
		return $content + array ('Background Image' => $this->backstretch_panel($post)) ;
   }	

	function backstretch_form_fields($backstretch) {
		$b = '<h4>Background</h4>' .
         $this->backstretch_form_field($backstretch, 'location', 'text', array(), array('size' => 30)) .
         $this->backstretch_form_field($backstretch, 'src', 'textarea', array(), array('rows' => 5, 'cols' => 50, 'class' => 'large-text')) .
         $this->backstretch_form_field($backstretch, 'bgcolor',  'text', array(), array('size' => 7, 'class' => 'color-picker')); 
		$t = '<h4>Transitions</h4>'.
         $this->backstretch_form_field($backstretch, 'fade', 'text', array(), array('size' => 4)).
         $this->backstretch_form_field($backstretch, 'duration', 'text', array(), array('size' => 4)). 
         $this->backstretch_form_field($backstretch, 'once', 'checkbox');
		$p = '<h4>Positioning</h4>'.
         $this->backstretch_form_field($backstretch, 'centeredX', 'checkbox').
         $this->backstretch_form_field($backstretch, 'centeredY', 'checkbox');
		$o = '<h4>Content Opacity</h4>' .
         $this->backstretch_form_field($backstretch, 'cbgelement', 'text', array(), array('size' => 30)).
         $this->backstretch_form_field($backstretch, 'opacity', 'text', array(), array('size' => 4)).
         $this->backstretch_form_field($backstretch, 'cbgcolor', 'text', array(), array('size' => 7, 'class' => 'color-picker')); 
 		return sprintf('<div class="diy-wrap">%1$s%2$s%3$s%4$s<p class="meta-options"><input type="hidden" name="genesis_club_backstretch" value="1" /></p></div>', $b, $t, $p, $o);
    }  

	private function backstretch_form_field($backstretch, $key, $type, $options=array(), $args=array()) {
		return $this->form_field( $backstretch[$key]['id'], $backstretch[$key]['name'], false, 
			$backstretch[$key]['value'], $type, $options, $args);
	}

	private function bigvideo_form_field($bigvideo, $key, $type, $options=array(), $args=array()) {
		return $this->form_field( $bigvideo[$key]['id'], $bigvideo[$key]['name'], false,
			$bigvideo[$key]['value'], $type, $options, $args);
	}	

}