protected static function get_tweet_content() { ob_start(); require dirname(__FILE__) . '/share-handler.php'; ob_end_clean(); $p = $_POST; $defaults = array('text' => '', 'custom_url' => '', 'custom_twitter_handles' => '', 'custom_hidden_hashtags' => '', 'custom_hidden_urls' => '', 'remove_twitter_handles' => '', 'remove_url' => '', 'remove_hidden_hashtags' => '', 'remove_hidden_urls' => ''); // Merge passed values with defaults $p = array_merge($defaults, $p); // Convert empty values to boolean false to play along nicely with TT_Share_Handler $p = TT_Tools::empty_to_false($p); $SH = new TT_Share_Handler($p['text'], $p['custom_url'], $p['custom_twitter_handles'], $p['custom_hidden_hashtags'], $p['custom_hidden_urls'], $p['remove_twitter_handles'], $p['remove_url'], $p['remove_hidden_hashtags'], $p['remove_hidden_urls'], $p['post_id']); $data = $SH->generate_actual_text(); // Generate JSON response $json = json_encode(array('status' => true, 'data' => $data)); echo $json; }