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

Tagwords removed from core. Use TagCloud instead.

This commit is contained in:
Cameron
2016-12-23 08:58:02 -08:00
parent 4bfe84b253
commit 7e3e26578c
18 changed files with 0 additions and 2087 deletions

View File

@@ -1,38 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords Admin
*
*/
require_once("../../class2.php");
if (!getperms("P"))
{
header("location:".e_BASE."index.php");
exit ;
}
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."userclass_class.php");
$mes = e107::getMessage();
require_once(e_PLUGIN."tagwords/tagwords_class.php");
$tag = new tagwords();
//update preferences
if(isset($_POST['updatesettings']))
{
$tag->update_prefs();
$mes->addSuccess(LAN_UPDATED);
}
$ns->tablerender($caption, $mes->render() . $text);
$tag->tagwords_options();
require_once(e_ADMIN."footer.php");
?>

View File

@@ -1,90 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords Event Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/tagwords/e_event.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
if (!defined('e107_INIT')) { exit; }
if(!defined("TAG_TEXTAREA_COLS")){ define("TAG_TEXTAREA_COLS", "70"); }
if(!defined("TAG_TEXTAREA_ROWS")){ define("TAG_TEXTAREA_ROWS", "4"); }
class e_event_tagwords
{
/*
* all event methods have a single parameter
* @param array $data array containing
* @param string $method form,insert,update,delete
* @param string $table the table name of the calling plugin
* @param int $id item id of the record
* @param string $plugin identifier for the calling plugin
* @param string $function identifier for the calling function
*/
/*
* constructor
*/
function e_event_tagwords()
{
global $tag;
require_once(e_PLUGIN."tagwords/tagwords_class.php");
$this->tag = new tagwords();
$tag = $this->tag;
}
/*
* add form field
* @param array $data
*/
function event_form($data)
{
return $this->tag->tagwords_form($data['table'], intval($data['id']));
}
/*
* handle db create
* @param array $data
*/
function event_create($data)
{
if(isset($_POST['tagwords']))
{
return $this->tag->dbTagWords($data['table'], intval($data['id']), $_POST['tagwords']);
}
}
/*
* handle db update
* @param array $data
*/
function event_update($data)
{
if(isset($_POST['tagwords']))
{
return $this->tag->dbTagWords($data['table'], intval($data['id']), $_POST['tagwords']);
}
}
/*
* handle db delete
* @param array $data
*/
function event_delete($data)
{
return $this->tag->dbDelete($data['table'], intval($data['id']));
}
} //end class
?>

View File

@@ -1,28 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords Meta Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/tagwords/e_meta.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
if (!defined('e107_INIT')) { exit; }
if (is_readable(THEME."tagwords_css.php"))
{
$src = THEME_ABS."tagwords_css.php";
} else {
$src = e_PLUGIN_ABS."tagwords/tagwords_css.php";
}
echo "<link rel='stylesheet' href='".$src."' type='text/css' />\n";
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,76 +0,0 @@
<?php
/*
* Copyright (C) 2008-2011 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
*
* Tagwords Language File
*/
define("LAN_TAG_INS_1", "Tagwords");
define("LAN_TAG_INS_2", "A fully featured Tagword system");
define("LAN_TAG_INS_3", "Configure TagWords");
define("LAN_TAG_INS_4", "Tagwords is installed<br />To configure please click on the link in the plugins section of the admin front page");
define("LAN_TAG_SEARCH_1", "Search For:");
define("LAN_TAG_SEARCH_2", "Search");
define("LAN_TAG_SEARCH_3", "View");
define("LAN_TAG_1", "TagWords");
define("LAN_TAG_2", "Tag");
define("LAN_TAG_3", "TagWords updated");
define("LAN_TAG_4", "sort ");
define("LAN_TAG_5", "display ");
define("LAN_TAG_6", "");
define("LAN_TAG_7", "< Back to Tagwords Frontpage");
define("LAN_TAG_8", "result found for");
define("LAN_TAG_9", "results found for");
define("LAN_TAG_10", "alphabetically");
define("LAN_TAG_11", "by size");
define("LAN_TAG_12", "taglist");
define("LAN_TAG_13", "tagcloud");
define("LAN_TAG_14", "selection : ");
define("LAN_TAG_15", "all areas");
define("LAN_TAG_16", "TagCloud");
define("LAN_TAG_17", "TagList");
define("LAN_TAG_18", "no tagwords found for this selection");
define("LAN_TAG_19", "choose sort");
define("LAN_TAG_20", "choose style");
define("LAN_TAG_21", "each tag on a separate line");
//define("LAN_TAG_ADMIN_1", "preferences updated");
define("LAN_TAG_OPT_1", "tagwords preferences");
define("LAN_TAG_OPT_2", "minimum word appearance needed for tagcloud/taglist");
define("LAN_TAG_OPT_3", "tagcloud/taglist only visible for");
define("LAN_TAG_OPT_4", "default tag sort");
define("LAN_TAG_OPT_5", "alphabetically");
define("LAN_TAG_OPT_6", "by size");
define("LAN_TAG_OPT_7", "default tag style");
define("LAN_TAG_OPT_8", "tagcloud");
define("LAN_TAG_OPT_9", "taglist");
define("LAN_TAG_OPT_10", "yes");
define("LAN_TAG_OPT_11", "no");
define("LAN_TAG_OPT_12", "options tag sort");
define("LAN_TAG_OPT_13", "options tag type");
define("LAN_TAG_OPT_14", "options tag area");
define("LAN_TAG_OPT_15", "maximum number of words in menu");
define("LAN_TAG_OPT_16", "tagwords page");
define("LAN_TAG_OPT_17", "tagwords menu");
define("LAN_TAG_OPT_18", "menu caption");
define("LAN_TAG_OPT_19", "options tag search");
define("LAN_TAG_OPT_20", "frequency after tagword");
define("LAN_TAG_OPT_21", "shortcode");
define("LAN_TAG_OPT_22", "word separator");
define("LAN_TAG_OPT_23", "areas");
define("LAN_TAG_OPT_24", "check active areas");
define("LAN_TAG_OPT_25", "generic");
define("LAN_TAG_OPT_26", "display");
define("LAN_TAG_MENU_1", "view complete tagwords cloud");
define("LAN_TAG_MENU_2", "Tagwords");
define("LAN_TAG_CORE_NEWS_1", "News");
define("LAN_TAG_CORE_CPAGES_1", "Pages");
define("LAN_TAG_URL_NAME", "Tagwords");
define("LAN_TAG_URL_DEFAULT_LABEL", "Default");
define("LAN_TAG_URL_DEFAULT_DESCR", "Example: http://yoursite.com/tagwords/some-tag");

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: plugin.xml,v 1.8 2009-10-22 04:14:45 e107coders Exp $ -->
<e107Plugin name="Tagwords" version="1.0" date="2012-08-01" compatibility="2.0" installRequired="true">
<author name="e107 Inc." url="http://e107.org/" />
<description>A fully featured Tagword system</description>
<category>misc</category>
<adminLinks>
<link url='admin_tagwords_config.php' description='Configure Tagwords' icon='images/tagwords_32.png' iconSmall='images/tagwords_16.png' primary='true' >Configure Tagwords</link>
</adminLinks>
<siteLinks>
<link url="{e_PLUGIN}tagwords/tagwords.php" perm="everyone">Tagwords</link>
</siteLinks>
</e107Plugin>

