"; //echo "loginurl = ".$loginUrl; } $id = get_post_meta(999911114,'svpTwitID', TRUE); $secret = get_post_meta(999911114,'svpTwitSecret', TRUE); $youtubeapi = get_post_meta(999911115,'youtubeapi', TRUE); $facebook = new svpFacebook(array( 'appId' => $id, 'secret' => $secret, )); $user = $facebook->getUser(); if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); $user = null; } } // Login or logout url will be needed depending on current user state. if ($user) { $logoutUrl = $facebook->getLogoutUrl(); $accesstoken = $facebook->getAccessToken(); echo "accesstoken = ".$accesstoken; update_post_meta('999911114', 'svpaccesstoken', $accesstoken ); } else { $loginUrl = $facebook->getLoginUrl(array( 'scope' => 'publish_actions,manage_pages,publish_pages' )); } $id = get_post_meta(999911114,'svpTwitID', TRUE); $secret = get_post_meta(999911114,'svpTwitSecret', TRUE); $authurl = get_post_meta(999911114,'svpTwitAuthURL', TRUE); $selectedTimezone = get_post_meta(999911114,'svptimezone', TRUE); $showsource = get_post_meta(999911114,'svpshowsource', TRUE); $sourcelabel = get_post_meta(999911114,'svpsourcelabel', TRUE); $category = get_post_meta(999911114,'svpcategory', TRUE); $authfacebook = plugin_dir_url(__FILE__ ).'authfacebook.php'; $cron = plugin_dir_url(__FILE__ ).'auto.php'; echo '
'.SOCIALVIDEOPRESSR.'

Settings

'; echo "
"; if (!empty($loginUrl )){ echo ""; } /*else if (!empty($logoutUrl )){ echo ""; }*/ else{ echo ""; } echo'
Cron URL: wget -q ".$cron."
Facebook App Key:
Facebook App Secret:
Youtube API Key:
"; echo'
Select Your Timezone: Auth Facebook
Unauth Facebook

'; } ?>prefix ."svpHistory"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE $table_name ( ID INTEGER(100) UNSIGNED AUTO_INCREMENT, Source text, Message text, Timesent int(11), Status text, UNIQUE KEY id (id) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } $table_name = $wpdb->prefix ."svpFeeds"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE $table_name ( ID INTEGER(100) UNSIGNED AUTO_INCREMENT, Name text, URL text, Page text, Message text, UNIQUE KEY id (id) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } $table_name = $wpdb->prefix ."svpVideo"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE $table_name ( ID INTEGER(100) UNSIGNED AUTO_INCREMENT, Source text, URL text, Frequency text, Historic text, Messageset text, Page text, UNIQUE KEY id (id) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } $table_name = $wpdb->prefix ."svpReddit"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE $table_name ( ID INTEGER(100) UNSIGNED AUTO_INCREMENT, Name text, URL text, Page text, Message text, UNIQUE KEY id (id) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } $table_name = $wpdb->prefix ."svpPromotions"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE $table_name ( ID INTEGER(100) UNSIGNED AUTO_INCREMENT, URL text, Page text, Message text, UNIQUE KEY id (id) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } } ?> function svpGetGroups(){ var values = jQuery("input:checkbox:checked.groupselect").map(function () { return this.value; }).get(); var length = values.length, element = null; for (var i = 0; i < length; i++) { element = values[i]; } return values; } function svpDeleteVideo(){ var selectedMessages = svpGetGroups(); var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var response = ajaxRequest.responseText; //alert(response); location.reload(); } } var parameters = "messages="+selectedMessages; ajaxRequest.open("POST","'.$deleteVideo.'", true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded") ajaxRequest.send(parameters); } function svpDeletePromotion(){ var selectedMessages = svpGetGroups(); var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var response = ajaxRequest.responseText; //alert(response); location.reload(); } } var parameters = "messages="+selectedMessages; ajaxRequest.open("POST","'.$deletePromotion.'", true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded") ajaxRequest.send(parameters); } function svpDeleteReddit(){ var selectedMessages = svpGetGroups(); var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var response = ajaxRequest.responseText; //alert(response); location.reload(); } } var parameters = "messages="+selectedMessages; ajaxRequest.open("POST","'.$deleteReddit.'", true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded") ajaxRequest.send(parameters); } function svpChangeVidFreq(id, newValue){ var selectedMessages = svpGetGroups(); var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var response = ajaxRequest.responseText; //alert(response); } } var parameters = "id="+id+"&newValue="+newValue; ajaxRequest.open("POST","'.$changevidfreq.'", true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded") ajaxRequest.send(parameters); } jQuery(function() { jQuery("#popupDatepicker").datepick(); }); function svpDeleteFeeds(){ var selectedMessages = svpGetGroups(); var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var response = ajaxRequest.responseText; location.reload(); } } var parameters = "messages="+selectedMessages; ajaxRequest.open("POST","'.$deleteFeeds.'", true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded") ajaxRequest.send(parameters); } function svpChangeMessageSet(id){ var ajaxRequest; var selectedMessage= jQuery("#svpMessageSelect"+id).val(); try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var response = ajaxRequest.responseText; } } var parameters = "id="+id+"&message="+selectedMessage; ajaxRequest.open("POST","'.$changeMessageSet.'", true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded") ajaxRequest.send(parameters); } function svpDeleteMessages(){ var selectedMessages = svpGetGroups(); var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var response = ajaxRequest.responseText; location.reload(); } } var parameters = "messages="+selectedMessages; ajaxRequest.open("POST","'.$deleteMessages.'", true); ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded") ajaxRequest.send(parameters); } function svpMessageSelect(){ document.getElementById("svpMessagesForm").submit(); //alert("hello"); } '; } ?>show_errors(); $table_name = $wpdb->prefix ."svpReddit"; $wpdb->insert( $table_name, array( 'URL' =>$url, 'Page' =>$page ) ); $url = $_SERVER['REQUEST_URI']; echo ''; /* $redirecturl = get_admin_url().'admin.php?page=svp_admin_reddit'; echo ''; */ } if(isset($_POST['redditsubmit'])){ $redditusername = trim($_POST['redditusername']); $redditpassword = trim($_POST['redditpassword']); $twtpredditfreq = trim($_POST['twtpredditfreq']); $twtpsubreddits = $_POST['twtpsubreddits']; update_post_meta('999911116', 'redditusername', $redditusername ); update_post_meta('999911116', 'redditpassword', $redditpassword ); update_post_meta('999911116', 'twtpredditfreq', $twtpredditfreq ); update_post_meta('999911116', 'twtpsubreddits', $twtpsubreddits ); } $redditusername = get_post_meta(999911116,'redditusername', TRUE); $redditpassword = get_post_meta(999911116,'redditpassword', TRUE); $twtpredditfreq = get_post_meta(999911116,'twtpredditfreq', TRUE); $twtpsubreddits = get_post_meta(999911116,'twtpsubreddits', TRUE); if (empty($twtpredditfreq)){ $twtpredditfreq = 2; } echo '

