????

Your IP : 216.73.216.174


Current Path : /home2/morganrand/www/wp-content/plugins/pinwheel-slider/includes/
Upload File :
Current File : /home2/morganrand/www/wp-content/plugins/pinwheel-slider/includes/pinwheel-slider-functions.php

<?php 
function pinwheel_ss_get_sliders(){
	global $wpdb,$table_prefix;
	$slider_meta = $table_prefix.PINWHEEL_SLIDER_META; 
	$sql = "SELECT * FROM $slider_meta WHERE type=0 || type=17";
 	$sliders = $wpdb->get_results($sql, ARRAY_A);
	return $sliders;
}

function pinwheel_ss_get_expiry($post_id){
	global $wpdb,$table_prefix;
	$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
	$sql = "SELECT expiry FROM $table_name WHERE post_id = '$post_id'";
 	$expiry = $wpdb->get_var($sql);
	return $expiry;
}

/*
 * Matches each symbol of PHP date format standard
 * with jQuery equivalent codeword
 * @author Tristan Jahier
 */
function pinwheel_dateformat_PHP_to_jQueryUI($php_format)
{
    $SYMBOLS_MATCHING = array(
        // Day
        'd' => 'dd',
        'D' => 'D',
        'j' => 'd',
        'l' => 'DD',
        'N' => '',
        'S' => '',
        'w' => '',
        'z' => 'o',
        // Week
        'W' => '',
        // Month
        'F' => 'MM',
        'm' => 'mm',
        'M' => 'M',
        'n' => 'm',
        't' => '',
        // Year
        'L' => '',
        'o' => '',
        'Y' => 'yy',
        'y' => 'y',
        // Time
        'a' => '',
        'A' => '',
        'B' => '',
        'g' => '',
        'G' => '',
        'h' => '',
        'H' => '',
        'i' => '',
        's' => '',
        'u' => ''
    );
    $jqueryui_format = "";
    $escaping = false;
    for($i = 0; $i < strlen($php_format); $i++)
    {
        $char = $php_format[$i];
        if($char === '\\') // PHP date format escaping character
        {
            $i++;
            if($escaping) $jqueryui_format .= $php_format[$i];
            else $jqueryui_format .= '\'' . $php_format[$i];
            $escaping = true;
        }
        else
        {
            if($escaping) { $jqueryui_format .= "'"; $escaping = false; }
            if(isset($SYMBOLS_MATCHING[$char]))
                $jqueryui_format .= $SYMBOLS_MATCHING[$char];
            else
                $jqueryui_format .= $char;
        }
    }
    return $jqueryui_format;
}

//function to get already added posts in slider
function get_pinwheel_addedposts( $slider_id ) {
	global $wpdb, $table_prefix;
	$pids = array();
	$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
	if( !empty( $slider_id ) ) {
		$results = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $table_name WHERE slider_id = %d ", $slider_id ));
		foreach( $results as $result ) {
			$pids[] = $result->post_id;	
		}
	}
	return $pids;
}