View File

@@ -1,55 +0,0 @@
<?php
/**
* Copyright (C) 2008-2013 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords core section
*/
if (!defined('e107_INIT')) { exit; }
class e_tagwords_news
{
function e_tagwords_news()
{
$this->e107 = e107::getInstance();
$this->settings = array();
$this->settings['plugin'] = "";
$this->settings['table'] = "news";
$this->settings['db_id'] = "news_id";
$this->settings['caption'] = "LAN_TAG_CORE_NEWS_1";
}
function getLink($id)
{
if(empty($this->row))
{
$this->row = $this->getRecord($id);
}
//$url = e_BASE."news.php?item.".$this->row['news_id'];
$url = e107::getUrl()->create('news/view/item', $this->row);
return "<a href='".$url."'>".e107::getParser()->toHTML($this->row['news_title'], TRUE, '')."</a>";
}
function getRecord($id)
{
$sql = e107::getDb();
$this->row = '';
//FIXME - only if news mod rewrite is on
$qry = "SELECT n.*, nc.*
FROM #news as n
LEFT JOIN #news_category AS nc ON n.news_category=nc.category_id
WHERE n.news_id='{$id}'
AND n.news_start < ".time()."
AND (n.news_end=0 || n.news_end>".time().")
AND n.news_class REGEXP '".e_CLASS_REGEXP."' ";
if($sql->gen($qry))
{
$this->row= $sql->fetch();
}
return $this->row;
}
}
?>

View File

@@ -1,51 +0,0 @@
<?php
/**
* Copyright (C) 2008-2013 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords core section
*/
if (!defined('e107_INIT')) { exit; }
class e_tagwords_page
{
function e_tagwords_page()
{
$this->e107 = e107::getInstance();
$this->settings = array();
$this->settings['plugin'] = "";
$this->settings['table'] = "page";
$this->settings['db_id'] = "page_id";
$this->settings['caption'] = "LAN_TAG_CORE_CPAGES_1";
}
function getLink($id)
{
if($this->row=='')
{
$this->row = $this->getRecord($id);
}
$url = e_BASE."page.php?".$this->row['page_id'];
$url = e107::getUrl()->create('page/view', $this->row, 'allow=page_id,page_title,page_sef');
return "<a href='".$url."'>".e107::getParser()->toHTML($this->row['page_title'], TRUE, '')."</a>";
}
function getRecord($id)
{
$sql = e107::getDb();
$this->row = '';
$qry = "SELECT p.*, u.user_id, u.user_name FROM #page AS p
LEFT JOIN #user AS u ON p.page_author = u.user_id
WHERE p.page_id='{$id}' AND p.page_class IN (".USERCLASS_LIST.") ";
if($sql->gen($qry))
{
$this->row = $sql->fetch();
}
return $this->row;
}
}
?>

View File

@@ -1,43 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords Page
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/tagwords/tagwords.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
if(!defined('e107_INIT')) require_once('../../class2.php');
//$_GET = e107::getUrl()->parseRequest('tagwords', 'main', e_QUERY);
require_once(HEADERF);
require_once(e_PLUGIN."tagwords/tagwords_class.php");
$tag = new tagwords();
//echo e107::getUrl()->create('tagwords/search/area', 'area=news&q=something');
if(vartrue($tag->pref['tagwords_class']) && !check_class($tag->pref['tagwords_class']) )
{
header("location:".SITEURL); exit;
}
if(vartrue($_GET['q']))
{
$tag->TagSearchResults();
}
else
{
$tag->TagRender();
}
require_once(FOOTERF);
?>

View File

@@ -1,6 +0,0 @@
require_once(e_PLUGIN."tagwords/tagwords_class.php");
$tag = new tagwords();
global $parm;
$tmp = explode("^", $parm);
return $tag->getRecords($tmp[0],$tmp[1], TRUE);

View File

