This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

buddystream import.php

By: MrsAngelD on Mar 21st, 2011  |  syntax: PHP  |  size: 3.14 KB  |  views: 207  |  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.  
  6. $incPath = str_replace("/wp-content/plugins/buddystream","",getcwd());
  7.  
  8. ini_set('include_path', $incPath);
  9. include('wp-load.php');
  10.  
  11. function microtime_float_import() {
  12.     list($usec, $sec) = explode(" ", microtime());
  13.     return ((float)$usec + (float)$sec);
  14. }
  15.  
  16. if(!get_option("bs_cronjob")){
  17.     update_option("bs_cronjob","youtube");
  18.     update_option("bs_cronjob_status","ready");
  19. }
  20.  
  21. $time_start_cron = microtime_float_import();
  22. update_option("buddystream_cron_stamp",current_time('mysql'));
  23.  
  24.     //import youtube
  25.     if (get_option("bs_cronjob") == "youtube") {
  26.         if (get_site_option("buddystream_twitter_power")) {
  27.             if (get_site_option("tweetstream_consumer_key")) {
  28.                 include_once "classes/twitter/BuddyStreamTwitterImport.php";
  29.                 $twitterImport = new BuddyStreamTwitterImport();
  30.                 $timeTwitter = $twitterImport->doImport();
  31.                 //echo "Twitter imported in ".$timeTwitter." seconds";
  32.             }
  33.         }
  34.         update_option("bs_cronjob","twitter");
  35.         die();
  36.     }
  37.  
  38.     //import facebook
  39.     if (get_option("bs_cronjob") == "twitter") {
  40.         if (get_site_option("buddystream_facebook_power")) {
  41.             if (get_site_option("facestream_application_id")) {
  42.                 include_once "classes/facebook/BuddyStreamFacebookImport.php";
  43.                 $facebookImport= new BuddyStreamFacebookImport();
  44.                 $timeFacebook = $facebookImport->doImport();
  45.                 //echo "Facebook imported in ".$timeFacebook." seconds";
  46.             }
  47.         }
  48.         update_option("bs_cronjob","facebook");
  49.         die();
  50.     }
  51.  
  52.     //import flickr
  53.     if (get_option("bs_cronjob") == "facebook") {
  54.         if (get_site_option("buddystream_flickr_power")) {
  55.             if (get_site_option("bs_flickr_api_key")) {
  56.                 include_once "classes/flickr/BuddyStreamFlickrImport.php";
  57.                 $flickrImport= new BuddyStreamFlickrImport();
  58.                 $timeFlickr = $flickrImport->doImport();
  59.                 //echo "Flickr imported in ".$timeFlickr." seconds";
  60.             }
  61.         }
  62.         update_option("bs_cronjob","flickr");
  63.         die();
  64.     }
  65.  
  66.     //import lastfm
  67.     if (get_option("bs_cronjob") == "flickr") {
  68.         if (get_site_option("buddystream_lastfm_power")) {
  69.             include_once "classes/lastfm/BuddyStreamLastfmImport.php";
  70.             $lastfmImport= new BuddyStreamLastfmImport();
  71.             $timeLastfm = $lastfmImport->doImport();
  72.             //echo "Last.fm imported in ".$timeLastfm." seconds";
  73.         }
  74.         update_option("bs_cronjob","lastfm");
  75.         die();
  76.     }
  77.  
  78.     //import youtube
  79.     if (get_option("bs_cronjob") == "lastfm") {
  80.         if (get_site_option("buddystream_youtube_power")) {
  81.             include_once "classes/youtube/BuddyStreamYoutubeImport.php";
  82.             $youtubeImport= new BuddyStreamYoutubeImport();
  83.             $timeYoutube = $youtubeImport->doImport();
  84.             //echo "Youtube imported in ".$timeYoutube." seconds";
  85.         }
  86.         update_option("bs_cronjob","youtube");
  87.         die();
  88.     }
  89. ?>
clone this paste RAW Paste Data