function pinwheel_get_slider_posts_in_order($slider_id) {
    	global $wpdb, $table_prefix;
	$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
	$slider_posts = $wpdb->get_results("SELECT * FROM $table_name WHERE slider_id = '$slider_id' AND (expiry IS NULL OR DATE(expiry) >= DATE(NOW())) ORDER BY slide_order ASC, date DESC", OBJECT);
	return $slider_posts;
}
function get_pinwheel_slider_name($slider_id) {
    	global $wpdb, $table_prefix;
	$slider_name = '';
	$table_name = $table_prefix.PINWHEEL_SLIDER_META;
	$slider_obj = $wpdb->get_results("SELECT * FROM $table_name WHERE slider_id = '$slider_id'", OBJECT);
	if (isset ($slider_obj[0]))$slider_name = $slider_obj[0]->slider_name;
	return $slider_name;
}
function pinwheel_ss_get_post_sliders($post_id){
    global $wpdb,$table_prefix;
	$slider_table = $table_prefix.PINWHEEL_SLIDER_TABLE; 
	$sql = "SELECT * FROM $slider_table 
	        WHERE post_id = '$post_id';";
	$post_sliders = $wpdb->get_results($sql, ARRAY_A);
	return $post_sliders;
}
function pinwheel_ss_post_on_slider($post_id,$slider_id){
    global $wpdb,$table_prefix;
	$slider_postmeta = $table_prefix.PINWHEEL_SLIDER_POST_META;
    $sql = "SELECT * FROM $slider_postmeta  
	        WHERE post_id = '$post_id' 
			AND slider_id = '$slider_id';";
	$result = $wpdb->query($sql);
	if($result == 1) { return TRUE; }
	else { return FALSE; }
}
function pinwheel_ss_slider_on_this_post($post_id){
    global $wpdb,$table_prefix;
	$slider_postmeta = $table_prefix.PINWHEEL_SLIDER_POST_META;
    $sql = "SELECT * FROM $slider_postmeta  
	        WHERE post_id = '$post_id';";
	$result = $wpdb->query($sql);
	if($result == 1) { return TRUE; }
	else { return FALSE; }
}
//Checks if the post is already added to slider
function pinwheel_slider($post_id,$slider_id = '1') {
	global $wpdb, $table_prefix;
	$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
	$check = "SELECT id FROM $table_name WHERE post_id = '$post_id' AND slider_id = '$slider_id';";
	$result = $wpdb->query($check);
	if($result == 1) { return TRUE; }
	else { return FALSE; }
}
function is_post_on_any_pinwheel_slider($post_id) {
	global $wpdb, $table_prefix;
	$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
	$check = "SELECT post_id FROM $table_name WHERE post_id = '$post_id' LIMIT 1;";
	$result = $wpdb->query($check);
	if($result == 1) { return TRUE; }
	else { return FALSE; }
}
function is_pinwheel_slider_on_slider_table($slider_id) {
	global $wpdb, $table_prefix;
	$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
	$check = "SELECT * FROM $table_name WHERE slider_id = '$slider_id' LIMIT 1;";
	$result = $wpdb->query($check);
	if($result == 1) { return TRUE; }
	else { return FALSE; }
}
function is_pinwheel_slider_on_meta_table($slider_id) {
	global $wpdb, $table_prefix;
	$table_name = $table_prefix.PINWHEEL_SLIDER_META;
	$check = "SELECT * FROM $table_name WHERE slider_id = '$slider_id' LIMIT 1;";
	$result = $wpdb->query($check);
	if($result == 1) { return TRUE; }
	else { return FALSE; }
}
function is_pinwheel_slider_on_postmeta_table($slider_id) {
	global $wpdb, $table_prefix;
	$table_name = $table_prefix.PINWHEEL_SLIDER_POST_META;
	$check = "SELECT * FROM $table_name WHERE slider_id = '$slider_id' LIMIT 1;";
	$result = $wpdb->query($check);
	if($result == 1) { return TRUE; }
	else { return FALSE; }
}
function get_pinwheel_slider_for_the_post($post_id) {
    global $wpdb, $table_prefix;
	$table_name = $table_prefix.PINWHEEL_SLIDER_POST_META;
	$sql = "SELECT slider_id FROM $table_name WHERE post_id = '$post_id' LIMIT 1;";
	$slider_postmeta = $wpdb->get_row($sql, ARRAY_A);
	$slider_id = $slider_postmeta['slider_id'];
	return $slider_id;
}
function pinwheel_slider_word_limiter( $text, $limit = 50 ) {
    $text = str_replace(']]>', ']]&gt;', $text);
	//Not using strip_tags as to accomodate the 'retain html tags' feature
	//$text = strip_tags($text);
	
    $explode = explode(' ',$text);
    $string  = '';

    $dots = '...';
    if(count($explode) <= $limit){
        $dots = '';
    }
    for($i=0;$i<$limit;$i++){
        if (isset ($explode[$i]))  $string .= $explode[$i]." ";
    }
    if ($dots) {
        $string = substr($string, 0, strlen($string));
    }
    return $string.$dots;
}
function pinwheel_sslider_admin_url( $query = array() ) {
	global $plugin_page;

	if ( ! isset( $query['page'] ) )
		$query['page'] = $plugin_page;

	$path = 'admin.php';

	if ( $query = build_query( $query ) )
		$path .= '?' . $query;

	$url = admin_url( $path );

	return esc_url_raw( $url );
}
function pinwheel_slider_table_exists($table, $db) { 
	$tables = mysql_list_tables ($db); 
	while (list ($temp) = mysql_fetch_array ($tables)) {
		if ($temp == $table) {
			return TRUE;
		}
	}
	return FALSE;
}

function pinwheel_hex2rgb($hex) {
   $hex = str_replace("#", "", $hex);
   if(strlen($hex) == 3) {
      $r = hexdec(substr($hex,0,1).substr($hex,0,1));
      $g = hexdec(substr($hex,1,1).substr($hex,1,1));
      $b = hexdec(substr($hex,2,1).substr($hex,2,1));
   } else {
      $r = hexdec(substr($hex,0,2));
      $g = hexdec(substr($hex,2,2));
      $b = hexdec(substr($hex,4,2));
   }
   $rgb = array($r, $g, $b);
   return $rgb; // returns an array with the rgb values
}

//Added for video
function pinwheel_slide_video($id='0', $ytb='', $mp4='', $webm='', $ogg='', $wd='', $ht=''){
	$html_video='';
	if(!empty($ytb) || !empty($mp4) || !empty($webm) || !empty($ogg)){
		wp_enqueue_script('wp-mediaelement');
		wp_enqueue_style('wp-mediaelement');
		
		if(empty($ytb)){
			$randint=rand(0,99);
			if(!empty($mp4)) $mp4=add_query_arg('i',$randint,$mp4); else $mp4='';
			if(!empty($webm)) $webm=add_query_arg('i',$randint,$webm); else $webm='';
			if(!empty($ogg)) $ogg=add_query_arg('i',$randint,$ogg); else $ogg='';
		
			//die($webm);
			/*if(is_admin()) $flashswf=includes_url( 'js/mediaelement/flashmediaelement.swf' );*/
			//else 
			$flashswf='flashmediaelement.swf';

			$html_video.='<video id="'.$id.'" width="'.$wd.'" height="'.$ht.'" class="pinwheel_video" controls="controls" preload="metadata" >';
				    
			if( !empty($mp4))$html_video.='<source type="video/mp4" src="'.$mp4.'" />'; else $html_video.='';
			if( !empty($webm))$html_video.='<source type="video/webm" src="'.$webm.'" />'; else $html_video.='';
			if( !empty($ogg))$html_video.='<source type="video/ogg" src="'.$ogg.'" />'; else $html_video.='';
			if(!empty($mp4)) $html_video.='<object width="'.$wd.'" height="'.$ht.'" type="application/x-shockwave-flash" data="'.includes_url( 'js/mediaelement/flashmediaelement.swf' ).'"><param name="movie" value="'.includes_url( 'js/mediaelement/flashmediaelement.swf' ).'" /><param name="flashvars" value="controls=true&file='.$mp4.'" /></object>';	else $html_video.='';	
			$html_video.='</video><script>
			jQuery(document).ready(function($) {
				new MediaElementPlayer("#'.$id.'",{pauseOtherPlayers: true,flashName: "'.$flashswf.'", features: ["playpause"]});
			});
			</script>';
		}
		else{
			$html_video=pinwheelytbUrltoEmbed($ytb,$wd,$ht);		
		}	
	}
	return $html_video;
}
function pinwheelytbUrltoEmbed($youtube_url, $width, $height){
	$vid_id = pinwheelExtractYtbId($youtube_url);
	return pinwheelYtbEmbedCode($vid_id, $width, $height);
}
 
function pinwheelExtractYtbId($url){
	/*
	* type1: http://www.youtube.com/watch?v=H1ImndT0fC8
	* type2: http://www.youtube.com/watch?v=4nrxbHyJp9k&feature=related
	* type3: http://youtu.be/H1ImndT0fC8
	*/
	$vid_id = "";
	$flag = false;
	if(isset($url) && !empty($url)){
		/*case1 and 2*/
		$parts = explode("?", $url);
		if(isset($parts) && !empty($parts) && is_array($parts) && count($parts)>1){
			$params = explode("&", $parts[1]);
			if(isset($params) && !empty($params) && is_array($params)){
				foreach($params as $param){
					$kv = explode("=", $param);
					if(isset($kv) && !empty($kv) && is_array($kv) && count($kv)>1){
						if($kv[0]=='v'){
							$vid_id = $kv[1];
							$flag = true;
							break;
						}
					}
				}
			}
		}
		
		/*case 3*/
		if(!$flag){
			$needle = "youtu.be/";
			$pos = null;
			$pos = strpos($url, $needle);
			if ($pos !== false) {
				$start = $pos + strlen($needle);
				$vid_id = substr($url, $start, 11);
				$flag = true;
			}
		}
	}
	return $vid_id;
}
 
