mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
Moved smilies code into functions, would it be better in bbcode.php?
git-svn-id: file:///svn/phpbb/trunk@828 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
3ed35bfd6f
commit
88570ae919
2 changed files with 34 additions and 38 deletions
|
@ -623,7 +623,6 @@ function sync($type, $id)
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function language_select($default, $dirname="language/")
|
function language_select($default, $dirname="language/")
|
||||||
{
|
{
|
||||||
global $phpEx;
|
global $phpEx;
|
||||||
|
@ -767,5 +766,39 @@ function tz_select($default)
|
||||||
return($tz_select);
|
return($tz_select);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Smilies code ... would this be better tagged
|
||||||
|
// on to the end of bbcode.php?
|
||||||
|
//
|
||||||
|
function smilies_pass($message)
|
||||||
|
{
|
||||||
|
global $db, $board_config;
|
||||||
|
static $smilies;
|
||||||
|
|
||||||
|
if(empty($smilies))
|
||||||
|
{
|
||||||
|
$sql = "SELECT code, smile_url
|
||||||
|
FROM " . SMILIES_TABLE;
|
||||||
|
if($result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
|
$smilies = $db->sql_fetchrowset($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for($i = 0; $i < count($smilies); $i++)
|
||||||
|
{
|
||||||
|
$orig[] = "'([\s\.\>\
|
||||||
|
\(])" . preg_quote($smilies[$i]['code']) . "([\<\s\\).\
|
||||||
|
])'si";
|
||||||
|
$repl[] = '\1<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '">\2';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($i > 0)
|
||||||
|
{
|
||||||
|
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
|
||||||
|
$message = substr($message, 1, -1);
|
||||||
|
}
|
||||||
|
return($message);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -25,43 +25,6 @@ include($phpbb_root_path . 'extension.inc');
|
||||||
include($phpbb_root_path . 'common.'.$phpEx);
|
include($phpbb_root_path . 'common.'.$phpEx);
|
||||||
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
||||||
|
|
||||||
//
|
|
||||||
// Start functions
|
|
||||||
//
|
|
||||||
function smilies_pass($message)
|
|
||||||
{
|
|
||||||
global $db, $board_config;
|
|
||||||
static $smilies;
|
|
||||||
|
|
||||||
if(empty($smilies))
|
|
||||||
{
|
|
||||||
$sql = "SELECT code, smile_url
|
|
||||||
FROM " . SMILIES_TABLE;
|
|
||||||
if($result = $db->sql_query($sql))
|
|
||||||
{
|
|
||||||
$smilies = $db->sql_fetchrowset($result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for($i = 0; $i < count($smilies); $i++)
|
|
||||||
{
|
|
||||||
$orig[] = "'([\s\.\>\
|
|
||||||
])" . preg_quote($smilies[$i]['code']) . "([\s\.\
|
|
||||||
])'si";
|
|
||||||
$repl[] = '\1<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '">\2';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($i > 0)
|
|
||||||
{
|
|
||||||
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
|
|
||||||
$message = substr($message, 1, -1);
|
|
||||||
}
|
|
||||||
return($message);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// End functions
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Start initial var setup
|
// Start initial var setup
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Reference in a new issue