'.SOCIALVIDEOPRESSR.' Reddit

'; echo "
Reddit Frequency Every ".$twtpredditfreq." Cron Runs.
Reddit Username:
Reddit Password:
"; $addfeedprocess = plugin_dir_url(__FILE__ ).'addReddit.php'; echo '
'; echo'"; echo'
Subreddit: Page:
'; $wp_list_table = new svpReddit_Table(); $wp_list_table->prepare_items(); $wp_list_table->display(); echo'
'; } function svpReddit(){ $twtpsubreddits = get_post_meta(999911116,'twtpsubreddits', TRUE); $subreddits = explode(PHP_EOL, $twtpsubreddits); $subreddit = $subreddits[array_rand($subreddits)]; if (!empty($subreddit)){ $redditTicker = get_post_meta(999911116,'redditTicker', TRUE); $twtpredditfreq = get_post_meta(999911116,'twtpredditfreq', TRUE); if (empty($redditTicker)){ $redditTicker = 1; } if ($redditTicker < $twtpredditfreq){ $redditTicker = $redditTicker+1; update_post_meta('999911116', 'redditTicker', $redditTicker ); return 0; } else{ $redditTicker = 1; update_post_meta('999911116', 'redditTicker', $redditTicker ); $redditusername = get_post_meta(999911116,'redditusername', TRUE); $redditpassword = get_post_meta(999911116,'redditpassword', TRUE); $reddit = new FBVPReddit($redditusername, $redditpassword); $subreddit = trim($subreddit); $response = $reddit->getListing($subreddit."/hot", 25); for($i = 1; $i<25; $i++){ //print_r($response); $title = $response ->data->children[$i]->data->title; $url = $response ->data->children[$i]->data->url; if(!twtpCheckHistory( $title)){ svpPostVideo($url, $title, $page); //twtpPostToTwitter("r/".$subreddit, $url, $title,""); break; } } } } } ?> '.SOCIALVIDEOPRESSR.'

Promotions

