Plugin Directory

Changeset 2885658


Ignore:
Timestamp:
03/23/2023 12:51:20 PM (3 years ago)
Author:
wpsocio
Message:

Update to version 4.0.9 from GitHub

Location:
wptelegram
Files:
2 added
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wptelegram/tags/4.0.9/README.txt

    r2878741 r2885658  
    11=== WP Telegram (Auto Post and Notifications) ===
    22Contributors: wpsocio, irshadahmad21
    3 Donate link: https://wpsocio.com
     3Donate link: https://wpsocio.com/donate
    44Tags: telegram, notifications, posts, channel, group
    55Requires at least: 5.8
    66Requires PHP: 7.2
    77Tested up to: 6.1.1
    8 Stable tag: 4.0.8
     8Stable tag: 4.0.9
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    206206== Changelog ==
    207207
     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
    208213= 4.0.8 =
    209214- Fixed the broken hyperlinks in Message Template when using custom field link
  • wptelegram/tags/4.0.9/changelog.md

    r2878741 r2885658  
    44
    55## 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"
    617
    718## [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  
    269269            return '';
    270270        }
    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 );
    285283
    286284        if ( $json_encode ) {
     
    496494
    497495        $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,
    504503        ];
    505504
  • wptelegram/tags/4.0.9/includes/format-text/src/Converter/LinkConverter.php

    r2873093 r2885658  
    4444        }
    4545
    46         $retainHyperlinks = $this->config->getOption( 'retain_hyperlinks', true );
     46        $textHyperlinks = $this->config->getOption( 'text_hyperlinks', 'retain' );
    4747
    48         $format = $retainHyperlinks ? '%1$s (%2$s)' : '%1$s';
     48        $format = 'retain' === $textHyperlinks ? '%1$s (%2$s)' : '%1$s';
    4949
    5050        return sprintf( $format, $text, $href );
  • wptelegram/tags/4.0.9/includes/format-text/src/HtmlConverter.php

    r2874222 r2885658  
    6565                // Set to false to keep display:none elements.
    6666                'remove_display_none' => true,
    67                 // Set to false to remove hyperlinks being added in parentheses when formatting to 'text'.
    68                 'retain_hyperlinks'   => true,
    6967                // A callable to determine if a node should be converted.
    7068                'should_convert_cb'   => null,
     
    7775                // Set the default separator for each <tr>.
    7876                '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',
    7979                // Whether to throw an exception when document parsing fails.
    8080                'throw_on_doc_error'  => false,
  • wptelegram/tags/4.0.9/languages/wptelegram.pot

    r2878741 r2885658  
    55"Project-Id-Version: \n"
    66"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"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
    1010"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"
    1212"Last-Translator: WP Telegram\n"
    1313"Language-Team: WP Telegram\n"
  • wptelegram/tags/4.0.9/modules/notify/NotifySender.php

    r2874222 r2885658  
    294294            'limit'           => $limit,
    295295            'limit_by'        => 'chars',
     296            'text_hyperlinks' => 'retain',
    296297            'images_in_links' => [
    297298                'title_or_alt'    => 'retain',
  • wptelegram/tags/4.0.9/modules/p2tg/PostData.php

    r2873851 r2885658  
    192192                    ]
    193193                );
     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
    194201                // If the excerpt is not empty.
    195202                if ( $value ) {
  • wptelegram/tags/4.0.9/wptelegram.php

    r2878741 r2885658  
    1111 * Plugin URI:        https://t.me/WPTelegram
    1212 * 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.8
     13 * Version:           4.0.9
    1414 * Requires at least: 5.8
    1515 * Requires PHP:      7.2
     
    2727}
    2828
    29 define( 'WPTELEGRAM_VER', '4.0.8' );
     29define( 'WPTELEGRAM_VER', '4.0.9' );
    3030
    3131defined( 'WPTELEGRAM_MAIN_FILE' ) || define( 'WPTELEGRAM_MAIN_FILE', __FILE__ );
  • wptelegram/trunk/README.txt

    r2878741 r2885658  
    11=== WP Telegram (Auto Post and Notifications) ===
    22Contributors: wpsocio, irshadahmad21
    3 Donate link: https://wpsocio.com
     3Donate link: https://wpsocio.com/donate
    44Tags: telegram, notifications, posts, channel, group
    55Requires at least: 5.8
    66Requires PHP: 7.2
    77Tested up to: 6.1.1
    8 Stable tag: 4.0.8
     8Stable tag: 4.0.9
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    206206== Changelog ==
    207207
     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
    208213= 4.0.8 =
    209214- Fixed the broken hyperlinks in Message Template when using custom field link
  • wptelegram/trunk/changelog.md

    r2878741 r2885658  
    44
    55## 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"
    617
    718## [4.0.8 - 2023-03-12](https://github.com/wpsocio/wptelegram/releases/tag/v4.0.8)
  • wptelegram/trunk/includes/Utils.php

    r2878741 r2885658  
    269269            return '';
    270270        }
    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 );
    285283
    286284        if ( $json_encode ) {
     
    496494
    497495        $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,
    504503        ];
    505504
  • wptelegram/trunk/includes/format-text/src/Converter/LinkConverter.php

    r2873093 r2885658  
    4444        }
    4545
    46         $retainHyperlinks = $this->config->getOption( 'retain_hyperlinks', true );
     46        $textHyperlinks = $this->config->getOption( 'text_hyperlinks', 'retain' );
    4747
    48         $format = $retainHyperlinks ? '%1$s (%2$s)' : '%1$s';
     48        $format = 'retain' === $textHyperlinks ? '%1$s (%2$s)' : '%1$s';
    4949
    5050        return sprintf( $format, $text, $href );
  • wptelegram/trunk/includes/format-text/src/HtmlConverter.php

    r2874222 r2885658  
    6565                // Set to false to keep display:none elements.
    6666                'remove_display_none' => true,
    67                 // Set to false to remove hyperlinks being added in parentheses when formatting to 'text'.
    68                 'retain_hyperlinks'   => true,
    6967                // A callable to determine if a node should be converted.
    7068                'should_convert_cb'   => null,
     
    7775                // Set the default separator for each <tr>.
    7876                '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',
    7979                // Whether to throw an exception when document parsing fails.
    8080                'throw_on_doc_error'  => false,
  • wptelegram/trunk/languages/wptelegram.pot

    r2878741 r2885658  
    55"Project-Id-Version: \n"
    66"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"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
    1010"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"
    1212"Last-Translator: WP Telegram\n"
    1313"Language-Team: WP Telegram\n"
  • wptelegram/trunk/modules/notify/NotifySender.php

    r2874222 r2885658  
    294294            'limit'           => $limit,
    295295            'limit_by'        => 'chars',
     296            'text_hyperlinks' => 'retain',
    296297            'images_in_links' => [
    297298                'title_or_alt'    => 'retain',
  • wptelegram/trunk/modules/p2tg/PostData.php

    r2873851 r2885658  
    192192                    ]
    193193                );
     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
    194201                // If the excerpt is not empty.
    195202                if ( $value ) {
  • wptelegram/trunk/wptelegram.php

    r2878741 r2885658  
    1111 * Plugin URI:        https://t.me/WPTelegram
    1212 * 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.8
     13 * Version:           4.0.9
    1414 * Requires at least: 5.8
    1515 * Requires PHP:      7.2
     
    2727}
    2828
    29 define( 'WPTELEGRAM_VER', '4.0.8' );
     29define( 'WPTELEGRAM_VER', '4.0.9' );
    3030
    3131defined( 'WPTELEGRAM_MAIN_FILE' ) || define( 'WPTELEGRAM_MAIN_FILE', __FILE__ );
Note: See TracChangeset for help on using the changeset viewer.