diff --git a/CHANGELOG.md b/CHANGELOG.md
index c794b7f..435f08e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
+## [0.1.0] - 2020-06-14
+### Added
+* Added new method for getting links attributes.
+* Separated fetch method from returning tweets.
+
## [0.0.4] - 2020-06-13
### Added
* Added tweet author.
@@ -27,5 +32,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.1.0]: https://github.com/aldolat/aldolat-twitter/compare/0.0.4...0.1.0
+[0.0.4]: https://github.com/aldolat/aldolat-twitter/compare/0.0.3...0.0.4
[0.0.3]: https://github.com/aldolat/aldolat-twitter/compare/0.0.2...0.0.3
[0.0.2]: https://github.com/aldolat/aldolat-twitter/compare/0.0.1...0.0.2
diff --git a/README.md b/README.md
index 6d83ed1..263d6da 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
**Tags** twitter, sidebar, widget
**Requires at least** 5.4
**Tested up to** 5.4
-**Stable tag** 0.0.4
+**Stable tag** 0.1.0
**License** GPLv3 or later
**License URI** https://www.gnu.org/licenses/gpl-3.0.html
diff --git a/aldolat-twitter.php b/aldolat-twitter.php
index 6a782be..582a5c8 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.0.4
+ * Version: 0.1.0
* License: GPLv3 or later
* Text Domain: aldolat-twitter
* Domain Path: /languages/
@@ -57,6 +57,9 @@
exit( 'No script kiddies please!' );
}
+/**
+ * Run the class for setting up the plugin.
+ */
function aldolat_twitter_run() {
require_once 'includes/class-aldolat-twitter.php';
$aldolat_twitter = new Aldolat_Twitter();
diff --git a/changelog.txt b/changelog.txt
index 180817e..29dc701 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,10 @@
== Changelog ==
+= 0.1.0 =
+
+* Added new method for getting links attributes.
+* Separated fetch method from returning tweets.
+
= 0.0.4 =
* Added tweet author.
diff --git a/includes/class-aldolat-twitter-core.php b/includes/class-aldolat-twitter-core.php
index e034c55..599df65 100644
--- a/includes/class-aldolat-twitter-core.php
+++ b/includes/class-aldolat-twitter-core.php
@@ -1,6 +1,6 @@
'extended',
);
- $html = '
';
- return $html;
+ return $output;
}
/**
@@ -116,6 +133,7 @@ public function fetch() {
* @param integer $t The formatted datetime of the tweet.
* @return integer The difference in seconds
* @since 0.0.1
+ * @access private
*/
private function relative_time( $t ) {
$new_tweet_time = strtotime( $t );
@@ -128,16 +146,13 @@ private function relative_time( $t ) {
* @param object $tweet The object containing the tweet.
* @return string $tweet_text The resulting tweet with HTML.
* @since 0.0.1
+ * @access private
*/
private function format( $tweet ) {
$tweet_text = $tweet->full_text;
$tweet_entities = array();
- if ( $this->plugin_settings['new_tab'] ) {
- $new_tab_text = 'rel="external noreferrer nofollow noopener" target="_blank" ';
- } else {
- $new_tab_text = '';
- }
+ $new_tab_text = $this->new_tab( $this->plugin_settings['new_tab'] );
foreach ( $tweet->entities->urls as $url ) {
$tweet_entities[] = array(
@@ -181,6 +196,8 @@ private function format( $tweet ) {
*
* @param string $tweet_time The formatted time of the tweet.
* @return string $time The datetime of the tweet or the '... ago' form.
+ * @since 0.0.1
+ * @access private
*/
private function get_tweet_time( $tweet_time ) {
// Get the local GMT offset and date/time formats.
@@ -199,4 +216,22 @@ private function get_tweet_time( $tweet_time ) {
return $time;
}
+
+ /**
+ * Get the HTML rel attribute for links.
+ *
+ * @param bool $new_tab Whether the browser should open links in a new tab.
+ * @return string $text The rel and target attributes for links.
+ * @since 0.1.0
+ * @access private
+ */
+ private function new_tab( $new_tab ) {
+ if ( $new_tab ) {
+ $text = 'rel="external noreferrer nofollow noopener" target="_blank" ';
+ } else {
+ $text = '';
+ }
+
+ return $text;
+ }
}
diff --git a/includes/class-aldolat-twitter-widget.php b/includes/class-aldolat-twitter-widget.php
index 3ad250d..2e0ea8c 100644
--- a/includes/class-aldolat-twitter-widget.php
+++ b/includes/class-aldolat-twitter-widget.php
@@ -91,7 +91,7 @@ public function widget( $args, $instance ) {
'widget_id' => $args['widget_id'],
);
$aldolat_tweets = new Aldolat_Twitter_Core( $params );
- echo $aldolat_tweets->fetch();
+ echo $aldolat_tweets->get_tweets();
echo $args['after_widget'];
diff --git a/includes/class-aldolat-twitter.php b/includes/class-aldolat-twitter.php
index 5533e52..eed6806 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.0.4';
+ $this->plugin_version = '0.1.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 5cc0b17..674c45d 100644
--- a/languages/aldolat-twitter-it_IT.po
+++ b/languages/aldolat-twitter-it_IT.po
@@ -5,7 +5,7 @@ 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: 2020-06-13T22:19:00+02:00\n"
+"POT-Creation-Date: 2020-06-14T08:22:12+02:00\n"
"PO-Revision-Date: 2020-06-05 21:56+0200\n"
"Last-Translator: Aldo Latino \n"
"Language-Team: Italian \n"
@@ -43,11 +43,11 @@ msgstr "https://www.aldolat.it/"
msgid "My latest tweets"
msgstr "I miei ultimi tweet"
-#: includes/class-aldolat-twitter-core.php:102
+#: includes/class-aldolat-twitter-core.php:116
msgid "by"
msgstr "di"
-#: includes/class-aldolat-twitter-core.php:197
+#: includes/class-aldolat-twitter-core.php:214
msgid "ago"
msgstr "fa"
diff --git a/languages/aldolat-twitter.pot b/languages/aldolat-twitter.pot
index 003de17..c7318a3 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.0.4\n"
+"Project-Id-Version: Aldolat Twitter 0.1.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: 2020-06-13T22:19:00+02:00\n"
+"POT-Creation-Date: 2020-06-14T08:22:12+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"
@@ -40,11 +40,11 @@ msgstr ""
msgid "My latest tweets"
msgstr ""
-#: includes/class-aldolat-twitter-core.php:102
+#: includes/class-aldolat-twitter-core.php:116
msgid "by"
msgstr ""
-#: includes/class-aldolat-twitter-core.php:197
+#: includes/class-aldolat-twitter-core.php:214
msgid "ago"
msgstr ""
diff --git a/readme.txt b/readme.txt
index 970178f..7777a74 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.4
-Stable tag: 0.0.4
+Stable tag: 0.1.0
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html