From e7e6d45789d4084b98a9c6227a42976e4a1d8f7f Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 10 Aug 2014 02:26:16 +0200 Subject: [ticket/12957] Update the constructions of the template engine PHPBB3-12957 --- phpBB/includes/bbcode.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 3460db4882..d5e01a7e1e 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -129,13 +129,30 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_path_helper; + global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_path_helper, $phpbb_container; if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $template = new phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new phpbb\template\context(), $phpbb_extension_manager); + $template = new \phpbb\template\twig\twig( + $phpbb_container->get('path_helper'), + $phpbb_container->get('config'), + $phpbb_container->get('user'), + new \phpbb\template\context(), + new \phpbb\template\twig\environment( + $phpbb_container->get('config'), + $phpbb_container->get('path_helper'), + $phpbb_container, + $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('ext.manager'), + new \phpbb\template\twig\loader() + ), + $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('template.twig.extensions.collection'), + $phpbb_extension_manager + ); + $template->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); -- cgit v1.2.1 From 4bdef6fd21a5dcab455b0cd1ee2652de606929c3 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Thu, 12 Mar 2015 00:25:00 +0100 Subject: [ticket/13697] Moving filesystem related functions to filesystem service * Moving filesystem service to \phpbb\filesystem namespace * Wraping Symfony's Filesystem component * Moving filesystem related functions from includes/functions.php into \phpbb\filesystem\filesystem Functions moved (and deprecated): - phpbb_chmod - phpbb_is_writable - phpbb_is_absolute - phpbb_own_realpath - phpbb_realpath * Adding interface for filesystem service PHPBB3-13697 --- phpBB/includes/bbcode.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index ee911b5ec5..53675637a0 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -129,7 +129,7 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $phpEx, $config, $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_path_helper, $phpbb_container; + global $phpbb_root_path, $phpEx, $config, $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_path_helper, $phpbb_container, $phpbb_filesystem; if (empty($this->template_filename)) { @@ -146,7 +146,9 @@ class bbcode $phpbb_container, $phpbb_container->getParameter('core.root_path') . 'cache/', $phpbb_container->get('ext.manager'), - new \phpbb\template\twig\loader() + new \phpbb\template\twig\loader( + $phpbb_filesystem + ) ), $phpbb_container->getParameter('core.root_path') . 'cache/', $phpbb_container->get('template.twig.extensions.collection'), -- cgit v1.2.1 From 51376a43919cba7a5037edb7cc31f18b5950437b Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Mon, 4 May 2015 23:50:16 +0200 Subject: [ticket/13638] Inject $filesystem in \phpbb\template\asset PHPBB3-13638 --- phpBB/includes/bbcode.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 53675637a0..150157e275 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -142,6 +142,7 @@ class bbcode new \phpbb\template\context(), new \phpbb\template\twig\environment( $phpbb_container->get('config'), + $phpbb_container->get('filesystem'), $phpbb_container->get('path_helper'), $phpbb_container, $phpbb_container->getParameter('core.root_path') . 'cache/', -- cgit v1.2.1 From 7b301e22f32e9209bb4e3ea17a5637a84a4ef908 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Fri, 1 May 2015 19:04:21 +0200 Subject: [ticket/13804] Make template's user dependency optional PHPBB3-13804 --- 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 150157e275..24eaddf067 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -138,7 +138,6 @@ class bbcode $template = new \phpbb\template\twig\twig( $phpbb_container->get('path_helper'), $phpbb_container->get('config'), - $phpbb_container->get('user'), new \phpbb\template\context(), new \phpbb\template\twig\environment( $phpbb_container->get('config'), @@ -152,6 +151,7 @@ class bbcode ) ), $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager ); -- cgit v1.2.1 From 71f5c9c32715b634d315f79aa11df07be2a9676c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 18 May 2015 17:07:02 +0200 Subject: [ticket/13832] Use preg_replace_callback instead of /e modifier PHPBB3-13832 --- phpBB/includes/bbcode.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 24eaddf067..dce9966efd 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -385,7 +385,16 @@ class bbcode } // Replace {L_*} lang strings - $bbcode_tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl); + $bbcode_tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { + if (!empty($user->lang[$match['1']])) + { + return $user->lang[$match['1']]; + } + else + { + return ucwords(strtolower(str_replace('_', ' ', $match['1']))); + } + }, $bbcode_tpl); if (!empty($rowset[$bbcode_id]['second_pass_replace'])) { @@ -509,7 +518,16 @@ class bbcode 'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2') ); - $tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl); + $tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { + if (!empty($user->lang[$match['1']])) + { + return $user->lang[$match['1']]; + } + else + { + return ucwords(strtolower(str_replace('_', ' ', $match['1']))); + } + }, $tpl); if (!empty($replacements[$tpl_name])) { -- cgit v1.2.1 From 3106195cddec48ec779282d03f2c54c88fc66511 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 19 May 2015 16:29:50 +0200 Subject: [ticket/13832] Use preg_replace_callback in bbcode class PHPBB3-13832 --- phpBB/includes/bbcode.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index dce9966efd..0c9869fe25 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -110,7 +110,18 @@ class bbcode $undid_bbcode_specialchars = true; } - $message = preg_replace($preg['search'], $preg['replace'], $message); + foreach ($preg['search'] as $key => $search) + { + if (is_callable($preg['replace'][$key])) + { + $message = preg_replace_callback($search, $preg['replace'][$key], $message); + } + else + { + $message = preg_replace($search, $preg['replace'][$key], $message); + } + } + $preg = array('search' => array(), 'replace' => array()); } } @@ -212,7 +223,9 @@ class bbcode '[/quote:$uid]' => $this->bbcode_tpl('quote_close', $bbcode_id) ), 'preg' => array( - '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise' => "\$this->bbcode_second_pass_quote('\$1', '\$2')" + '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#is' => function ($match) { + return $this->bbcode_second_pass_quote($match[1], $match[2]); + }, ) ); break; @@ -291,7 +304,9 @@ class bbcode case 8: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( - '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#ise' => "\$this->bbcode_second_pass_code('\$1', '\$2')", + '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#is' => function ($match) { + return $this->bbcode_second_pass_code($match[1], $match[2]); + }, ) ); break; @@ -301,7 +316,9 @@ class bbcode 'preg' => array( '#(\[\/?(list|\*):[mou]?:?$uid\])[\n]{1}#' => "\$1", '#(\[list=([^\[]+):$uid\])[\n]{1}#' => "\$1", - '#\[list=([^\[]+):$uid\]#e' => "\$this->bbcode_list('\$1')", + '#\[list=([^\[]+):$uid\]#' => function ($match) { + return $this->bbcode_list($match[1]); + }, ), 'str' => array( '[list:$uid]' => $this->bbcode_tpl('ulist_open_default', $bbcode_id), -- cgit v1.2.1 From 91cace06a5b8d0d2b2446429ec404acda0f42e5b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 20 May 2015 08:59:19 +0200 Subject: [ticket/13832] Resolve minor coding issues PHPBB3-13832 --- phpBB/includes/bbcode.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 0c9869fe25..ac5b3e6390 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -403,14 +403,7 @@ class bbcode // Replace {L_*} lang strings $bbcode_tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { - if (!empty($user->lang[$match['1']])) - { - return $user->lang[$match['1']]; - } - else - { - return ucwords(strtolower(str_replace('_', ' ', $match['1']))); - } + return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1]))); }, $bbcode_tpl); if (!empty($rowset[$bbcode_id]['second_pass_replace'])) @@ -536,14 +529,7 @@ class bbcode ); $tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { - if (!empty($user->lang[$match['1']])) - { - return $user->lang[$match['1']]; - } - else - { - return ucwords(strtolower(str_replace('_', ' ', $match['1']))); - } + return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1]))); }, $tpl); if (!empty($replacements[$tpl_name])) -- cgit v1.2.1 From 73e6e5b77faadbb7676961bf38122d669de111db Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Dec 2015 17:50:29 +0100 Subject: [ticket/13454] Remove unused variables This is the first part of the changes. More to come. PHPBB3-13454 --- 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 41d4ec40fe..eb6133d013 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -140,7 +140,7 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $phpEx, $config, $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_path_helper, $phpbb_container, $phpbb_filesystem; + global $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem; if (empty($this->template_filename)) { -- cgit v1.2.1 From 46c79bbe901d31e93d321a8de46696d3ac277cd5 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Fri, 18 Mar 2016 10:56:14 +0100 Subject: [ticket/9435] Convert bbcode magic numbers to constants PHPBB3-9435 --- phpBB/includes/bbcode.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index eb6133d013..3a71881730 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -219,7 +219,7 @@ class bbcode { switch ($bbcode_id) { - case 0: + case BBCODE_QUOTE_ID: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[/quote:$uid]' => $this->bbcode_tpl('quote_close', $bbcode_id) @@ -232,7 +232,7 @@ class bbcode ); break; - case 1: + case BBCODE_B_ID: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[b:$uid]' => $this->bbcode_tpl('b_open', $bbcode_id), @@ -241,7 +241,7 @@ class bbcode ); break; - case 2: + case BBCODE_I_ID: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[i:$uid]' => $this->bbcode_tpl('i_open', $bbcode_id), @@ -250,7 +250,7 @@ class bbcode ); break; - case 3: + case BBCODE_URL_ID: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#\[url:$uid\]((.*?))\[/url:$uid\]#s' => $this->bbcode_tpl('url', $bbcode_id), @@ -259,7 +259,7 @@ class bbcode ); break; - case 4: + case BBCODE_IMG_ID: if ($user->optionget('viewimg')) { $this->bbcode_cache[$bbcode_id] = array( @@ -278,7 +278,7 @@ class bbcode } break; - case 5: + case BBCODE_SIZE_ID: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#\[size=([\-\+]?\d+):$uid\](.*?)\[/size:$uid\]#s' => $this->bbcode_tpl('size', $bbcode_id), @@ -286,7 +286,7 @@ class bbcode ); break; - case 6: + case BBCODE_COLOR_ID: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is' => $this->bbcode_tpl('color', $bbcode_id), @@ -294,7 +294,7 @@ class bbcode ); break; - case 7: + case BBCODE_U_ID: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[u:$uid]' => $this->bbcode_tpl('u_open', $bbcode_id), @@ -303,7 +303,7 @@ class bbcode ); break; - case 8: + case BBCODE_CODE_ID: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#is' => function ($match) { @@ -313,7 +313,7 @@ class bbcode ); break; - case 9: + case BBCODE_LIST_ID: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#(\[\/?(list|\*):[mou]?:?$uid\])[\n]{1}#' => "\$1", @@ -333,7 +333,7 @@ class bbcode ); break; - case 10: + case BBCODE_EMAIL_ID: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#\[email:$uid\]((.*?))\[/email:$uid\]#is' => $this->bbcode_tpl('email', $bbcode_id), @@ -342,7 +342,7 @@ class bbcode ); break; - case 11: + case BBCODE_FLASH_ID: if ($user->optionget('viewflash')) { $this->bbcode_cache[$bbcode_id] = array( @@ -361,7 +361,7 @@ class bbcode } break; - case 12: + case BBCODE_ATTACH_ID: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[/attachment:$uid]' => $this->bbcode_tpl('inline_attachment_close', $bbcode_id) -- cgit v1.2.1 From 15a00131938fd0d1ae151f562f4fc75569db06cc Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sat, 19 Mar 2016 17:17:03 +0100 Subject: [ticket/9435] Switch "ID" and BBcode name in constants keys PHPBB3-9435 --- phpBB/includes/bbcode.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 3a71881730..f439279e78 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -219,7 +219,7 @@ class bbcode { switch ($bbcode_id) { - case BBCODE_QUOTE_ID: + case BBCODE_ID_QUOTE: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[/quote:$uid]' => $this->bbcode_tpl('quote_close', $bbcode_id) @@ -232,7 +232,7 @@ class bbcode ); break; - case BBCODE_B_ID: + case BBCODE_ID_B: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[b:$uid]' => $this->bbcode_tpl('b_open', $bbcode_id), @@ -241,7 +241,7 @@ class bbcode ); break; - case BBCODE_I_ID: + case BBCODE_ID_I: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[i:$uid]' => $this->bbcode_tpl('i_open', $bbcode_id), @@ -250,7 +250,7 @@ class bbcode ); break; - case BBCODE_URL_ID: + case BBCODE_ID_URL: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#\[url:$uid\]((.*?))\[/url:$uid\]#s' => $this->bbcode_tpl('url', $bbcode_id), @@ -259,7 +259,7 @@ class bbcode ); break; - case BBCODE_IMG_ID: + case BBCODE_ID_IMG: if ($user->optionget('viewimg')) { $this->bbcode_cache[$bbcode_id] = array( @@ -278,7 +278,7 @@ class bbcode } break; - case BBCODE_SIZE_ID: + case BBCODE_ID_SIZE: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#\[size=([\-\+]?\d+):$uid\](.*?)\[/size:$uid\]#s' => $this->bbcode_tpl('size', $bbcode_id), @@ -286,7 +286,7 @@ class bbcode ); break; - case BBCODE_COLOR_ID: + case BBCODE_ID_COLOR: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is' => $this->bbcode_tpl('color', $bbcode_id), @@ -294,7 +294,7 @@ class bbcode ); break; - case BBCODE_U_ID: + case BBCODE_ID_U: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[u:$uid]' => $this->bbcode_tpl('u_open', $bbcode_id), @@ -303,7 +303,7 @@ class bbcode ); break; - case BBCODE_CODE_ID: + case BBCODE_ID_CODE: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#is' => function ($match) { @@ -313,7 +313,7 @@ class bbcode ); break; - case BBCODE_LIST_ID: + case BBCODE_ID_LIST: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#(\[\/?(list|\*):[mou]?:?$uid\])[\n]{1}#' => "\$1", @@ -333,7 +333,7 @@ class bbcode ); break; - case BBCODE_EMAIL_ID: + case BBCODE_ID_EMAIL: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( '#\[email:$uid\]((.*?))\[/email:$uid\]#is' => $this->bbcode_tpl('email', $bbcode_id), @@ -342,7 +342,7 @@ class bbcode ); break; - case BBCODE_FLASH_ID: + case BBCODE_ID_FLASH: if ($user->optionget('viewflash')) { $this->bbcode_cache[$bbcode_id] = array( @@ -361,7 +361,7 @@ class bbcode } break; - case BBCODE_ATTACH_ID: + case BBCODE_ID_ATTACH: $this->bbcode_cache[$bbcode_id] = array( 'str' => array( '[/attachment:$uid]' => $this->bbcode_tpl('inline_attachment_close', $bbcode_id) -- cgit v1.2.1 From 56c2caf6c0778c0da48fe0ac688c893777b89ee4 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 23 Mar 2016 22:48:58 +0100 Subject: [ticket/14555] Uniformize cache directory usages PHPBB3-14555 --- phpBB/includes/bbcode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index eb6133d013..5fb8304b9a 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -155,13 +155,13 @@ class bbcode $phpbb_container->get('filesystem'), $phpbb_container->get('path_helper'), $phpbb_container, - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('ext.manager'), new \phpbb\template\twig\loader( $phpbb_filesystem ) ), - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager -- cgit v1.2.1 From 2505aaa9d677e1cb86684500b5f1ae9b04aae0f6 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sun, 3 Apr 2016 09:22:21 +0200 Subject: [ticket/14426] Fixed undefined offset error PHPBB3-14426 --- phpBB/includes/bbcode.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index e8969e552e..4b2aa90ebc 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -226,6 +226,11 @@ class bbcode ), 'preg' => array( '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#is' => function ($match) { + if (!isset($match[2])) + { + $match[2] = ''; + } + return $this->bbcode_second_pass_quote($match[1], $match[2]); }, ) -- cgit v1.2.1 From 663e3bc64238668ec139b53ccfb2f82a1d306601 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 23 Mar 2016 21:59:40 +0100 Subject: [ticket/13616] Updates direct call to twig environment constructor PHPBB3-13616 --- 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 4b2aa90ebc..e8492a82a3 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -154,7 +154,6 @@ class bbcode $phpbb_container->get('config'), $phpbb_container->get('filesystem'), $phpbb_container->get('path_helper'), - $phpbb_container, $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('ext.manager'), new \phpbb\template\twig\loader( -- cgit v1.2.1 From aabb9d2e488e465d48d9910f98a861ab96f55f74 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 15 Aug 2017 15:41:56 +0700 Subject: [ticket/15323] Allow Twig syntax in bbcode.html PHPBB3-15323 --- phpBB/includes/bbcode.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/bbcode.php') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index e8492a82a3..6572c0ad2c 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -501,7 +501,10 @@ class bbcode // Turn template blocks into PHP assignment statements for the values of $bbcode_tpl.. $this->bbcode_template = array(); - $matches = preg_match_all('#(.*?)#', $tpl, $match); + // Capture the BBCode template matches + // Allow phpBB template or the Twig syntax + $matches = (preg_match_all('#(.*?)#', $tpl, $match)) ?: + preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $tpl, $match); for ($i = 0; $i < $matches; $i++) { -- cgit v1.2.1