@@ -1,895 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2014 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords Class
*
*/
if(!defined("TAG_TEXTAREA_COLS")){ define("TAG_TEXTAREA_COLS", "70"); }
if(!defined("TAG_TEXTAREA_ROWS")){ define("TAG_TEXTAREA_ROWS", "4"); }
//##### explanation of present $_GET's ----------------------------------------
// $_GET['type'] : the type of tag to show (cloud, list)
// $_GET['sort'] : the sort method for the cloud/list (alpha, freq)
// $_GET['area'] : the area to show cloud/list for (eg news, content)
// $_GET['q'] : the search query to show results for
class tagwords
{
var $tagwords = array();
var $mapper = array();
var $core = array('news', 'page');
var $table = 'tagwords';
var $pref;
var $template;
var $shortcodes;
/*
* constructor (include all e_tagwords.php files)
*/
function __construct()
{
global $pref, $TEMPLATE_TAGWORDS, $tagwords_shortcodes;
$this->e107 = e107::getInstance();
//language
e107::includeLan(e_PLUGIN."tagwords/languages/".e_LANGUAGE.".php");
//shortcodes
//require_once(e_PLUGIN.'tagwords/tagwords_shortcodes.php');
$this->shortcodes = e107::getScBatch('tagwords',TRUE);
//$this->shortcodes = $tagwords_shortcodes;
//template
if (is_readable(THEME."tagwords_template.php"))
{
require_once(THEME."tagwords_template.php");
}
else
{
require_once(e_PLUGIN."tagwords/tagwords_template.php");
}
$this->template = $TEMPLATE_TAGWORDS;
$this->pref = $this->get_prefs();
//load plugin and core tagword areas
$this->loadPlugin();
$this->loadCore();
//prepare and assign key'ed tagwords data
$this->mapper();
}
/*
* get all plugin classes
*/
function loadPlugin()
{
global $pref;
$list = e107::getPref('e_tagwords_list');
if($list && is_array($list))
{
foreach($list as $e_tag)
{
if(is_readable(e_PLUGIN.$e_tag."/e_tagwords.php"))
{
require_once(e_PLUGIN.$e_tag."/e_tagwords.php");
$name = "e_tagwords_{$e_tag}";
if(class_exists($name))
{
if(!is_object($name))
{
$this->$name = new $name;
}
$this->tagwords[] = $e_tag;
}
}
}
}
}
/*
* get all core classes
*/
function loadCore()
{
foreach($this->core as $s)
{
require_once(e_PLUGIN."tagwords/section/e_tagwords_{$s}.php");
$name = "e_tagwords_{$s}";
if(class_exists($name))
{
if(!is_object($name))
{
$this->$name = new $name;
}
$this->tagwords[] = $s;
}
}
}
/*
* map plugin names to tables names
*/
function mapper()
{
$ret = array();
foreach($this->tagwords as $area)
{
$ins = "e_tagwords_{$area}";
$table = $this->$ins->settings['table'];
$ret[$table] = $area;
}
$this->mapper = $ret;
}
/*
* display the form element to provide tag words
* @param string $tag_type type
* @param string $tag_itemid itemid
* @return array $caption, $text form element
*/
function tagwords_form($tag_type='', $tag_itemid='')
{
$tp = e107::getParser();
$allowed = $this->getAllowedAreas();
if(count($allowed)==0)
{
return;
}
else
{
if(!in_array($tag_type, $allowed))
{
return;
}
}
$this->word = false;
if( $ret = $this->getRecords($tag_type, $tag_itemid) )
{
$this->word = $tp->toForm($ret);
}
$caption = $tp->parseTemplate($this->template['caption'], true, $this->shortcodes);
$text = $tp->parseTemplate($this->template['form'], true, $this->shortcodes);
return array('caption'=>$caption, 'html'=>$text);
}
/*
* retrieve all tag_words for the provided item (type+itemid)
* @param string $tag_type type
* @param string $tag_itemid itemid
* @param boolean $returnwordsonly return comma seperated list of tagwords
* @param boolean $link return hyperlink to taglist on words
* @return array $ret array of tagwords
*/
function getRecords($tag_type='', $tag_itemid='', $returnwordsonly=false, $link=true)
{
$tp = e107::getParser();
$sqlgr = new db;
$qry = "
SELECT tag_word FROM #".$this->table."
WHERE tag_type='".$tp->toDB($tag_type)."'
AND tag_itemid='".intval($tag_itemid)."'
ORDER BY tag_word ";
if($sqlgr->gen($qry))
{
$ret=array();
while($row = $sqlgr->fetch())
{
$ret[] = $row['tag_word'];
}
if($returnwordsonly)
{
$arr = array();
foreach($ret as $word)
{
$word = $tp->toHTML($word,true,'no_hook, emotes_off');
$arr[] = ($link ? trim($this->createTagWordLink($word)) : $word);
}
return implode($this->pref['tagwords_word_seperator'], $arr);
}
//return a \n seperated list of tagwords for the specific item
return implode($this->pref['tagwords_word_seperator'], $ret);
}
return;
}
/*
* used on tagword search; get only those records that contain ALL tagwords that is searched on
* @param array $array the array containing all results for each word seperately
* @return array $combined array of combined tagwords
*/
function getUnique($array)
{
//combine all arrays
$combined = array();
foreach($array as $v)
{
foreach($v as $type=>$arr)
{
foreach($arr as $id)
{
if(!array_key_exists($type,$combined))
{
$combined[$type] = array();
}
if(!in_array($id, $combined[$type]))
{
$combined[$type][] = $id;
}
}
}
}
//$combined is combined array of ALL values
foreach($combined as $ntype=>$narr)
{
foreach($narr as $nid)
{
//$array is the array containing all results for each word seperately
foreach($array as $ov)
{
//if an id value is not present in the result $array, remove it from the combined array
if(!in_array($nid, $ov[$ntype]))
{
$key = array_search($nid, $combined[$ntype]);
unset($combined[$ntype][$key]);
}
}
}
}
//finally remove empty areas from the array
foreach($combined as $ntype=>$narr)
{
sort($combined[$ntype]);
if(empty($combined[$ntype]))
{
unset($combined[$ntype]);
}
}
return $combined;
}
/*
* create the tag word hyperlink
* @param string $word word
* @param string $class if present and int, adds the 'level' of the word to the css item
* @return string $text hyperlink to tagword
*/
function createTagWordLink($word, $class='')
{
$word = trim($word);
/*$qry = $tp->toDB($word);
$qry = str_replace(' ', '+', $qry);*/
$url = e107::getUrl()->create('tagwords/search', 'q='.$word);
$word = e107::getParser()->toHTML($word,true,'no_hook, emotes_off');
$class = ($class ? "class='tag".intval($class)."'" : "");
return "<a href='".$url."' ".$class." title=''>".$word."</a>";
}
/*
* db entry tagwords
* @param string $tag_type type
* @param string $tag_itemid itemid
* @param string $tag_word word
* @return string $text message
*/
function dbTagWords($tag_type='', $tag_itemid='', $tag_word='')
{
$tp = e107::getParser();
$sql = e107::getDb();
$mes = e107::getMessage();
//prepare data
$tag_type = $tp->toDB($tag_type);
$tag_itemid = intval($tag_itemid);
//get existing word records
$existing_array = $this->getRecords($tag_type, $tag_itemid, false);
$existing = explode($this->pref['tagwords_word_seperator'], $existing_array);
//create array of new posted words
$new = explode($this->pref['tagwords_word_seperator'], $tag_word);
//delete the differences (delete what has been removed)
$delete_diff = array_diff($existing, $new);
foreach($delete_diff as $word)
{
$word = trim($word);
$word = $tp->toDB($word);
$sql->delete($this->table, "tag_type='".$tag_type."' AND tag_itemid='".$tag_itemid."' AND tag_word='".$word."'");
}
//insert the differences (insert what has been added)
$insert_diff = array_diff($new, $existing);
$count = 0;
//print_a($insert_diff);
//return ("Tagword Insert: ".print_a($new,true)); // debug info
foreach($insert_diff as $word)
{
$word = trim($word);
$word = $tp->toDB($word);
$args = array();
$args['tag_id'] = 0;
$args['tag_type'] = $tag_type;
$args['tag_itemid'] = $tag_itemid;
$args['tag_word'] = $word;
$count += $sql->insert($this->table, $args) ? 1 : 0;
//return "a Diff was made";
}
return "<br />".LAN_TAG_3.": ".$count." words.";
}
/*
* db delete entries
* @param string $tag_type type
* @param string $tag_itemid itemid
*/
function dbDelete($tag_type='', $tag_itemid='')
{
e107::getDb()->delete($this->table, "tag_type='".$tag_type."' AND tag_itemid='".$tag_itemid."' ");
}
/*
* retrieve all tag words (if $_GET['area'], only retrieve tagwords from that area (news, content, ...) )
* @param string $tagarea tagarea
* @return array $ret array of word=>number
*/
function getAllTagWords($tagarea='')
{
$sql = e107::getDb();
$tag_type='';
$allowed = $this->getAllowedAreas();
if(count($allowed)>0)
{
$typeqry = " AND tag_type IN ('".implode("','", $this->getAllowedAreas())."') ";
}
if($tagarea!='menu')
{
//if user is able to manually set a area
if(vartrue($this->pref['tagwords_view_area'])=='1')
{
foreach($this->tagwords as $area)
{
//limit data to only one area, if so, which area
if(vartrue($_GET['area'])==$area)
{
$ins = "e_tagwords_{$area}";
$typeqry = " AND tag_type='".$this->$ins->settings['table']."'";
break;
}
}
}
}
//menu additions
$menuqry='';
if($tagarea=='menu')
{
if($this->pref['tagwords_menu_min'])
{
$menuqry = "ORDER BY number DESC LIMIT 0,".$this->pref['tagwords_menu_min'];
}
}
$qry = "
SELECT tag_id, tag_itemid, tag_type, tag_word, COUNT(tag_word) as number
FROM #".$this->table."
WHERE tag_word!='' ".$typeqry."
GROUP BY tag_word HAVING COUNT(tag_word)>=".intval($this->pref['tagwords_min'])." ".$menuqry." ";
if($sql->gen($qry))
{
$ret=array();
while($row = $sql->fetch())
{
$word = trim($row['tag_word']);
$word = e107::getParser()->toHTML($word,true,'no_hook, emotes_off');
$ret[$word] = $row['number'];
}
return $ret;
}
return;
}
/*
* Get allowed areas from pref
* @return $array allowed areas
*/
function getAllowedAreas()
{
$this->allowed_areas = array();
foreach($this->tagwords as $area)
{
if(array_key_exists($area,$this->pref['tagwords_activeareas']))
{
$ins = "e_tagwords_{$area}";
$this->allowed_areas[] = $this->$ins->settings['table'];
}
}
return $this->allowed_areas;
}
/*
* Sort data array of tag words
* @param string $array the array of words
* @param string $tagarea the area (menu,page)
* @return $array sorted array
*/
function TagSort($array, $tagarea='')
{
//MENU
if($tagarea=='menu')
{
if(vartrue($this->pref['tagwords_menu_default_sort'])==1)
{
//alphabetically
ksort($array, SORT_STRING);
}
else
{
//by size
arsort($array);
}
return $array;
}
//PAGE
//user can set own sort
if(vartrue($this->pref['tagwords_view_sort'])==1)
{
$s = varset($_GET['sort'],'');
switch($s)
{
//if user has set sort, and is set to alpha
case 'alpha':
ksort($array, SORT_STRING);
break;
//if user has set sort, and is set to by size
case 'freq':
arsort($array);
break;
default:
if(vartrue($this->pref['tagwords_default_sort'])==1)
{
//alphabetically
ksort($array, SORT_STRING);
}
else
{
//by size
arsort($array);
}
break;
}
//user cannot set sort, so use default sort value
}
else
{
if(vartrue($this->pref['tagwords_default_sort'])==1)
{
//alphabetically
ksort($array, SORT_STRING);
}
else
{
//by size
arsort($array);
}
}
return $array;
}
/*
* Render Message
* @param string $message message
* @param string $caption caption
* @return string $text (ns,echo,return)
*/
function show_message($message, $caption='', $type='ns')
{
switch($type)
{
case 'echo':
echo "<div style='text-align:center'><b>".$message."</b></div>";
break;
case 'return':
return "<div style='text-align:center'><b>".$message."</b></div>";
break;
case 'ns':
default:
e107::getRender()->tablerender($caption, "<div style='text-align:center'><b>".$message."</b></div>");
break;
}
}
//##### show tagcloud/taglist -------------------------------------------------
/*
* Show tagcloud/taglist
* @return tablerender tagcloud/taglist
*/
function TagRender()
{
$tp = e107::getParser();
$type = false;
//decide whether to show the taglist or the tagcloud
//user can set own tag style
if(vartrue($this->pref['tagwords_view_style'])=='1')
{
$t = varset($_GET['type'],'');
switch($t)
{
case 'cloud':
$type='cloud';
break;
case 'list':
$type='list';
break;
default:
$type = (vartrue($this->pref['tagwords_default_style'])=='1' ? 'cloud' : 'list');
break;
}
}
else
{
//user cannot set tag style, so use default tag style value
$type = (vartrue($this->pref['tagwords_default_style'])=='1' ? 'cloud' : 'list');
}
//show the taglist or tagcloud
if($type=='list')
{
$text = $tp->parseTemplate($this->template['cloudlist'], true, $this->shortcodes);
e107::getRender()->tablerender(LAN_TAG_17, $text);
}
else
{
$text = $tp->parseTemplate($this->template['cloud'], true, $this->shortcodes);
e107::getRender()->tablerender(LAN_TAG_16, $text);
}
return;
}
/*
* retrieve all records based on tag word
* @param string $word word
* @param string $caption caption
* @return array $type=>$id
*/
function getRecordsByTag($word='')
{
$sql = e107::getDb();
$typeqry = '';
$allowed = $this->getAllowedAreas();
if(count($allowed)>0)
{
$typeqry = " AND tag_type IN ('".implode("','", $allowed)."') ";
}
if($sql->gen("SELECT tag_type, tag_itemid FROM #".$this->table." WHERE tag_word REGEXP('".e107::getParser()->toDB($word)."') ".$typeqry." "))
{
$ret = array();
while($row = $sql->fetch())
{
$ret[$row['tag_type']][] = $row['tag_itemid'];
}
return $ret;
}
return;
}
/*
* show list of related content based on the word (=$_GET['q'])
* @param string tablerender
*/
function TagSearchResults()
{
$tp = e107::getParser();
global $row;
//the full search query + every single word in the query will be used to search
$_GET['q'] = str_replace('+', ' ', $_GET['q']);
$words=array();
//add each seperate word to search
$words = explode(" ", trim($_GET['q']));
if(count($words)>1)
{
//add full query to search
array_unshift($words, $_GET['q']);
}
$results=array();
foreach($words as $w)
{
if($w!='')
{
if($t = $this->getRecordsByTag($w))
{
$results[] = $t;
}
}
}
//only combine the array if searching on multiple words
//else the array is always the [0] key
if(count($words)==1)
{
$records = $results[0];
ksort($records, SORT_STRING);
}
elseif(count($words) > 1)
{
$records = $this->getUnique($results);
ksort($records, SORT_STRING);
}
$this->num = count($records, 1) - count($records);
$text = $tp->parseTemplate($this->template['intro'], true, $this->shortcodes);
foreach($records as $type=>$ids)
{
if(array_key_exists($type, $this->mapper))
{
$pluginName = $this->mapper[$type];
$ins = "e_tagwords_{$pluginName}";
$this->area = $this->$ins;
//area (news, content, ...)
$text .= $tp->parseTemplate($this->template['area'], true, $this->shortcodes);
//records for found related tagword
$text .= $this->template['link_start'];
foreach($ids as $id)
{
$this->id = $id;
if(method_exists($this->area, 'getRecord'))
{
$this->area->getRecord($this->id);
$text .= $tp->parseTemplate($this->template['link_item'], true, $this->shortcodes);
}
}
$text .= $this->template['link_end'];
}
}
e107::getRender()->tablerender(LAN_TAG_1, $text);
return;
}
/*
* create a tag cloud
* @return string $text
*/
function TagCloud($mode='')
{
if($mode=='menu')
{
$t_start = $this->template['menu_cloud_start'];
$t_item = $this->template['menu_cloud_item'];
$t_end = $this->template['menu_cloud_end'];
}
else
{
$t_start = $this->template['cloud_start'];
$t_item = $this->template['cloud_item'];
$t_end = $this->template['cloud_end'];
}
$tags = $this->getAllTagWords($mode);
$tags = $this->TagSort($tags, $mode);
if(!is_array($tags))
{
return $this->show_message(LAN_TAG_18, '', 'return');
}
// tags will be displayed between class 1 to class 5
$min_size = 1;
$max_size = 5;
// get the largest and smallest array values
$min_qty = min(array_values($tags));
$max_qty = max(array_values($tags));
// find the range of values
$spread = $max_qty - $min_qty;
// we don't want to divide by zero
if(0 == $spread)
{
$spread = 1;
}
// determine the increment, this is the increase per tag quantity (times used)
$step = ($max_size - $min_size)/($spread);
$text = $t_start;
// loop through our tag array
foreach ($tags as $key => $value)
{
$class = ceil($min_size + (($value - $min_qty) * $step));
$this->word = $this->createTagWordLink($key, $class);
$this->number = $value;
$text .= e107::getParser()->parseTemplate($t_item, true, $this->shortcodes);
}
$text .= $t_end;
return $text;
}
/*
* create a tag list
* @return string $text tagcloudlist
*/
function TagCloudList()
{
$tags = $this->getAllTagWords();
$tags = $this->TagSort($tags);
if(!is_array($tags))
{
return $this->show_message(LAN_TAG_18, '', 'return');
}
$text = $this->template['cloudlist_start'];
foreach($tags as $key => $value)
{
$this->word = $this->createTagWordLink($key);
$this->number = $value;
$text .= e107::getParser()->parseTemplate($this->template['cloudlist_item'], true, $this->shortcodes);
}
$text .= $this->template['cloudlist_end'];
return $text;
}
//##### ADMIN
/*
* default preferences
*/
function default_prefs()
{
$ret=array();
$ret['tagwords_min'] = 1;
$ret['tagwords_class'] = 0;
$ret['tagwords_default_sort'] = 1;
$ret['tagwords_default_style'] = 1;
$ret['tagwords_view_sort'] = 1;
$ret['tagwords_view_style'] = 1;
$ret['tagwords_view_area'] = 1;
$ret['tagwords_view_search'] = 1;
$ret['tagwords_view_freq'] = 1;
$ret['tagwords_word_seperator'] = ' / ';
$ret['tagwords_menu_caption'] = 'LAN_TAG_MENU_2';
$ret['tagwords_menu_min'] = 5;
$ret['tagwords_menu_default_sort'] = 1;
$ret['tagwords_menu_view_search'] = 1;
$ret['tagwords_menu_view_freq'] = 0;
//activate core areas by default
$ret['tagwords_activeareas'] = array();
foreach($this->core as $area)
{
$ret['tagwords_activeareas'][$area] = 1;
}
return $ret;
}
/*
* get preferences from db
*/
function get_prefs()
{
$sql = e107::getDb();
$num_rows = $sql->gen("SELECT * FROM #core WHERE e107_name='".$this->table."' ");
if($num_rows == 0)
{
$p = $this->default_prefs();
$tmp = $this->e107->arrayStorage->WriteArray($p);
$sql->insert("core", "'".$this->table."', '{$tmp}' ");
$sql->gen("SELECT * FROM #core WHERE e107_name='".$this->table."' ");
}
$row = $sql->fetch();
$p = e107::unserialize($row['e107_value']);
//validation
if(!array_key_exists('tagwords_activeareas', $p))
{
$p['tagwords_activeareas'] = array();
}
return $p;
}
/*
* Update preferences
*/
function update_prefs()
{
$sql = e107::getDb();
$num_rows = $sql->gen("SELECT * FROM #core WHERE e107_name='".$this->table."' ");
if ($num_rows == 0)
{
$p = $this->default_prefs();
$tmp = $this->e107->arrayStorage->WriteArray($p);
$sql->insert("core", "'".$this->table."', '{$tmp}' ");
}
else
{
$row = $sql->fetch();
//assign new preferences
foreach($_POST as $k => $v)
{
if(preg_match("#^tagwords_#",$k))
{
$tagwords_pref[$k] = e107::getParser()->toDB($v);
}
}
$this->pref = $tagwords_pref;
//create new array of preferences
$tmp = $this->e107->arrayStorage->WriteArray($tagwords_pref);
$sql->update("core", "e107_value = '{$tmp}' WHERE e107_name = '".$this->table."' ");
}
return;
}
/*
* Validate tagword db, removes all non-existing records
* in case a db entry has been deleted but the tagwords were not
*/
function validate()
{
$sql = e107::getDb();
global $sql2;
if($sql->gen("SELECT * FROM #".$this->table." GROUP BY tag_type, tag_itemid ORDER BY tag_id"))
{
while($row= $sql->fetch())
{
if(array_key_exists($row['tag_type'], $this->mapper))
{
$name = "e_tagwords_{$this->mapper[$row['tag_type']]}";
if(!$sql2->gen("SELECT * FROM #".$row['tag_type']." WHERE ".$this->$name->settings['db_id']." = '".$row['tag_itemid']."' "))
{
$sql2->delete($this->table, "tag_type='".$row['tag_type']."' AND tag_itemid='".$row['tag_itemid']."' ");
}
}
}
}
}
/*
* Options
* @return string tablerender
*/
function tagwords_options()
{
$this->validate();
$text = e107::getParser()->parseTemplate($this->template['admin_options'], true, $this->shortcodes);
e107::getRender()->tablerender(LAN_TAG_OPT_1, $text);
}
} //end class
?>

