Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

MrsAngelD

By: a guest on Dec 22nd, 2010  |  syntax: PHP  |  size: 3.12 KB  |  views: 381  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * Import for BuddyStream
  4.  */
  5. $incPath = str_replace("/wp-content/plugins/buddystream","",getcwd());
  6.  
  7. ini_set('include_path', $incPath);
  8. include('wp-load.php');
  9.  
  10. function microtime_float_import() {
  11.     list($usec, $sec) = explode(" ", microtime());
  12.     return ((float)$usec + (float)$sec);
  13. }
  14.  
  15. if(!get_option("bs_cronjob")){
  16.     update_option("bs_cronjob","youtube");
  17.     update_option("bs_cronjob_status","ready");
  18. }
  19.  
  20. $time_start_cron = microtime_float_import();
  21. update_option("buddystream_cron_stamp",current_time('mysql'));
  22.  
  23.     //import youtube
  24.     if (get_option("bs_cronjob") == "youtube") {
  25.         if (get_site_option("buddystream_twitter_power")) {
  26.             if (get_site_option("tweetstream_consumer_key")) {
  27.                 include_once "classes/twitter/BuddyStreamTwitterImport.php";
  28.                 $twitterImport = new BuddyStreamTwitterImport();
  29.                 $timeTwitter = $twitterImport->doImport();
  30.                 echo "Twitter imported in ".$timeTwitter." seconds";
  31.             }
  32.         }
  33.         update_option("bs_cronjob","twitter");
  34.         die();
  35.     }
  36.  
  37.     //import facebook
  38.     if (get_option("bs_cronjob") == "twitter") {
  39.         if (get_site_option("buddystream_facebook_power")) {
  40.             if (get_site_option("facestream_application_id")) {
  41.                 include_once "classes/facebook/BuddyStreamFacebookImport.php";
  42.                 $facebookImport= new BuddyStreamFacebookImport();
  43.                 $timeFacebook = $facebookImport->doImport();
  44.                 echo "Facebook imported in ".$timeFacebook." seconds";
  45.             }
  46.         }
  47.         update_option("bs_cronjob","facebook");
  48.         die();
  49.     }
  50.  
  51.     //import flickr
  52.     if (get_option("bs_cronjob") == "facebook") {
  53.         if (get_site_option("buddystream_flickr_power")) {
  54.             if (get_site_option("bs_flickr_api_key")) {
  55.                 include_once "classes/flickr/BuddyStreamFlickrImport.php";
  56.                 $flickrImport= new BuddyStreamFlickrImport();
  57.                 $timeFlickr = $flickrImport->doImport();
  58.                 echo "Flickr imported in ".$timeFlickr." seconds";
  59.             }
  60.         }
  61.         update_option("bs_cronjob","flickr");
  62.         die();
  63.     }
  64.  
  65.     //import lastfm
  66.     if (get_option("bs_cronjob") == "flickr") {
  67.         if (get_site_option("buddystream_lastfm_power")) {
  68.             include_once "classes/lastfm/BuddyStreamLastfmImport.php";
  69.             $lastfmImport= new BuddyStreamLastfmImport();
  70.             $timeLastfm = $lastfmImport->doImport();
  71.             echo "Last.fm imported in ".$timeLastfm." seconds";
  72.         }
  73.         update_option("bs_cronjob","lastfm");
  74.         die();
  75.     }
  76.  
  77.     //import youtube
  78.     if (get_option("bs_cronjob") == "lastfm") {
  79.         if (get_site_option("buddystream_youtube_power")) {
  80.             include_once "classes/youtube/BuddyStreamYoutubeImport.php";
  81.             $youtubeImport= new BuddyStreamYoutubeImport();
  82.             $timeYoutube = $youtubeImport->doImport();
  83.             echo "Youtube imported in ".$timeYoutube." seconds";
  84.         }
  85.         update_option("bs_cronjob","youtube");
  86.         die();
  87.     }