1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-27 16:20:13 +02:00

new module creation

This commit is contained in:
mcfly
2006-12-02 04:36:16 +00:00
commit e149b35fcc
2196 changed files with 182987 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/linkwords.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:24 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
class e_linkwords
{
var $linkwords = array();
var $linkhold = array(); // Placeholders in case url's contain linkwords
var $linkurls = array();
function e_linkwords()
{
/* constructor */
$sql = new db;
if($sql -> db_Select("linkwords", "*", "linkword_active=0"))
{
$linkWords = $sql -> db_getList();
$placeprefix="|*#!|"; // A highly unusual string
$iPlace = 1;
foreach($linkWords as $words)
{
$word = $words['linkword_word'];
$this -> linkwords[] = $word;
$this -> linkurls[] = " <a href='".$words['linkword_link']."' rel='external'>$word</a>";
$this -> linkhold[] = $placeprefix.$iPlace++.$placeprefix;
$word2 = substr_replace($word, strtoupper($word[0]), 0, 1);
$this -> linkwords[] = $word2;
$this -> linkhold[] = $placeprefix.$iPlace++.$placeprefix;
$this -> linkurls[] = " <a href='".$words['linkword_link']."' rel='external'>$word2</a>";
}
}
}
function linkwords($text)
{
$content = preg_split('#(<.*>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
$ptext = "";
foreach($content as $cont)
{
if (strstr($cont, "<"))
{
$ptext .= $cont;
} else {
$cont2=str_replace($this -> linkwords, $this -> linkhold, $cont);
$cont2=str_replace($this -> linkhold, $this -> linkurls, $cont2);
$ptext .= $cont2;
}
}
return $ptext;
}
}
?>