Page 1 of 17

[ABD] Lexicon / Acronym MOD

Posted: Fri Oct 12, 2007 8:03 pm
by reh
MOD Title: Lexicon MOD
MOD Description: Give you the ability to have a table with words and descriptions, who can be displayed as a lexicon and also can be used to automatic insert acronyms with Tooltips to all posts. This mod is my first mod and it is alpha. I made it public, why a lot of people ask for a acronym mod. I had merged 2 mods for my phpBB2 (lexicon hack from experienz.net and Acronym Mod from CodeMonkeyX) and used this as submittal for the new one.
If you dont need a lexicon, only use the acronym part. For this you must not edit the overall_header.html, common.php and the functions.php und you only need the functions_acronym.php and some styling informations for your acronyms.

The lexicon can have entrys in several languages.
Each entry have this columns:
acronym - The string searched in the text. Add space before/after the word if it should only find entire words. If there are no space, it also was found in composite words or plural.
Can stay empty, then the term instead would be used.
term - the complete word used in the lexicon
description - used as title for the acronym and in the lexicon
long_desc - additional description for the lexicon

*** if you generally dont like acronyms inside other words, you can disable this in the acp ***

MOD Version: 0.1.5

MOD Download: http://www.kaninchenwissen.de/lexicon_0.1.5.zip

Demo Board: http://www.kaninchenwissen.de
http://www.kaninchenwissen.de/viewtopic ... t=43&#p496

This mod is my first mod. I made it public, why a lot of people ask for a acronym mod. I used 2 mods for phpBB2 (lexique and Acronym Mod from CodeMonkeyX)

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Wed Oct 31, 2007 9:53 pm
by Frold
Hey,

It seems like I have trouble with this line in the functions_acronym.php

Code: Select all

$acronyms['match'][] = '#(' . preg_quote($row['acronym'], '#') . ')#i'; 
If the Acronym is set to UL in the database UL is replaced in words like "should" - howto let it be case sensitive and match whole case? :S

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Thu Nov 01, 2007 12:54 am
by ecwpa
wow, i was looking for something like this for a long time!

it is possible to add auto-link function? i made a request in the past for like that
http://startrekguide.com/forum/viewtopi ... 997&hilit=

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Thu Nov 01, 2007 7:13 am
by reh
The original line for this was

Code: Select all

        $acronyms['match'][] = '#(?<!\w)(' . preg_quote($row['acronym'], '#') . ')(?!\w)#i';
i changed this to find also terms in longer words. See the text in the first post:
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
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.

@ecwpa
I cant read the topic without logging in

I also thought over linking the acronym, but there are no single view for the lexicon, only pages for the letters. So i have add a little ajax popup on clicking acronyms with long description using jquery (i already use jquery for a suggested search with ajax).

If i have time, i made a updated mod for this.

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Thu Nov 01, 2007 9:28 am
by ecwpa
ow, let me quote myself then:
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

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Thu Nov 01, 2007 5:26 pm
by Frold
TUTORIAL OF HOWTO USE YOUR OLD ACRONYM MOD (cmx_acronym_mod_v095) BASED ON THIS MOD

1. Copy you old acronyms database from phpBB2 to your new phpBB3 database

Something like
CREATE 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');
2. Open: viewtopic.php

FIND

Code: Select all

include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
ADD AFTER

Code: Select all

//----------------------------------------------------------------------
// Lexicon MOD - Begin Code Alteration
include($phpbb_root_path . 'includes/functions_acronym.' . $phpEx);
// Lexicon MOD - End Code Alteration
//----------------------------------------------------------------------
FIND

Code: Select all

$message = censor_text($row['post_text']);
ADD AFTER

Code: Select all

//----------------------------------------------------------------------
// Lexicon MOD - Begin Code Alteration
  $message = acronym_pass($message);
// Lexicon MOD - End Code Alteration
//----------------------------------------------------------------------
3. 0pen; /styles/prosilver/theme/commen.css

Insert:

Code: Select all

/* for common.php
---------------------------------------- */
acronym{
  font-style:italic;
  border-bottom:1px #BD5121 dashed ;
  color:#459B37;
  cursor: help;
}
4. Open; /styles/prosilver/theme/colours.css

Insert:

Code: Select all

/* for colours.php
---------------------------------------- */
acronym{
  border-bottom:1px #BD5121 dashed ;
  color:#459B37;
}
5. OPEN include/functions_acronyms.php

REPLACE ALL WITH

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
//----------------------------------------------------------------------

}
?>

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Tue Mar 11, 2008 9:24 am
by blauesblut
hello
i just get this error:

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)

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Wed Mar 12, 2008 2:21 pm
by Bruno36
Meme message d'erreur

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Thu Mar 13, 2008 12:01 pm
by Sr X
i think that this mod is useful, i hope that this have success. thanks.

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Thu Mar 27, 2008 7:53 am
by GeorgeA
Is this mod still under development?

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Thu Mar 27, 2008 10:19 am
by Bruno36
I get an error message when I clicked
http://www.scooter-chinois-4t.com/lexicon.php

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)

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Fri Mar 28, 2008 9:00 am
by Bruno36
Help :oops:

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Fri Mar 28, 2008 12:08 pm
by Overhead
@ Bruno36

show us the line 40 until 43 in lexicon.php - maybe it can be fixed. ;)

cu Overhead

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Fri Mar 28, 2008 1:56 pm
by Bruno36

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'>" : ">") 
Merci :D
Thank you

Re: [ALPHA] Lexicon / Acronym MOD

Posted: Mon Apr 14, 2008 7:02 am
by Bruno36
Help :oops:

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)