View File

@@ -1,58 +0,0 @@
<?php
// First, let the browser know this is a CSS file.
header('Content-type: text/css');
/* stylesheet for the tagwords plugin */
$color1 = "#C79810";
$color2 = "#D15600";
$color3 = "#6BBA70";
$color4 = "#73880A";
$color5 = "#356AA0";
?>
.tag1, a.tag1:link, a.tag1:active, a.tag1:visited, a.tag1:hover {
font-size: 100%;
color:#C79810;
text-decoration:none;
}
a.tag1:hover {
text-decoration:underline;
}
.tag2, a.tag2:link, a.tag2:active, a.tag2:visited, a.tag2:hover {
font-size: 137%;
color:#D15600;
text-decoration:none;
}
a.tag2:hover {
text-decoration:underline;
}
.tag3, a.tag3:link, a.tag3:active, a.tag3:visited, a.tag3:hover {
font-size: 175%;
color:#6BBA70;
text-decoration:none;
}
a.tag3:hover {
text-decoration:underline;
}
.tag4, a.tag4:link, a.tag4:active, a.tag4:visited, a.tag4:hover {
font-size: 212%;
color:#73880A;
text-decoration:none;
}
a.tag4:hover {
text-decoration:underline;
}
.tag5, a.tag5:link, a.tag5:active, a.tag5:visited, a.tag5:hover {
font-size: 250%;
color:#356AA0;
text-decoration:none;
}
a.tag5:hover {
text-decoration:underline;
}

