Changeset 2885658
- Timestamp:
- 03/23/2023 12:51:20 PM (3 years ago)
- Location:
- wptelegram
- Files:
-
- 2 added
- 18 edited
- 1 copied
-
tags/4.0.9 (copied) (copied from wptelegram/trunk)
-
tags/4.0.9/README.txt (modified) (2 diffs)
-
tags/4.0.9/changelog.md (modified) (1 diff)
-
tags/4.0.9/includes/TemplateGuard.php (added)
-
tags/4.0.9/includes/Utils.php (modified) (2 diffs)
-
tags/4.0.9/includes/format-text/src/Converter/LinkConverter.php (modified) (1 diff)
-
tags/4.0.9/includes/format-text/src/HtmlConverter.php (modified) (2 diffs)
-
tags/4.0.9/languages/wptelegram.pot (modified) (1 diff)
-
tags/4.0.9/modules/notify/NotifySender.php (modified) (1 diff)
-
tags/4.0.9/modules/p2tg/PostData.php (modified) (1 diff)
-
tags/4.0.9/wptelegram.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/changelog.md (modified) (1 diff)
-
trunk/includes/TemplateGuard.php (added)
-
trunk/includes/Utils.php (modified) (2 diffs)
-
trunk/includes/format-text/src/Converter/LinkConverter.php (modified) (1 diff)
-
trunk/includes/format-text/src/HtmlConverter.php (modified) (2 diffs)
-
trunk/languages/wptelegram.pot (modified) (1 diff)
-
trunk/modules/notify/NotifySender.php (modified) (1 diff)
-
trunk/modules/p2tg/PostData.php (modified) (1 diff)
-
trunk/wptelegram.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wptelegram/tags/4.0.9/README.txt
r2878741 r2885658 1 1 === WP Telegram (Auto Post and Notifications) === 2 2 Contributors: wpsocio, irshadahmad21 3 Donate link: https://wpsocio.com 3 Donate link: https://wpsocio.com/donate 4 4 Tags: telegram, notifications, posts, channel, group 5 5 Requires at least: 5.8 6 6 Requires PHP: 7.2 7 7 Tested up to: 6.1.1 8 Stable tag: 4.0. 88 Stable tag: 4.0.9 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 206 206 == Changelog == 207 207 208 = 4.0.9 = 209 - Improved message template sanitization to prevent breaking the markup 210 - Added a new filter `wptelegram_p2tg_post_data_plain_excerpt` to allow sending plain text excerpt 211 - Fixed the links added in parenthesis when "Formatting" is set to "None" 212 208 213 = 4.0.8 = 209 214 - Fixed the broken hyperlinks in Message Template when using custom field link -
wptelegram/tags/4.0.9/changelog.md
r2878741 r2885658 4 4 5 5 ## Unreleased 6 7 ## [4.0.9 - 2023-03-23](https://github.com/wpsocio/wptelegram/releases/tag/v4.0.9) 8 9 ### Enhancements 10 11 - Improved message template sanitization to prevent breaking the markup 12 - Added a new filter `wptelegram_p2tg_post_data_plain_excerpt` to allow sending plain text excerpt 13 14 ### Bug fixes 15 16 - Fixed the links added in parenthesis when "Formatting" is set to "None" 6 17 7 18 ## [4.0.8 - 2023-03-12](https://github.com/wpsocio/wptelegram/releases/tag/v4.0.8) -
wptelegram/tags/4.0.9/includes/Utils.php
r2878741 r2885658 269 269 return ''; 270 270 } 271 272 $filtered = wp_check_invalid_utf8( (string) $value ); 273 274 $allowed_protocols = []; 275 276 // If the Message Template contains a link with {cf: field as the href, 277 // We need to allow "{cf" as a protocol to avoid wp_kses() stripping the link. 278 if ( preg_match( '/<a[^>]href=["\']{cf:/', $filtered ) ) { 279 $allowed_protocols = array_merge( wp_allowed_protocols(), [ '{cf' ] ); 280 } 281 282 $allowed_protocols = apply_filters( 'wptelegram_message_template_allowed_protocols', $allowed_protocols, $filtered ); 283 284 $filtered = trim( wp_kses( $filtered, self::SUPPORTED_HTML_TAGS, $allowed_protocols ) ); 271 $value = (string) $value; 272 273 $guard = new TemplateGuard(); 274 275 $value = $guard->safeguard_macros( $value ); 276 277 $filtered = wp_check_invalid_utf8( $value ); 278 279 $filtered = trim( wp_kses( $filtered, self::SUPPORTED_HTML_TAGS ) ); 280 281 // Restore the macros with the original values. 282 $filtered = $guard->restore_macros( $filtered ); 285 283 286 284 if ( $json_encode ) { … … 496 494 497 495 $defaults = [ 498 'elipsis' => '…', 499 'format_to' => 'text', 500 'id' => 'default', 501 'limit' => 55, 502 'limit_by' => 'words', 503 'preserve_eol' => true, 496 'elipsis' => '…', 497 'format_to' => 'text', 498 'id' => 'default', 499 'limit' => 55, 500 'limit_by' => 'words', 501 'text_hyperlinks' => 'strip', 502 'preserve_eol' => true, 504 503 ]; 505 504 -
wptelegram/tags/4.0.9/includes/format-text/src/Converter/LinkConverter.php
r2873093 r2885658 44 44 } 45 45 46 $ retainHyperlinks = $this->config->getOption( 'retain_hyperlinks', true);46 $textHyperlinks = $this->config->getOption( 'text_hyperlinks', 'retain' ); 47 47 48 $format = $retainHyperlinks ? '%1$s (%2$s)' : '%1$s';48 $format = 'retain' === $textHyperlinks ? '%1$s (%2$s)' : '%1$s'; 49 49 50 50 return sprintf( $format, $text, $href ); -
wptelegram/tags/4.0.9/includes/format-text/src/HtmlConverter.php
r2874222 r2885658 65 65 // Set to false to keep display:none elements. 66 66 'remove_display_none' => true, 67 // Set to false to remove hyperlinks being added in parentheses when formatting to 'text'.68 'retain_hyperlinks' => true,69 67 // A callable to determine if a node should be converted. 70 68 'should_convert_cb' => null, … … 77 75 // Set the default separator for each <tr>. 78 76 'table_row_sep' => "\n" . str_repeat( '-', 20 ) . "\n", 77 // Set to 'strip' to remove hyperlinks being added in parentheses when formatting to 'text'. 78 'text_hyperlinks' => 'retain', 79 79 // Whether to throw an exception when document parsing fails. 80 80 'throw_on_doc_error' => false, -
wptelegram/tags/4.0.9/languages/wptelegram.pot
r2878741 r2885658 5 5 "Project-Id-Version: \n" 6 6 "Report-Msgid-Bugs-To: https://github.com/wpsocio/wptelegram\n" 7 "POT-Creation-Date: 2023-03- 12 17:29:13+00:00\n"7 "POT-Creation-Date: 2023-03-23 12:50:29+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=utf-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "PO-Revision-Date: 2023-03- 12 17:290\n"11 "PO-Revision-Date: 2023-03-23 12:500\n" 12 12 "Last-Translator: WP Telegram\n" 13 13 "Language-Team: WP Telegram\n" -
wptelegram/tags/4.0.9/modules/notify/NotifySender.php
r2874222 r2885658 294 294 'limit' => $limit, 295 295 'limit_by' => 'chars', 296 'text_hyperlinks' => 'retain', 296 297 'images_in_links' => [ 297 298 'title_or_alt' => 'retain', -
wptelegram/tags/4.0.9/modules/p2tg/PostData.php
r2873851 r2885658 192 192 ] 193 193 ); 194 195 $plain_excerpt = apply_filters( 'wptelegram_p2tg_post_data_plain_excerpt', false, $value, $excerpt, $this->post, $options ); 196 197 if ( $plain_excerpt ) { 198 $value = trim( wp_strip_all_tags( $value ) ); 199 } 200 194 201 // If the excerpt is not empty. 195 202 if ( $value ) { -
wptelegram/tags/4.0.9/wptelegram.php
r2878741 r2885658 11 11 * Plugin URI: https://t.me/WPTelegram 12 12 * Description: Integrate your WordPress website perfectly with Telegram. Send posts automatically to Telegram when published or updated, whether to a Telegram Channel, Group or private chat, with full control. Get your email notifications on Telegram. 13 * Version: 4.0. 813 * Version: 4.0.9 14 14 * Requires at least: 5.8 15 15 * Requires PHP: 7.2 … … 27 27 } 28 28 29 define( 'WPTELEGRAM_VER', '4.0. 8' );29 define( 'WPTELEGRAM_VER', '4.0.9' ); 30 30 31 31 defined( 'WPTELEGRAM_MAIN_FILE' ) || define( 'WPTELEGRAM_MAIN_FILE', __FILE__ ); -
wptelegram/trunk/README.txt
r2878741 r2885658 1 1 === WP Telegram (Auto Post and Notifications) === 2 2 Contributors: wpsocio, irshadahmad21 3 Donate link: https://wpsocio.com 3 Donate link: https://wpsocio.com/donate 4 4 Tags: telegram, notifications, posts, channel, group 5 5 Requires at least: 5.8 6 6 Requires PHP: 7.2 7 7 Tested up to: 6.1.1 8 Stable tag: 4.0. 88 Stable tag: 4.0.9 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 206 206 == Changelog == 207 207 208 = 4.0.9 = 209 - Improved message template sanitization to prevent breaking the markup 210 - Added a new filter `wptelegram_p2tg_post_data_plain_excerpt` to allow sending plain text excerpt 211 - Fixed the links added in parenthesis when "Formatting" is set to "None" 212 208 213 = 4.0.8 = 209 214 - Fixed the broken hyperlinks in Message Template when using custom field link -
wptelegram/trunk/changelog.md
r2878741 r2885658 4 4 5 5 ## Unreleased 6 7 ## [4.0.9 - 2023-03-23](https://github.com/wpsocio/wptelegram/releases/tag/v4.0.9) 8 9 ### Enhancements 10 11 - Improved message template sanitization to prevent breaking the markup 12 - Added a new filter `wptelegram_p2tg_post_data_plain_excerpt` to allow sending plain text excerpt 13 14 ### Bug fixes 15 16 - Fixed the links added in parenthesis when "Formatting" is set to "None" 6 17 7 18 ## [4.0.8 - 2023-03-12](https://github.com/wpsocio/wptelegram/releases/tag/v4.0.8) -
wptelegram/trunk/includes/Utils.php
r2878741 r2885658 269 269 return ''; 270 270 } 271 272 $filtered = wp_check_invalid_utf8( (string) $value ); 273 274 $allowed_protocols = []; 275 276 // If the Message Template contains a link with {cf: field as the href, 277 // We need to allow "{cf" as a protocol to avoid wp_kses() stripping the link. 278 if ( preg_match( '/<a[^>]href=["\']{cf:/', $filtered ) ) { 279 $allowed_protocols = array_merge( wp_allowed_protocols(), [ '{cf' ] ); 280 } 281 282 $allowed_protocols = apply_filters( 'wptelegram_message_template_allowed_protocols', $allowed_protocols, $filtered ); 283 284 $filtered = trim( wp_kses( $filtered, self::SUPPORTED_HTML_TAGS, $allowed_protocols ) ); 271 $value = (string) $value; 272 273 $guard = new TemplateGuard(); 274 275 $value = $guard->safeguard_macros( $value ); 276 277 $filtered = wp_check_invalid_utf8( $value ); 278 279 $filtered = trim( wp_kses( $filtered, self::SUPPORTED_HTML_TAGS ) ); 280 281 // Restore the macros with the original values. 282 $filtered = $guard->restore_macros( $filtered ); 285 283 286 284 if ( $json_encode ) { … … 496 494 497 495 $defaults = [ 498 'elipsis' => '…', 499 'format_to' => 'text', 500 'id' => 'default', 501 'limit' => 55, 502 'limit_by' => 'words', 503 'preserve_eol' => true, 496 'elipsis' => '…', 497 'format_to' => 'text', 498 'id' => 'default', 499 'limit' => 55, 500 'limit_by' => 'words', 501 'text_hyperlinks' => 'strip', 502 'preserve_eol' => true, 504 503 ]; 505 504 -
wptelegram/trunk/includes/format-text/src/Converter/LinkConverter.php
r2873093 r2885658 44 44 } 45 45 46 $ retainHyperlinks = $this->config->getOption( 'retain_hyperlinks', true);46 $textHyperlinks = $this->config->getOption( 'text_hyperlinks', 'retain' ); 47 47 48 $format = $retainHyperlinks ? '%1$s (%2$s)' : '%1$s';48 $format = 'retain' === $textHyperlinks ? '%1$s (%2$s)' : '%1$s'; 49 49 50 50 return sprintf( $format, $text, $href ); -
wptelegram/trunk/includes/format-text/src/HtmlConverter.php
r2874222 r2885658 65 65 // Set to false to keep display:none elements. 66 66 'remove_display_none' => true, 67 // Set to false to remove hyperlinks being added in parentheses when formatting to 'text'.68 'retain_hyperlinks' => true,69 67 // A callable to determine if a node should be converted. 70 68 'should_convert_cb' => null, … … 77 75 // Set the default separator for each <tr>. 78 76 'table_row_sep' => "\n" . str_repeat( '-', 20 ) . "\n", 77 // Set to 'strip' to remove hyperlinks being added in parentheses when formatting to 'text'. 78 'text_hyperlinks' => 'retain', 79 79 // Whether to throw an exception when document parsing fails. 80 80 'throw_on_doc_error' => false, -
wptelegram/trunk/languages/wptelegram.pot
r2878741 r2885658 5 5 "Project-Id-Version: \n" 6 6 "Report-Msgid-Bugs-To: https://github.com/wpsocio/wptelegram\n" 7 "POT-Creation-Date: 2023-03- 12 17:29:13+00:00\n"7 "POT-Creation-Date: 2023-03-23 12:50:29+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=utf-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "PO-Revision-Date: 2023-03- 12 17:290\n"11 "PO-Revision-Date: 2023-03-23 12:500\n" 12 12 "Last-Translator: WP Telegram\n" 13 13 "Language-Team: WP Telegram\n" -
wptelegram/trunk/modules/notify/NotifySender.php
r2874222 r2885658 294 294 'limit' => $limit, 295 295 'limit_by' => 'chars', 296 'text_hyperlinks' => 'retain', 296 297 'images_in_links' => [ 297 298 'title_or_alt' => 'retain', -
wptelegram/trunk/modules/p2tg/PostData.php
r2873851 r2885658 192 192 ] 193 193 ); 194 195 $plain_excerpt = apply_filters( 'wptelegram_p2tg_post_data_plain_excerpt', false, $value, $excerpt, $this->post, $options ); 196 197 if ( $plain_excerpt ) { 198 $value = trim( wp_strip_all_tags( $value ) ); 199 } 200 194 201 // If the excerpt is not empty. 195 202 if ( $value ) { -
wptelegram/trunk/wptelegram.php
r2878741 r2885658 11 11 * Plugin URI: https://t.me/WPTelegram 12 12 * Description: Integrate your WordPress website perfectly with Telegram. Send posts automatically to Telegram when published or updated, whether to a Telegram Channel, Group or private chat, with full control. Get your email notifications on Telegram. 13 * Version: 4.0. 813 * Version: 4.0.9 14 14 * Requires at least: 5.8 15 15 * Requires PHP: 7.2 … … 27 27 } 28 28 29 define( 'WPTELEGRAM_VER', '4.0. 8' );29 define( 'WPTELEGRAM_VER', '4.0.9' ); 30 30 31 31 defined( 'WPTELEGRAM_MAIN_FILE' ) || define( 'WPTELEGRAM_MAIN_FILE', __FILE__ );
Note: See TracChangeset
for help on using the changeset viewer.