From 5195f9c2997e31ceddd60d20f08a23477d95db1e Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 4 Dec 2013 16:44:21 -0800 Subject: [ticket/12060] Add event core.display_custom_bbcodes_modify_sql Modify the SQL statement retrieving the custom bbcodes PHPBB3-12060 --- phpBB/includes/functions_display.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 5592aa89ba..f2d76cfd73 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -932,6 +932,17 @@ function display_custom_bbcodes() FROM ' . BBCODES_TABLE . ' WHERE display_on_posting = 1 ORDER BY bbcode_tag'; + + /** + * Modify the SQL statement retrieving the custom bbcodes + * + * @event core.display_custom_bbcodes_modify_sql + * @var string sql SQL SELECT statement + * @since 3.1-A3 + */ + $vars = array('sql'); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_sql', compact($vars))); + $result = $db->sql_query($sql); $i = 0; -- cgit v1.2.1 From 02ddc181d66e91357c5ee4132cc19187680109ff Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 4 Dec 2013 16:46:28 -0800 Subject: [ticket/12060] Fix a core typo in display_custom_bbcodes doc block PHPBB3-12060 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index f2d76cfd73..e0bf6786e1 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -919,7 +919,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold /** * Assign/Build custom bbcodes for display in screens supporting using of bbcodes -* The custom bbcodes buttons will be placed within the template block 'custom_codes' +* The custom bbcodes buttons will be placed within the template block 'custom_tags' */ function display_custom_bbcodes() { -- cgit v1.2.1 From 6ccec39e43a6f28051fc702378b038e78e18b225 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 12 Dec 2013 13:50:13 -0800 Subject: [ticket/12060] Use $sql_ary instead of $sql PHPBB3-12060 --- phpBB/includes/functions_display.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index e0bf6786e1..0525f8133c 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -928,22 +928,24 @@ function display_custom_bbcodes() // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) $num_predefined_bbcodes = 22; - $sql = 'SELECT bbcode_id, bbcode_tag, bbcode_helpline - FROM ' . BBCODES_TABLE . ' - WHERE display_on_posting = 1 - ORDER BY bbcode_tag'; + $sql_ary = array( + 'SELECT' => 'b.bbcode_id, b.bbcode_tag, b.bbcode_helpline', + 'FROM' => array(BBCODES_TABLE => 'b'), + 'WHERE' => 'b.display_on_posting = 1', + 'ORDER_BY' => 'b.bbcode_tag', + ); /** - * Modify the SQL statement retrieving the custom bbcodes + * Event to modify the SQL query before custom bbcode data is queried * * @event core.display_custom_bbcodes_modify_sql - * @var string sql SQL SELECT statement + * @var array sql_ary The SQL array to get the bbcode data * @since 3.1-A3 */ - $vars = array('sql'); + $vars = array('sql_ary'); extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_sql', compact($vars))); - $result = $db->sql_query($sql); + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); $i = 0; while ($row = $db->sql_fetchrow($result)) @@ -963,7 +965,7 @@ function display_custom_bbcodes() ); /** - * Modify the template data block of a bbcode + * Event to modify the template data block of a custom bbcode * * This event is triggered once per bbcode * -- cgit v1.2.1 From 75831dc2d0bb79007db14d0c2a86cbb024d98a31 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 12 Dec 2013 14:09:30 -0800 Subject: [ticket/12060] Change @since in event docblocks PHPBB3-12060 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 0525f8133c..5dac901b73 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -940,7 +940,7 @@ function display_custom_bbcodes() * * @event core.display_custom_bbcodes_modify_sql * @var array sql_ary The SQL array to get the bbcode data - * @since 3.1-A3 + * @since 3.1.0-A3 */ $vars = array('sql_ary'); extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_sql', compact($vars))); -- cgit v1.2.1 From b26e4dd42c434221acb488641a121e97307cb7dd Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 13 Dec 2013 10:31:04 -0800 Subject: [ticket/12060] Correctly label alpha versions in event docblocks PHPBB3-12060 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 5dac901b73..d1118b9672 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -940,7 +940,7 @@ function display_custom_bbcodes() * * @event core.display_custom_bbcodes_modify_sql * @var array sql_ary The SQL array to get the bbcode data - * @since 3.1.0-A3 + * @since 3.1.0-a3 */ $vars = array('sql_ary'); extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_sql', compact($vars))); -- cgit v1.2.1 From a24d2058cd7953084662c140ae4946d773e6411a Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 13 Dec 2013 16:47:38 -0800 Subject: [ticket/12060] Add num_predefined_bbcodes to display_custom_bbcodes_modify_sql event PHPBB3-12060 --- phpBB/includes/functions_display.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index d1118b9672..21ac3666e1 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -939,10 +939,12 @@ function display_custom_bbcodes() * Event to modify the SQL query before custom bbcode data is queried * * @event core.display_custom_bbcodes_modify_sql - * @var array sql_ary The SQL array to get the bbcode data + * @var array sql_ary The SQL array to get the bbcode data + * @var int num_predefined_bbcodes The number of predefined core bbcodes + * (multiplied by factor of 2) * @since 3.1.0-a3 */ - $vars = array('sql_ary'); + $vars = array('sql_ary', 'num_predefined_bbcodes'); extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_sql', compact($vars))); $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); -- cgit v1.2.1