Plugin Directory

Changeset 1999795


Ignore:
Timestamp:
12/21/2018 02:22:58 PM (7 years ago)
Author:
mechter
Message:

remove all filters from the_title hook before retrieving topic title plus some other code improvements

Location:
asyncronous-bbpress-subscriptions
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • asyncronous-bbpress-subscriptions/tags/3.5/asyncronous-bbpress-subscriptions.php

    r1997840 r1999795  
    66Author: Markus Echterhoff
    77Author URI: https://www.markusechterhoff.com
    8 Version: 3.4
     8Version: 3.5
    99License: GPLv3 or later
    1010Text Domain: asyncronous-bbpress-subscriptions
     
    7171        $recipients = array();
    7272           
    73         if ( !$user_ids ) {
    74             $recipients = apply_filters( 'abbps_recipients', $recipients ); // abbps 1.5 compatibility
    75             $recipients = apply_filters( 'bbp_subscription_email_recipients', $recipients ); // bbpress forwards compatibility
    76         } else {
     73        if ( !empty( $user_ids ) ) {
    7774            global $wpdb;
    7875            $ids_substitution = substr( str_repeat( ',%d', count( $user_ids ) ), 1 );
     
    8279                $recipients = array();
    8380            }
    84             $recipients = apply_filters( 'abbps_recipients', $recipients ); // abbps 1.5 compatibility
    85             $recipients = apply_filters( 'bbp_subscription_email_recipients', $recipients ); // bbpress forwards compatibility
    86         }
     81        }
     82       
     83        $recipients = apply_filters( 'abbps_recipients', $recipients ); // abbps 1.5 compatibility
     84        $recipients = apply_filters( 'bbp_subscription_email_recipients', $recipients ); // bbpress forwards compatibility
    8785       
    8886        return $recipients;
     
    10199        // Remove filters from reply content and topic title to prevent content
    102100        // from being encoded with HTML entities, wrapped in paragraph tags, etc...
    103         remove_all_filters( 'bbp_get_topic_content' );
    104         remove_all_filters( 'bbp_get_topic_title'   );
     101        bbp_remove_all_filters( 'bbp_get_reply_content' );
     102        bbp_remove_all_filters( 'bbp_get_topic_title'   );
     103        bbp_remove_all_filters( 'the_title'             );
    105104   
    106105        // collect various pieces of information
     
    112111        $user_id = bbp_get_topic_author_id( $topic_id ); // for backwards compatible filters below
    113112       
     113        // Restore previously removed filters
     114        bbp_restore_all_filters( 'bbp_get_topic_content' );
     115        bbp_restore_all_filters( 'bbp_get_topic_title'   );
     116        bbp_restore_all_filters( 'the_title'             );
     117       
    114118        // subject
    115119        $this->subject = sprintf( __( "[%s Forums] New Topic: \"%s\"", 'asyncronous-bbpress-subscriptions' ), $blog_name, $topic_title );
     
    172176        // Remove filters from reply content and topic title to prevent content
    173177        // from being encoded with HTML entities, wrapped in paragraph tags, etc...
    174         remove_all_filters( 'bbp_get_reply_content' );
    175         remove_all_filters( 'bbp_get_topic_title'   );
     178        bbp_remove_all_filters( 'bbp_get_reply_content' );
     179        bbp_remove_all_filters( 'bbp_get_topic_title'   );
     180        bbp_remove_all_filters( 'the_title'             );
    176181       
    177182        // collect various pieces of information
     
    181186        $reply_url = bbp_get_reply_url( $reply_id );
    182187        $reply_content = wp_specialchars_decode( strip_tags( bbp_get_reply_content( $reply_id ) ), ENT_QUOTES );
     188
     189        // Restore previously removed filters
     190        bbp_restore_all_filters( 'bbp_get_topic_content' );
     191        bbp_restore_all_filters( 'bbp_get_topic_title'   );
     192        bbp_restore_all_filters( 'the_title'             );
    183193
    184194        // subject
  • asyncronous-bbpress-subscriptions/tags/3.5/readme.txt

    r1998592 r1999795  
    55Requires at least: 3.6
    66Tested up to: 5.0
    7 Stable tag: 3.4
     7Stable tag: 3.5
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    8585== Changelog ==
    8686
     87= 3.5 =
     88
     89* fix: in some cases email subjects contained html entities. They now contain proper characters.
     90* code improvements
     91
    8792= 3.4 =
    8893
  • asyncronous-bbpress-subscriptions/trunk/asyncronous-bbpress-subscriptions.php

    r1997840 r1999795  
    66Author: Markus Echterhoff
    77Author URI: https://www.markusechterhoff.com
    8 Version: 3.4
     8Version: 3.5
    99License: GPLv3 or later
    1010Text Domain: asyncronous-bbpress-subscriptions
     
    7171        $recipients = array();
    7272           
    73         if ( !$user_ids ) {
    74             $recipients = apply_filters( 'abbps_recipients', $recipients ); // abbps 1.5 compatibility
    75             $recipients = apply_filters( 'bbp_subscription_email_recipients', $recipients ); // bbpress forwards compatibility
    76         } else {
     73        if ( !empty( $user_ids ) ) {
    7774            global $wpdb;
    7875            $ids_substitution = substr( str_repeat( ',%d', count( $user_ids ) ), 1 );
     
    8279                $recipients = array();
    8380            }
    84             $recipients = apply_filters( 'abbps_recipients', $recipients ); // abbps 1.5 compatibility
    85             $recipients = apply_filters( 'bbp_subscription_email_recipients', $recipients ); // bbpress forwards compatibility
    86         }
     81        }
     82       
     83        $recipients = apply_filters( 'abbps_recipients', $recipients ); // abbps 1.5 compatibility
     84        $recipients = apply_filters( 'bbp_subscription_email_recipients', $recipients ); // bbpress forwards compatibility
    8785       
    8886        return $recipients;
     
    10199        // Remove filters from reply content and topic title to prevent content
    102100        // from being encoded with HTML entities, wrapped in paragraph tags, etc...
    103         remove_all_filters( 'bbp_get_topic_content' );
    104         remove_all_filters( 'bbp_get_topic_title'   );
     101        bbp_remove_all_filters( 'bbp_get_reply_content' );
     102        bbp_remove_all_filters( 'bbp_get_topic_title'   );
     103        bbp_remove_all_filters( 'the_title'             );
    105104   
    106105        // collect various pieces of information
     
    112111        $user_id = bbp_get_topic_author_id( $topic_id ); // for backwards compatible filters below
    113112       
     113        // Restore previously removed filters
     114        bbp_restore_all_filters( 'bbp_get_topic_content' );
     115        bbp_restore_all_filters( 'bbp_get_topic_title'   );
     116        bbp_restore_all_filters( 'the_title'             );
     117       
    114118        // subject
    115119        $this->subject = sprintf( __( "[%s Forums] New Topic: \"%s\"", 'asyncronous-bbpress-subscriptions' ), $blog_name, $topic_title );
     
    172176        // Remove filters from reply content and topic title to prevent content
    173177        // from being encoded with HTML entities, wrapped in paragraph tags, etc...
    174         remove_all_filters( 'bbp_get_reply_content' );
    175         remove_all_filters( 'bbp_get_topic_title'   );
     178        bbp_remove_all_filters( 'bbp_get_reply_content' );
     179        bbp_remove_all_filters( 'bbp_get_topic_title'   );
     180        bbp_remove_all_filters( 'the_title'             );
    176181       
    177182        // collect various pieces of information
     
    181186        $reply_url = bbp_get_reply_url( $reply_id );
    182187        $reply_content = wp_specialchars_decode( strip_tags( bbp_get_reply_content( $reply_id ) ), ENT_QUOTES );
     188
     189        // Restore previously removed filters
     190        bbp_restore_all_filters( 'bbp_get_topic_content' );
     191        bbp_restore_all_filters( 'bbp_get_topic_title'   );
     192        bbp_restore_all_filters( 'the_title'             );
    183193
    184194        // subject
  • asyncronous-bbpress-subscriptions/trunk/readme.txt

    r1998592 r1999795  
    55Requires at least: 3.6
    66Tested up to: 5.0
    7 Stable tag: 3.4
     7Stable tag: 3.5
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    8585== Changelog ==
    8686
     87= 3.5 =
     88
     89* fix: in some cases email subjects contained html entities. They now contain proper characters.
     90* code improvements
     91
    8792= 3.4 =
    8893
Note: See TracChangeset for help on using the changeset viewer.