'; if (isset($_POST['svpAddPromotion'])){ $url = trim($_POST['url']); $page = trim($_POST['page']); $svpMessSelect = trim($_POST['svpMessSelect']); global $wpdb; $wpdb->show_errors(); $table_name = $wpdb->prefix ."svpPromotions"; $wpdb->insert( $table_name, array( 'URL' =>$url, 'Message' => $svpMessSelect, 'Page' => $page ) ); $url = $_SERVER['REQUEST_URI']; echo ''; } if (isset($_POST['svpChangeFreq'])){ $twtpredditfreq = trim($_POST['twtpredditfreq']); update_post_meta('999911116', 'svppromofreq', $twtpredditfreq ); } $twtpredditfreq = get_post_meta(999911116,'svppromofreq', TRUE); echo '
'; echo" "; echo' '; echo'"; echo''; echo'
Promotions Frequency Every ".$twtpredditfreq." Cron Runs.
URL: Page: Message Set: '; $messagesets= get_post_meta(999911113, 'svpmessagegroups',TRUE); echo'
'; $wp_list_table = new svpPromotions_Table(); $wp_list_table->prepare_items(); $wp_list_table->display(); echo'
'; } ?>getRequestToken(plugin_dir_url(__FILE__ ).'callback.php'); // Use config.php callback URL. $temptoken = $token = $request_token['oauth_token']; $tempsecret = $request_token['oauth_token_secret']; update_post_meta('999911113', 'twtpTempToken', $temptoken); update_post_meta('999911113', 'twtpTempSecret',$tempsecret ); $redirect_url = $connection->getAuthorizeURL($token); update_post_meta('999911113', 'twtpTwitAuthURL',$redirect_url ); } $id = get_post_meta(999911113,'twtpTwitID', TRUE); $secret = get_post_meta(999911113,'twtpTwitSecret', TRUE); $authurl = get_post_meta(999911113,'twtpTwitAuthURL', TRUE); $selectedTimezone = get_post_meta(999911113,'twtptimezone', TRUE); $showsource = get_post_meta(999911113,'twtpshowsource', TRUE); $sourcelabel = get_post_meta(999911113,'twtpsourcelabel', TRUE); $category = get_post_meta(999911113,'twtpcategory', TRUE); $callback = plugin_dir_url(__FILE__ ).'callback.php'; $cron = plugin_dir_url(__FILE__ ).'auto.php'; echo '

'.TWEETPRESSR.' Settings

'; echo "
"; } else{ echo""; } echo'
Callback URL: ".$callback."
Cron URL: wget -q ".$cron."
API Key:
API Secret: "; echo'
Select Your Timezone:
Authorize Twitter

'; } ?>

'.TWEETPRESSR.' Retweets

