Skip to content

Commit

Permalink
Merge pull request #2 from oddevan/long-tweets
Browse files Browse the repository at this point in the history
Long tweets
  • Loading branch information
jtsternberg committed Apr 1, 2019
2 parents da5ebe3 + f09ef29 commit d0fc8b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion TwitterWP
Submodule TwitterWP updated 1 files
+2 −2 lib/TwitterWP.php
8 changes: 4 additions & 4 deletions dsgnwrks-twitter-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function import( $user_id, $nonce_val, $doing_cron = false ) {
// If no override, proceed as usual
if ( null === $tweets ) {
// @TODO https://dev.twitter.com/docs/working-with-timelines
$tweets = $twitterwp->get_tweets( $user_id, 200 );
$tweets = $twitterwp->get_tweets( $user_id, 200, array( 'tweet_mode' => 'extended' ) );
}

if ( is_wp_error( $tweets ) ) {
Expand Down Expand Up @@ -385,7 +385,7 @@ protected function loop( $tweets = array(), $opts = array() ) {
$in_title = false;
if ( $tags ) {
foreach ($tags as $tag) {
if ( strpos( $tweet->text, '#'.$tag ) ) $in_title = true;
if ( strpos( $tweet->full_text, '#'.$tag ) ) $in_title = true;
}
}

Expand Down Expand Up @@ -424,7 +424,7 @@ protected function save_tweet( $tweet, $opts = array() ) {

$post_date = date( 'Y-m-d H:i:s', strtotime( $tweet->created_at ) );

$tweet_text = apply_filters( 'dw_twitter_clean_tweets', false ) ? iconv( 'UTF-8', 'ISO-8859-1//IGNORE', $tweet->text ) : $tweet->text;
$tweet_text = apply_filters( 'dw_twitter_clean_tweets', false ) ? iconv( 'UTF-8', 'ISO-8859-1//IGNORE', $tweet->full_text ) : $tweet->full_text;

// Format tweet (hashtags, links, etc)
$tweet_text = self::twitter_linkify( $tweet_text, $tweet );
Expand Down Expand Up @@ -495,7 +495,7 @@ protected function save_tweet( $tweet, $opts = array() ) {
if ( !empty( $tweet->in_reply_to_screen_name ) )
update_post_meta( $new_post_id, 'in_reply_to_screen_name', $tweet->in_reply_to_screen_name );

return '<p><strong><em>&ldquo;'. wp_trim_words( strip_tags( $tweet->text ), 10 ) .'&rdquo; </em> imported and created successfully.</strong></p>';
return '<p><strong><em>&ldquo;'. wp_trim_words( strip_tags( $tweet->full_text ), 10 ) .'&rdquo; </em> imported and created successfully.</strong></p>';
}

/**
Expand Down

0 comments on commit d0fc8b4

Please sign in to comment.