View File

@@ -1,30 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords Menu
*
*/
if (!defined('e107_INIT')){ exit; }
global $tag;
$e107 = e107::getInstance();
require_once(e_PLUGIN."tagwords/tagwords_class.php");
$tag = new tagwords();
if(vartrue($tag->pref['tagwords_class']) && !check_class($tag->pref['tagwords_class']) )
{
return;
}
$text = e107::getParser()->parseTemplate($tag->template['menu_cloud'], true, $tag->shortcodes);
$caption = $tag->pref['tagwords_menu_caption'] ? defset($tag->pref['tagwords_menu_caption'], $tag->pref['tagwords_menu_caption']) : LAN_TAG_16;
e107::getRender()->tablerender($caption, $text);
?>

View File

@@ -1,416 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords Shortcodes
*
*/
if (!defined('e107_INIT')) { exit; }
/*
$codes = array(
'tag_search', 'tag_area_heading', 'tag_link', 'tag_cloud', 'tag_word', 'tag_number', 'tag_sort', 'tag_type', 'tag_area', 'tag_button', 'tag_options', 'tag_opt_min', 'tag_opt_class', 'tag_opt_default_sort', 'tag_opt_default_style', 'tag_opt_view_sort', 'tag_opt_view_style', 'tag_opt_view_area', 'tag_opt_view_search', 'tag_opt_view_freq', 'tag_opt_caption', 'tag_opt_seperator', 'tag_opt_activeareas', 'tag_opt_button'
);
*/
$codes = array();
/*
$tmp = get_class_methods('tagwords_shortcodes');
foreach($tmp as $c)
{
if(strpos($c, 'sc_') === 0)
{
$codes[] = substr($c, 3);
}
}
*/
// register_shortcode('tagwords_shortcodes', TRUE);
// initShortcodeClass('tagwords_shortcodes');
class tagwords_shortcodes extends e_shortcode
{
var $e107;
function tagwords_shortcodes()
{
$this->e107 = e107::getInstance();
}
function sc_tag_search($parm, $sc_mode)
{
global $tag;
$value = (isset($_GET['q']) ? e107::getParser()->toForm($_GET['q']) : '');
switch($sc_mode)
{
case 'menu':
if(vartrue($tag->pref['tagwords_menu_view_search'])!=1)
{
return;
}
$id = 'tagwords_searchform_menu';
return "
<form id='".$id."' method='get' action='".e_PLUGIN_ABS."tagwords/tagwords.php'>
<div>
<input class='tbox' style='width:100px;' type='text' name='q' size='35' value='".$value."' maxlength='50' />
<input class='btn btn-default button' type='submit' name='se' value='".LAN_TAG_SEARCH_2."' />
</div>
</form>";
break;
case 'search':
if(vartrue($tag->pref['tagwords_view_search'])!=1)
{
return;
}
$id = 'tagwords_searchform';
return "
<form id='".$id."' method='get' action='".e_PLUGIN_ABS."tagwords/tagwords.php'>
<div>
<input class='tbox' style='width:100px;' type='text' name='q' size='35' value='".$value."' maxlength='50' />
<input class='btn btn-default button' type='submit' name='s' value='".LAN_TAG_SEARCH_2."' />
</div>
</form>";
break;
default:
if(vartrue($tag->pref['tagwords_view_search'])!=1)
{
return;
}
return "
<input class='tbox' style='width:100px;' type='text' name='q' size='35' value='".$value."' maxlength='50' />
<input class='btn btn-default button' type='submit' name='s' value='".LAN_TAG_SEARCH_2."' />";
break;
}
}
function sc_tag_area_heading()
{
global $tag;
return (vartrue($tag->area->settings['caption']) ? defset($tag->area->settings['caption'], $tag->area->settings['caption']) : '');
}
function sc_tag_link($parm, $sc_mode)
{
global $tag;
switch($sc_mode)
{
case 'menu':
return "<a href='".e107::getUrl()->create('tagwords')."'>".LAN_TAG_MENU_1."</a>";
break;
case 'home':
return "<a href='".e107::getUrl()->create('tagwords')."'>".LAN_TAG_7."</a>";
break;
default:
if(method_exists($tag->area, 'getLink'))
{
return $tag->area->getLink($tag->id);
}
break;
}
}
function sc_tag_cloud($parm, $sc_mode)
{
global $tag;
switch($sc_mode)
{
case 'menu':
return $tag->TagCloud('menu');
break;
case 'list':
return $tag->TagCloudList();
break;
default:
return $tag->TagCloud();
break;
}
}
function sc_tag_word($parm, $sc_mode)
{
global $tag;
switch($sc_mode)
{
case 'result':
return "<b>".$tag->num."</b> ".($tag->num==1 ? LAN_TAG_8 : LAN_TAG_9)." '<b>".e107::getParser()->toHTML($_GET['q'],true)."</b>'";
break;
case 'form':
default:
return $tag->word;
break;
}
}
function sc_tag_number($parm, $sc_mode)
{
global $tag;
switch($sc_mode)
{
case 'list':
return $tag->number;
break;
case 'menu':
if(vartrue($tag->pref['tagwords_menu_view_freq'])==1)
{
return $tag->number;
}
break;
default:
if(vartrue($tag->pref['tagwords_view_freq'])==1)
{
return $tag->number;
}
break;
}
}
function sc_tag_sort()
{
global $tag;
if(vartrue($tag->pref['tagwords_view_sort'])==1)
{
$s = varset($_GET['sort'],'');
switch($s)
{
case 'alpha':
$sel = 'alpha';
break;
case 'freq':
$sel = 'freq';
break;
default:
$sel = '';
break;
}
$text = "
<select id='sort' name='sort' class='tbox'>
<option value=''>".LAN_TAG_19."</option>
<option value='alpha' ".($sel=='alpha' ? "selected='selected'" : '')." >".LAN_TAG_10."</option>
<option value='freq' ".($sel=='freq' ? "selected='selected'" : '')." >".LAN_TAG_11."</option>
</select>";
return $text;
}
return;
}
function sc_tag_type()
{
global $tag;
if(vartrue($tag->pref['tagwords_view_style'])==1)
{
$t = varset($_GET['type'],'');
switch($t)
{
case 'cloud':
$sel = 'cloud';
break;
case 'list':
$sel = 'list';
break;
default:
$sel = '';
break;
}
$text = "
<select id='type' name='type' class='tbox'>
<option value=''>".LAN_TAG_20."</option>
<option value='cloud' ".($sel=='cloud' ? "selected='selected'" : '')." >".LAN_TAG_13."</option>
<option value='list' ".($sel=='list' ? "selected='selected'" : '')." >".LAN_TAG_12."</option>
</select>";
return $text;
}
return;
}
function sc_tag_area()
{
global $tag;
if(vartrue($tag->pref['tagwords_view_area'])==1)
{
$text = "
<select id='area' name='area' class='tbox'>
<option value='' >".LAN_TAG_15."</option>";
foreach($tag->tagwords as $area)
{
if(array_key_exists($area,$tag->pref['tagwords_activeareas']))
{
$name = "e_tagwords_{$area}";
$selected = (vartrue($_GET['area'])==$area ? "selected=selected" : '');
$text .= "<option value='".$area."' ".$selected." >".defset($tag->$name->settings['caption'], $tag->$name->settings['caption'])."</option>";
}
}
$text .= "
</select>";
return $text;
}
return;
}
function sc_tag_button()
{
global $tag;
if(vartrue($tag->pref['tagwords_view_sort']) || vartrue($tag->pref['tagwords_view_style']) || vartrue($tag->pref['tagwords_view_area']))
return "<input class='btn btn-default button' type='submit' name='so' value='".LAN_TAG_SEARCH_3."' />";
return '';
}
function sc_tag_options()
{
global $tag;
if( vartrue($tag->pref['tagwords_view_search'])==1 || vartrue($tag->pref['tagwords_view_sort'])==1 || vartrue($tag->pref['tagwords_view_style'])==1 || vartrue($tag->pref['tagwords_view_area'])==1 )
{
return e107::getParser()->parseTemplate($tag->template['options'], true, $tag->shortcodes);
}
}
function sc_tag_url($parm)
{
return e107::getUrl()->create('tagwords', $parm);
}
//##### ADMIN OPTIONS -------------------------
function sc_tag_opt_min($parm, $sc_mode)
{
global $tag;
$id = ($sc_mode=='menu' ? 'tagwords_menu_min' : 'tagwords_min');
return "<input class='tbox' type='text' id='".$id."' name='".$id."' value='".$tag->pref[$id]."' size='3' maxlength='3' />";
}
function sc_tag_opt_class()
{
global $tag;
$id = 'tagwords_class';
return r_userclass($id,$tag->pref[$id],"","admin,public,guest,nobody,member,classes");
}
function sc_tag_opt_default_sort($parm, $sc_mode)
{
global $tag;
$id = ($sc_mode=='menu' ? 'tagwords_menu_default_sort' : 'tagwords_default_sort');
return "<label><input type='radio' name='".$id."' value='1' ".($tag->pref[$id] ? "checked='checked'" : "")." /> ".LAN_TAG_OPT_5."</label>&nbsp;&nbsp;
<label><input type='radio' name='".$id."' value='0' ".($tag->pref[$id] ? "" : "checked='checked'")." /> ".LAN_TAG_OPT_6."</label>";
}
function sc_tag_opt_default_style()
{
global $tag;
$id = 'tagwords_default_style';
return "<label><input type='radio' name='".$id."' value='1' ".($tag->pref[$id] ? "checked='checked'" : "")." /> ".LAN_TAG_OPT_8."</label>&nbsp;&nbsp;
<label><input type='radio' name='".$id."' value='0' ".($tag->pref[$id] ? "" : "checked='checked'")." /> ".LAN_TAG_OPT_9."</label>";
}
function sc_tag_opt_view_sort()
{
global $tag;
$id = 'tagwords_view_sort';
$sel = (isset($tag->pref[$id]) && $tag->pref[$id] ? "checked='checked'" : "");
return "
<label for='".$id."'>
<input type='checkbox' name='".$id."' id='".$id."' value='1' ".$sel." /> ".LAN_TAG_OPT_12."
</label>";
}
function sc_tag_opt_view_style()
{
global $tag;
$id = 'tagwords_view_style';
$sel = (isset($tag->pref[$id]) && $tag->pref[$id] ? "checked='checked'" : "");
return "
<label for='".$id."'>
<input type='checkbox' name='".$id."' id='".$id."' value='1' ".$sel." /> ".LAN_TAG_OPT_13."
</label>";
}
function sc_tag_opt_view_area()
{
global $tag;
$id = 'tagwords_view_area';
$sel = (isset($tag->pref[$id]) && $tag->pref[$id] ? "checked='checked'" : "");
return "
<label for='".$id."'>
<input type='checkbox' name='".$id."' id='".$id."' value='1' ".$sel." /> ".LAN_TAG_OPT_14."
</label>";
}
function sc_tag_opt_view_search($parm, $sc_mode)
{
global $tag;
$id = ($sc_mode=='menu' ? 'tagwords_menu_view_search' : 'tagwords_view_search');
$sel = (isset($tag->pref[$id]) && $tag->pref[$id] ? "checked='checked'" : "");
return "
<label for='".$id."'>
<input type='checkbox' name='".$id."' id='".$id."' value='1' ".$sel." /> ".LAN_TAG_OPT_19."
</label>";
}
function sc_tag_opt_view_freq($parm, $sc_mode)
{
global $tag;
if($sc_mode=='menu')
{
$id = 'tagwords_menu_view_freq';
}
else
{
$id = 'tagwords_view_freq';
}
$sel = (isset($tag->pref[$id]) && $tag->pref[$id] ? "checked='checked'" : "");
return "
<label for='".$id."'>
<input type='checkbox' name='".$id."' id='".$id."' value='1' ".$sel." /> ".LAN_TAG_OPT_20."
</label>";
}
function sc_tag_opt_caption()
{
global $tag;
$id = 'tagwords_menu_caption';
return "<input class='tbox' type='text' id='".$id."' name='".$id."' value='".e107::getParser()->toForm($tag->pref[$id],"","defs")."' size='30' maxlength='100' />";
}
function sc_tag_opt_seperator()
{
global $tag;
$id = 'tagwords_word_seperator';
return "<input class='tbox' type='text' id='".$id."' name='".$id."' value='".e107::getParser()->toForm($tag->pref[$id])."' size='3' maxlength='10' />";
}
function sc_tag_opt_activeareas()
{
global $tag;
$id = 'tagwords_activeareas';
$text = "";
foreach($tag->tagwords as $area)
{
$sel = (array_key_exists($area,$tag->pref[$id]) ? "checked='checked'" : '');
$name = "e_tagwords_{$area}";
$text .= "
<label for='".$id."-".$area."'>
<input type='checkbox' name='".$id."[".$area."]' id='".$id."-".$area."' value='1' ".$sel." />
".defset($tag->$name->settings['caption'], $tag->$name->settings['caption'])."
</label><br />";
}
return $text;
}
function sc_tag_opt_button()
{
return "<input class='btn btn-default button' type='submit' name='updatesettings' value='".LAN_UPDATE."' />";
}
}
?>