'; if(isset($_POST['twtpRetweetSave'])){ $twtpretweetfreq = $_POST['twtpretweetfreq']; $twtpretweetkeywords = $_POST['twtpretweetkeywords']; $twtpfollow = $_POST['twtpfollow']; update_post_meta('999911113', 'twtpretweetfreq', $twtpretweetfreq ); update_post_meta('999911113', 'twtpretweetkeywords', $twtpretweetkeywords ); update_post_meta('999911113', 'twtpfollow', $twtpfollow ); } $twtpretweetfreq = get_post_meta(999911113,'twtpretweetfreq', TRUE); $twtpretweetkeywords = get_post_meta(999911113,'twtpretweetkeywords', TRUE); $twtpfollow = get_post_meta(999911113,'twtpfollow', TRUE); if (empty($twtpretweetfreq)){ $twtpretweetfreq = 1; } echo '
'; } function twtpRetweet(){ $twtpretweetfreq = get_post_meta(999911113,'twtpretweetfreq', TRUE); $twtpretweetkeywords = get_post_meta(999911113,'twtpretweetkeywords', TRUE); $keywords = explode(PHP_EOL, $twtpretweetkeywords); $query = $keywords[array_rand($keywords)]; $retweetTicker = get_post_meta(999911113,'retweetTicker', TRUE); if (empty($retweetTicker)){ $retweetTicker = 1; } if (empty($query)){ return 0; } //echo "retweetActive = ".$retweetActive." query = ".$query; $query = trim($query); //echo "ticker = ".$retweetTicker." freq = ".$twtpretweetfreq; if ($retweetTicker < $twtpretweetfreq){ $retweetTicker = $retweetTicker+1; update_post_meta('999911113', 'retweetTicker', $retweetTicker ); return 0; } else{ $retweetTicker = 1; update_post_meta('999911113', 'retweetTicker', $retweetTicker ); $token_credentials = get_post_meta(999911113,'twtCredentials', TRUE); $id = get_post_meta(999911113,'twtpTwitID', TRUE); $secret = get_post_meta(999911113,'twtpTwitSecret', TRUE); $tmhOAuth = new tmhOAuth(array( 'consumer_key' => $id, 'consumer_secret' => $secret, 'user_token' => $token_credentials['oauth_token'], 'user_secret' =>$token_credentials['oauth_token_secret'], 'curl_ssl_verifypeer' => false )); $code = $tmhOAuth->request( 'GET', 'https://api.twitter.com/1.1/search/tweets.json', array( 'q' => $query, 'result_type' => 'popular', 'lang' => 'en' ) ); $ids = array(); $messages = array(); $users = array(); $response = $tmhOAuth->response['response']; //echo " code ".$code."
"; //print_r($reponse); $response = json_decode($response, TRUE); foreach($response as $responsearray){ for($i = 0; $i<15; $i++ ){ $users[] = $responsearray[$i]['user']['id_str']; $names[] = $responsearray[$i]['user']['screen_name']; $ids[] = $responsearray[$i]['id_str']; $messages[] = $responsearray[$i]['text']; // echo $responsearray[$i]['id_str']." ".$responsearray[$i]['text']."
"; } } $tweeted = twtpPostRetweet($ids,$messages,$users, $names); return $tweeted; } } function twtpPostRetweet($tweetids, $messages, $users, $names){ $twtpfollow = get_post_meta(999911113,'twtpfollow', TRUE); for($i = 0; $i<15; $i++){ $tweetid = $tweetids[$i]; // echo"tweetid = ".$tweetid; $message = $messages[$i]; $user = $users[$i]; $name = $names[$i]; if (!twtpCheckHistory($message)){ //if not in history post //echo "message = ". $message."
"; $token_credentials = get_post_meta(999911113,'twtCredentials', TRUE); $id = get_post_meta(999911113,'twtpTwitID', TRUE); $secret = get_post_meta(999911113,'twtpTwitSecret', TRUE); //$connection = new TwitterOAuth($id, $secret, $token_credentials['oauth_token'],$token_credentials['oauth_token_secret']); $tmhOAuth = new tmhOAuth(array( 'consumer_key' => $id, 'consumer_secret' => $secret, 'user_token' => $token_credentials['oauth_token'], 'user_secret' =>$token_credentials['oauth_token_secret'], 'curl_ssl_verifypeer' => false )); $params = array( 'id' => $tweetid // Don't give up.. ); $code = $tmhOAuth->user_request(array( 'method' => 'POST', 'url' => $tmhOAuth->url("1.1/statuses/retweet/".$tweetid) , 'params' => $params )); $response = $tmhOAuth->response['response']; // echo $code." tweetid = ".$tweetid; //print_r($response); twtpInsertHistory("Retweet", $code, $message); if ($twtpfollow == "yes"){ $params = array( 'user_id' => $user, 'follow' => 'true' ); $code = $tmhOAuth->user_request(array( 'method' => 'POST', 'url' => $tmhOAuth->url("1.1/friendships/create") , 'params' => $params )); $response = $tmhOAuth->response['response']; } twtpPostReply($tweetid, $name); return 1; } } return 0; } ?>

'.TWEETPRESSR.' Reddit

'; echo "
Retweet Frequency Every '.$twtpretweetfreq.' Cron Runs.
Follow On Retweet ? '; if ($twtpfollow == "yes"){ echo 'Yes No'; } else{ echo 'Yes No'; } echo'
Keywords / #Hashtags / @Users (One Per Line)
"; echo' '; echo"
Reddit Frequency Every ".$twtpredditfreq." Cron Runs.
Reddit Username:
Reddit Password:
Subreddits (One per line)
"; } function twtpReddit(){ $twtpsubreddits = get_post_meta(999911113,'twtpsubreddits', TRUE); $subreddits = explode(PHP_EOL, $twtpsubreddits); $subreddit = $subreddits[array_rand($subreddits)]; if (!empty($subreddit)){ $redditTicker = get_post_meta(999911113,'redditTicker', TRUE); $twtpredditfreq = get_post_meta(999911113,'twtpredditfreq', TRUE); if (empty($redditTicker)){ $redditTicker = 1; } if ($redditTicker < $twtpredditfreq){ $redditTicker = $redditTicker+1; update_post_meta('999911113', 'redditTicker', $redditTicker ); return 0; } else{ $redditTicker = 1; update_post_meta('999911113', 'redditTicker', $redditTicker ); $redditusername = get_post_meta(999911113,'redditusername', TRUE); $redditpassword = get_post_meta(999911113,'redditpassword', TRUE); $reddit = new reddit($redditusername, $redditpassword); $subreddit = trim($subreddit); $response = $reddit->getListing($subreddit."/hot", 25); for($i = 1; $i<25; $i++){ //print_r($response); $title = $response ->data->children[$i]->data->title; $url = $response ->data->children[$i]->data->url; if(!twtpCheckHistory( $title)){ twtpPostToTwitter("r/".$subreddit, $url, $title,""); break; } } } } } ?>