PHP Класс BP_Reply_By_Email_Extension, bp-reply-by-email

This class relies on the activity component. If your plugin doesn't rely on the activity component (eg. PMs), don't extend this class. Extend this class and in your constructor call the bootstrap() method. See inline docs in the bootstrap() method for more details. Next, override the post_by_email() method to do your custom checks and posting routine. You should call this class anytime *after* the 'bp_include' hook of priority 10, but before or equal to the 'bp_loaded' hook.
С версии: 1.0-RC1
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$data array These variables are stored in a protected array that is magically updated using PHP 5.2+ methods.

Открытые методы

Метод Описание
__get ( string $key ) Magic method for getting a certain data variable.
__isset ( string $key ) Magic method for checking the existence of a certain data variable.
extend_activity_listener ( obj $listener, obj $item ) RBE activity listener for your plugin.
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 $headers, integer $i, resource $connection ) : mixed Setup your extension's failure message to send back to the sender.
internal_rbe_log ( mixed $log, string $type, array $headers, integer $i, resource $connection ) : mixed Log your extension's error messages during the post_by_email() method.
post ( boolean $retval, array $data, array $params ) : array | object Detect your extension and do your post routine in this method.
register_params ( array $params ) : array This method registers your 'item_id_param' / 'secondary_item_id_param' with RBE.

Защищенные методы

Метод Описание
bootstrap ( array $data = [] ) Extensions must use this method in their constructor.
setup_hooks ( ) Hooks! We do the dirty work here, so you don't have to! :)

Описание методов

__get() публичный Метод

Magic method for getting a certain data variable.
public __get ( string $key )
$key string

__isset() публичный Метод

Magic method for checking the existence of a certain data variable.
public __isset ( string $key )
$key string

bootstrap() защищенный Метод

Extensions must use this method in their constructor.
protected bootstrap ( array $data = [] )
$data array See inline doc.

extend_activity_listener() публичный Метод

Override this in your class if your 'item_id' / 'secondary_item_id' needs to be calculated in a different manner. If your plugin doesn't rely on the activity component, you will probably want to override this method and make it an empty method.
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() публичный Метод

Override this if needed.
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() публичный Метод

Extend away!
public failure_message_to_sender ( mixed $message, string $type, array $headers, integer $i, resource $connection ) : mixed
$message mixed Should override to string in method. Defaults to boolean false.
$type string Type of error message
$headers array The email headers
$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!
Результат mixed $message

internal_rbe_log() публичный Метод

Extend away!
public internal_rbe_log ( mixed $log, string $type, array $headers, integer $i, resource $connection ) : mixed
$log mixed Should override to string in method. Defaults to boolean false.
$type string Type of error message
$headers array The email headers
$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!
Результат mixed $log

post() абстрактный публичный Метод

Yup, you must declare this in your class and actually write some code! :) The actual contents of this method will differ for each extension. See {@link BP_Reply_By_Email::post()} for an example. You should return the posted ID of your extension on success and a {@link WP_Error} object on failure.
abstract public post ( boolean $retval, array $data, array $params ) : array | object
$retval boolean Defeults to boolean true.
$data array The data from the parsing. Includes email content, user ID, subject.
$params array Holds an array of params used by RBE. Also holds the params registered in the bootstrap() method.
Результат array | object On success, return an array of the posted ID recommended. On failure, return a WP_Error object.

register_params() публичный Метод

You shouldn't have to override this.
public register_params ( array $params ) : array
$params array Whitelisted parameters used by RBE for the querystring
Результат array $params

setup_hooks() защищенный Метод

Hooks! We do the dirty work here, so you don't have to! :)
protected setup_hooks ( )

Описание свойств

$data защищенное свойство

These variables are stored in a protected array that is magically updated using PHP 5.2+ methods.
См. также: BP_Reply_By_Email::bootstrap() This is where $data is defined
protected array $data
Результат array