1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Linkwords first cut of upgrade

This commit is contained in:
e107steved
2008-12-07 21:55:02 +00:00
parent dd282efc69
commit 3362a349c5
9 changed files with 536 additions and 463 deletions

View File

@@ -11,32 +11,53 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/admin_config.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/admin_config.php,v $
| $Revision: 1.6 $ | $Revision: 1.7 $
| $Date: 2008-01-11 22:13:43 $ |
| ***** START OF VERSION WHICH ALLOWS TOOLTIPS (also order of forms changed )
|
| $Date: 2008-12-07 21:55:01 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
require_once("../../class2.php"); require_once("../../class2.php");
if (!getperms("P")) { if (!plugInstalled('linkwords')) header("Location: ".e_BASE."index.php");
if (!getperms("P"))
{
header("location:".e_BASE."index.php"); header("location:".e_BASE."index.php");
exit ; exit ;
} }
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN."auth.php");
@include_once(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php"); @include_lan(e_PLUGIN."linkwords/languages/".e_LANGUAGE."_admin_linkwords.php");
@include_once(e_PLUGIN."linkwords/languages/English.php");
$lw_context_areas = array( $lw_context_areas = array(
'title' => LWLAN_33, 'TITLE' => LWLAN_33,
'summary' => LWLAN_34, 'SUMMARY' => LWLAN_34,
'body' => LWLAN_35, 'BODY' => LWLAN_35,
'description' => LWLAN_36, 'DESCRIPTION' => LWLAN_36,
'user_title' => LWLAN_40, 'USER_TITLE' => LWLAN_40,
'user_body' => LWLAN_41 'USER_BODY' => LWLAN_41
// Don't do the next three - linkwords are meaningless on them // Don't do the next three - linkwords are meaningless on them
// 'olddefault' => LWLAN_37, // 'olddefault' => LWLAN_37,
// 'linktext' => LWLAN_38, // 'linktext' => LWLAN_38,
// 'rawtext' => LWLAN_39' // 'rawtext' => LWLAN_39'
); );
// Yes, I know its a silly order - but that's history!
$lwaction_vals = array(1=>LWLAN_51, 0=>LWLAN_52, 2=>LWLAN_53, 3=>LWLAN_54);
// Generate dropdown for possible actions on finding a linkword
function lw_act_opts($curval)
{
global $lwaction_vals;
$ret = '';
foreach ($lwaction_vals as $opt => $val)
{
$selected = ($curval == $opt ? "selected='selected'" : "");
$ret .= "<option value='{$opt}' {$selected}>{$val}</option>\n";
}
return $ret;
}
$deltest = array_flip($_POST); $deltest = array_flip($_POST);
@@ -47,6 +68,7 @@ if(isset($deltest[LWLAN_17]))
if ($sql->db_Count("linkwords", "(*)", "WHERE linkword_id = ".$delete_id)) if ($sql->db_Count("linkwords", "(*)", "WHERE linkword_id = ".$delete_id))
{ {
$sql->db_Delete("linkwords", "linkword_id=".$delete_id); $sql->db_Delete("linkwords", "linkword_id=".$delete_id);
$admin_log->log_event('LINKWD_03','ID: '.$delete_id,'');
$message = LWLAN_19; $message = LWLAN_19;
} }
} }
@@ -57,7 +79,7 @@ if(e_QUERY)
if (!isset($lw_qs[0])) $lw_qs[0] = 'words'; if (!isset($lw_qs[0])) $lw_qs[0] = 'words';
if (!isset($lw_qs[1])) $lw_qs[1] = -1; if (!isset($lw_qs[1])) $lw_qs[1] = -1;
$action = $lw_qs[0]; $action = $lw_qs[0];
$id = $lw_qs[1]; $id = intval($lw_qs[1]);
} }
if (!isset($action)) $action = 'words'; if (!isset($action)) $action = 'words';
@@ -65,13 +87,15 @@ if (isset($_POST['saveopts_linkword']))
{ // Save options page { // Save options page
// Array of context flags // Array of context flags
$pref['lw_context_visibility'] = array( $pref['lw_context_visibility'] = array(
'olddefault' => FALSE, 'OLDDEFAULT' => FALSE,
'title' => FALSE, 'TITLE' => FALSE,
'summary' => FALSE, 'USER_TITLE' => FALSE,
'body' => FALSE, 'SUMMARY' => FALSE,
'description' => FALSE, 'BODY' => FALSE,
'linktext' => FALSE, 'USER_BODY' => FALSE,
'rawtext' => FALSE 'DESCRIPTION' => FALSE,
'LINKTEXT' => FALSE,
'RAWTEXT' => FALSE
); );
foreach ($_POST['lw_visibility_area'] as $can_see) foreach ($_POST['lw_visibility_area'] as $can_see)
{ {
@@ -87,40 +111,55 @@ if (isset($_POST['saveopts_linkword']))
$pagelist[$i] = trim($pagelist[$i]); $pagelist[$i] = trim($pagelist[$i]);
} }
$pref['lw_page_visibility'] = '2-'.implode("|", $pagelist); // '2' for 'hide on specified pages' $pref['lw_page_visibility'] = '2-'.implode("|", $pagelist); // '2' for 'hide on specified pages'
$pref['lw_ajax_enable'] = isset($_POST['lw_ajax_enable']);
save_prefs(); save_prefs();
$logString = implode(', ',$pref['lw_context_visibility']).'[!br!]'.$pref['lw_page_visibility'].'[!br!]'.$pref['lw_ajax_enable'];
$admin_log->log_event('LINKWD_04',$logString,'');
} }
if (isset($_POST['submit_linkword'])) if (isset($_POST['submit_linkword']) || isset($_POST['update_linkword']))
{ {
if(!$_POST['linkwords_word'] && $_POST['linkwords_url']) if(!$_POST['linkwords_word'] && $_POST['linkwords_url'])
{ { // Key fields empty
$message = LWLAN_1; $message = LWLAN_1;
} }
else else
{ {
$word = $tp -> toDB($_POST['linkword_word']); $data['linkword_word'] = $tp -> toDB($_POST['linkword_word']);
$link = $tp -> toDB($_POST['linkword_link']); $data['linkword_link'] = $tp -> toDB($_POST['linkword_link']);
$active = intval($_POST['linkword_active']); $data['linkword_tooltip'] = $tp -> toDB($_POST['linkword_tooltip']);
$sql -> db_Insert("linkwords", "0, {$active}, '{$word}', '{$link}' "); $data['linkword_tip_id'] = intval($_POST['linkword_tip_id']);
$message = LWLAN_2; $data['linkword_active'] = intval($_POST['linkword_active']);
} $data['linkword_newwindow'] = isset($_POST['linkword_newwindow']) ? 1 : 0;
}
if (isset($_POST['update_linkword'])) $logString = implode('[!br!]',$data);
{ if (isset($_POST['submit_linkword']))
if(!$_POST['linkwords_word'] && $_POST['linkwords_url']) {
{ if ($sql -> db_Insert('linkwords', $data))
$message = LWLAN_1; {
} $message = LWLAN_2;
else $admin_log->log_event('LINKWD_01',$logString,'');
{ }
$id = $_POST['id']; else
$word = $tp -> toDB($_POST['linkword_word']); {
$link = $tp -> toDB($_POST['linkword_link']); $message = LWLAN_57;
$active = $_POST['linkword_active']; }
$sql -> db_Update("linkwords", "linkword_active=$active, linkword_word='$word', linkword_link='$link' WHERE linkword_id=".$id); }
$message = LWLAN_3; elseif (isset($_POST['update_linkword']))
{
$id = intval(varset($_POST['lw_edit_id'],0));
if (($id > 0) && $sql -> db_UpdateArray('linkwords', $data, ' WHERE `linkword_id`='.$id))
{
$message = LWLAN_3;
$logString = 'ID: '.$id.'[!br!]'.$logString;
$admin_log->log_event('LINKWD_02',$logString,'');
}
else
{
$message = LWLAN_57;
}
}
} }
} }
@@ -131,13 +170,14 @@ if (isset($message))
} }
$chkNewWindow = " checked='checked'"; // Open links in new window by default
if($action == "edit") if($action == "edit")
{ {
if($sql -> db_Select("linkwords", "*", "linkword_id=".$id)) if($sql -> db_Select("linkwords", "*", "linkword_id=".$id))
{ {
$row = $sql -> db_Fetch(); $row = $sql -> db_Fetch();
extract($row); extract($row);
$chkNewWindow = $row['linkword_newwindow'] ? " checked='checked'" : ''; // Open links in new window by default
define("LW_EDIT", TRUE); define("LW_EDIT", TRUE);
} }
} }
@@ -154,45 +194,64 @@ $text = "
<div class='center'> <div class='center'>
<form method='post' action='".e_SELF."?words'> <form method='post' action='".e_SELF."?words'>
<table style='".ADMIN_WIDTH."' class='fborder'> <table style='".ADMIN_WIDTH."' class='fborder'>
<colgroup>
<col style='width: 35%; vertical-align:top;' />
<col style='width: 65%; vertical-align:top;' />
</colgroup>
<tr> <tr>
<td style='width:50%' class='forumheader3'>".LWLAN_21."</td> <td class='forumheader3'>".LWLAN_21."</td>
<td style='width:50%' class='forumheader3'> <td class='forumheader3'>
<input class='tbox' type='text' name='linkword_word' size='40' value='".$linkword_word."' maxlength='100' /> <input class='tbox' type='text' name='linkword_word' size='40' value='".$linkword_word."' maxlength='100' />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style='width:50%' class='forumheader3'>".LWLAN_6."</td> <td class='forumheader3'>".LWLAN_6."</td>
<td style='width:50%' class='forumheader3'> <td class='forumheader3'>
<input class='tbox' type='text' name='linkword_link' size='60' value='".$linkword_link."' maxlength='200' /> <input class='tbox' type='text' name='linkword_link' size='60' value='".$linkword_link."' maxlength='250' /><br />
<input type='checkbox' name='linkword_newwindow' value='1'{$chkNewWindow} />".LWLAN_55."
</td> </td>
</tr> </tr>
<tr> <tr>
<td style='width:50%' class='forumheader3'>".LWLAN_22."</td> <td class='forumheader3'>".LWLAN_50."</td>
<td style='width:50%; text-align:right' class='forumheader3'> <td class='forumheader3'>
<input type='radio' name='linkword_active' value='0'".(!$linkword_active ? " checked='checked'" : "")." /> ".LWLAN_9."&nbsp;&nbsp; <textarea rows='3' cols='80' class='tbox' name='linkword_tooltip'>".$linkword_tooltip."</textarea>
<input type='radio' name='linkword_active' value='1'".($linkword_active ? " checked='checked'" : "")." /> ".LWLAN_10." </td>
</tr>
<tr>
<td class='forumheader3'>".LWLAN_62."</td>
<td class='forumheader3'>
<input class='tbox' type='text' name='linkword_tip_id' size='10' value='".$linkword_tip_id."' maxlength='10' /> ".LWLAN_63."
</td>
</tr>
<tr>
<td class='forumheader3'>".LWLAN_22."</td>
<td style='text-align:left' class='forumheader3'><select class='tbox' name='linkword_active'>".lw_act_opts($linkword_active).
"</select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan='2' style='text-align:center' class='forumheader'>". <td colspan='2' style='text-align:center' class='forumheader'>".
(defined("LW_EDIT") ? "<input class='button' type='submit' name='update_linkword' value='".LWLAN_15."' /><input type='hidden' name='id' value='$id' />" : "<input class='button' type='submit' name='submit_linkword' value='".LWLAN_14."' />")." (defined("LW_EDIT") ? "<input class='button' type='submit' name='update_linkword' value='".LWLAN_15."' /><input type='hidden' name='lw_edit_id' value='{$id}' />" : "<input class='button' type='submit' name='submit_linkword' value='".LWLAN_14."' />")."
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
</div>\n"; </div>\n";
$ns -> tablerender(LWLAN_31, $text); $ns -> tablerender(LWLAN_31, $text);
} }
// Now display existing linkwords
if (($action == 'words') || ($action == 'edit')) if (($action == 'words') || ($action == 'edit'))
{ {
$text = "<div class='center'>\n"; $text = "<div class='center'>\n";
if(!$sql -> db_Select("linkwords")) if(!$sql -> db_Select("linkwords"))
{ {
@@ -201,30 +260,49 @@ if (($action == 'words') || ($action == 'edit'))
else else
{ {
$text = " $text = "
<div class='center'>
<table style='".ADMIN_WIDTH."' class='fborder'> <table style='".ADMIN_WIDTH."' class='fborder'>
<tr> <colgroup>
<td class='forumheader' style='width: 20%;'>".LWLAN_5."</td> <col style='width: 5%; vertical-align:top;' />
<td class='forumheader' style='width: 40%;'>".LWLAN_6."</td> <col style='width: 15%; vertical-align:top;' />
<td class='forumheader' style='width: 10%; text-align: center;'>".LWLAN_7."</td> <col style='width: 20%; vertical-align:top;' />
<td class='forumheader' style='width: 30%; text-align: center;'>".LWLAN_8."</td> <col style='width: 5%; vertical-align:top;' />
<col style='width: 25%; vertical-align:top;' />
<col style='width: 5%; vertical-align:top;' />
<col style='width: 10%; vertical-align:top; text-align: center;' />
<col style='width: 15%; vertical-align:top; text-align: center;' />
</colgroup> <tr>
<td class='forumheader'>".LWLAN_61."</td>
<td class='forumheader'>".LWLAN_5."</td>
<td class='forumheader'>".LWLAN_6."</td>
<td class='forumheader'>".LWLAN_56."</td>
<td class='forumheader'>".LWLAN_50."</td>
<td class='forumheader'>".LWLAN_60."</td>
<td class='forumheader'>".LWLAN_7."</td>
<td class='forumheader'>".LWLAN_8."</td>
</tr>\n"; </tr>\n";
while($row = $sql -> db_Fetch()) while($row = $sql -> db_Fetch())
{ {
extract($row);
$text .= " $text .= "
<form action='".e_SELF."' method='post' id='myform_$linkword_id' onsubmit=\"return jsconfirm('".LWLAN_18." [ID: $linkword_id ]')\">
<tr> <tr>
<td class='forumheader' style='width: 20%;'>$linkword_word</td> <td class='forumheader'>{$row['linkword_id']}</td>
<td class='forumheader' style='width: 40%;'>$linkword_link</td> <td class='forumheader'>{$row['linkword_word']}</td>
<td class='forumheader' style='width: 10%; text-align: center;'>".(!$linkword_active ? LWLAN_12 : LWLAN_13)."</td> <td class='forumheader'>{$row['linkword_link']}</td>
<td class='forumheader' style='width: 30%; text-align: center;'> <td class='forumheader'>".($row['linkword_newwindow'] ? LAN_YES : LAN_NO)."</td>
<input class='button' type='button' onclick=\"document.location='".e_SELF."?edit.$linkword_id'\" value='".LWLAN_16."' id='edit_$linkword_id' name='edit_linkword_id' /> <td class='forumheader'>{$row['linkword_tooltip']}</td>
<input class='button' type='submit' value='".LWLAN_17."' id='delete_$linkword_id' name='delete_$linkword_id' /> <td class='forumheader'>".($row['linkword_tip_id'] > 0 ? $row['linkword_tip_id'] : '')."</td>
<td class='forumheader' >".$lwaction_vals[$row['linkword_active']]."</td>
<td class='forumheader' >
<form action='".e_SELF."' method='post' id='myform_{$row['linkword_id']}' onsubmit=\"return jsconfirm('".LWLAN_18." [ID: {$row['linkword_id']} ]')\">
<div>
<input class='button' type='button' onclick=\"document.location='".e_SELF."?edit.{$row['linkword_id']}'\" value='".LWLAN_16."' id='edit_{$row['linkword_id']}' name='edit_linkword_id' />
<input class='button' type='submit' value='".LWLAN_17."' id='delete_{$row['linkword_id']}' name='delete_{$row['linkword_id']}' />
</div>
</form>\n
</td> </td>
</tr> </tr>
</form>\n"; ";
} }
$text .= "</table>"; $text .= "</table>";
} }
@@ -239,6 +317,7 @@ if ($action=='options')
{ {
$menu_pages = substr($pref['lw_page_visibility'],2); // Knock off the 'show/hide' flag $menu_pages = substr($pref['lw_page_visibility'],2); // Knock off the 'show/hide' flag
$menu_pages = str_replace("|", "\n", $menu_pages); $menu_pages = str_replace("|", "\n", $menu_pages);
$AjaxEnable = varset($pref['lw_ajax_enable'],0);
$text = " $text = "
<div class='center'> <div class='center'>
<form method='post' action='".e_SELF."?options'> <form method='post' action='".e_SELF."?options'>
@@ -265,6 +344,15 @@ if ($action=='options')
<td class='forumheader3'><textarea rows='5' cols='60' class='tbox' name='linkword_omit_pages' >".$menu_pages."</textarea> <td class='forumheader3'><textarea rows='5' cols='60' class='tbox' name='linkword_omit_pages' >".$menu_pages."</textarea>
</td> </td>
<td class='forumheader3'>".LWLAN_29." <td class='forumheader3'>".LWLAN_29."
</tr>";
$checked = varset($pref['lw_ajax_enable'],0) ? 'checked=checked' : '';
$text .= "
<tr>
<td class='forumheader3'>".LWLAN_59."</td>
<td class='forumheader3'><input type='checkbox' name='lw_ajax_enable' {$checked}>
</td>
<td class='forumheader3'>".""."
</tr> </tr>
<tr> <tr>

View File

@@ -0,0 +1,38 @@
<?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/e_help.php,v $
| $Revision: 1.1 $
| $Date: 2008-12-07 21:55:01 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
include_lan(e_PLUGIN."linkwords/languages/".e_LANGUAGE."_admin_linkwords.php");
if (e_QUERY) list($action,$junk) = explode('.',e_QUERY); else $action = 'words';
switch ($action)
{
case 'options' :
$text = LAN_LW_HELP_01;
break;
case 'words' :
case 'edit' :
default :
$text = LAN_LW_HELP_02;
}
$ns -> tablerender(LAN_LW_HELP_00, $text);
unset($text);
?>

View File

@@ -3,7 +3,7 @@
+ ----------------------------------------------------------------------------+ + ----------------------------------------------------------------------------+
| e107 website system | e107 website system
| |
| Steve Dunstan 2001-2002 | <EFBFBD>Steve Dunstan 2001-2002
| http://e107.org | http://e107.org
| jalist@e107.org | jalist@e107.org
| |
@@ -11,149 +11,213 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/e_tohtml.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/e_tohtml.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2008-02-08 20:09:43 $ | $Date: 2008-12-07 21:55:01 $
| $Author: mcfly_e107 $ | $Author: e107steved $
|
| *utf - flags functions which need utf-8-aware code
TODO:
1. Add utf-8 aware routines - done, test a bit more
2. Add special effects for tooltips
3. Caching?
| |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
if (!plugInstalled('linkwords')) exit;
class e_tohtml_linkwords class e_tohtml_linkwords
{ {
var $lw_enabled = FALSE; // Default to disabled to start var $lw_enabled = FALSE; // Default to disabled to start
var $word_list = array(); // List of link words/phrases var $lwAjaxEnabled = FALSE; // Adds in Ajax-compatible links
var $link_list = array(); // Corresponding list of links to apply var $utfMode = ''; // Flag to enable utf-8 on regex
var $tip_list = array(); var $word_list = array(); // List of link words/phrases
var $area_opts = array(); // Process flags for the various contexts var $link_list = array(); // Corresponding list of links to apply
var $ext_list = array(); // Flags to determine 'open in new window' for link
var $tip_list = array(); // Store for tooltips
var $area_opts = array(); // Process flags for the various contexts
var $block_list = array(); // Array of 'blocked' pages var $block_list = array(); // Array of 'blocked' pages
var $LinkID = array(); // Unique ID for each linkword
function to_html() /* constructor */
function e_tohtml_linkwords()
{ {
global $pref; global $pref, $tp;
/* constructor */
// See whether they should be active on this page - if not, no point doing anything! // See whether they should be active on this page - if not, no point doing anything!
if ((strpos(e_SELF, ADMINDIR) !== FALSE) || (strpos(e_PAGE, "admin_") !== FALSE)) return; // No linkwords on admin directories if ((strpos(e_SELF, ADMINDIR) !== FALSE) || (strpos(e_PAGE, "admin_") !== FALSE)) return; // No linkwords on admin directories
// Now see if disabled on specific pages // Now see if disabled on specific pages
$check_url = e_SELF.(e_QUERY ? "?".e_QUERY : ''); $check_url = e_SELF.(e_QUERY ? "?".e_QUERY : '');
$this->block_list = explode("|",substr($pref['lw_page_visibility'],2)); // Knock off the 'show/hide' flag $this->block_list = explode("|",substr(varset($pref['lw_page_visibility'],''),2)); // Knock off the 'show/hide' flag
foreach ($this->block_list as $p) foreach ($this->block_list as $p)
{ {
if ($p=trim($p)) if ($p=trim($p))
{ {
if(substr($p, -1) == '!') if(substr($p, -1) == '!')
{ {
$p = substr($p, 0, -1); $p = substr($p, 0, -1);
if(substr($check_url, strlen($p)*-1) == $p) return; if(substr($check_url, strlen($p)*-1) == $p) return;
} }
else else
{ {
if(strpos($check_url, $p) !== FALSE) return; if(strpos($check_url, $p) !== FALSE) return;
} }
} }
} }
// Will probably need linkwords on this page - so get the info // Will probably need linkwords on this page - so get the info
$this->lw_enabled = TRUE;
$link_sql = new db; $link_sql = new db;
if($link_sql -> db_Select("linkwords", "*", "linkword_active=0")) if($link_sql -> db_Select("linkwords", "*", "linkword_active!=1"))
{ {
$this->lw_enabled = TRUE;
while ($row = $link_sql->db_Fetch()) while ($row = $link_sql->db_Fetch())
{ {
$lw = trim(strtolower($row['linkword_word'])); extract($row);
// $lw = strtolower($linkword_word); // It was trimmed when saved *utf
$lw = $tp->uStrToLower($linkword_word); // It was trimmed when saved *utf
if ($linkword_active == 2) $linkword_link = ''; // Make sure linkword disabled
if ($linkword_active < 2) $linkword_tooltip = ''; // Make sure tooltip disabled
$lwID = max($row['linkword_tip_id'], $row['linkword_id']); // If no specific ID defined, use the DB record ID
if (strpos($lw,',')) if (strpos($lw,','))
{ // Several words to same link { // Several words to same link
$lwlist = explode(',',$lw); $lwlist = explode(',',$lw);
foreach ($lwlist as $lw) foreach ($lwlist as $lw)
{ {
$this->word_list[] = trim($lw); $this->word_list[] = trim($lw);
$this->link_list[] = $row['linkword_link']; $this->link_list[] = $linkword_link;
$this->tip_list[] = $linkword_tooltip;
$this->ext_list[] = $linkword_newwindow;
$this->LinkID[] = $lwID;
} }
} }
else else
{ {
$this->word_list[] = $lw; $this->word_list[] = $lw;
$this->link_list[] = $row['linkword_link']; $this->link_list[] = $linkword_link;
$this->tip_list[] = $linkword_tooltip;
$this->ext_list[] = $linkword_newwindow;
$this->LinkID[] = $lwID;
} }
} }
} }
if (is_array($pref['lw_context_visibility'])) $this->area_opts = $pref['lw_context_visibility'];
{ $this->utfMode = (strtolower(CHARSET) == 'utf-8') ? 'u' : ''; // Flag to enable utf-8 on regex
$this->area_opts = $pref['lw_context_visibility']; $this->lwAjaxEnabled = varset($pref['lw_ajax_enable'],0);
}
} }
function linkwords($text,$area = 'olddefault') function to_html($text,$area = 'olddefault')
{ {
if (!$this->lw_enabled || !array_key_exists($area,$this->area_opts) || !$this->area_opts[$area]) return $text; // No linkwords in disabled areas if (!$this->lw_enabled || !array_key_exists($area,$this->area_opts) || !$this->area_opts[$area]) return $text; // No linkwords in disabled areas
// Split up by HTML tags and process the odd bits here // Split up by HTML tags and process the odd bits here
$ptext = ""; $ptext = "";
$lflag = FALSE; $lflag = FALSE;
$content = preg_split('#(<.*?>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); // Shouldn't need utf-8 on next line - just looking for HTML tags
foreach($content as $cont) $content = preg_split('#(<.*?>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
{ foreach($content as $cont)
if (strpos($cont, "<") !== FALSE) {
{ // Its some HTML if ($cont[0] == "<")
$ptext .= $cont; { // Its some HTML
if (strpos($cont,"<a") !== FALSE) $lflag = TRUE; $ptext .= $cont;
if (strpos($cont,"</a") !== FALSE) $lflag = FALSE; if (substr($cont,0,2) == "<a") $lflag = TRUE;
} if (substr($cont,0,3) == "</a") $lflag = FALSE;
else }
{ // Its the text in between else
if ($lflag) { // Its the text in between
{ // Its probably within a link - leave unchanged if ($lflag)
$ptext .= $cont; { // Its probably within a link - leave unchanged
} $ptext .= $cont;
else }
{ else
if (trim($cont)) {
{ // Some non-white space - worth word matching if (trim($cont))
$ptext .= $this->linksproc($cont,0,count($this->word_list)); { // Some non-white space - worth word matching
$ptext .= $this->linksproc($cont,0,count($this->word_list));
// echo "Check linkwords: ".count($this->word_list).'<br />';
}
else
{
$ptext .= $cont;
}
}
} }
else
{
$ptext .= $cont;
}
}
} }
} return $ptext;
return $ptext;
} }
function linksproc($text,$first,$limit) function linksproc($text,$first,$limit)
{ // This function is called recursively - it splits the text up into blocks - some containing a particular linkword { // This function is called recursively - it splits the text up into blocks - some containing a particular linkword
while (($first < $limit) && (stripos($text,$this->word_list[$first]) === FALSE)) { $first++; }; global $tp;
if ($first == $limit) return $text; // Return if no linkword found
// Consider next line - stripos is PHP5, and mb_stripos is PHP >= 5.2 - so may well often require handling
// There's at least one occurrence of the linkword in the text // while (($first < $limit) && (stripos($text,$this->word_list[$first]) === FALSE)) { $first++; }; // *utf (stripos is PHP5 - compatibility handler implements)
$ret = ''; while (($first < $limit) && (strpos($tp->uStrToLower($text),$this->word_list[$first]) === FALSE)) { $first++; }; // *utf
$lw = $this->word_list[$first]; if ($first == $limit) return $text; // Return if no linkword found
// This splits the text into blocks, some of which will precisely contain a linkword
$split_line = preg_split('#\b('.$lw.')\b#i', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); // There's at least one occurrence of the linkword in the text
foreach ($split_line AS $sl) // Prepare all info once only
{ // If supporting Ajax, use the following:
if (strcasecmp($sl,$lw) == 0) // <a href='link url' rel='external linkwordId::122' class='linkword-ajax'>
{ // Do linkword replace // linkwordId::122 is a unique ID
$ret .= " <a href='".$this->link_list[$first]."' rel='external'>{$sl}</a>"; $ret = '';
$linkwd = '';
$linkrel = array();
// $linkwd = "href='#' "; // Not relevant for Prototype, but needed with 'pure' JS to make tooltip stuff work - doesn't find link elements without href
$lwClass = array();
$lw = $this->word_list[$first]; // This is the word we're matching - in lower case in our 'master' list
$tooltip = '';
if ($this->tip_list[$first])
{ // Got tooltip
if ($this->lwAjaxEnabled)
{
$linkrel[] = 'linkwordID::'.$this->LinkID[$first];
$lwClass[] = 'lw_ajax';
}
else
{
$tooltip = " title='{$this->tip_list[$first]}' ";
$lwClass[] = 'lw_tip';
}
} }
elseif (trim($sl)) if ($this->link_list[$first])
{ // Something worthwhile left - look for more linkwords in it { // Got link
$ret .= $this->linksproc($sl,$first+1,$limit); $linkwd = " href='".$tp->replaceConstants($this->link_list[$first])."' ";
if ($this->ext_list[$first]) { $linkrel[] = 'external'; } // Determine external links
$lwClass[] = 'lw_link';
} }
else if (!count($lwClass))
{ {
$ret .= $sl; // Probably just some white space return $this->linksproc($sl,$first+1,$limit); // Nothing to do - move on to next word (shouldn't really get here)
} }
} if (count($linkrel))
return $ret; {
} $linkwd .= " rel='".implode(' ',$linkrel)."'";
}
// This splits the text into blocks, some of which will precisely contain a linkword
$split_line = preg_split('#\b('.$lw.')\b#i'.$this->utfMode, $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); // *utf (selected)
$class = "class='".implode(' ',$lwClass)."' ";
foreach ($split_line as $sl)
{
if ($tp->uStrToLower($sl) == $lw) // We know the linkword is already lower case // *utf
{ // Do linkword replace
$ret .= ' <a '.$class.$linkwd.$tooltip.'>'.$sl.'</a>';
}
elseif (trim($sl))
{ // Something worthwhile left - look for more linkwords in it
$ret .= $this->linksproc($sl,$first+1,$limit);
}
else
{
$ret .= $sl; // Probably just some white space
}
}
return $ret;
}
} }
?> ?>

View File

@@ -1,68 +0,0 @@
<?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/languages/English.php,v $
| $Revision: 1.4 $
| $Date: 2007-07-23 21:02:35 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
define("LWLAN_1", "Field(s) left blank.");
define("LWLAN_2", "Link word saved.");
define("LWLAN_3", "Link word updated.");
define("LWLAN_4", "No link words defined yet.");
define("LWLAN_5", "Words");
define("LWLAN_6", "Link");
define("LWLAN_7", "Active?");
define("LWLAN_8", "Options");
define("LWLAN_9", "yes");
define("LWLAN_10", "no");
define("LWLAN_11", "Existing Linkwords");
define("LWLAN_12", "Yes");
define("LWLAN_13", "No");
define("LWLAN_14", "Submit LinkWord");
define("LWLAN_15", "Update LinkWord");
define("LWLAN_16", "Edit");
define("LWLAN_17", "Delete");
define("LWLAN_18", "Are you sure you want to delete this linkword?");
define("LWLAN_19", "Linkword deleted.");
define("LWLAN_20", "Unable to find that linkword entry.");
define("LWLAN_21", "Word to autolink (or comma-separated list of words)");
define("LWLAN_22", "Activate?");
define("LWLAN_23", "Linkwords Administration");
define("LWLAN_24", "Manage Words");
define("LWLAN_25", "Options");
define("LWLAN_26", "Areas in which to enable linkwords");
define("LWLAN_27", "This is the 'context' of the displayed text");
define("LWLAN_28", "Pages on which to disable linkwords");
define("LWLAN_29", "Same format as menu visibility control. One match per line. Specify a partial or complete URL. End with '!' for exact match of the end part of the link");
define("LWLAN_30", "Save options");
define("LWLAN_31", "Add/edit linkword");
define("LWLAN_32", "Linkword Options");
define("LWLAN_33", 'Title areas');
define("LWLAN_34", 'Item summaries');
define("LWLAN_35", 'Body text');
define("LWLAN_36", 'Descriptions (links etc)');
define("LWLAN_37", 'Legacy areas');
define("LWLAN_38", 'Clickable links');
define("LWLAN_39", 'Unprocessed text');
define("LWLAN_40", 'User-entered titles (e.g. forum)');
define("LWLAN_41", 'User-entered body text (e.g. forum)');
define("LWLANINS_1", "Linkwords");
define("LWLANINS_2", "This plugin will link specified words with a defined link");
define("LWLANINS_3", "Configure LinkWords");
define("LWLANINS_4", "To configure please click on the link in the plugins section of the admin front page");
?>

View File

@@ -0,0 +1,114 @@
<?php
define("LWLAN_1", "Field(s) left blank.");
define("LWLAN_2", "Link word saved.");
define("LWLAN_3", "Link word updated.");
define("LWLAN_4", "No link words defined yet.");
define("LWLAN_5", "Words");
define("LWLAN_6", "Link");
define("LWLAN_7", "Active?");
define("LWLAN_8", "Options");
define("LWLAN_9", "yes");
define("LWLAN_10", "no");
define("LWLAN_11", "Existing Linkwords");
define("LWLAN_12", "Yes");
define("LWLAN_13", "No");
define("LWLAN_14", "Submit LinkWord");
define("LWLAN_15", "Update LinkWord");
define("LWLAN_16", "Edit");
define("LWLAN_17", "Delete");
define("LWLAN_18", "Are you sure you want to delete this linkword?");
define("LWLAN_19", "Linkword deleted.");
define("LWLAN_20", "Unable to find that linkword entry.");
define("LWLAN_21", "Word to autolink (or comma-separated list of words)");
define("LWLAN_22", "Activate?");
define("LWLAN_23", "Linkwords Administration");
define("LWLAN_24", "Manage Words");
define("LWLAN_25", "Options");
define("LWLAN_26", "Areas in which to enable linkwords");
define("LWLAN_27", "This is the 'context' of the displayed text");
define("LWLAN_28", "Pages on which to disable linkwords");
define("LWLAN_29", "Same format as menu visibility control. One match per line. Specify a partial or complete URL. End with '!' for exact match of the end part of the link");
define("LWLAN_30", "Save options");
define("LWLAN_31", "Add/edit linkword");
define("LWLAN_32", "Linkword Options");
define("LWLAN_33", 'Title areas');
define("LWLAN_34", 'Item summaries');
define("LWLAN_35", 'Body text');
define("LWLAN_36", 'Descriptions (links etc)');
define("LWLAN_37", 'Legacy areas');
define("LWLAN_38", 'Clickable links');
define("LWLAN_39", 'Unprocessed text');
define("LWLAN_40", 'User-entered titles (e.g. forum)');
define("LWLAN_41", 'User-entered body text (e.g. forum)');
// Reserve numbers for further context strings
define('LWLAN_42', '');
define('LWLAN_43', '');
define('LWLAN_44', '');
define('LWLAN_45', '');
define('LWLAN_46', '');
define('LWLAN_47', '');
define('LWLAN_48', '');
define('LWLAN_49', '');
define('LWLAN_50', 'Tooltip');
define('LWLAN_51', 'Inactive');
define('LWLAN_52', 'Linkword only');
define('LWLAN_53', 'Tooltip only');
define('LWLAN_54', 'Linkword and Tooltip');
define('LWLAN_55', 'Open link in new window');
define('LWLAN_56', 'Open in new page');
define('LWLAN_57', 'Error writing new values');
define('LWLAN_58', 'Pref hook converted to 0.8 format'); // Used in 0.7-compatible stub only
define('LWLAN_59', 'Enable Ajax functionality');
define('LWLAN_60', 'LW ID');
define('LWLAN_61', 'ID');
define('LWLAN_62', 'Tooltip ID (LW ID)');
define('LWLAN_63', '(Positive integers only)');
// Installation-related
define("LWLANINS_1", "Linkwords");
define("LWLANINS_2", "This plugin links specified words with a defined link and/or tooltip");
define("LWLANINS_3", "Configure LinkWords");
define("LWLANINS_4", "To configure please click on the link in the plugins section of the admin front page");
define("LWLANINS_5", 'Upgrade complete');
// Help text
define('LAN_LW_HELP_00','Linkwords Help');
define('LAN_LW_HELP_01','
<b><u>Areas to enable</u></b><br />
many areas of text have an associated \'context\', and linkwords will only be displayed in areas matching that context.<br /><br />
<b><u>Linkwords Disable</u></b><br />
Linkwords may be disabled on specific pages, or pages matching a pattern. Enter these here (same syntax as for menus), one pattern per line.
If the pattern ends in \'!\', this corresponds to \'end of query\', and is usually an exact match. Otherwise any URL containing the specified string will match.<br />
Note that linkwords are <i>never</i> displayed on admin pages.
<b><u>Enable Ajax Functionality</u></b><br />
The tooltips can use Ajax to get information for display. This usually requires some custom coding.
');
define('LAN_LW_HELP_02','Define the words which become clickable links, or which display text on mouseover, here<br /><br />
<b><u>Word to Link</u></b><br />
This is case-insensitive. For multiple words mapping to the same links and tooltips, separate them with commas (no spaces)<br /><br />
<b><u>Link</u></b><br />
Define a clickable link here. If its an external link, it [i]must[/i] begin \'http://\'. If its a link within this site, the normal {e_XXX} constants may be used.<br /><br />
<b><u>Tooltip</u></b><br />
This defines the text to be displayed when the user\'s mouse passes over the word.<br /><br />
<b><u>LW ID (Tooltip ID)</u></b><br /><br />
This defines an optional numeric ID to be used with Ajax processing. If blank, the database record number is used.<br /><br />
<b><u>Activate?</u></b><br />
Defines which options are active.
');
// Admin log related
define('LAN_AL_LINKWD_00', 'Linkword-related message');
define('LAN_AL_LINKWD_01', 'Linkword Added');
define('LAN_AL_LINKWD_02', 'Linkword Edited');
define('LAN_AL_LINKWD_03', 'Linkword deleted');
define('LAN_AL_LINKWD_04', 'Linkword options updated');
define('LAN_AL_LINKWD_05', 'Linkwords version update'); // Used in 0.7-compatible stub only
define('LAN_AL_LINKWD_06', '');
?>

View File

@@ -3,7 +3,7 @@
+ ----------------------------------------------------------------------------+ + ----------------------------------------------------------------------------+
| e107 website system | e107 website system
| |
| Steve Dunstan 2001-2002 | <EFBFBD>Steve Dunstan 2001-2002
| http://e107.org | http://e107.org
| jalist@e107.org | jalist@e107.org
| |
@@ -11,149 +11,71 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/linkwords.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/linkwords.php,v $
| $Revision: 1.9 $ | $Revision: 1.10 $
| $Date: 2007-06-21 19:40:38 $ | $Date: 2008-12-07 21:55:01 $
| $Author: e107steved $ | $Author: e107steved $
| |
| This is just a stub so that systems migrated from 0.7 don't crash
| It auto-updates the prefs so that the newer routine is called in future.
|
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
if (!plugInstalled('linkwords')) exit;
class e_linkwords class e_linkwords
{ {
var $lw_enabled = FALSE; // Default to disabled to start
var $word_list = array(); // List of link words/phrases
var $link_list = array(); // Corresponding list of links to apply
var $tip_list = array();
var $area_opts = array(); // Process flags for the various contexts
var $block_list = array(); // Array of 'blocked' pages
function e_linkwords() function e_linkwords()
{ {
global $pref; global $pref, $admin_log;
/* constructor */ /* constructor */
// See whether they should be active on this page - if not, no point doing anything! // Do an auto-update on the variable used to hook parsers - so we should only be called once
if ((strpos(e_SELF, ADMINDIR) !== FALSE) || (strpos(e_PAGE, "admin_") !== FALSE)) return; // No linkwords on admin directories @include_lan(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
$hooks = explode(",",$pref['tohtml_hook']);
// Now see if disabled on specific pages if (($key=array_search('linkwords',$hooks)) !== FALSE)
$check_url = e_SELF.(e_QUERY ? "?".e_QUERY : '');
$this->block_list = explode("|",substr($pref['lw_page_visibility'],2)); // Knock off the 'show/hide' flag
foreach ($this->block_list as $p)
{
if ($p=trim($p))
{ {
if(substr($p, -1) == '!') unset($hooks[$key]);
{
$p = substr($p, 0, -1);
if(substr($check_url, strlen($p)*-1) == $p) return;
}
else
{
if(strpos($check_url, $p) !== FALSE) return;
}
} }
} if (count($hooks) == 0)
{
unset($pref['tohtml_hook']);
}
else
{
$pref['tohtml_hook'] = implode(',',$hooks);
}
if (!isset($pref['e_tohtml_list']))
{
$pref['e_tohtml_list'] = array();
}
if (!in_array('linkwords',$pref['e_tohtml_list']))
{
$pref['e_tohtml_list'][] = 'linkwords';
}
save_prefs();
$admin_log->log_event('LINKWD_05',LWLAN_58.'[!br!]'.$pref['tohtml_hook'],''); // Log that the update was done
return;
}
// Will probably need linkwords on this page - so get the info
$this->lw_enabled = TRUE; // This avoids confusing the parser!
$link_sql = new db; function to_html($text,$area = 'olddefault')
if($link_sql -> db_Select("linkwords", "*", "linkword_active=0")) {
{ return $text;
while ($row = $link_sql->db_Fetch())
{
$lw = trim(strtolower($row['linkword_word']));
if (strpos($lw,','))
{ // Several words to same link
$lwlist = explode(',',$lw);
foreach ($lwlist as $lw)
{
$this->word_list[] = trim($lw);
$this->link_list[] = $row['linkword_link'];
}
}
else
{
$this->word_list[] = $lw;
$this->link_list[] = $row['linkword_link'];
}
}
}
if (is_array($pref['lw_context_visibility']))
{
$this->area_opts = $pref['lw_context_visibility'];
}
} }
function linkwords($text,$area = 'olddefault') function linkwords($text,$area = 'olddefault')
{ {
if (!$this->lw_enabled || !array_key_exists($area,$this->area_opts) || !$this->area_opts[$area]) return $text; // No linkwords in disabled areas return $text;
// Split up by HTML tags and process the odd bits here
$ptext = "";
$lflag = FALSE;
$content = preg_split('#(<.*?>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
foreach($content as $cont)
{
if (strpos($cont, "<") !== FALSE)
{ // Its some HTML
$ptext .= $cont;
if (strpos($cont,"<a") !== FALSE) $lflag = TRUE;
if (strpos($cont,"</a") !== FALSE) $lflag = FALSE;
}
else
{ // Its the text in between
if ($lflag)
{ // Its probably within a link - leave unchanged
$ptext .= $cont;
}
else
{
if (trim($cont))
{ // Some non-white space - worth word matching
$ptext .= $this->linksproc($cont,0,count($this->word_list));
}
else
{
$ptext .= $cont;
}
}
}
}
return $ptext;
} }
function linksproc($text,$first,$limit) function linksproc($text,$first,$limit)
{ // This function is called recursively - it splits the text up into blocks - some containing a particular linkword {
while (($first < $limit) && (stripos($text,$this->word_list[$first]) === FALSE)) { $first++; }; return $text; // Shouldn't get called - but just in case
if ($first == $limit) return $text; // Return if no linkword found }
// There's at least one occurrence of the linkword in the text
$ret = '';
$lw = $this->word_list[$first];
// This splits the text into blocks, some of which will precisely contain a linkword
$split_line = preg_split('#\b('.$lw.')\b#i', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
foreach ($split_line AS $sl)
{
if (strcasecmp($sl,$lw) == 0)
{ // Do linkword replace
$ret .= " <a href='".$this->link_list[$first]."' rel='external'>{$sl}</a>";
}
elseif (trim($sl))
{ // Something worthwhile left - look for more linkwords in it
$ret .= $this->linksproc($sl,$first+1,$limit);
}
else
{
$ret .= $sl; // Probably just some white space
}
}
return $ret;
}
} }
?> ?>

View File

@@ -1,7 +1,10 @@
CREATE TABLE linkwords ( CREATE TABLE linkwords (
linkword_id INT(10) UNSIGNED NOT NULL auto_increment, linkword_id int(10) UNSIGNED NOT NULL auto_increment,
linkword_active tinyint(1) unsigned NOT NULL default '0', linkword_active tinyint(1) unsigned NOT NULL default '0',
linkword_word varchar(100) NOT NULL default '', linkword_word varchar(100) NOT NULL default '',
linkword_link varchar(200) NOT NULL default '', linkword_link varchar(250) NOT NULL default '',
linkword_tooltip text NOT NULL,
linkword_tip_id int(10) UNSIGNED NOT NULL Default '0',
linkword_newwindow tinyint(1) unsigned NOT NULL default '1',
PRIMARY KEY (linkword_id) PRIMARY KEY (linkword_id)
) TYPE=MyISAM AUTO_INCREMENT=1; ) TYPE=MyISAM AUTO_INCREMENT=1;

View File

@@ -1,119 +0,0 @@
<?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/plugin.php,v $
| $Revision: 1.4 $
| $Date: 2008-02-01 18:09:02 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
@include_once(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
@include_once(e_PLUGIN."linkwords/languages/English.php");
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "LWLANINS_1";
$eplug_version = "1.2";
$eplug_author = "jalist";
$eplug_url = "http://e107.org";
$eplug_email = "jalist@e107.org";
$eplug_description = LWLANINS_2;
$eplug_compatible = "e107v7+";
$eplug_readme = "";
// leave blank if no readme file
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "linkwords";
// Mane of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "";
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "admin_config.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/images/linkwords_32.png";
$eplug_icon_small = $eplug_folder."/images/linkwords_16.png";
$eplug_caption = LWLANINS_3;
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_array_pref = array(
'tohtml_hook' => 'linkwords'
);
$eplug_prefs = array(
'lw_page_visibility'=>'',
'lw_context_visibility'=>array(
'olddefault' => FALSE,
'title' => FALSE,
'summary' => TRUE,
'body' => TRUE,
'description' => TRUE,
'user_title' => FALSE,
'user_body' => TRUE,
'linktext' => FALSE,
'rawtext' => FALSE
)
);
// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = array(
"linkwords"
);
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = array(
"CREATE TABLE ".MPREFIX."linkwords (
linkword_id INT UNSIGNED NOT NULL auto_increment,
linkword_active tinyint(1) unsigned NOT NULL default '0',
linkword_word varchar(100) NOT NULL default '',
linkword_link varchar(150) NOT NULL default '',
PRIMARY KEY ( linkword_id )
) TYPE=MyISAM AUTO_INCREMENT=1;"
);
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = FALSE;
$eplug_link_name = "";
$ec_dir = e_PLUGIN."";
$eplug_link_url = "";
// Text to display after plugin successfully installed ------------------------------------------------------------------
$eplug_done = LWLANINS_4;
// upgrading ... //
$upgrade_add_prefs = array(
'lw_page_visibility'=>'',
'lw_context_visibility'=>array(
'olddefault' => FALSE,
'title' => FALSE,
'summary' => TRUE,
'body' => TRUE,
'description' => TRUE,
'linktext' => FALSE,
'rawtext' => FALSE
)
);
$upgrade_remove_prefs = "";
$upgrade_alter_tables = "";
$eplug_upgrade_done = "";
?>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Id: plugin.xml,v 1.1 2008-12-07 21:55:02 e107steved Exp $ -->
<e107Plugin name="LWLANINS_1" version="1.1" compatibility="0.8" installRequired="true" >
<author name="jalist, steved" url="http://e107.org" />
<description>This plugin will link specified words with a defined link and/or tooltip</description>
<folder>linkwords</folder>
<logLanguageFile filename="languages/--LAN--.php" />
<administration>
<configFile>admin_config.php</configFile>
<icon>images/linkwords_32.png</icon>
<iconSmall>images/linkwords_16.png</iconSmall>
<caption>Configure LinkWords</caption>
<installDone>To configure please click on the link in the plugins section of the admin front page</installDone>
</administration>
<mainPrefs>
<pref name="lw_page_visibility" value="" />
<pref name="lw_context_visibility" type="array">
<key name="OLDDEFAULT" value="" />
<key name="TITLE" value="" />
<key name="SUMMARY" value="1" />
<key name="BODY" value="1" />
<key name="DESCRIPTION" value="1" />
<key name="USER_TITLE" value="" />
<key name="USER_BODY" value="1" />
<key name="LINKTEXT" value="" />
<key name="RAWTEXT" value="" />
</pref>
<pref name="lw_ajax_enable" value="0" />
<arrayPref name="e_tohtml_list" value="linkwords" />
</mainPrefs>
</e107Plugin>