mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
Linkwords; some tidying, option to suppress clickable links that point to current page
This commit is contained in:
@@ -2,15 +2,15 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
* Linkwords plugin - admin page
|
* Linkwords plugin - admin page
|
||||||
*
|
*
|
||||||
* $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.12 $
|
* $Revision: 1.13 $
|
||||||
* $Date: 2010-01-02 22:57:41 $
|
* $Date: 2010-01-16 20:49:51 $
|
||||||
* $Author: e107steved $
|
* $Author: e107steved $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @package e107_plugins
|
* @package e107_plugins
|
||||||
* @subpackage linkwords
|
* @subpackage linkwords
|
||||||
* @version $Id: admin_config.php,v 1.12 2010-01-02 22:57:41 e107steved Exp $;
|
* @version $Id: admin_config.php,v 1.13 2010-01-16 20:49:51 e107steved Exp $;
|
||||||
*
|
*
|
||||||
* Administration page
|
* Administration page
|
||||||
*/
|
*/
|
||||||
@@ -119,6 +119,7 @@ if (isset($_POST['saveopts_linkword']))
|
|||||||
}
|
}
|
||||||
$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']);
|
$pref['lw_ajax_enable'] = isset($_POST['lw_ajax_enable']);
|
||||||
|
$pref['lw_notsamepage'] = isset($_POST['lw_notsamepage']);
|
||||||
save_prefs();
|
save_prefs();
|
||||||
$logString = implode(', ',$pref['lw_context_visibility']).'[!br!]'.$pref['lw_page_visibility'].'[!br!]'.$pref['lw_ajax_enable'];
|
$logString = implode(', ',$pref['lw_context_visibility']).'[!br!]'.$pref['lw_page_visibility'].'[!br!]'.$pref['lw_ajax_enable'];
|
||||||
$e107->ecache->clear_sys(LW_CACHE_TAG);
|
$e107->ecache->clear_sys(LW_CACHE_TAG);
|
||||||
@@ -345,27 +346,36 @@ if ($action=='options')
|
|||||||
<td class='forumheader3'>";
|
<td class='forumheader3'>";
|
||||||
foreach ($lw_context_areas as $lw_key=>$lw_desc)
|
foreach ($lw_context_areas as $lw_key=>$lw_desc)
|
||||||
{
|
{
|
||||||
$checked = $pref['lw_context_visibility'][$lw_key] ? 'checked=checked' : '';
|
$checked = $pref['lw_context_visibility'][$lw_key] ? "checked='checked'" : '';
|
||||||
$text .= "<input type='checkbox' name='lw_visibility_area[]' value={$lw_key} {$checked} />{$lw_desc}<br />";
|
$text .= "<input type='checkbox' name='lw_visibility_area[]' value='{$lw_key}' {$checked} />{$lw_desc}<br />";
|
||||||
}
|
}
|
||||||
$text .= "</td>
|
$text .= "</td>
|
||||||
<td class='forumheader3'>".LWLAN_27."
|
<td class='forumheader3'>".LWLAN_27."</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class='forumheader3'>".LWLAN_28."</td>
|
<td class='forumheader3'>".LWLAN_28."</td>
|
||||||
<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."</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
$checked = varset($pref['lw_ajax_enable'],0) ? 'checked=checked' : '';
|
$checked = varset($pref['lw_ajax_enable'],0) ? 'checked=checked' : '';
|
||||||
$text .= "
|
$text .= "
|
||||||
<tr>
|
<tr>
|
||||||
<td class='forumheader3'>".LWLAN_59."</td>
|
<td class='forumheader3'>".LWLAN_59."</td>
|
||||||
<td class='forumheader3'><input type='checkbox' name='lw_ajax_enable' {$checked}>
|
<td class='forumheader3'><input type='checkbox' name='lw_ajax_enable' {$checked} />
|
||||||
</td>
|
</td>
|
||||||
<td class='forumheader3'>".""."
|
<td class='forumheader3'>".""."</td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
$checked = varset($pref['lw_notsamepage'],0) ? 'checked=checked' : '';
|
||||||
|
$text .= "
|
||||||
|
<tr>
|
||||||
|
<td class='forumheader3'>".LWLAN_64."</td>
|
||||||
|
<td class='forumheader3'><input type='checkbox' name='lw_notsamepage' {$checked} />
|
||||||
|
</td>
|
||||||
|
<td class='forumheader3'>".LWLAN_65."</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
@@ -2,37 +2,29 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $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.10 $
|
* $Revision: 1.11 $
|
||||||
* $Date: 2010-01-02 22:57:41 $
|
* $Date: 2010-01-16 20:49:53 $
|
||||||
* $Author: e107steved $
|
* $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?
|
|
||||||
|
|
|
||||||
+----------------------------------------------------------------------------+
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* e107 Linkword plugin
|
* e107 Linkword plugin
|
||||||
*
|
*
|
||||||
* @package e107_plugins
|
* @package e107_plugins
|
||||||
* @subpackage linkwords
|
* @subpackage linkwords
|
||||||
* @version $Id: e_tohtml.php,v 1.10 2010-01-02 22:57:41 e107steved Exp $;
|
* @version $Id: e_tohtml.php,v 1.11 2010-01-16 20:49:53 e107steved Exp $;
|
||||||
*
|
*
|
||||||
* 'Hook' page
|
* 'Hook' page
|
||||||
* The class is 'hooked' by the parser, to add linkword capability to any context where its enabled.
|
* The class is 'hooked' by the parser, to add linkword capability to any context where its enabled.
|
||||||
|
*
|
||||||
|
* @todo Link to capability for clever display options on tooltips
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -187,14 +179,17 @@ class e_tohtml_linkwords
|
|||||||
}
|
}
|
||||||
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
|
||||||
global $tp;
|
$tp = e107::getParser();
|
||||||
|
$doSamePage = !e107::getPref('lw_notsamepage');
|
||||||
|
|
||||||
// Consider next line - stripos is PHP5, and mb_stripos is PHP >= 5.2 - so may well often require handling
|
// Consider next line - stripos is PHP5, and mb_stripos is PHP >= 5.2 - so may well often require handling
|
||||||
// while (($first < $limit) && (stripos($text,$this->word_list[$first]) === FALSE)) { $first++; }; // *utf (stripos is PHP5 - compatibility handler implements)
|
// while (($first < $limit) && (stripos($text,$this->word_list[$first]) === FALSE)) { $first++; }; // *utf (stripos is PHP5 - compatibility handler implements)
|
||||||
while (($first < $limit) && (strpos($tp->uStrToLower($text),$this->word_list[$first]) === FALSE)) { $first++; }; // *utf
|
while (($first < $limit) && (strpos($tp->ustrtolower($text),$this->word_list[$first]) === FALSE)) { $first++; }; // *utf
|
||||||
if ($first == $limit) return $text; // Return if no linkword found
|
if ($first == $limit) return $text; // Return if no linkword found
|
||||||
|
|
||||||
// There's at least one occurrence of the linkword in the text
|
// There's at least one occurrence of the linkword in the text
|
||||||
@@ -224,9 +219,13 @@ class e_tohtml_linkwords
|
|||||||
}
|
}
|
||||||
if ($this->link_list[$first])
|
if ($this->link_list[$first])
|
||||||
{ // Got link
|
{ // Got link
|
||||||
$linkwd = " href='".$tp->replaceConstants($this->link_list[$first])."' ";
|
$newLink = $tp->replaceConstants($this->link_list[$first], 'full');
|
||||||
if ($this->ext_list[$first]) { $linkrel[] = 'external'; } // Determine external links
|
if ($doSamePage || ($newLink != e_SELF.'?'.e_QUERY))
|
||||||
$lwClass[] = 'lw_link';
|
{
|
||||||
|
$linkwd = " href='".$newLink."' ";
|
||||||
|
if ($this->ext_list[$first]) { $linkrel[] = 'external'; } // Determine external links
|
||||||
|
$lwClass[] = 'lw_link';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!count($lwClass))
|
if (!count($lwClass))
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
* Linkwords plugin - language file (only needed for admin)
|
||||||
|
*
|
||||||
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/languages/English_admin_linkwords.php,v $
|
||||||
|
* $Revision: 1.2 $
|
||||||
|
* $Date: 2010-01-16 20:49:55 $
|
||||||
|
* $Author: e107steved $
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* e107 Linkword plugin
|
||||||
|
*
|
||||||
|
* @package e107_plugins
|
||||||
|
* @subpackage linkwords
|
||||||
|
* @version $Id: English_admin_linkwords.php,v 1.2 2010-01-16 20:49:55 e107steved Exp $;
|
||||||
|
*
|
||||||
|
* Language file
|
||||||
|
*/
|
||||||
|
|
||||||
define("LWLAN_1", "Field(s) left blank.");
|
define("LWLAN_1", "Field(s) left blank.");
|
||||||
define("LWLAN_2", "Link word saved.");
|
define("LWLAN_2", "Link word saved.");
|
||||||
define("LWLAN_3", "Link word updated.");
|
define("LWLAN_3", "Link word updated.");
|
||||||
@@ -66,26 +91,31 @@ define('LWLAN_60', 'LW ID');
|
|||||||
define('LWLAN_61', 'ID');
|
define('LWLAN_61', 'ID');
|
||||||
define('LWLAN_62', 'Tooltip ID (LW ID)');
|
define('LWLAN_62', 'Tooltip ID (LW ID)');
|
||||||
define('LWLAN_63', '(Positive integers only)');
|
define('LWLAN_63', '(Positive integers only)');
|
||||||
|
define('LWLAN_64', 'Suppress link on current page');
|
||||||
|
define('LWLAN_65', 'When checked, suppresses clickable link if points to current page');
|
||||||
|
|
||||||
|
|
||||||
// Installation-related
|
// Installation-related
|
||||||
define("LWLANINS_1", "Linkwords");
|
define('LWLANINS_1', 'Linkwords');
|
||||||
define("LWLANINS_2", "This plugin links specified words with a defined link and/or tooltip");
|
define('LWLANINS_2', 'This plugin links specified words with a defined link and/or tooltip');
|
||||||
define("LWLANINS_3", "Configure LinkWords");
|
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_4', 'To configure please click on the link in the plugins section of the admin front page');
|
||||||
define("LWLANINS_5", 'Upgrade complete');
|
define('LWLANINS_5', 'Upgrade complete');
|
||||||
|
|
||||||
|
|
||||||
// Help text
|
// Help text
|
||||||
define('LAN_LW_HELP_00','Linkwords Help');
|
define('LAN_LW_HELP_00','Linkwords Help');
|
||||||
define('LAN_LW_HELP_01','
|
define('LAN_LW_HELP_01','
|
||||||
<b><u>Areas to enable</u></b><br />
|
<b>Areas to enable</b><br />
|
||||||
many areas of text have an associated \'context\', and linkwords will only be displayed in areas matching that context.<br /><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 />
|
<b>Linkwords Disable</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.
|
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 />
|
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.
|
Note that linkwords are <i>never</i> displayed on admin pages.<br /><br />
|
||||||
<b><u>Enable Ajax Functionality</u></b><br />
|
<b>Enable Ajax Functionality</b><br />
|
||||||
The tooltips can use Ajax to get information for display. This usually requires some custom coding.
|
The tooltips can use Ajax to get information for display. This usually requires some custom coding.<br /><br />
|
||||||
|
<b>Suppress link on current page</b><br />
|
||||||
|
Usually its pointless for the user to be able to click a link if they\'re already on the page. Tick this box to remove the option,<br />
|
||||||
');
|
');
|
||||||
define('LAN_LW_HELP_02','Define the words which become clickable links, or which display text on mouseover, here<br /><br />
|
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 />
|
<b><u>Word to Link</u></b><br />
|
||||||
|
Reference in New Issue
Block a user