mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/17135] Add messenger method interface class
PHPBB-17135
This commit is contained in:
parent
e8cf35c583
commit
50e408bdea
2 changed files with 72 additions and 19 deletions
|
@ -29,7 +29,7 @@ use phpbb\user;
|
||||||
/**
|
/**
|
||||||
* Messenger base class
|
* Messenger base class
|
||||||
*/
|
*/
|
||||||
abstract class base
|
abstract class base implements messenger_interface
|
||||||
{
|
{
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $additional_headers = [];
|
protected $additional_headers = [];
|
||||||
|
@ -142,16 +142,12 @@ abstract class base
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get messenger method id
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
abstract public function get_id(): int;
|
abstract public function get_id(): int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the messenger method is enabled
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
abstract public function is_enabled(): bool;
|
abstract public function is_enabled(): bool;
|
||||||
|
|
||||||
|
@ -176,6 +172,7 @@ abstract class base
|
||||||
* Set addresses for to/im as available
|
* Set addresses for to/im as available
|
||||||
*
|
*
|
||||||
* @param array $user_row User row
|
* @param array $user_row User row
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
abstract public function set_addresses(array $user_row): void;
|
abstract public function set_addresses(array $user_row): void;
|
||||||
|
@ -188,10 +185,7 @@ abstract class base
|
||||||
abstract public function get_queue_object_name(): string;
|
abstract public function get_queue_object_name(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up subject for mail
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param string $subject Email subject
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function subject(string $subject = ''): void
|
public function subject(string $subject = ''): void
|
||||||
{
|
{
|
||||||
|
@ -199,16 +193,15 @@ abstract class base
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send out messages
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
abstract protected function send(): bool;
|
abstract public function send(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send messages from the queue
|
* Send messages from the queue
|
||||||
*
|
*
|
||||||
* @param array $queue_data Queue data array
|
* @param array $queue_data Queue data array
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
abstract public function process_queue(array &$queue_data): void;
|
abstract public function process_queue(array &$queue_data): void;
|
||||||
|
@ -303,6 +296,7 @@ abstract class base
|
||||||
* Assign variables to email template
|
* Assign variables to email template
|
||||||
*
|
*
|
||||||
* @param array $vars Array of VAR => VALUE to assign to email template
|
* @param array $vars Array of VAR => VALUE to assign to email template
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function assign_vars(array $vars): void
|
public function assign_vars(array $vars): void
|
||||||
|
@ -316,6 +310,7 @@ abstract class base
|
||||||
*
|
*
|
||||||
* @param string $blockname Template block name
|
* @param string $blockname Template block name
|
||||||
* @param array $vars Array of VAR => VALUE to assign to email template block
|
* @param array $vars Array of VAR => VALUE to assign to email template block
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function assign_block_vars(string $blockname, array $vars): void
|
public function assign_block_vars(string $blockname, array $vars): void
|
||||||
|
@ -402,10 +397,7 @@ abstract class base
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add error message to log
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param string $msg Error message text
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function error(string $msg): void
|
public function error(string $msg): void
|
||||||
{
|
{
|
||||||
|
@ -426,6 +418,7 @@ abstract class base
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save message data to the messenger file queue
|
* Save message data to the messenger file queue
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function save_queue(): void
|
public function save_queue(): void
|
||||||
|
@ -479,6 +472,7 @@ abstract class base
|
||||||
*
|
*
|
||||||
* @param string|array $path_name Email template path name
|
* @param string|array $path_name Email template path name
|
||||||
* @param string|array $paths Email template paths
|
* @param string|array $paths Email template paths
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function set_template_paths(string|array $path_name, string|array $paths): void
|
protected function set_template_paths(string|array $path_name, string|array $paths): void
|
||||||
|
|
59
phpBB/phpbb/messenger/method/messenger_interface.php
Normal file
59
phpBB/phpbb/messenger/method/messenger_interface.php
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\messenger\method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Messenger method interface class
|
||||||
|
*/
|
||||||
|
interface messenger_interface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get messenger method id
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function get_id(): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the messenger method is enabled
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function is_enabled(): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up subject for the message
|
||||||
|
*
|
||||||
|
* @param string $subject Email subject
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function subject(string $subject = ''): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send out messages
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function send(): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add error message to log
|
||||||
|
*
|
||||||
|
* @param string $msg Error message text
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function error(string $msg): void;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue