diff --git a/config/controllers.yml b/config/controllers.yml index 3b6bde8bb..9d95c826a 100644 --- a/config/controllers.yml +++ b/config/controllers.yml @@ -196,6 +196,8 @@ services: - '@phpbb.titania.attachment.uploader' - '@phpbb.titania.attachment.uploader' - '@phpbb.titania.subscriptions' + - '@text_formatter.parser' + - '@text_formatter.utils' phpbb.titania.controller.contrib.revision: class: phpbb\titania\controller\contribution\revision @@ -216,6 +218,8 @@ services: - '@phpbb.titania.attachment.uploader' - '@phpbb.titania.subscriptions' - '@phpbb.titania.message' + - '@text_formatter.parser' + - '@text_formatter.utils' phpbb.titania.controller.contrib.revision.edit: class: phpbb\titania\controller\contribution\revision_edit diff --git a/controller/contribution/manage.php b/controller/contribution/manage.php index a4ba5f753..82e949e0a 100644 --- a/controller/contribution/manage.php +++ b/controller/contribution/manage.php @@ -37,6 +37,12 @@ class manage extends base /** @var \phpbb\titania\subscriptions */ protected $subscriptions; + /** @var \phpbb\textformatter\s9e\parser */ + protected $parser; + + /** @var \phpbb\textformatter\s9e\utils */ + protected $utils; + /** @var bool */ protected $is_moderator; @@ -68,8 +74,10 @@ class manage extends base * @param \phpbb\titania\attachment\uploader $screenshots * @param \phpbb\titania\attachment\uploader $colorizeit_sample * @param \phpbb\titania\subscriptions $subscriptions + * @param \phpbb\textformatter\s9e\parser $parser + * @param \phpbb\textformatter\s9e\utils $utils */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\message\message $message, \phpbb\titania\attachment\uploader $screenshots, \phpbb\titania\attachment\uploader $colorizeit_sample, \phpbb\titania\subscriptions $subscriptions) + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\message\message $message, \phpbb\titania\attachment\uploader $screenshots, \phpbb\titania\attachment\uploader $colorizeit_sample, \phpbb\titania\subscriptions $subscriptions, \phpbb\textformatter\s9e\parser $parser, \phpbb\textformatter\s9e\utils $utils) { parent::__construct($auth, $config, $db, $template, $user, $helper, $types, $request, $cache, $ext_config, $display, $access); @@ -77,6 +85,8 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config $this->screenshots = $screenshots; $this->colorizeit_sample = $colorizeit_sample; $this->subscriptions = $subscriptions; + $this->parser = $parser; + $this->utils = $utils; } /** @@ -490,6 +500,9 @@ protected function submit($authors, $old_settings) // Set custom field values. $this->contrib->set_custom_fields($this->settings['custom']); + // Parse the contrib name so emojis can be used + $this->contrib->contrib_name = $this->parser->parse($this->contrib->contrib_name); + // Create relations $this->contrib->put_contrib_in_categories( $this->settings['categories'], @@ -708,6 +721,10 @@ protected function assign_vars($error) $this->contrib->type->id ); } + + // Unparse the contrib name + $this->contrib->contrib_name = $this->utils->unparse($this->contrib->contrib_name); + $this->message->display(); $this->contrib->assign_details(); $this->display->assign_global_vars(); diff --git a/controller/contribution/revision.php b/controller/contribution/revision.php index f163ccd4a..c309988c5 100644 --- a/controller/contribution/revision.php +++ b/controller/contribution/revision.php @@ -53,6 +53,12 @@ class revision extends base /** @var bool */ private $skip_epv = false; + /** @var \phpbb\textformatter\s9e\parser */ + protected $parser; + + /** @var \phpbb\textformatter\s9e\utils */ + protected $utils; + /** * Constructor * @@ -71,8 +77,10 @@ class revision extends base * @param \phpbb\titania\attachment\uploader $uploader * @param \phpbb\titania\subscriptions $subscriptions * @param \phpbb\titania\message\message $message + * @param \phpbb\textformatter\s9e\parser $parser + * @param \phpbb\textformatter\s9e\utils $utils */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\attachment\uploader $uploader, \phpbb\titania\subscriptions $subscriptions, \phpbb\titania\message\message $message) + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\attachment\uploader $uploader, \phpbb\titania\subscriptions $subscriptions, \phpbb\titania\message\message $message, \phpbb\textformatter\s9e\parser $parser, \phpbb\textformatter\s9e\utils $utils) { parent::__construct($auth, $config, $db, $template, $user, $helper, $types, $request, $cache, $ext_config, $display, $access); @@ -80,6 +88,9 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config $this->subscriptions = $subscriptions; $this->message = $message; + $this->parser = $parser; + $this->utils = $utils; + // Increase timeout when dealing with revisions @set_time_limit(90); } @@ -217,6 +228,9 @@ public function add($contrib_type, $contrib) // Load the revisions for this contribution $this->contrib->get_revisions(); + // Unparse the contrib name + $this->contrib->contrib_name = $this->utils->unparse($this->contrib->contrib_name); + if (sizeof($this->contrib->revisions)) { // Find out what the previous revision was, if this is a new revision to an existing contribution