function pinwheelYtbEmbedCode($vid_id, $width, $height){
	$w = $width;
	$h = $height;
	$html = '<iframe width="'.$w.'" height="'.$h.'" src="http://www.youtube.com/embed/'.$vid_id.'?rel=0" frameborder="0" allowfullscreen></iframe>';
	return $html;
}

function get_pinwheel_nextgen_galleries($id = '1') {
	global $wpdb, $table_prefix;
	$options ='';
	$table_name = $table_prefix."ngg_gallery";
	if($wpdb->get_var("show tables like '$table_name'") == $table_name) {
		$galleries = "SELECT * FROM $table_name";
		$result = $wpdb->get_results($galleries);
		foreach($result as $res) {
			$gid = isset($res->gid)?$res->gid:'1';
			$name = isset($res->name)?$res->name:'';
			$options .= "<option value='".$gid."' ".selected($id,$gid, false).">".$name."</option>";
		}
		return $options;
	} else return '';
}
// Transition 
function get_pinwheel_transitions($name,$transtion) {
	$transition = '<select name="'.$name.'" class="pinwheel_transitions eb-selnone" >
	 <option value="">'.__('Choose Transition','pinwheel-slider').'</option>
	<optgroup label="'.__('Attention Seekers','pinwheel-slider').'">
          <option value="bounce" '. selected( $transtion, "bounce", false ) .'>'.__('bounce','pinwheel-slider').'</option>
          <option value="flash" '. selected( $transtion, "flash", false ) .'>'.__('flash','pinwheel-slider').'</option>
          <option value="pulse" '. selected( $transtion, "pulse", false ) .'>'.__('pulse','pinwheel-slider').'</option>
          <option value="rubberBand" '. selected( $transtion, "rubberBand", false ) .'>'.__('rubberBand','pinwheel-slider').'</option>
          <option value="shake" '. selected( $transtion, "shake", false ) .'>'.__('shake','pinwheel-slider').'</option>
          <option value="swing" '. selected( $transtion, "swing", false ) .'>'.__('swing','pinwheel-slider').'</option>
          <option value="tada" '. selected( $transtion, "tada", false ) .'>'.__('tada','pinwheel-slider').'</option>
          <option value="wobble" '. selected( $transtion, "wobble", false ) .'>'.__('wobble','pinwheel-slider').'</option>
        </optgroup>
	<optgroup label="'.__('Bouncing Entrances','pinwheel-slider').'">
          <option value="bounceIn" '. selected( $transtion, "bounceIn", false ) .'>'.__('bounceIn','pinwheel-slider').'</option>
          <option value="bounceInDown" '. selected( $transtion, "bounceInDown", false ) .'>'.__('bounceInDown','pinwheel-slider').'</option>
          <option value="bounceInLeft" '. selected( $transtion, "bounceInLeft", false ) .'>'.__('bounceInLeft','pinwheel-slider').'</option>
          <option value="bounceInRight" '. selected( $transtion, "bounceInRight", false ) .'>'.__('bounceInRight','pinwheel-slider').'</option>
          <option value="bounceInUp" '. selected( $transtion, "bounceInUp", false ) .'>'.__('bounceInUp','pinwheel-slider').'</option>
        </optgroup>

       <optgroup label="'.__('Fading Entrances','pinwheel-slider').'">
          <option value="fadeIn" '. selected( $transtion, "fadeIn", false ) .'>'.__('fadeIn','pinwheel-slider').'</option>
          <option value="fadeInDown" '. selected( $transtion, "fadeInDown", false ) .'>'.__('fadeInDown','pinwheel-slider').'</option>
          <option value="fadeInDownBig"'. selected( $transtion, "fadeInDownBig", false ) .'>'.__('fadeInDownBig','pinwheel-slider').'</option>
          <option value="fadeInLeft" '. selected( $transtion, "fadeInLeft", false ) .'>'.__('fadeInLeft','pinwheel-slider').'</option>
          <option value="fadeInLeftBig" '. selected( $transtion, "fadeInLeftBig", false ) .'>'.__('fadeInLeftBig','pinwheel-slider').'</option>
          <option value="fadeInRight" '. selected( $transtion, "fadeInRight", false ) .'>'.__('fadeInRight','pinwheel-slider').'</option>
          <option value="fadeInRightBig" '. selected( $transtion, "fadeInRightBig", false ) .'>'.__('fadeInRightBig','pinwheel-slider').'</option>
          <option value="fadeInUp" '. selected( $transtion, "fadeInUp", false ) .'>'.__('fadeInUp','pinwheel-slider').'</option>
          <option value="fadeInUpBig" '. selected( $transtion, "fadeInUpBig", false ) .'>'.__('fadeInUpBig','pinwheel-slider').'</option>
        </optgroup>

       <optgroup label="'.__('Flippers','pinwheel-slider').'">
          <option value="flip" '. selected( $transtion, "flip", false ) .'>'.__('flip','pinwheel-slider').'</option>
          <option value="flipInX" '. selected( $transtion, "flipInX", false ) .'>'.__('flipInX','pinwheel-slider').'</option>
          <option value="flipInY" '. selected( $transtion, "flipInY", false ) .'>'.__('flipInY','pinwheel-slider').'</option>
       </optgroup>

        <optgroup label="'.__('Lightspeed','pinwheel-slider').'">
          <option value="lightSpeedIn" '. selected( $transtion, "lightSpeedIn", false ) .'>'.__('lightSpeedIn','pinwheel-slider').'</option>
        </optgroup>

        <optgroup label="'.__('Rotating Entrances','pinwheel-slider').'">
          <option value="rotateIn" '. selected( $transtion, "rotateIn", false ) .'>'.__('rotateIn','pinwheel-slider').'</option>
          <option value="rotateInDownLeft" '. selected( $transtion, "rotateInDownLeft", false ) .'>'.__('rotateInDownLeft','pinwheel-slider').'</option>
          <option value="rotateInDownRight" '. selected( $transtion, "rotateInDownRight", false ) .'>'.__('rotateInDownRight','pinwheel-slider').'</option>
          <option value="rotateInUpLeft" '. selected( $transtion, "rotateInUpLeft", false ) .'>'.__('rotateInUpLeft','pinwheel-slider').'</option>
          <option value="rotateInUpRight" '. selected( $transtion, "rotateInUpRight", false ) .'>'.__('rotateInUpRight','pinwheel-slider').'</option>
        </optgroup>

        <optgroup label="'.__('Specials','pinwheel-slider').'">
          <option value="hinge" '. selected( $transtion, "hinge", false ) .'>'.__('hinge','pinwheel-slider').'</option>
          <option value="rollIn" '. selected( $transtion, "rollIn", false ) .'>'.__('rollIn','pinwheel-slider').'</option>
        </optgroup>

        <optgroup label="'.__('Zoom Entrances','pinwheel-slider').'">
          <option value="zoomIn" '. selected( $transtion, "zoomIn", false ) .'>'.__('zoomIn','pinwheel-slider').'</option>
          <option value="zoomInDown" '. selected( $transtion, "zoomInDown", false ) .'>'.__('zoomInDown','pinwheel-slider').'</option>
          <option value="zoomInLeft" '. selected( $transtion, "zoomInLeft", false ) .'>'.__('zoomInLeft','pinwheel-slider').'</option>
          <option value="zoomInRight" '. selected( $transtion, "zoomInRight", false ) .'>'.__('zoomInRight','pinwheel-slider').'</option>
          <option value="zoomInUp" '. selected( $transtion, "zoomInUp", false ) .'>'.__('zoomInUp','pinwheel-slider').'</option>
        </optgroup>
	
	 <optgroup label="'.__('Slide Entrances','pinwheel-slider').'">
          <option value="slideInDown" '. selected( $transtion, "slideInDown", false ) .'>'.__('slideInDown','pinwheel-slider').'</option>
          <option value="slideInLeft" '. selected( $transtion, "slideInLeft", false ) .'>'.__('slideInLef','pinwheel-slider').'t</option>
          <option value="slideInRight" '. selected( $transtion, "slideInRight", false ) .'>'.__('slideInRight','pinwheel-slider').'</option>
          <option value="slideInUp" '. selected( $transtion, "slideInUp", false ) .'>'.__('slideInUp','pinwheel-slider').'</option>
         </optgroup>
      
</select>';
	return $transition;
}

