diff --git a/CHANGELOG.md b/CHANGELOG.md index fdbead5..026381d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [0.6.0] - 2021-03-28 +### Added +* Added option to display the user profile picture. + ## [0.5.0] - 2021-02-27 ### Fixed * Fixed caching issue. @@ -49,6 +53,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * First release of the plugin. [Unreleased]: https://github.com/aldolat/aldolat-twitter/commits/develop +[0.6.0]: https://github.com/aldolat/aldolat-twitter/compare/0.5.0...0.6.0 [0.5.0]: https://github.com/aldolat/aldolat-twitter/compare/0.4.0...0.5.0 [0.4.0]: https://github.com/aldolat/aldolat-twitter/compare/0.3.0...0.4.0 [0.3.0]: https://github.com/aldolat/aldolat-twitter/compare/0.2.0...0.3.0 diff --git a/README.md b/README.md index 4e06400..615c492 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ **Tags** twitter, sidebar, widget **Requires at least** 5.4 **Tested up to** 5.7 -**Stable tag** 0.5.0 +**Stable tag** 0.6.0 **License** GPLv3 or later **License URI** diff --git a/aldolat-twitter.php b/aldolat-twitter.php index df19e72..297b7d3 100644 --- a/aldolat-twitter.php +++ b/aldolat-twitter.php @@ -18,7 +18,7 @@ * Plugin URI: https://dev.aldolat.it/projects/aldolat-twitter/ * Author: Aldo Latino * Author URI: https://www.aldolat.it/ - * Version: 0.5.0 + * Version: 0.6.0 * License: GPLv3 or later * Text Domain: aldolat-twitter * Domain Path: /languages/ diff --git a/changelog.txt b/changelog.txt index 0a38673..0e59abb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ == Changelog == += 0.6.0 = + +* Added option to display the user profile picture. + = 0.5.0 = * Fixed caching issue. diff --git a/includes/aldolat-twitter-functions.php b/includes/aldolat-twitter-functions.php index d635a4e..4926864 100644 --- a/includes/aldolat-twitter-functions.php +++ b/includes/aldolat-twitter-functions.php @@ -22,9 +22,11 @@ * string $title The title of the widget. * string $intro_text The introductory text for the widget. * string $screen_name The username on Twitter. + * string $type_of_tweets The type of tweets to display. * string $count The number of tweets to retrieve. * boolean $exclude_replies Whether to esclude replies. * boolean $include_rts Whether to include retweets. + * boolean $display_avatar Whether to display user avatar. * integer $cache_duration The duration of the cache. * boolean $new_tab Whether the links should be opened in a new tab. * string $consumer_key The Consumer Key of the Twitter app. @@ -46,6 +48,7 @@ function aldolat_twitter_get_defaults() { 'count' => 5, 'exclude_replies' => false, 'include_rts' => true, + 'display_avatar' => true, 'cache_duration' => 5, // In minutes. 'new_tab' => false, 'consumer_key' => '', diff --git a/includes/class-aldolat-twitter-core.php b/includes/class-aldolat-twitter-core.php index 7979b92..eb2abb6 100644 --- a/includes/class-aldolat-twitter-core.php +++ b/includes/class-aldolat-twitter-core.php @@ -31,9 +31,11 @@ class Aldolat_Twitter_Core { * 'title' => string '', * 'intro_text' => string '', * 'screen_name' => string '', + * 'type_of_tweets' => string '', * 'count' => int INT, * 'exclude_replies' => boolean, * 'include_rts' => boolean, + * 'display_avatar' => boolean, * 'cache_duration' => int INT, * 'new_tab' => boolean, * 'consumer_key' => string '', @@ -168,19 +170,23 @@ private function the_html_tweets( $tweets, $new_tab_text ) { ?>
retweeted_status ) ) { - $tweet_screen_name = $tweet->retweeted_status->user->screen_name; - $tweet_user_image = $tweet->retweeted_status->user->profile_image_url_https; - } else { - $tweet_screen_name = $tweet->user->screen_name; - $tweet_user_image = $tweet->user->profile_image_url_https; + if ( $this->plugin_settings['display_avatar'] ) { + if ( isset( $tweet->retweeted_status ) ) { + $tweet_screen_name = $tweet->retweeted_status->user->screen_name; + $tweet_user_image = $tweet->retweeted_status->user->profile_image_url_https; + } else { + $tweet_screen_name = $tweet->user->screen_name; + $tweet_user_image = $tweet->user->profile_image_url_https; + } + ?> +

+ href="https://twitter.com/"> + profile picture + +

+ -

- href="https://twitter.com/"> - profile picture - -

format( $tweet ); ?>

diff --git a/includes/class-aldolat-twitter-widget.php b/includes/class-aldolat-twitter-widget.php index b34d102..6aa5b18 100644 --- a/includes/class-aldolat-twitter-widget.php +++ b/includes/class-aldolat-twitter-widget.php @@ -132,6 +132,7 @@ public function update( $new_instance, $old_instance ) { $instance['exclude_replies'] = isset( $new_instance['exclude_replies'] ) ? true : false; $instance['include_rts'] = isset( $new_instance['include_rts'] ) ? true : false; + $instance['display_avatar'] = isset( $new_instance['display_avatar'] ) ? true : false; $instance['cache_duration'] = absint( sanitize_text_field( $new_instance['cache_duration'] ) ); if ( 0 === $instance['cache_duration'] || '' === $instance['cache_duration'] || ! is_numeric( $instance['cache_duration'] ) ) { @@ -252,6 +253,14 @@ public function form( $instance ) { $instance['include_rts'] ); + // Display avatar. + aldolat_twitter_form_checkbox( + esc_html__( 'Display user profile picture', 'aldolat-twitter' ), + $this->get_field_id( 'display_avatar' ), + $this->get_field_name( 'display_avatar' ), + $instance['display_avatar'] + ); + // Cache. aldolat_twitter_form_input_text( esc_html__( 'Cache duration:', 'aldolat-twitter' ), diff --git a/includes/class-aldolat-twitter.php b/includes/class-aldolat-twitter.php index 9d4911a..6cf9d1f 100644 --- a/includes/class-aldolat-twitter.php +++ b/includes/class-aldolat-twitter.php @@ -36,7 +36,7 @@ class Aldolat_Twitter { * @since 0.0.4 */ public function __construct() { - $this->plugin_version = '0.5.0'; + $this->plugin_version = '0.6.0'; $this->plugin_dir_path = trailingslashit( dirname( plugin_dir_path( __FILE__ ) ) ); $this->plugin_dirname = trailingslashit( dirname( plugin_basename( __FILE__ ), 2 ) ); } diff --git a/languages/aldolat-twitter-it_IT.po b/languages/aldolat-twitter-it_IT.po index caebdd6..fc87694 100644 --- a/languages/aldolat-twitter-it_IT.po +++ b/languages/aldolat-twitter-it_IT.po @@ -1,19 +1,19 @@ # Copyright (C) 2020 Aldo Latino # This file is distributed under the same license as the Aldolat Twitter plugin. -# Aldo Latino , 2020. +# Aldo Latino , 2020, 2021. msgid "" msgstr "" "Project-Id-Version: Aldolat Twitter 0.0.1\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/aldolat-twitter\n" -"POT-Creation-Date: 2021-02-27T18:51:26+01:00\n" -"PO-Revision-Date: 2020-08-09 17:20+0200\n" +"POT-Creation-Date: 2021-03-28T08:17:37+02:00\n" +"PO-Revision-Date: 2021-03-28 08:18+0200\n" "Last-Translator: Aldo Latino \n" "Language-Team: Italian \n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 20.04.3\n" +"X-Generator: Lokalize 20.12.3\n" "X-Domain: aldolat-twitter\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" @@ -38,30 +38,30 @@ msgstr "Aldo Latino" msgid "https://www.aldolat.it/" msgstr "https://www.aldolat.it/" -#: includes/aldolat-twitter-functions.php:42 -#: includes/class-aldolat-twitter-widget.php:179 +#: includes/aldolat-twitter-functions.php:44 +#: includes/class-aldolat-twitter-widget.php:180 msgid "My latest tweets" msgstr "I miei ultimi tweet" -#: includes/class-aldolat-twitter-core.php:77 +#: includes/class-aldolat-twitter-core.php:79 msgid "No response from Twitter" msgstr "Nessuna risposta da Twitter" #. translators: The original tweet author name and link. -#: includes/class-aldolat-twitter-core.php:194 +#: includes/class-aldolat-twitter-core.php:200 msgid "In reply to %s" msgstr "In risposta a %s" -#: includes/class-aldolat-twitter-core.php:220 +#: includes/class-aldolat-twitter-core.php:226 msgid "by" msgstr "da" #. translators: date and tweet author name -#: includes/class-aldolat-twitter-core.php:227 +#: includes/class-aldolat-twitter-core.php:233 msgid "(RT on %1$s by %2$s)" msgstr "(RT il %1$s da %2$s)" -#: includes/class-aldolat-twitter-core.php:329 +#: includes/class-aldolat-twitter-core.php:335 msgid "ago" msgstr "fa" @@ -69,110 +69,117 @@ msgstr "fa" msgid "Publish your tweets in your blog" msgstr "Pubblica i tuoi tweet nel tuo blog" -#: includes/class-aldolat-twitter-widget.php:170 +#: includes/class-aldolat-twitter-widget.php:171 msgid "Title of the widget" msgstr "Titolo del widget" -#: includes/class-aldolat-twitter-widget.php:175 +#: includes/class-aldolat-twitter-widget.php:176 msgid "Title:" msgstr "Titolo:" -#: includes/class-aldolat-twitter-widget.php:183 +#: includes/class-aldolat-twitter-widget.php:184 msgid "Introductory text" msgstr "Testo introduttivo" -#: includes/class-aldolat-twitter-widget.php:188 +#: includes/class-aldolat-twitter-widget.php:189 msgid "Place this text after the title:" msgstr "Metti questo testo dopo il titolo:" -#: includes/class-aldolat-twitter-widget.php:192 +#: includes/class-aldolat-twitter-widget.php:193 msgid "These are my latest tweets. Follow me on Twitter!" msgstr "Questi sono i miei ultimi tweet. Seguimi su Twitter!" -#: includes/class-aldolat-twitter-widget.php:193 +#: includes/class-aldolat-twitter-widget.php:194 msgid "You can use some HTML, as you would do when writing a post." msgstr "Puoi usare anche dell'HTML, come quando scrivi un articolo." -#: includes/class-aldolat-twitter-widget.php:198 +#: includes/class-aldolat-twitter-widget.php:199 msgid "Setup" msgstr "Impostazioni" -#: includes/class-aldolat-twitter-widget.php:203 +#: includes/class-aldolat-twitter-widget.php:204 msgid "Username on Twitter:" msgstr "Nome utente su Twitter:" -#: includes/class-aldolat-twitter-widget.php:207 +#: includes/class-aldolat-twitter-widget.php:208 msgid "username" msgstr "nome_utente" -#: includes/class-aldolat-twitter-widget.php:208 +#: includes/class-aldolat-twitter-widget.php:209 msgid "This is the only mandatory option." msgstr "Questa è l'unica opzione obbligatoria." -#: includes/class-aldolat-twitter-widget.php:215 +#: includes/class-aldolat-twitter-widget.php:216 msgid "Timeline" msgstr "Timeline" -#: includes/class-aldolat-twitter-widget.php:219 +#: includes/class-aldolat-twitter-widget.php:220 msgid "Favorites" msgstr "Mi piace" -#: includes/class-aldolat-twitter-widget.php:232 +#: includes/class-aldolat-twitter-widget.php:233 msgid "Number of items:" msgstr "Numero di voci:" -#: includes/class-aldolat-twitter-widget.php:241 +#: includes/class-aldolat-twitter-widget.php:242 msgid "Exclude replies" msgstr "Escludi le risposte" -#: includes/class-aldolat-twitter-widget.php:249 +#: includes/class-aldolat-twitter-widget.php:250 msgid "Include retweets" msgstr "Includi i retweet" -#: includes/class-aldolat-twitter-widget.php:257 +#: includes/class-aldolat-twitter-widget.php:258 +msgid "Display user profile picture" +msgstr "Mostra l'immagine del profilo utente" + +#: includes/class-aldolat-twitter-widget.php:266 msgid "Cache duration:" msgstr "Durata della cache:" -#: includes/class-aldolat-twitter-widget.php:262 +#: includes/class-aldolat-twitter-widget.php:271 msgid "In minutes. The minimum accepted value is 5." msgstr "In minuti. Il valore minimo accettato è 5." -#: includes/class-aldolat-twitter-widget.php:267 +#: includes/class-aldolat-twitter-widget.php:276 msgid "Open links in a new browser tab" msgstr "Apri i link in una nuova scheda del browser" -#: includes/class-aldolat-twitter-widget.php:274 +#: includes/class-aldolat-twitter-widget.php:283 msgid "Twitter authentication" msgstr "Autenticazione su Twitter" -#: includes/class-aldolat-twitter-widget.php:279 +#: includes/class-aldolat-twitter-widget.php:288 msgid "Consumer Key:" msgstr "Consumer Key:" -#: includes/class-aldolat-twitter-widget.php:284 +#: includes/class-aldolat-twitter-widget.php:293 msgid "Insert Consumer Key" msgstr "Inserisci la Consumer Key:" -#: includes/class-aldolat-twitter-widget.php:291 +#: includes/class-aldolat-twitter-widget.php:300 msgid "Consumer secret:" msgstr "Consumer secret:" -#: includes/class-aldolat-twitter-widget.php:296 +#: includes/class-aldolat-twitter-widget.php:305 msgid "Insert Consumer Secret" msgstr "Inserisci il Consumer secret:" -#: includes/class-aldolat-twitter-widget.php:303 +#: includes/class-aldolat-twitter-widget.php:312 msgid "Oauth token:" msgstr "Oauth token:" -#: includes/class-aldolat-twitter-widget.php:308 +#: includes/class-aldolat-twitter-widget.php:317 msgid "Insert Oauth Token" msgstr "Inserisci l'Oauth token:" -#: includes/class-aldolat-twitter-widget.php:315 +#: includes/class-aldolat-twitter-widget.php:324 msgid "Oauth token secret:" msgstr "Oauth token secret:" -#: includes/class-aldolat-twitter-widget.php:320 +#: includes/class-aldolat-twitter-widget.php:329 msgid "Insert Oauth Token Secret" msgstr "Inserisci l'Oauth token secret:" + +#~ msgid "Display avatar" +#~ msgstr "Mostra l'avatar" diff --git a/languages/aldolat-twitter.pot b/languages/aldolat-twitter.pot index dbe933e..4c7959a 100644 --- a/languages/aldolat-twitter.pot +++ b/languages/aldolat-twitter.pot @@ -2,14 +2,14 @@ # This file is distributed under the same license as the Aldolat Twitter plugin. msgid "" msgstr "" -"Project-Id-Version: Aldolat Twitter 0.5.0\n" +"Project-Id-Version: Aldolat Twitter 0.6.0\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/aldolat-twitter\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2021-02-27T18:51:26+01:00\n" +"POT-Creation-Date: 2021-03-28T08:19:53+02:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.4.0\n" "X-Domain: aldolat-twitter\n" @@ -35,30 +35,30 @@ msgstr "" msgid "https://www.aldolat.it/" msgstr "" -#: includes/aldolat-twitter-functions.php:42 -#: includes/class-aldolat-twitter-widget.php:179 +#: includes/aldolat-twitter-functions.php:44 +#: includes/class-aldolat-twitter-widget.php:180 msgid "My latest tweets" msgstr "" -#: includes/class-aldolat-twitter-core.php:77 +#: includes/class-aldolat-twitter-core.php:79 msgid "No response from Twitter" msgstr "" #. translators: The original tweet author name and link. -#: includes/class-aldolat-twitter-core.php:194 +#: includes/class-aldolat-twitter-core.php:200 msgid "In reply to %s" msgstr "" -#: includes/class-aldolat-twitter-core.php:220 +#: includes/class-aldolat-twitter-core.php:226 msgid "by" msgstr "" #. translators: date and tweet author name -#: includes/class-aldolat-twitter-core.php:227 +#: includes/class-aldolat-twitter-core.php:233 msgid "(RT on %1$s by %2$s)" msgstr "" -#: includes/class-aldolat-twitter-core.php:329 +#: includes/class-aldolat-twitter-core.php:335 msgid "ago" msgstr "" @@ -66,110 +66,114 @@ msgstr "" msgid "Publish your tweets in your blog" msgstr "" -#: includes/class-aldolat-twitter-widget.php:170 +#: includes/class-aldolat-twitter-widget.php:171 msgid "Title of the widget" msgstr "" -#: includes/class-aldolat-twitter-widget.php:175 +#: includes/class-aldolat-twitter-widget.php:176 msgid "Title:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:183 +#: includes/class-aldolat-twitter-widget.php:184 msgid "Introductory text" msgstr "" -#: includes/class-aldolat-twitter-widget.php:188 +#: includes/class-aldolat-twitter-widget.php:189 msgid "Place this text after the title:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:192 +#: includes/class-aldolat-twitter-widget.php:193 msgid "These are my latest tweets. Follow me on Twitter!" msgstr "" -#: includes/class-aldolat-twitter-widget.php:193 +#: includes/class-aldolat-twitter-widget.php:194 msgid "You can use some HTML, as you would do when writing a post." msgstr "" -#: includes/class-aldolat-twitter-widget.php:198 +#: includes/class-aldolat-twitter-widget.php:199 msgid "Setup" msgstr "" -#: includes/class-aldolat-twitter-widget.php:203 +#: includes/class-aldolat-twitter-widget.php:204 msgid "Username on Twitter:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:207 +#: includes/class-aldolat-twitter-widget.php:208 msgid "username" msgstr "" -#: includes/class-aldolat-twitter-widget.php:208 +#: includes/class-aldolat-twitter-widget.php:209 msgid "This is the only mandatory option." msgstr "" -#: includes/class-aldolat-twitter-widget.php:215 +#: includes/class-aldolat-twitter-widget.php:216 msgid "Timeline" msgstr "" -#: includes/class-aldolat-twitter-widget.php:219 +#: includes/class-aldolat-twitter-widget.php:220 msgid "Favorites" msgstr "" -#: includes/class-aldolat-twitter-widget.php:232 +#: includes/class-aldolat-twitter-widget.php:233 msgid "Number of items:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:241 +#: includes/class-aldolat-twitter-widget.php:242 msgid "Exclude replies" msgstr "" -#: includes/class-aldolat-twitter-widget.php:249 +#: includes/class-aldolat-twitter-widget.php:250 msgid "Include retweets" msgstr "" -#: includes/class-aldolat-twitter-widget.php:257 +#: includes/class-aldolat-twitter-widget.php:258 +msgid "Display user profile picture" +msgstr "" + +#: includes/class-aldolat-twitter-widget.php:266 msgid "Cache duration:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:262 +#: includes/class-aldolat-twitter-widget.php:271 msgid "In minutes. The minimum accepted value is 5." msgstr "" -#: includes/class-aldolat-twitter-widget.php:267 +#: includes/class-aldolat-twitter-widget.php:276 msgid "Open links in a new browser tab" msgstr "" -#: includes/class-aldolat-twitter-widget.php:274 +#: includes/class-aldolat-twitter-widget.php:283 msgid "Twitter authentication" msgstr "" -#: includes/class-aldolat-twitter-widget.php:279 +#: includes/class-aldolat-twitter-widget.php:288 msgid "Consumer Key:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:284 +#: includes/class-aldolat-twitter-widget.php:293 msgid "Insert Consumer Key" msgstr "" -#: includes/class-aldolat-twitter-widget.php:291 +#: includes/class-aldolat-twitter-widget.php:300 msgid "Consumer secret:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:296 +#: includes/class-aldolat-twitter-widget.php:305 msgid "Insert Consumer Secret" msgstr "" -#: includes/class-aldolat-twitter-widget.php:303 +#: includes/class-aldolat-twitter-widget.php:312 msgid "Oauth token:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:308 +#: includes/class-aldolat-twitter-widget.php:317 msgid "Insert Oauth Token" msgstr "" -#: includes/class-aldolat-twitter-widget.php:315 +#: includes/class-aldolat-twitter-widget.php:324 msgid "Oauth token secret:" msgstr "" -#: includes/class-aldolat-twitter-widget.php:320 +#: includes/class-aldolat-twitter-widget.php:329 msgid "Insert Oauth Token Secret" msgstr "" diff --git a/readme.txt b/readme.txt index 624fe4a..4baad30 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://dev.aldolat.it/projects/aldolat-twitter/ Tags: twitter, sidebar, widget Requires at least: 5.4 Tested up to: 5.7 -Stable tag: 0.5.0 +Stable tag: 0.6.0 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html