Changeset 8081
- Timestamp:
- 01/15/2019 03:10:41 AM (6 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-support-compat.php
r7293 r8081 355 355 if ( class_exists( 'WordPressdotorg\Forums\Term_Subscription\Plugin' ) ) { 356 356 Plugin::get_instance()->plugin_subscriptions = new Term_Subscription\Plugin( array( 357 'taxonomy' => 'topic-plugin', 358 'labels' => array( 357 'taxonomy' => 'topic-plugin', 358 'directory' => Plugin::get_instance()->plugins, 359 'labels' => array( 359 360 'subscribed_header' => __( 'Subscribed Plugins', 'wporg-forums' ), 360 361 'subscribed_user_notice' => __( 'You are not currently subscribed to any plugins.', 'wporg-forums' ), 361 362 'subscribed_anon_notice' => __( 'This user is not currently subscribed to any plugins.', 'wporg-forums' ), 362 'receipt' => __( 'You are receiving this email because you are subscribed to a plugin.', 'wporg-forums' ), 363 /* translators: %s: Plugin Name. */ 364 'receipt' => __( 'You are receiving this email because you are subscribed to the %s plugin.', 'wporg-forums' ), 363 365 ), 364 366 ) ); 365 367 Plugin::get_instance()->theme_subscriptions = new Term_Subscription\Plugin( array( 366 'taxonomy' => 'topic-theme', 367 'labels' => array( 368 'taxonomy' => 'topic-theme', 369 'directory' => Plugin::get_instance()->themes, 370 'labels' => array( 368 371 'subscribed_header' => __( 'Subscribed Themes', 'wporg-forums' ), 369 372 'subscribed_user_notice' => __( 'You are not currently subscribed to any themes.', 'wporg-forums' ), 370 373 'subscribed_anon_notice' => __( 'This user is not currently subscribed to any themes.', 'wporg-forums' ), 371 'receipt' => __( 'You are receiving this email because you are subscribed to a theme.', 'wporg-forums' ), 374 /* translators: %s: Theme Name. */ 375 'receipt' => __( 'You are receiving this email because you are subscribed to the %s theme.', 'wporg-forums' ), 372 376 ), 373 377 ) ); … … 394 398 FROM {$prefix}posts AS p 395 399 LEFT JOIN {$prefix}term_relationships AS tr ON p.ID = tr.object_id 396 LEFT JOIN {$prefix}term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id 400 LEFT JOIN {$prefix}term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id 397 401 LEFT JOIN {$prefix}terms AS t ON tt.term_id = t.term_id 398 402 WHERE tt.taxonomy = 'plugin_committers' AND p.post_status = 'publish' AND p.post_type = 'plugin' AND t.slug = %s … … 412 416 FROM {$prefix}posts AS p 413 417 LEFT JOIN {$prefix}term_relationships AS tr ON p.ID = tr.object_id 414 LEFT JOIN {$prefix}term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id 418 LEFT JOIN {$prefix}term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id 415 419 LEFT JOIN {$prefix}terms AS t ON tt.term_id = t.term_id 416 420 WHERE tt.taxonomy = 'plugin_contributors' AND p.post_status = 'publish' AND p.post_type = 'plugin' AND t.slug = %s -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-term-subscription/inc/class-plugin.php
r7560 r8081 12 12 private $subscribers = array(); 13 13 14 public $taxonomy = false; 15 public $labels = array(); 14 public $taxonomy = false; 15 public $labels = array(); 16 public $directory = false; 16 17 17 18 const META_KEY = '_bbp_term_subscription'; … … 19 20 public function __construct( $args = array() ) { 20 21 $r = wp_parse_args( $args, array( 21 'taxonomy' => 'topic-tag', 22 'labels' => array( 22 'taxonomy' => 'topic-tag', 23 'directory' => false, 24 'labels' => array( 23 25 'subscribed_header' => __( 'Subscribed Topic Tags', 'wporg-forums' ), 24 26 'subscribed_user_notice' => __( 'You are not currently subscribed to any topic tags.', 'wporg-forums' ), … … 28 30 ) ); 29 31 30 $this->taxonomy = $r['taxonomy']; 31 $this->labels = $r['labels']; 32 $this->taxonomy = $r['taxonomy']; 33 $this->labels = $r['labels']; 34 $this->directory = $r['directory']; 32 35 33 36 add_action( 'bbp_init', array( $this, 'bbp_init' ) ); … … 157 160 * @param int $topic_author The topic author id 158 161 */ 159 public function notify_term_subscribers_of_new_topic( $topic_id, $forum_id, 162 public function notify_term_subscribers_of_new_topic( $topic_id, $forum_id, $anonymous_data = false, $topic_author = 0 ) { 160 163 $terms = get_the_terms( $topic_id, $this->taxonomy ); 161 164 if ( ! $terms ) { … … 185 188 // Replace forum-specific messaging with term subscription messaging. 186 189 add_filter( 'bbp_forum_subscription_mail_message', array( $this, 'replace_forum_subscription_mail_message' ), 10, 4 ); 190 add_filter( 'bbp_forum_subscription_mail_title', array( $this, 'replace_forum_subscription_mail_title' ), 10, 2 ); 187 191 188 192 // Replace forum subscriber list with term subscribers, avoiding duplicates. … … 193 197 194 198 // Remove filters. 195 remove_filter( 'bbp_forum_subscription_user_ids', array( $this, 'add_term_subscribers_to_forum' ) );199 remove_filter( 'bbp_forum_subscription_user_ids', array( $this, 'add_term_subscribers_to_forum' ) ); 196 200 remove_filter( 'bbp_forum_subscription_mail_message', array( $this, 'replace_forum_subscription_mail_message' ), 10 ); 201 remove_filter( 'bbp_forum_subscription_mail_title', array( $this, 'replace_forum_subscription_mail_title' ) ); 202 197 203 } 198 204 … … 236 242 $topic_content, 237 243 $topic_url, 238 $this->labels['receipt'] 244 // String may not have placeholders, ie. in the case of tags. 245 sprintf( $this->labels['receipt'], $this->directory ? $this->directory->title() : '' ) 239 246 ); 240 247 241 248 return $message; 249 } 250 251 /** 252 * Replace the forum subscription subject/title with term-specific messaging. 253 * 254 * @param string $title The current title 255 * @param int $topic_id The topic id 256 */ 257 public function replace_forum_subscription_mail_title( $title, $topic_id ) { 258 if ( $this->directory && $this->directory->title() ) { 259 $blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 260 $topic_title = strip_tags( bbp_get_topic_title( $topic_id ) ); 261 262 // [WordPress.org] [Plugin Name] This is my threads 263 $title = sprintf( '[%s] [%s] %s', $blog_name, $this->directory->title(), $topic_title ); 264 } 265 266 return $title; 242 267 } 243 268 … … 281 306 // Replace topic-specific messaging with term subscription messaging. 282 307 add_filter( 'bbp_subscription_mail_message', array( $this, 'replace_topic_subscription_mail_message' ), 10, 3 ); 308 add_filter( 'bbp_subscription_mail_title', array( $this, 'replace_topic_subscription_mail_title' ), 10, 3 ); 283 309 284 310 // Replace forum subscriber list with term subscribers, avoiding duplicates. … … 290 316 // Remove filters. 291 317 remove_filter( 'bbp_topic_subscription_user_ids', array( $this, 'add_term_subscribers_to_topic' ) ); 292 remove_filter( 'bbp_subscription_mail_message', array( $this, 'replace_topic_subscription_mail_message' ), 10 ); 318 remove_filter( 'bbp_subscription_mail_message', array( $this, 'replace_topic_subscription_mail_message' ) ); 319 remove_filter( 'bbp_subscription_mail_title', array( $this, 'replace_topic_subscription_mail_title' ) ); 293 320 } 294 321 … … 331 358 $reply_content, 332 359 $reply_url, 333 $this->labels['receipt'] 360 // String may not have placeholders, ie. in the case of tags. 361 sprintf( $this->labels['receipt'], $this->directory ? $this->directory->title() : '' ) 334 362 ); 335 363 336 364 return $message; 365 } 366 367 /** 368 * Replace the topic subscription subject/title with term-specific messaging. 369 * 370 * @param string $title The current title 371 * @param int $reply_id The reply id 372 * @param int $topic_id The topic id 373 */ 374 public function replace_topic_subscription_mail_title( $title, $reply_id, $topic_id ) { 375 if ( $this->directory && $this->directory->title() ) { 376 $blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 377 $topic_title = strip_tags( bbp_get_topic_title( $topic_id ) ); 378 379 // [WordPress.org] [Plugin Name] This is my threads 380 $title = sprintf( '[%s] [%s] %s', $blog_name, $this->directory->title(), $topic_title ); 381 } 382 383 return $title; 337 384 } 338 385
Note: See TracChangeset
for help on using the changeset viewer.