mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-14 04:42:04 +02:00
[ticket/9435] Switch "ID" and BBcode name in constants keys
PHPBB3-9435
This commit is contained in:
parent
0f7d08c121
commit
15a0013193
@ -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)
|
||||
|
@ -185,19 +185,19 @@ define('NUM_CORE_BBCODES', 12);
|
||||
define('NUM_PREDEFINED_BBCODES', 22);
|
||||
|
||||
// BBCode IDs
|
||||
define('BBCODE_QUOTE_ID', 0);
|
||||
define('BBCODE_B_ID', 1);
|
||||
define('BBCODE_I_ID', 2);
|
||||
define('BBCODE_URL_ID', 3);
|
||||
define('BBCODE_IMG_ID', 4);
|
||||
define('BBCODE_SIZE_ID', 5);
|
||||
define('BBCODE_COLOR_ID', 6);
|
||||
define('BBCODE_U_ID', 7);
|
||||
define('BBCODE_CODE_ID', 8);
|
||||
define('BBCODE_LIST_ID', 9);
|
||||
define('BBCODE_EMAIL_ID', 10);
|
||||
define('BBCODE_FLASH_ID', 11);
|
||||
define('BBCODE_ATTACH_ID', 12);
|
||||
define('BBCODE_ID_QUOTE', 0);
|
||||
define('BBCODE_ID_B', 1);
|
||||
define('BBCODE_ID_I', 2);
|
||||
define('BBCODE_ID_URL', 3);
|
||||
define('BBCODE_ID_IMG', 4);
|
||||
define('BBCODE_ID_SIZE', 5);
|
||||
define('BBCODE_ID_COLOR', 6);
|
||||
define('BBCODE_ID_U', 7);
|
||||
define('BBCODE_ID_CODE', 8);
|
||||
define('BBCODE_ID_LIST', 9);
|
||||
define('BBCODE_ID_EMAIL', 10);
|
||||
define('BBCODE_ID_FLASH', 11);
|
||||
define('BBCODE_ID_ATTACH', 12);
|
||||
|
||||
// BBCode hard limit
|
||||
define('BBCODE_LIMIT', 1511);
|
||||
|
@ -141,67 +141,67 @@ class bbcode_firstpass extends bbcode
|
||||
// To perform custom validation in extension, use $this->validate_bbcode_by_extension()
|
||||
// method which accepts variable number of parameters
|
||||
$this->bbcodes = array(
|
||||
'code' => array('bbcode_id' => BBCODE_CODE_ID, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uis' => function ($match) use($bbcode_class)
|
||||
'code' => array('bbcode_id' => BBCODE_ID_CODE, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_code($match[1], $match[2]);
|
||||
}
|
||||
)),
|
||||
'quote' => array('bbcode_id' => BBCODE_QUOTE_ID, 'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#uis' => function ($match) use($bbcode_class)
|
||||
'quote' => array('bbcode_id' => BBCODE_ID_QUOTE, 'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_quote($match[0]);
|
||||
}
|
||||
)),
|
||||
'attachment' => array('bbcode_id' => BBCODE_ATTACH_ID, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uis' => function ($match) use($bbcode_class)
|
||||
'attachment' => array('bbcode_id' => BBCODE_ID_ATTACH, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_attachment($match[1], $match[2]);
|
||||
}
|
||||
)),
|
||||
'b' => array('bbcode_id' => BBCODE_B_ID, 'regexp' => array('#\[b\](.*?)\[/b\]#uis' => function ($match) use($bbcode_class)
|
||||
'b' => array('bbcode_id' => BBCODE_ID_B, 'regexp' => array('#\[b\](.*?)\[/b\]#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_strong($match[1]);
|
||||
}
|
||||
)),
|
||||
'i' => array('bbcode_id' => BBCODE_I_ID, 'regexp' => array('#\[i\](.*?)\[/i\]#uis' => function ($match) use($bbcode_class)
|
||||
'i' => array('bbcode_id' => BBCODE_ID_I, 'regexp' => array('#\[i\](.*?)\[/i\]#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_italic($match[1]);
|
||||
}
|
||||
)),
|
||||
'url' => array('bbcode_id' => BBCODE_URL_ID, 'regexp' => array('#\[url(=(.*))?\](?(1)((?s).*(?-s))|(.*))\[/url\]#uiU' => function ($match) use($bbcode_class)
|
||||
'url' => array('bbcode_id' => BBCODE_ID_URL, 'regexp' => array('#\[url(=(.*))?\](?(1)((?s).*(?-s))|(.*))\[/url\]#uiU' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->validate_url($match[2], ($match[3]) ? $match[3] : $match[4]);
|
||||
}
|
||||
)),
|
||||
'img' => array('bbcode_id' => BBCODE_IMG_ID, 'regexp' => array('#\[img\](.*)\[/img\]#uiU' => function ($match) use($bbcode_class)
|
||||
'img' => array('bbcode_id' => BBCODE_ID_IMG, 'regexp' => array('#\[img\](.*)\[/img\]#uiU' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_img($match[1]);
|
||||
}
|
||||
)),
|
||||
'size' => array('bbcode_id' => BBCODE_SIZE_ID, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uis' => function ($match) use($bbcode_class)
|
||||
'size' => array('bbcode_id' => BBCODE_ID_SIZE, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_size($match[1], $match[2]);
|
||||
}
|
||||
)),
|
||||
'color' => array('bbcode_id' => BBCODE_COLOR_ID, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uis' => function ($match) use($bbcode_class)
|
||||
'color' => array('bbcode_id' => BBCODE_ID_COLOR, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_color($match[1], $match[2]);
|
||||
}
|
||||
)),
|
||||
'u' => array('bbcode_id' => BBCODE_U_ID, 'regexp' => array('#\[u\](.*?)\[/u\]#uis' => function ($match) use($bbcode_class)
|
||||
'u' => array('bbcode_id' => BBCODE_ID_U, 'regexp' => array('#\[u\](.*?)\[/u\]#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_underline($match[1]);
|
||||
}
|
||||
)),
|
||||
'list' => array('bbcode_id' => BBCODE_LIST_ID, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#uis' => function ($match) use($bbcode_class)
|
||||
'list' => array('bbcode_id' => BBCODE_ID_LIST, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_parse_list($match[0]);
|
||||
}
|
||||
)),
|
||||
'email' => array('bbcode_id' => BBCODE_EMAIL_ID, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#uis' => function ($match) use($bbcode_class)
|
||||
'email' => array('bbcode_id' => BBCODE_ID_EMAIL, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#uis' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->validate_email($match[1], $match[2]);
|
||||
}
|
||||
)),
|
||||
'flash' => array('bbcode_id' => BBCODE_FLASH_ID, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ui' => function ($match) use($bbcode_class)
|
||||
'flash' => array('bbcode_id' => BBCODE_ID_FLASH, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ui' => function ($match) use($bbcode_class)
|
||||
{
|
||||
return $bbcode_class->bbcode_flash($match[1], $match[2], $match[3]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user