From 627e2644a2aee478303e63577213329225a39173 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 17 Jul 2011 00:44:39 -0400 Subject: [ticket/8937] Keep space characters in front of [code] bbcode content PHPBB3-8937 --- phpBB/includes/bbcode.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index d77bb3c4a7..9356e3e9b4 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -584,6 +584,13 @@ class bbcode $code = str_replace("\t", '   ', $code); $code = str_replace(' ', '  ', $code); $code = str_replace(' ', '  ', $code); + $code = str_replace("\n ", "\n ", $code); + + // keep space at the beginning + if (!empty($code) && $code[0] == ' ') + { + $code = ' ' . substr($code, 1); + } // remove newline at the beginning if (!empty($code) && $code[0] == "\n") -- cgit v1.2.1 From df46a576e952881df963dcc03daede58dfb98927 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 7 Aug 2011 19:26:28 -0400 Subject: [feature/template-engine] Use template engine class in bbcode class. PHPBB3-9726 --- phpBB/includes/bbcode.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index a360bcd5d1..c29875dcbf 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -128,28 +128,17 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $template, $user; + global $phpbb_root_path, $phpEx, $template, $config, $user; if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']); - $this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html'; - if (!@file_exists($this->template_filename)) - { - if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) - { - $this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template/bbcode.html'; - if (!@file_exists($this->template_filename)) - { - trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR); - } - } - else - { - trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR); - } - } + $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user); + $template->set_template(); + $locator = $template->_get_locator(); + $locator->set_filenames(array('bbcode.html' => 'bbcode.html')); + $this->template_filename = $locator->get_source_file_for_handle('bbcode.html'); } $bbcode_ids = $rowset = $sql = array(); -- cgit v1.2.1 From 035a8d7154b25414532bfb2de066cde1065feded Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 9 Aug 2011 23:18:37 -0400 Subject: [feature/template-engine] Delete useless $template globalization. PHPBB3-9726 --- phpBB/includes/bbcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index c29875dcbf..93c4bba009 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -128,7 +128,7 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $phpEx, $template, $config, $user; + global $phpbb_root_path, $phpEx, $config, $user; if (empty($this->template_filename)) { -- cgit v1.2.1 From 4bb56cddb3a0ab8012e9324f94138630799449de Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 9 Aug 2011 23:18:58 -0400 Subject: [feature/template-engine] Delete no longer used $template_filename property. PHPBB3-9726 --- phpBB/includes/bbcode.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 93c4bba009..85d7459163 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -30,7 +30,6 @@ class bbcode var $bbcodes = array(); var $template_bitfield; - var $template_filename = ''; /** * Constructor -- cgit v1.2.1 From acb767f14d6300ebff793f87b1a62ebbb4bde82a Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 9 Aug 2011 23:28:40 -0400 Subject: [feature/template-engine] Dependency inject locator into template. PHPBB3-9726 --- phpBB/includes/bbcode.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 85d7459163..482858446c 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -133,7 +133,8 @@ class bbcode { $this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']); - $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user); + $template_locator = new phpbb_template_locator(); + $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator); $template->set_template(); $locator = $template->_get_locator(); $locator->set_filenames(array('bbcode.html' => 'bbcode.html')); -- cgit v1.2.1 From 7cfd4052c5a9f7f6caabd9a1fc734d7b9e838dcd Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 13 Aug 2011 23:48:39 -0400 Subject: [feature/template-engine] Clean up template locator usage in bbcode. PHPBB3-9726 --- phpBB/includes/bbcode.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 482858446c..eeac98d3f3 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -136,9 +136,8 @@ class bbcode $template_locator = new phpbb_template_locator(); $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator); $template->set_template(); - $locator = $template->_get_locator(); - $locator->set_filenames(array('bbcode.html' => 'bbcode.html')); - $this->template_filename = $locator->get_source_file_for_handle('bbcode.html'); + $template_locator->set_filenames(array('bbcode.html' => 'bbcode.html')); + $this->template_filename = $template_locator->get_source_file_for_handle('bbcode.html'); } $bbcode_ids = $rowset = $sql = array(); -- cgit v1.2.1