Skip to content

Commit

Permalink
Fixed issue with [Reading Time WP](https://wordpress.org/plugins/read…
Browse files Browse the repository at this point in the history
…ing-time-wp/) it returns string instead number for reading time less than 1 minute. Props for Radosław Serba.
  • Loading branch information
iworks committed Aug 16, 2022
1 parent 8d2f357 commit 4a39f1b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ public function add_reading_time( $twitter ) {
$rt_reading_time_options = get_option( 'rt_reading_time_options' );
$reading_time_wp = new Reading_Time_WP();
$time = $reading_time_wp->rt_calculate_reading_time( get_the_ID(), $rt_reading_time_options );
$data = intval( $time );
if ( '< 1' === $time ) {
$time = 1;
}
$time = intval( $time );
if ( 0 < $time ) {
if ( ! isset( $twitter['labels'] ) ) {
$twitter['labels'] = array();
}
$twitter['labels'][] = array(
'label' => $rt_reading_time_options['label'],
'label' => __( 'Reading time', 'og' ),
'data' => sprintf(
_n( '%d minute', '%d minutes', $time, 'og' ),
$time
Expand Down
73 changes: 49 additions & 24 deletions languages/og.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (C) 2021 Marcin Pietrzak
# This file is distributed under the GNU GPL.
# Copyright (C) 2022 AUTHOR_NAME
# This file is distributed under the GPL v2 or later.
msgid ""
msgstr ""
"Project-Id-Version: OG - Better Share on Social Media 2.9.2\n"
"Project-Id-Version: OG Better Share on Social Media PLUGIN_VERSION\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/og\n"
"POT-Creation-Date: 2021-11-19 08:19:52+00:00\n"
"POT-Creation-Date: 2022-08-16 06:31:09+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2022-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: en\n"
Expand All @@ -24,32 +24,60 @@ msgstr ""
"X-Textdomain-Support: yes\n"
"X-Generator: grunt-wp-i18n 1.0.3\n"

#: includes/iworks/class-iworks-opengraph.php:110
#: includes/iworks/class-iworks-opengraph.php:131
msgid ""
"If you like <strong>OG</strong> please leave us a "
"%1$s&#9733;&#9733;&#9733;&#9733;&#9733;%2$s rating. A huge thanks in "
"advance!"
msgstr ""

#: includes/iworks/class-iworks-opengraph.php:237
#: includes/iworks/class-iworks-opengraph.php:259
msgid "<!-- OG: %s -->"
msgstr ""

#: includes/iworks/opengraph/integrations/class-iworks-opengraph-integrations-reading-time-wp.php:28
#: includes/iworks/opengraph/integrations/class-iworks-opengraph-integrations-reading-time-wp.php:34
msgid "Reading time"
msgstr ""

#: includes/iworks/opengraph/integrations/class-iworks-opengraph-integrations-reading-time-wp.php:36
msgid "%d minute"
msgid_plural "%d minutes"
msgstr[0] ""
msgstr[1] ""

#: includes/iworks/rate/rate.php:111
#: includes/iworks/rate/rate.php:124
msgid "Settings"
msgstr ""

#: includes/iworks/rate/rate.php:117
#: includes/iworks/rate/rate.php:130
#: includes/iworks/rate/templates/thanks.php:28
msgid "Provide us a coffee"
msgstr ""

#: includes/iworks/rate/rate.php:474
msgid "OpenGraph"
msgstr ""

#. Plugin Name of the plugin/theme
msgid "OG — Better Share on Social Media"
msgstr ""

#: includes/iworks/rate/rate.php:491
msgid "https://wordpress.org/plugins/og/"
msgstr ""

#: includes/iworks/rate/templates/plugins/og.php:2
msgid "Would you like to boost your website sharing abilities?"
msgstr ""

#: includes/iworks/rate/templates/plugins/og.php:7
msgid "Don't wait, install plugin %s!"
msgstr ""

#: includes/iworks/rate/templates/plugins/og.php:17
msgid "Install"
msgstr ""

#: includes/iworks/rate/templates/thanks.php:17
msgid "Thank you for using our plugin %s!"
msgstr ""
Expand Down Expand Up @@ -117,35 +145,32 @@ msgid ""
"Thank you for all the ratings, reviews and donates."
msgstr ""

#: og.php:17
#: og.php:28
msgid "OG"
msgstr ""

#. Plugin Name of the plugin/theme
msgid "OG - Better Share on Social Media"
msgstr ""

#. Author URI of the plugin/theme
msgid "http://iworks.pl/"
#. Plugin URI of the plugin/theme
msgid "PLUGIN_URI"
msgstr ""

#. Description of the plugin/theme
msgid ""
"Very tiny Open Graph plugin - add featured image as facebook image. This "
"plugin do not have any configuration - you can check how it works looking "
"into page source."
msgid "PLUGIN_DESCRIPTION"
msgstr ""

#. Author of the plugin/theme
msgid "Marcin Pietrzak"
msgid "AUTHOR_NAME"
msgstr ""

#. Author URI of the plugin/theme
msgid "AUTHOR_URI"
msgstr ""

#: includes/iworks/rate/rate.php:365
#: includes/iworks/rate/rate.php:405
msgctxt "plugins home"
msgid "https://wordpress.org/plugins/%s"
msgstr ""

#: includes/iworks/rate/rate.php:371
#: includes/iworks/rate/rate.php:411
msgctxt "plugins support home"
msgid "https://wordpress.org/support/plugin/%s"
msgstr ""
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ Rich filters implementation allows to change almost every output of this plugin,

== Changelog ==

= 3.1.7 (2022-08-16) =
* Fixed issue with [Reading Time WP](https://wordpress.org/plugins/reading-time-wp/) it returns string instead number for reading time less than 1 minute. Props for Radosław Serba.

= 3.1.6 (2022-08-05) =
* Removed post data if it is password protected entry (content, taxonomies). Props for [cris](http://og.iworks.pl/2022/06/23/3-1-5/#comment-3].

Expand Down

0 comments on commit 4a39f1b

Please sign in to comment.