PHP Class BBP_RBE_Extension, bp-reply-by-email

Extends the abstract {@link BP_Reply_By_Email_Extension} class, which helps do a lot of the dirty work!
Since: 1.0-RC1
Inheritance: extends BP_Reply_By_Email_Extension
Mostrar archivo Open project: r-a-y/bp-reply-by-email

Public Methods

Method Description
__construct ( ) Constructor.
activity_rbe_hook ( obj $activity ) Add RBE's special activity hook.
change_activity_action ( array $args ) Modify activity action to add our custom 'via email' string at the end.
clear_global_cache ( ) Clear lingering global cache.
extend_activity_listener ( obj $listener, obj $item ) RBE activity listener for our bbPress-GES extension.
extend_querystring ( string $querystring, obj $listener ) Sets up the querystring used in the 'Reply-To' email address.
failure_message_to_sender ( mixed $message, string $type, array $data, integer $i, $imap ) : string | boolean Setup our extension's failure message to send back to the sender.
ges_extend_listener ( BP_Reply_By_Email $rbe ) Register support for GES with RBE.
ges_support ( boolean $retval, BP_Activity_Activity $activity ) Add support for the BP Group Email Subscription plugin.
get_forum_encoded_email_address ( ) Template tag to return a bbP forum's encoded email address.
internal_rbe_log ( mixed $log, string $type, array $data, integer $i, resource $connection ) : string | boolean Log our extension's error messages during the post_by_email() method.
map_forum_meta_caps ( array $caps = [], string $cap = '', integer $user_id, array $args = [] ) : array Allow members to pass default cap checks.
new_topic_querystring ( str $querystring = '', integer $user_id = false ) : str Replace "Post New Topics via Email" email address to work with bbPress plugin.
new_topic_via_email_block ( ) Show 'Post New Topics via Email' block on a bbP forum page.
new_topic_via_email_css ( $retval ) Use 'Post New Topics via Email' CSS on a bbP forum page.
post ( boolean $retval, array $data, array $params ) : array | object Post by email handler.
register_custom_params ( array $params ) : array Registers our custom 'forum_id_param' and 'reply_id_param' params with RBE.
set_group_id ( obj | boolean $group ) Set locally-cached group ID so groups_get_current_group() will work in {@link BBP_Forums_Group_Extension::map_activity_to_group()}.

Private Methods

Method Description
custom_hooks ( ) Some custom hooks this class uses.
post_new_topic ( array $data, array $params ) : array | object Post new topic by email handler.

Method Details

__construct() public method

Constructor.
public __construct ( )

activity_rbe_hook() public method

Add RBE's special activity hook.
public activity_rbe_hook ( obj $activity )
$activity obj The BP_Activity_Activity object created after save

change_activity_action() public method

Modify activity action to add our custom 'via email' string at the end.
public change_activity_action ( array $args )
$args array Activity arguments before recording

clear_global_cache() public method

Interferes with email sending in the inbox loop.
public clear_global_cache ( )

extend_activity_listener() public method

We're overriding the parent method because we're trying to match two activity types and our 'secondary_item_id' needs to be calculated in a different manner for the 'bbp_reply_create' activity type.
public extend_activity_listener ( obj $listener, obj $item )
$listener obj Registers your component with RBE's activity listener
$item obj The activity object generated by BP during save.

extend_querystring() public method

Overrides our parent method to support our second component listener in the bbp_listener() method.
public extend_querystring ( string $querystring, obj $listener )
$querystring string Querystring used to form the "Reply-To" email address.
$listener obj The listener object registered in the extend_activity_listener() method.

failure_message_to_sender() public method

Setup our extension's failure message to send back to the sender.
public failure_message_to_sender ( mixed $message, string $type, array $data, integer $i, $imap ) : string | boolean
$message mixed
$type string Type of error message
$data array { An array of arguments. @type array $headers Email headers. @type string $content The email body content. @type string $subject The email subject line. @type int $user_id The user ID who sent the email. @type bool $is_html Whether the email content is HTML or not. @type int $i The email message number. }
$i integer The message number from the inbox loop
return string | boolean Could be a string or boolean false.

ges_extend_listener() public method

Since other GES plugins like BP Multiple Forum Post works by delaying GES email sending to remove duplicate emails {@see \bpmfp_interrupt_original_activity_notification()}, we need to let RBE's listener know about it.
Since: 1.0-RC4
public ges_extend_listener ( BP_Reply_By_Email $rbe )
$rbe BP_Reply_By_Email

ges_support() public method

This is the new way to add support for GES 3.6+.
Since: 1.0-RC4
public ges_support ( boolean $retval, BP_Activity_Activity $activity )
$retval boolean Whether GES should send the current email.
$activity BP_Activity_Activity Activity object GES is using.

get_forum_encoded_email_address() public method

Template tag to return a bbP forum's encoded email address.

internal_rbe_log() public method

Log our extension's error messages during the post_by_email() method.
public internal_rbe_log ( mixed $log, string $type, array $data, integer $i, resource $connection ) : string | boolean
$log mixed
$type string Type of error message
$data array { An array of arguments. @type array $headers Email headers. @type string $content The email body content. @type string $subject The email subject line. @type int $user_id The user ID who sent the email. @type bool $is_html Whether the email content is HTML or not. @type int $i The email message number. }
$i integer The message number from the inbox loop
$connection resource The current IMAP connection. Chances are you probably don't have to do anything with this!
return string | boolean Could be a string or boolean false.

map_forum_meta_caps() public method

A modified copy of BBP_Forums_Group_Extension::map_group_forum_meta_caps().
Since: 1.0-RC4
public map_forum_meta_caps ( array $caps = [], string $cap = '', integer $user_id, array $args = [] ) : array
$caps array
$cap string
$user_id integer
$args array
return array

new_topic_querystring() public method

Replace "Post New Topics via Email" email address to work with bbPress plugin.
public new_topic_querystring ( str $querystring = '', integer $user_id = false ) : str
$querystring str Encoded querystring used in the email address
$user_id integer The user ID
return str Encoded querystring used in the email address

new_topic_via_email_block() public method

Show 'Post New Topics via Email' block on a bbP forum page.

new_topic_via_email_css() public method

Use 'Post New Topics via Email' CSS on a bbP forum page.
public new_topic_via_email_css ( $retval )

post() public method

For bbPress, the logic in this method is the same as {@link bbp_new_reply_handler()}. It's duplicated because bbPress doesn't utilize hooks for verifying replies.
public post ( boolean $retval, array $data, array $params ) : array | object
$retval boolean True by default.
$data array { An array of arguments. @type array $headers Email headers. @type string $content The email body content. @type string $subject The email subject line. @type int $user_id The user ID who sent the email. @type bool $is_html Whether the email content is HTML or not. @type int $i The email message number. }
$params array Parsed paramaters from the email address querystring. See {@link BP_Reply_By_Email_Parser::get_parameters()}.
return array | object Array of the parsed item on success. WP_Error object on failure.

register_custom_params() public method

Registers our custom 'forum_id_param' and 'reply_id_param' params with RBE.
public register_custom_params ( array $params ) : array
$params array Whitelisted parameters used by RBE for the querystring
return array $params

set_group_id() public method

Set locally-cached group ID so groups_get_current_group() will work in {@link BBP_Forums_Group_Extension::map_activity_to_group()}.
public set_group_id ( obj | boolean $group )
$group obj | boolean The BP group object if it exists; boolean if it doesn't