View File

@@ -1,8 +0,0 @@
CREATE TABLE tagwords (
`tag_id` int(10) unsigned NOT NULL auto_increment,
`tag_type` varchar(100) NOT NULL default '',
`tag_itemid` int(10) unsigned NOT NULL default '0',
`tag_word` varchar(255) NOT NULL default '',
PRIMARY KEY (`tag_id`),
KEY `tag_word` (`tag_word`)
) ENGINE=MyISAM AUTO_INCREMENT=1;

View File

@@ -1,204 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords Template
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/tagwords/tagwords_template.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
if (!defined('e107_INIT')) { exit; }
global $sc_style, $tagwords_shortcodes;
if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
//##### form element ------------------------------------------------
$TEMPLATE_TAGWORDS['caption'] = LAN_TAG_1."<br /><span class='smalltext'>(".LAN_TAG_21.")</span>";
$TEMPLATE_TAGWORDS['form'] = "<textarea class='tbox' cols='".TAG_TEXTAREA_COLS."' rows='".TAG_TEXTAREA_ROWS."' id='tagwords' name='tagwords'>{TAG_WORD|form}</textarea><br />";
//##### intro in the 'related content' list -------------------------
$sc_style['TAG_SEARCH|search']['pre'] = "<div style='float:right; margin-bottom:5px; margin-left:5px;'>";
$sc_style['TAG_SEARCH|search']['post'] = "</div>";
$sc_style['TAG_LINK|home']['pre'] = "";
$sc_style['TAG_LINK|home']['post'] = "<br /><br />";
$TEMPLATE_TAGWORDS['intro'] = "
{TAG_LINK|home}
{TAG_SEARCH|search}
<div>
{TAG_WORD|result}<br />
<br />
</div>";
//##### area heading in the 'related content' list ------------------
$TEMPLATE_TAGWORDS['area'] = "<h2>{TAG_AREA_HEADING}</h2>";
//##### link to an item present in the 'related content' list -------
$TEMPLATE_TAGWORDS['link_start'] = "<div><ul>";
$TEMPLATE_TAGWORDS['link_item'] = "<li>{TAG_LINK}</li>";
$TEMPLATE_TAGWORDS['link_end'] = "</ul></div>";
//##### options --------------------------------------------------
$TEMPLATE_TAGWORDS['options'] = "
<form id='plugin-tagwords-form' method='get' action='{TAG_URL}'>
{TAG_SEARCH}
</form>
<form id='dataform' name='dataform' method='get' action='{TAG_URL}'>
<div style='line-height:150%; padding-bottom:10px;'>
{TAG_TYPE} {TAG_SORT} {TAG_AREA} {TAG_BUTTON}
</div>
</form>";
//##### cloud -------------------------------------------------------
$sc_style['TAG_NUMBER']['pre'] = "&nbsp;(";
$sc_style['TAG_NUMBER']['post'] = ")";
$TEMPLATE_TAGWORDS['cloud_start'] = "";
$TEMPLATE_TAGWORDS['cloud_item'] = " {TAG_WORD}{TAG_NUMBER}";
$TEMPLATE_TAGWORDS['cloud_end'] = "";
$TEMPLATE_TAGWORDS['cloud'] = "
{TAG_OPTIONS}
<div class='tagwords' style='text-align:center;'>
<div style='text-align:justify; width:85%; line-height:250%; margin:0 auto;'>
{TAG_CLOUD}
</div>
</div>";
//##### cloud list --------------------------------------------------
$sc_style['TAG_NUMBER|list']['pre'] = " (";
$sc_style['TAG_NUMBER|list']['post'] = ")";
$TEMPLATE_TAGWORDS['cloudlist_start'] = "<ul>";
$TEMPLATE_TAGWORDS['cloudlist_item'] = "<li>{TAG_WORD} {TAG_NUMBER|list}</li>";
$TEMPLATE_TAGWORDS['cloudlist_end'] = "</ul>";
$TEMPLATE_TAGWORDS['cloudlist'] = "
{TAG_OPTIONS}
<div class='tagwords'>
{TAG_CLOUD|list}
</div>";
//##### menu cloud --------------------------------------------------
$sc_style['TAG_NUMBER|menu']['pre'] = "&nbsp;(";
$sc_style['TAG_NUMBER|menu']['post'] = ") ";
$sc_style['TAG_SEARCH|menu']['pre'] = "<div style='margin-bottom:5px;'>";
$sc_style['TAG_SEARCH|menu']['post'] = "</div>";
$TEMPLATE_TAGWORDS['menu_cloud_start'] = "";
$TEMPLATE_TAGWORDS['menu_cloud_item'] = " {TAG_WORD|menu}{TAG_NUMBER|menu}";
$TEMPLATE_TAGWORDS['menu_cloud_end'] = "";
$TEMPLATE_TAGWORDS['menu_cloud'] = "
<div class='tagwords' style='text-align:center;'>
{TAG_SEARCH|menu}
<div style=' width:90%; line-height:250%; margin:0 auto;'>
{TAG_CLOUD|menu}
</div>
{TAG_LINK|menu}
</div>";
//##### admin -------------------------------------------------------
$TEMPLATE_TAGWORDS['admin_options'] = "
<form method='post' action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."'>
<table class='table adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tr>
<td colspan='2'>".LAN_TAG_OPT_25."</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_2."</td>
<td>{TAG_OPT_MIN}</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_3."</td>
<td>{TAG_OPT_CLASS}</td>
</tr>
<tr>
<td colspan='2'>".LAN_TAG_OPT_16."</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_4."</td>
<td>{TAG_OPT_DEFAULT_SORT}</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_7."</td>
<td>{TAG_OPT_DEFAULT_STYLE}</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_26."</td>
<td>
{TAG_OPT_VIEW_SORT}<br />
{TAG_OPT_VIEW_STYLE}<br />
{TAG_OPT_VIEW_AREA}<br />
{TAG_OPT_VIEW_SEARCH}<br />
{TAG_OPT_VIEW_FREQ}<br />
</td>
</tr>
<tr>
<td colspan='2'>".LAN_TAG_OPT_17."</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_18."</td>
<td>{TAG_OPT_CAPTION|menu}</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_15."</td>
<td>{TAG_OPT_MIN|menu}</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_4."</td>
<td>{TAG_OPT_DEFAULT_SORT|menu}</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_26."</td>
<td>
{TAG_OPT_VIEW_SEARCH|menu}<br />
{TAG_OPT_VIEW_FREQ|menu}<br />
</td>
</tr>
<tr>
<td colspan='2'>".LAN_TAG_OPT_21."</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_22."</td>
<td>{TAG_OPT_SEPERATOR}</td>
</tr>
<tr>
<td colspan='2'>".LAN_TAG_OPT_23."</td>
</tr>
<tr>
<td>".LAN_TAG_OPT_24."</td>
<td>{TAG_OPT_ACTIVEAREAS}</td>
</tr>
</table>
<div class='buttons-bar center'>
{TAG_OPT_BUTTON}
</div>
</table>
</form>";
?>

