'Invalid request.'))); $url = stripslashes( $_POST['url'] ); require_once( MLVL_DIR ."lib/Embed.class.php"); $AE = new Embed(); if( !$AE->parseUrl( $url )) die( json_encode( array( 'error'=>'Invalid video url provided.'))); $AE->setParam( 'wmode','transparent'); die( json_encode( array( 'attrb'=>$AE->getObjectAttribs(),'embed'=>$AE->getEmbedCode() ))); } add_action( 'wp_ajax_mlvl_parse_embed_url','mlvl_parse_embed_url_ajax'); add_action( 'wp_ajax_nopriv_mlvl_parse_embed_url','mlvl_parse_embed_url_ajax'); function mlvl_head(){ if( !mlvl_get_options( 'fbapp_id')) return; ;echo '
'; } add_action( 'wp_head','mlvl_head'); function mlvl_shortcode( $atts,$content ){ extract( shortcode_atts( array( 'video_url'=>'', 'width'=>'', 'height'=>'', 'overlay'=>MLVL_URL.'images/patterns/default_.png', 'overlay_radius'=>'0px', 'overlay_opacity'=>'0.5', 'overlay_padding'=>'0px', 'action_text'=>'', 'action_text_color'=>'white', 'action_text_size'=>'12', 'action_text_pleft'=>'100px', 'action_text_ptop'=>'20px', 'action_text_weight'=>'400', 'action_text_align'=>'center', 'action_text_width'=>'200px', 'share_button'=>MLVL_URL.'images/buttons/unlock1.png', 'share_button_pleft'=>'100px', 'share_button_ptop'=>'180px', 'countdown_time'=>'0', 'countdown_pleft'=>'100px', 'countdown_ptop'=>'130px', 'share_title'=>( is_singular()) ?the_title('','',false) : get_bloginfo( 'name'), 'share_link'=>( is_singular()) ?get_permalink() : home_url( '/'), 'invites'=>'1', 'multiunlock'=>'0', 'social_buttons'=>'0', 'subscription_method'=>'', 'subscription_form_data'=>'' ),$atts )); $multiunlock = (bool) $multiunlock; $social_buttons = (bool) $social_buttons; require_once( MLVL_DIR ."lib/Embed.class.php"); $AE = new Embed(); if( !$AE->parseUrl( $video_url )) return ''; $AE->setWidth( $width ); $AE->setHeight( $height ); $AE->setParam( 'wmode','transparent'); $locked = true; if( isset( $_COOKIE['mlvlmu'] )) $locked = false; $unlocked_videos = isset( $_COOKIE['mlvluv'] ) ?explode( ";",$_COOKIE['mlvluv'] ) : array(); if( $locked &&!empty( $unlocked_videos ) &&in_array( md5( $video_url ),$unlocked_videos )) $locked = false; $UID = get_the_ID() .rand( 0,1000000000 ); if( $multiunlock ){ $unlocked_js = ' mlvl_setCookie("mlvlmu", "1", 100); jQuery(".mlvl_overlay, .mlvl_action_text, .mlvl_countdown_wrap, .mlvl_share_button_wrap").remove(); jQuery(".mlvl_socialbar_wrap, .mlvl_content_reveal_wrap").show(); '; } else{ if( isset( $_COOKIE['mlvluv'] )) $new_cookie = md5( $video_url ) .";".$_COOKIE['mlvluv']; else $new_cookie = md5( $video_url ); $unlocked_js=' mlvl_setCookie("mlvluv", "'.$new_cookie .'", 100); jQuery("#mlvideo-'.$UID .' .mlvl_overlay, #mlvideo-'.$UID .' .mlvl_action_text, #mlvideo-'.$UID .' .mlvl_countdown_wrap, #mlvideo-'.$UID .' .mlvl_share_button_wrap").remove(); jQuery("#mlvideo-'.$UID .' .mlvl_socialbar_wrap, #mlvideo-'.$UID .' .mlvl_content_reveal_wrap").show(); '; } $subscription_js = ""; if( isset( $subscription_method ) &&in_array( $subscription_method,array( 'getresponse','mailchimp','icontact','aweber')) &&!empty( $subscription_form_data )){ $subscription_form_data = maybe_unserialize( base64_decode( $subscription_form_data )); $subscription_js .= "// Do Subscribe Call\n"; $subscription_js .= "\t\t\t\t\t\t\tFB.api('/me?fields=name,username,email', function(response){\n"; $subscription_js .= "\t\t\t\t\t\t\tvar args = ".json_encode( $subscription_form_data ).";\n"; $subscription_js .= "\t\t\t\t\t\t\targs.name = response.name;\n"; $subscription_js .= "\t\t\t\t\t\t\targs.email = response.email;\n"; $subscription_js .= "\t\t\t\t\t\t\tjQuery.post( '".admin_url( "admin-ajax.php") ."', {\"action\":\"mlvl_subscribe\", \"service\":\"$subscription_method\", \"args\":args});\n"; $subscription_js .= "});\n\n"; } $invites = (int) $invites; $width = (int) $width; $height = (int) $height; $countdown_time = intval( $countdown_time ); if( !isset( $action_text_color ) ||!preg_match( '/^#[a-f0-9]{6}$/i',$action_text_color )) $action_text_color = "#FFF"; $result = "
\n"; if( $locked ){ if( !empty( $action_text )){ $result .= "\t
\n"; $result .= "\t\t$action_text\n"; $result .= "\t
\n"; } if( $countdown_time ){ $result .= "\t
\n"; $result .= "\t\n"; } $result .= "\t
\n"; $result .= "\t\t\n"; $result .= "\t\t\t\"Share\n"; $result .= "\t\t\n"; $result .= "\t
\n"; $result .= "
\n"; $result .= ' '; } # Video Object $result .= "
{$AE->getEmbedCode()}
"; if( !empty( $content )){ $result .= "\t
\n"; $result .= "\t\tx\n"; $result .= "\t\t$content\n"; $result .= "\t
\n"; } if( $social_buttons ){ $result .= "
\n"; $result .= "\n"; $result .= "\n"; $result .= "\n"; $result .= "\n"; $result .= "\n"; $result .= "
\n"; } $result .= "
\n"; return $result; } add_shortcode( 'mlvl','mlvl_shortcode'); function mlvl_guess_url( $exclude_vars = array('m,e,n'),$exclude_structure = array()){ $schema = is_ssl() ?'https://': 'http://'; $url = $schema .$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']; if( !empty( $exclude_vars ) &&!is_array( $exclude_vars )){ $exclude_vars = explode( ',',$exclude_vars ); $exclude_vars = array_unique( $exclude_vars ); } if( !empty( $exclude_structure )) $url = preg_replace('#/('.implode('|',$exclude_structure ).')#i','',$url ); if( !empty( $exclude_vars )) $url = remove_query_arg( $exclude_vars,$url ); return $url; } # get plugin options function mlvl_get_options( $key = null ){ $mlvl_options = get_option( 'mlvl_options'); if( !$mlvl_options ) return false; if( !$key ) return $mlvl_options; if( !is_array( $key ) &&!array_key_exists( $key,$mlvl_options )) return false; if( is_array( $key )){ $return = array(); foreach( $key as $k ){ $return[$k] = array_key_exists( $k,$mlvl_options ) ?$mlvl_options[$k] : ''; } } else{ $return = $mlvl_options[$key]; } if( $return == ''||!isset( $return ) ||empty( $return ) ||false == $return ){ if( is_array( $key )) return array(); else return ''; } return $return; } # update plugin options. function mlvl_update_options( $options = array(),$newonly = false ){ if( empty( $options )) return; if( !is_array( $options )) $options = (array) $options; if( !$newonly ){ $old_options = mlvl_get_options(); $options = wp_parse_args( $options,$old_options ); } update_option( 'mlvl_options',$options ); return $options; } function mlvl($a){ echo '
';print_r($a);echo '
'."\n\n\n"; } ?>