function get_pinwheel_slider_default_settings() {
$default_pinwheel_slider_settings = array(
				'speed'=>'0.8', 
				'time'=>'4',
				'no_posts'=>'10',
				'offset' => '0',
				'bg_color'=>'#eeeced', 
				'height'=>'350',
				'width'=>'900',
				'border'=>'0',
				'brcolor'=>'#cccccc',
				'padding'=>'0',
				'prev_next'=>'0',
				'title_text'=>'Featured Articles',
				'title_from'=>'0',
				'st_font' => 'regular',
				'title_font'=>'Trebuchet MS,sans-serif',
				'title_fontg'=>'',
				'title_fontgsubset'=> array(),
				'title_fontgw'=>'',
				'stfont_custom' =>'',
				'title_fsize'=>'18',
				'title_fstyle'=>'bold',
				'title_fcolor'=>'#3F4C6B',
				'overlay_text'=>'1',
				'text_bg'=>'0',
				'tbgc'=>'#000000',
				'text_opacity'=>'0.7',
				'show_ptitle'=>'1',
				'pt_font'=>'regular',
				'ptitle_font'=>'Georgia,serif',
				'ptitle_fontg'=>'',
				'ptitle_fontgw'=>'',
				'ptitle_fontgsubset'=> array(),
				'ptfont_custom'=>'',
				'ptitle_fsize'=>'18',
				'ptitle_fstyle'=>'normal',
				'ptitle_fcolor'=>'#ffffff',
				'title_element'=>'4',
				'ptitle_transition'=>'',
				'ptitle_duration'=>'',
				'ptitle_delay'=>'',
				'img_height'=>'300',
				'img_width'=>'450',
				'img_transition'=>'',
				'img_duration'=>'',
				'img_delay'=>'',
				'sfw'=>'250',
				'sfh'=>'200',
				'sf_top'=>'50',
				'img_border'=>'0',
				'img_brcolor'=>'#D8E7EE',
				'show_content'=>'0',
				'pc_font'=>'regular',
				'pcfont_custom'=>'',
				'content_font'=>'Verdana,Geneva,sans-serif',
				'content_fontg'=>'',
				'content_fontgw'=>'',
				'content_fontgsubset'=> array(),
				'content_fsize'=>'11',
				'content_fstyle'=>'normal',
				'content_fcolor'=>'#ffffff',
				'content_from'=>'content',
				'climit'=>'0',
				'content_chars'=>'',
				'content_transition'=>'',
				'content_duration'=>'',
				'content_delay'=>'',
				'bg'=>'0',
				'image_only'=>'0',
				'allowable_tags'=>'',
				'more'=>'Read More',
				'img_size'=>'1',
				'img_pick'=>array('1','pinwheel_slider_thumbnail','1','1','1','1'), //use custom field/key, name of the key, use post featured image, pick the image attachment, attachment order,scan images
				'crop'=>'full',
				'easing'=>'swing',
				'autostep'=>'1',
				'navimg_w'=>'32',
				'navimg_ht'=>'32',
				'content_limit'=>'25',
				'slide_nav_limit'=>'3',
				'stylesheet'=>'default',
				'rand'=>'0',
				'ver'=>'1',
				'fouc'=>'0',
				'donotlink'=> '0',
				'buttons'=>'focus',
				'pnavtop'=>'45',
				'pnavleft'=>'10',
				'nnavtop'=>'45',
				'nnavright'=>'10',
				'navnum'=>'1',
				'navsum'=>'1',
				'navcss'=>'',
				'timthumb'=>'0',
				'pphoto'=>'0',
				'lbox_type'=>'pphoto_box',
				'preview'=>'2',
				'slider_id'=>'1',
				'catg_slug'=>'',
				'gencss'=>'1',
				'a_attr'=>'',
				'fields'=>'',
				'setname'=>'Set',
				'disable_preview'=>'0',
				'image_title_text'=>'0',
				'active_tab' => array('active_tabidx'=>'0','closed_sections'=>''),
				'default_image'=>pinwheel_slider_plugin_url( 'images/default_image.png' ),
				'new'=>'1',
				'popup'=>'1',
				'sideslides'=>'1',	
				'active_accordion'=>'basic',
				//Add to Cart	
				'enable_wooaddtocart' => '1',
				'woo_adc_text'=>'Add to Cart',
				'woo_adc_color'=>'#3DB432',
				'woo_adc_tcolor'=>'#ffffff',
				'woo_adc_fsize'=>'14',
				'woo_adc_border'=>'1',
				'woo_adc_brcolor'=>'#3db432',
				//sale strip	
				'enable_woosalestrip'=>'1',					
				'woo_sale_color'=>'#3DB432',
				'woo_sale_text'=>'Sale',
				'woo_sale_tcolor'=>'#ffffff',
				//regular slide price
				'enable_wooregprice'=>'1',
				'woo_font' => 'regular',
				'slide_woo_price_font' => 'Arial,Helvetica,sans-serif',
				'slide_woo_price_fontg'=> '',
				'slide_woo_price_fontgw'=> '',
				'slide_woo_price_fontgsubset'=> array(),
				'slide_woo_price_custom'=> '',
				'slide_woo_price_fcolor'=>'#ffffff',
				'slide_woo_price_fsize'=>'16',
				'slide_woo_price_fstyle'=> 'normal',
				//sale slide price
				'enable_woosprice'=>'1',
				'woosale_font'=> 'regular',
				'slide_woo_saleprice_font' => 'Arial,Helvetica,sans-serif',
				'slide_woo_saleprice_fontg'=> '',
				'slide_woo_saleprice_fontgw'=> '',
				'slide_woo_saleprice_fontgsubset'=> array(),
				'slide_woo_saleprice_custom'=> '',
				'slide_woo_saleprice_fcolor'=>'#eeee22',
				'slide_woo_saleprice_fsize'=>'14',
				'slide_woo_saleprice_fstyle'=> 'normal',
				//sale slide category
				'enable_woocat'=>'1',
				'woocat_font' => 'regular',
				'slide_woo_cat_font'=> 'Arial,Helvetica,sans-serif',
				'slide_woo_cat_fontg'=> '',
				'slide_woo_cat_fontgw'=> '',
				'slide_woo_cat_fontgsubset'=> array(),
				'slide_woo_cat_custom' => '',
				'slide_woo_cat_fcolor'=>'#ffffff',
				'slide_woo_cat_fsize'=>'14',
				'slide_woo_cat_fstyle'=> 'normal',
				'nav_woo_star'=> 'yellow',
				'enable_woostar'=>'1',	
				'woo_type'=> '0',
				'product_id'=>'',
				'ecom_type'=>'0',
				'event_type'=> '0',
				'eventcal_type'=> '0', 
				'product_woocatg_slug'=>'',
				'product_ecomcatg_slug'=>'',
				'events_mancatg_slug'=>'',
				'events_mantag_slug'=>'',
				'events_calcatg_slug'=>'',
				'events_caltag_slug'=>'',
				// events manager
				'enable_eventdtnav'=>'1',
				'enable_eventdt'=>'1',
				'enable_eventadd'=>'1',
				'enable_eventcat'=>'1',
				'eventmd_font' => 'regular', 
				'slide_eventm_font'=> 'Arial,Helvetica,sans-serif',
				'slide_eventm_fontg'=> '',
				'slide_eventm_fontgw'=> '',
				'slide_eventm_fontgsubset'=> array(),
				'slide_eventm_custom'=> '',
				'slide_eventm_fcolor'=>'#ffffff',
				'slide_eventm_fsize'=>'14',
				'slide_eventm_fstyle'=> 'normal',
				'nav_eventmd_font'=>'regular',
				'nav_eventm_font'=> 'Arial,Helvetica,sans-serif',
				'nav_eventm_fontg'=> '',
				'nav_eventm_fontgw'=> '',
				'nav_eventm_fontgsubset'=> array(),
				'nav_eventm_custom'=> '',
				'nav_eventm_fcolor'=>'#6D6D6D',
				'nav_eventm_fsize'=>'14',
				'nav_eventm_fstyle'=> 'normal',
				'event_addr_font'=> 'regular',
				'eventm_addr_font'=> 'Arial,Helvetica,sans-serif',
				'eventm_addr_fontg'=> '',
				'eventm_addr_fontgw'=> '',
				'eventm_addr_fontgsubset'=> array(),
				'eventm_addr_custom'=> '',
				'eventm_addr_fcolor'=>'#ffffff',
				'eventm_addr_fsize'=>'12',
				'eventm_addr_fstyle'=> 'normal',
				'event_cat_font'=> 'regular',
				'eventm_cat_font'=> 'Arial,Helvetica,sans-serif',
				'eventm_cat_fontg'=> '',
				'eventm_cat_fontgw'=> '',
				'eventm_cat_fontgsubset'=> array(),
				'eventm_cat_custom'=> '',
				'eventm_cat_fcolor'=>'#ffffff',
				'eventm_cat_fsize'=>'12',
				'eventm_cat_fstyle'=> 'normal',
				// Taxonomy
				'taxonomy_posttype'=> 'post',
				'taxonomy'=> 'category',
				'taxonomy_term'=> '',
				'taxonomy_show'=> '',
				'taxonomy_operator'=> '',
				'taxonomy_author'=> '',
				// Rss feed
				'rssfeed_id'=> '1',
				'rssfeed_feedurl'=> 'http://mashable.com/feed/',
				'rssfeed_default_image'=>pinwheel_slider_plugin_url( 'images/default_image.png' ),
				'rssfeed_feed'=> 'rss',
				'rssfeed_order'=> '0',
				'rssfeed_content'=> '',
				'rssfeed_media'=> '1',
				//'rssfeed_title'=> 'RSS',
				'rssfeed_src'=> '',
				'rssfeed_size'=> '',
				'rssfeed_image_class'=>'',
				// post attachment
				'postattch_id'=> '',
				// NextGenGallery  
				'nextgen_gallery_id'=> '1', 
				'nextgen_anchor' => '0',
				'separation'=>'150',
				'sizemultiplier'=>'0.75',
				'minimize_content'=>'0',
				'disableresize'=>'0',
				'disable_mobile'=>'0',
				'focusx'=>'0.33',
				'focusy'=>'0.249'
              );
return $default_pinwheel_slider_settings;
}