View File

@@ -1,76 +0,0 @@
<?php
/*
* Copyright (C) 2008-2011 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
*
* Tagwords Default URL configuration
*/
if (!defined('e107_INIT')){ exit; }
class plugin_tagwords_url extends eUrlConfig
{
public function config()
{
return array(
'config' => array(
'legacy' => '{e_PLUGIN}tagwords/tagwords.php', // this config won't work in single entry point mod (legacy not used at all), so just set this to default plugin file to notify router it's legacy module
'format' => 'path', // get|path - notify core for the current URL format, if set to 'get' rules will be ignored
'selfCreate' => true, // [optional] default false; use only this->create() method, no core routine URL creating
'defaultRoute' => 'search/index', // [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
),
'allowVars' => array(
'q', 'page','type', 'sort', 'area',/* 's', 'so',*/
),
// rule set array
'rules' => array(
'<area:{alphanum}>/<q:{secure}>' => 'search/area',
'<q:{secure}>' => 'search/index',
'' => 'search/index',
)
);
}
/**
* Admin callback
* Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page)
*/
public function admin()
{
// static may be used for performance
e107::plugLan('tagwords');
static $admin = array(
'labels' => array(
'name' => LAN_TAG_URL_NAME, // Module name
'label' => LAN_TAG_URL_DEFAULT_LABEL, // Current profile name
'description' => LAN_TAG_URL_DEFAULT_DESCR, //
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity
);
return $admin;
}
public function create($route, $params = array(), $options = array())
{
if(is_string($route)) $route = explode('/', $route, 2);
if(!varset($route[0]) || 'index' == $route[0]) $route[0] = 'tagwords';
if(!varset($route[1])) $route[1] = 'tagwords';
$base = e107::getInstance()->getFolder('plugins').'tagwords/';
if(($route[0] == 'tagwords') || ($route[0] == "search"))
{
if(isset($params['q']))
return $base.'tagwords.php?q='.$params['q'];
else
return $base.'tagwords.php';
}
}
}