/** * Import a single tweet as a post * * This function is not used in the plugin, it's here to be used when debugging or for custom use * * @param string $id Tweet ID ('454752497002115072' in 'https://twitter.com/ozh/statuses/454752497002115072') * @return bool|array false if not found, or array of stats about the insertion */ function ozh_ta_import_single_tweet($id) { if ($tweet = ozh_ta_get_single_tweet($id)) { return ozh_ta_insert_tweets(array($tweet)); } return false; }
function ozh_ta_import_bunch_o_tweets($id) { if (file_exists(plugin_dir_path(__FILE__) . '../ozh-tweet-archiver/inc/import.php')) { include plugin_dir_path(__FILE__) . '../ozh-tweet-archiver/inc/import.php'; if (function_exists('ozh_ta_get_single_tweet')) { if ($tweets = self::get_single_tweet($id)) { if (!is_array($tweets)) { $tweets = array($tweets); } $response = ozh_ta_insert_tweets($tweets); foreach ($tweets as $i => $tweet) { $this->process_mentions_hashtags($tweet); } return $response; } else { return " -- couldn't get tweets -- "; } } else { return " -- function doesn't exist -- "; } } else { return " -- plugin doesn't exist -- "; } }