function get_pinwheel_slider_global_default_settings() {
	$default_pinwheel_slider_global_settings = array(
		'fb_app_key' => '',
		'fb_secret' => '',
		'insta_client_id' => '',
		'flickr_app_key' => '',
		'youtube_app_id' => '',
		'px_ckey' => '',
		/*old settings*/
		'user_level' => 'edit_others_posts',
		'noscript'=> 'This page is having a slideshow that uses Javascript. Your browser either doesn\'t support Javascript or you have it turned off. To see this page as it is meant to appear please use a Javascript enabled browser.',
		'multiple_sliders' => '1',
		'enque_scripts' => '0',
		'custom_post' =>'1', 
		'cpost_slug' => 'slidervilla',
		'remove_metabox'=>array(),
		'css'=>'',
		'css_js'=>'',
		'support'=>'1'
	);
	return $default_pinwheel_slider_global_settings;
}
function populate_pinwheel_current( $pinwheel_slider_curr ) {
	$default_pinwheel_slider_settings=get_pinwheel_slider_default_settings();
	foreach($default_pinwheel_slider_settings as $key=>$value){
		if(!isset($pinwheel_slider_curr[$key])) $pinwheel_slider_curr[$key]='';
	}
	return $pinwheel_slider_curr;
}
function pinwheel_get_image_sizes( $name, $crop, $size='' ) {

        global $_wp_additional_image_sizes;

        $sizes = array();
        $get_intermediate_image_sizes = get_intermediate_image_sizes();

        // Create the full array with sizes and crop info
        foreach( $get_intermediate_image_sizes as $_size ) {

                if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {

                        $sizes[ $_size ]['width'] = get_option( $_size . '_size_w' );
                        $sizes[ $_size ]['height'] = get_option( $_size . '_size_h' );
                        $sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );

                } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {

                        $sizes[ $_size ] = array( 
                                'width' => $_wp_additional_image_sizes[ $_size ]['width'],
                                'height' => $_wp_additional_image_sizes[ $_size ]['height'],
                                'crop' =>  $_wp_additional_image_sizes[ $_size ]['crop']
                        );

                }

        }
        
         // Get only 1 size if found
        if ( $size ) {
		if( isset( $sizes[ $size ] ) ) {
                        return $sizes[ $size ];
                } else {
                        return false;
                }

        }
        
        $option_sizes = '<select name="'.$name.'" id="pinwheel_slider_crop" >
       	 	<option value="full" '.selected("full",$crop,false).'>Full</option>';
		foreach( $sizes as $key=>$val) {
			$option_sizes .= '<option value="'.$key.'" '.selected($key,$crop,false).'>'.$key.'('.$val['width'].'x'.$val['height'].')</option>';
		}
	$option_sizes .= '</select>';
        return $option_sizes;
}
?>