Code: Select all
$acronyms['match'][] = '#(' . preg_quote($row['acronym'], '#') . ')#i';
Code: Select all
$acronyms['match'][] = '#(?<!\w)(' . preg_quote($row['acronym'], '#') . ')(?!\w)#i';
The last i in the string is for search case insensitive, remove it should find case sensitive words only, but i have not tested it, i dont really understand this preg strings.The string searched in the text. add space before/after the word if it should only find entire words. If no space there, the text was also found in composite words or plural
Autolinks simply look for words in the autolinks list you have and then convert them to links.
In example:
phpbb - phpbb
profile - profile
search - search
are@51 - are@51
Actualy there is a module even better than autolinks for a cms called postnuke, it's called multihook and is the "evolution" of autolinks mod.
Description: MultiHook is a replacement for AutoLinks and can handle links, abbreviations and acronyms. It uses AJAX for admin tasks.
more info (and a demo) here
2. Open: viewtopic.phpCREATE TABLE `phpbb_acronyms` (
`acronym_id` mediumint(9) NOT NULL auto_increment,
`acronym` varchar(80) NOT NULL default '',
`description` varchar(255) NOT NULL default '',
PRIMARY KEY (`acronym_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=40 ;
--
-- Data dump for tabellen `phpbb_acronyms`
--
INSERT INTO `phpbb_acronyms` (`acronym_id`, `acronym`, `description`) VALUES
(1, 'KU', 'Københavns Universitet'),
(2, 'SDU', 'Syddansk Universitet'),
(3, 'AU', 'Århus Universitet'),
(4, 'Frold', 'Siteowner: Frederik Frost Nielsen'),
(39, 'PPC', 'PocketPC/lommecomputer');
Code: Select all
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
Code: Select all
//----------------------------------------------------------------------
// Lexicon MOD - Begin Code Alteration
include($phpbb_root_path . 'includes/functions_acronym.' . $phpEx);
// Lexicon MOD - End Code Alteration
//----------------------------------------------------------------------
Code: Select all
$message = censor_text($row['post_text']);
Code: Select all
//----------------------------------------------------------------------
// Lexicon MOD - Begin Code Alteration
$message = acronym_pass($message);
// Lexicon MOD - End Code Alteration
//----------------------------------------------------------------------
Code: Select all
/* for common.php
---------------------------------------- */
acronym{
font-style:italic;
border-bottom:1px #BD5121 dashed ;
color:#459B37;
cursor: help;
}
Code: Select all
/* for colours.php
---------------------------------------- */
acronym{
border-bottom:1px #BD5121 dashed ;
color:#459B37;
}
Code: Select all
<?php
/**
*
* @package acronym
* @version $Id: 0.1
* @copyright (c) 2007 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* automatic acronym insertion
*/
function acronym_pass($text)
{
$acronym_cache = new acronym_cache();
static $acronyms;
global $cache;
if (!isset($acronyms) || !is_array($acronyms))
{
// obtain_acronym_list is taking care of the users acronyms option and the board-wide option
$acronyms = $acronym_cache->obtain_acronym_list();
}
if (sizeof($acronyms))
{
$acronyms_match = $acronyms['match'];
$acronyms_repl = $acronyms['replace'];
return substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$acronyms_match, \$acronyms_repl, '\\0')", '>' . $text . '<'), 1, -1);
//return preg_replace(, , $text);
}
return $text;
}
function phpbb_preg_quote($str, $delimiter)
{
$text = preg_quote($str);
$text = str_replace($delimiter, '\\' . $delimiter, $text);
return $text;
}
/**
* Class for grabbing/handling acronym cached entries, extends acm_file or acm_db depending on the setup
* @package acm
*/
class acronym_cache extends acm
{//----------------------------------------------------------------------
// Acronym MOD - Begin Code Alteration
//
/**
* Obtain list of lexicon words for acronyms and build preg style replacement arrays for use by the
* calling script
*/
function obtain_acronym_list()
{
global $config, $user, $db;
/* if (!$user->optionget('viewcensors') && $config['allow_nocensors'])
{
return array();
}
*/
if (($acronyms = $this->get('_word_acronyms')) === false)
{
$sql = 'SELECT acronym, description
FROM ' . phpbb_acronyms . "
ORDER BY LENGTH(TRIM(acronym)) DESC";
$result = $db->sql_query($sql);
$acronyms = array();
while ($row = $db->sql_fetchrow($result))
{
$acronyms['match'][] = '#(' . phpbb_preg_quote($row['acronym'], '#') . ')#';
//$acronyms['match'][] = '#(?<!\w)(' . preg_quote($row['acronym'], '#') . ')(?!\w)#';
$acronyms['replace'][] = '<acronym title="' . $row['description'] . '">\\1</acronym>';
}
$db->sql_freeresult($result);
$this->put('_word_acronyms', $acronyms);
}
return $acronyms;
}
//
// Acronym MOD - End Code Alteration
//----------------------------------------------------------------------
}
?>
Code: Select all
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3480: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2932)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3482: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2932)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3483: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2932)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3484: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2932)
Code: Select all
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3548: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2955)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3550: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2955)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3551: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2955)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3552: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2955)
Code: Select all
foreach ($abc as $l) //make A-Z, link if entry
{
$abc_links .= (in_array($l, $alphabeth) OR $l == $user->lang['LEXICON_ALL']) ?
"<a href='lexicon.php?letter=$l&' " . ($letter === $l ? "class='letter'>" : ">")
Code: Select all
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /lexicon.php on line 42: in_array() [function.in-array]: Wrong datatype for second argument
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3581: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2955)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3583: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2955)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3584: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2955)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3585: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2955)