1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-16 21:54:00 +02:00

Merge pull request #3461 from s9e/ticket/11768

[3.2][ticket/11768] Integrate s9e\TextFormatter
This commit is contained in:
Tristan Darricau
2015-04-05 23:32:38 +02:00
81 changed files with 6463 additions and 145 deletions

View File

@@ -25,7 +25,7 @@ class acp_bbcodes
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher;
global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_log;
$user->add_lang('acp/posting');
@@ -269,6 +269,7 @@ class acp_bbcodes
$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
$cache->destroy('sql', BBCODES_TABLE);
$phpbb_container->get('text_formatter.cache')->invalidate();
$lang = 'BBCODE_ADDED';
$log_action = 'LOG_BBCODE_ADD';
@@ -280,6 +281,7 @@ class acp_bbcodes
WHERE bbcode_id = ' . $bbcode_id;
$db->sql_query($sql);
$cache->destroy('sql', BBCODES_TABLE);
$phpbb_container->get('text_formatter.cache')->invalidate();
$lang = 'BBCODE_EDITED';
$log_action = 'LOG_BBCODE_EDIT';
@@ -319,6 +321,7 @@ class acp_bbcodes
{
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
$cache->destroy('sql', BBCODES_TABLE);
$phpbb_container->get('text_formatter.cache')->invalidate();
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($row['bbcode_tag']));
if ($request->is_ajax())

View File

@@ -28,7 +28,7 @@ class acp_icons
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $request, $phpbb_container;
@@ -486,6 +486,7 @@ class acp_icons
$cache->destroy('_icons');
$cache->destroy('sql', $table);
$phpbb_container->get('text_formatter.cache')->invalidate();
$level = ($icons_updated) ? E_USER_NOTICE : E_USER_WARNING;
$errormsgs = '';
@@ -661,6 +662,7 @@ class acp_icons
$cache->destroy('_icons');
$cache->destroy('sql', $table);
$phpbb_container->get('text_formatter.cache')->invalidate();
trigger_error($user->lang[$lang . '_IMPORT_SUCCESS'] . adm_back_link($this->u_action));
}
@@ -783,6 +785,7 @@ class acp_icons
$cache->destroy('_icons');
$cache->destroy('sql', $table);
$phpbb_container->get('text_formatter.cache')->invalidate();
if ($request->is_ajax())
{
@@ -848,6 +851,7 @@ class acp_icons
$cache->destroy('_icons');
$cache->destroy('sql', $table);
$phpbb_container->get('text_formatter.cache')->invalidate();
if ($request->is_ajax())
{

View File

@@ -352,6 +352,11 @@ class acp_main
$config->increment('assets_version', 1);
$cache->purge();
// Remove old renderers from the text_formatter service. Since this
// operation is performed after the cache is purged, there is not "current"
// renderer and in effect all renderers will be purged
$phpbb_container->get('text_formatter.cache')->tidy();
// Clear permissions
$auth->acl_clear_prefetch();
phpbb_cache_moderators($db, $cache, $auth);

View File

@@ -53,6 +53,9 @@ class acp_styles
/** @var \phpbb\auth\auth */
protected $auth;
/** @var \phpbb\textformatter\cache_interface */
protected $text_formatter_cache;
/** @var string */
protected $phpbb_root_path;
@@ -61,7 +64,7 @@ class acp_styles
public function main($id, $mode)
{
global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config;
global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_container;
$this->db = $db;
$this->user = $user;
@@ -69,6 +72,7 @@ class acp_styles
$this->request = $request;
$this->cache = $cache;
$this->auth = $auth;
$this->text_formatter_cache = $phpbb_container->get('text_formatter.cache');
$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
@@ -216,6 +220,12 @@ class acp_styles
}
}
// Invalidate the text formatter's cache for the new styles to take effect
if (!empty($installed_names))
{
$this->text_formatter_cache->invalidate();
}
// Show message
if (!count($messages))
{

View File

@@ -28,7 +28,7 @@ class acp_words
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache, $phpbb_log, $request;
global $db, $user, $auth, $template, $cache, $phpbb_log, $request, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/posting');
@@ -115,6 +115,7 @@ class acp_words
}
$cache->destroy('_word_censors');
$phpbb_container->get('text_formatter.cache')->invalidate();
$log_action = ($word_id) ? 'LOG_WORD_EDIT' : 'LOG_WORD_ADD';
@@ -148,6 +149,7 @@ class acp_words
$db->sql_query($sql);
$cache->destroy('_word_censors');
$phpbb_container->get('text_formatter.cache')->invalidate();
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WORD_DELETE', false, array($deleted_word));