Changeset 3190691
- Timestamp:
- 11/17/2024 03:46:54 PM (17 months ago)
- Location:
- reading-time-wp
- Files:
-
- 4 edited
- 1 copied
-
tags/2.0.17 (copied) (copied from reading-time-wp/trunk)
-
tags/2.0.17/readme.txt (modified) (3 diffs)
-
tags/2.0.17/rt-reading-time.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/rt-reading-time.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
reading-time-wp/tags/2.0.17/readme.txt
r3068141 r3190691 4 4 Tags: reading time, estimated time, word count, time, posts, page, reading 5 5 Requires at least: 3.0.1 6 Tested up to: 6. 5.27 Stable tag: 2.0.1 66 Tested up to: 6.7 7 Stable tag: 2.0.17 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 WP Reading Time let's you easily add an estimated reading time to your WordPress posts. Activating the plugin will automatically add the reading time to the beginning of your post's content. This can be deactivated in the Reading Time settings which can be accessed from your Dashboard's Settings menu. You can also edit the label and postfix from this menu. 16 16 17 If you'd prefer more control over where you add your reading time you can use the the [rt_reading_time] shortcode to insert the time into a post. This shortcode also excepts values for label and postfix. These are optional. Ex. [rt_reading_time label="Reading Time:" postfix="minutes" ].17 If you'd prefer more control over where you add your reading time you can use the the [rt_reading_time] shortcode to insert the time into a post. This shortcode also excepts values for label and postfix. These are optional. Ex. [rt_reading_time label="Reading Time:" postfix="minutes" postfix_singular="minute"]. 18 18 19 19 == Installation == … … 75 75 76 76 == Changelog == 77 78 = 2.0.17 = 79 * Moved reading time output to function 80 * Added filter for reading time output `rtwp_filter_reading_time_output` passes 4 arguments: `$output`, `$label`, `$reading_time`, `$postfix` 81 * WordPress 6.7 support 77 82 78 83 = 2.0.16 = -
reading-time-wp/tags/2.0.17/rt-reading-time.php
r3068141 r3190691 8 8 * Plugin URI: https://jasonyingling.me/reading-time-wp/ 9 9 * Description: Add an estimated reading time to your posts. 10 * Version: 2.0.1 610 * Version: 2.0.17 11 11 * Author: Jason Yingling 12 12 * Author URI: https://jasonyingling.me … … 242 242 $rt_post = $atts['post_id'] && ( get_post_status( $atts['post_id'] ) ) ? $atts['post_id'] : get_the_ID(); 243 243 244 $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 245 246 $calculated_postfix = $this->rt_add_postfix( $this->reading_time, $atts['postfix_singular'], $atts['postfix'] ); 247 248 return '<span class="span-reading-time rt-reading-time"><span class="rt-label rt-prefix">' . wp_kses( $atts['label'], $this->rtwp_kses ) . '</span> <span class="rt-time"> ' . esc_html( $this->reading_time ) . '</span> <span class="rt-label rt-postfix">' . wp_kses( $calculated_postfix, $this->rtwp_kses ) . '</span></span>'; 244 // Store the result of $this->rt_calculate_reading_time in a variable 245 $reading_time = $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 246 247 $calculated_postfix = $this->rt_add_postfix( $reading_time, $atts['postfix_singular'], $atts['postfix'] ); 248 249 $output = $this->rt_generate_reading_time_output( $atts['label'], $reading_time, $calculated_postfix ); 250 251 return $output; 252 } 253 254 /** 255 * Generate the reading time output. 256 * 257 * @param string $label The label for the reading time. 258 * @param string $reading_time The calculated reading time. 259 * @param string $postfix The postfix for the reading time. 260 * @return string The generated reading time output. 261 */ 262 public function rt_generate_reading_time_output( $label, $reading_time, $postfix, $style = '' ) { 263 if ( $style !== '' ) { 264 $style = ' style="display: ' . esc_attr( $style ) . ';"'; 265 } 266 $output = '<span class="span-reading-time rt-reading-time"' . $style . '><span class="rt-label rt-prefix">' . wp_kses( $label, $this->rtwp_kses ) . '</span> <span class="rt-time"> ' . esc_html( $reading_time ) . '</span> <span class="rt-label rt-postfix">' . wp_kses( $postfix, $this->rtwp_kses ) . '</span></span>'; 267 return apply_filters( 'rtwp_filter_reading_time_output', $output, $label, $reading_time, $postfix ); 249 268 } 250 269 … … 305 324 $rt_post = get_the_ID(); 306 325 307 $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 326 // Store the result of $this->rt_calculate_reading_time in a variable 327 $reading_time = $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 308 328 309 329 $label = $rt_reading_time_options['label']; … … 315 335 } 316 336 317 $calculated_postfix = $this->rt_add_postfix( $ this->reading_time, $postfix_singular, $postfix );318 319 $content = '<span class="rt-reading-time" style="display: block;"><span class="rt-label rt-prefix">' . wp_kses( $label, $this->rtwp_kses ) . '</span> <span class="rt-time">' . esc_html( $this->reading_time ) . '</span> <span class="rt-label rt-postfix">' . wp_kses( $calculated_postfix, $this->rtwp_kses ) . '</span></span>';337 $calculated_postfix = $this->rt_add_postfix( $reading_time, $postfix_singular, $postfix ); 338 339 $content = $this->rt_generate_reading_time_output( $label, $reading_time, $calculated_postfix, 'block' ); 320 340 $content .= $original_content; 321 341 return $content; … … 351 371 $rt_post = get_the_ID(); 352 372 353 $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 373 // Store the result of $this->rt_calculate_reading_time in a variable 374 $reading_time = $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 354 375 355 376 $label = $rt_reading_time_options['label']; … … 359 380 $calculated_postfix = $this->rt_add_postfix( $this->reading_time, $postfix_singular, $postfix ); 360 381 361 $content = '<span class="rt-reading-time" style="display: block;"><span class="rt-label rt-prefix">' . wp_kses( $label, $this->rtwp_kses ) . '</span> <span class="rt-time">' . esc_html( $this->reading_time ) . '</span> <span class="rt-label rt-postfix">' . wp_kses( $calculated_postfix, $this->rtwp_kses ) . '</span></span> ';382 $content = $this->rt_generate_reading_time_output( $label, $reading_time, $calculated_postfix, 'block' ); 362 383 $content .= $original_content; 363 384 return $content; -
reading-time-wp/trunk/readme.txt
r3068141 r3190691 4 4 Tags: reading time, estimated time, word count, time, posts, page, reading 5 5 Requires at least: 3.0.1 6 Tested up to: 6. 5.27 Stable tag: 2.0.1 66 Tested up to: 6.7 7 Stable tag: 2.0.17 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 WP Reading Time let's you easily add an estimated reading time to your WordPress posts. Activating the plugin will automatically add the reading time to the beginning of your post's content. This can be deactivated in the Reading Time settings which can be accessed from your Dashboard's Settings menu. You can also edit the label and postfix from this menu. 16 16 17 If you'd prefer more control over where you add your reading time you can use the the [rt_reading_time] shortcode to insert the time into a post. This shortcode also excepts values for label and postfix. These are optional. Ex. [rt_reading_time label="Reading Time:" postfix="minutes" ].17 If you'd prefer more control over where you add your reading time you can use the the [rt_reading_time] shortcode to insert the time into a post. This shortcode also excepts values for label and postfix. These are optional. Ex. [rt_reading_time label="Reading Time:" postfix="minutes" postfix_singular="minute"]. 18 18 19 19 == Installation == … … 75 75 76 76 == Changelog == 77 78 = 2.0.17 = 79 * Moved reading time output to function 80 * Added filter for reading time output `rtwp_filter_reading_time_output` passes 4 arguments: `$output`, `$label`, `$reading_time`, `$postfix` 81 * WordPress 6.7 support 77 82 78 83 = 2.0.16 = -
reading-time-wp/trunk/rt-reading-time.php
r3068141 r3190691 8 8 * Plugin URI: https://jasonyingling.me/reading-time-wp/ 9 9 * Description: Add an estimated reading time to your posts. 10 * Version: 2.0.1 610 * Version: 2.0.17 11 11 * Author: Jason Yingling 12 12 * Author URI: https://jasonyingling.me … … 242 242 $rt_post = $atts['post_id'] && ( get_post_status( $atts['post_id'] ) ) ? $atts['post_id'] : get_the_ID(); 243 243 244 $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 245 246 $calculated_postfix = $this->rt_add_postfix( $this->reading_time, $atts['postfix_singular'], $atts['postfix'] ); 247 248 return '<span class="span-reading-time rt-reading-time"><span class="rt-label rt-prefix">' . wp_kses( $atts['label'], $this->rtwp_kses ) . '</span> <span class="rt-time"> ' . esc_html( $this->reading_time ) . '</span> <span class="rt-label rt-postfix">' . wp_kses( $calculated_postfix, $this->rtwp_kses ) . '</span></span>'; 244 // Store the result of $this->rt_calculate_reading_time in a variable 245 $reading_time = $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 246 247 $calculated_postfix = $this->rt_add_postfix( $reading_time, $atts['postfix_singular'], $atts['postfix'] ); 248 249 $output = $this->rt_generate_reading_time_output( $atts['label'], $reading_time, $calculated_postfix ); 250 251 return $output; 252 } 253 254 /** 255 * Generate the reading time output. 256 * 257 * @param string $label The label for the reading time. 258 * @param string $reading_time The calculated reading time. 259 * @param string $postfix The postfix for the reading time. 260 * @return string The generated reading time output. 261 */ 262 public function rt_generate_reading_time_output( $label, $reading_time, $postfix, $style = '' ) { 263 if ( $style !== '' ) { 264 $style = ' style="display: ' . esc_attr( $style ) . ';"'; 265 } 266 $output = '<span class="span-reading-time rt-reading-time"' . $style . '><span class="rt-label rt-prefix">' . wp_kses( $label, $this->rtwp_kses ) . '</span> <span class="rt-time"> ' . esc_html( $reading_time ) . '</span> <span class="rt-label rt-postfix">' . wp_kses( $postfix, $this->rtwp_kses ) . '</span></span>'; 267 return apply_filters( 'rtwp_filter_reading_time_output', $output, $label, $reading_time, $postfix ); 249 268 } 250 269 … … 305 324 $rt_post = get_the_ID(); 306 325 307 $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 326 // Store the result of $this->rt_calculate_reading_time in a variable 327 $reading_time = $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 308 328 309 329 $label = $rt_reading_time_options['label']; … … 315 335 } 316 336 317 $calculated_postfix = $this->rt_add_postfix( $ this->reading_time, $postfix_singular, $postfix );318 319 $content = '<span class="rt-reading-time" style="display: block;"><span class="rt-label rt-prefix">' . wp_kses( $label, $this->rtwp_kses ) . '</span> <span class="rt-time">' . esc_html( $this->reading_time ) . '</span> <span class="rt-label rt-postfix">' . wp_kses( $calculated_postfix, $this->rtwp_kses ) . '</span></span>';337 $calculated_postfix = $this->rt_add_postfix( $reading_time, $postfix_singular, $postfix ); 338 339 $content = $this->rt_generate_reading_time_output( $label, $reading_time, $calculated_postfix, 'block' ); 320 340 $content .= $original_content; 321 341 return $content; … … 351 371 $rt_post = get_the_ID(); 352 372 353 $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 373 // Store the result of $this->rt_calculate_reading_time in a variable 374 $reading_time = $this->rt_calculate_reading_time( $rt_post, $rt_reading_time_options ); 354 375 355 376 $label = $rt_reading_time_options['label']; … … 359 380 $calculated_postfix = $this->rt_add_postfix( $this->reading_time, $postfix_singular, $postfix ); 360 381 361 $content = '<span class="rt-reading-time" style="display: block;"><span class="rt-label rt-prefix">' . wp_kses( $label, $this->rtwp_kses ) . '</span> <span class="rt-time">' . esc_html( $this->reading_time ) . '</span> <span class="rt-label rt-postfix">' . wp_kses( $calculated_postfix, $this->rtwp_kses ) . '</span></span> ';382 $content = $this->rt_generate_reading_time_output( $label, $reading_time, $calculated_postfix, 'block' ); 362 383 $content .= $original_content; 363 384 return $content;
Note: See TracChangeset
for help on using the changeset viewer.