diff --git a/e107_plugins/tagwords/admin_tagwords_config.php b/e107_plugins/tagwords/admin_tagwords_config.php deleted file mode 100644 index 1fecfdd1f..000000000 --- a/e107_plugins/tagwords/admin_tagwords_config.php +++ /dev/null @@ -1,38 +0,0 @@ -update_prefs(); - $mes->addSuccess(LAN_UPDATED); -} - -$ns->tablerender($caption, $mes->render() . $text); - -$tag->tagwords_options(); - -require_once(e_ADMIN."footer.php"); -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/e_event.php b/e107_plugins/tagwords/e_event.php deleted file mode 100644 index a0ed4e806..000000000 --- a/e107_plugins/tagwords/e_event.php +++ /dev/null @@ -1,90 +0,0 @@ -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 - -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/e_meta.php b/e107_plugins/tagwords/e_meta.php deleted file mode 100644 index a88ff9728..000000000 --- a/e107_plugins/tagwords/e_meta.php +++ /dev/null @@ -1,28 +0,0 @@ -\n"; - -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/images/tagwords_16.png b/e107_plugins/tagwords/images/tagwords_16.png deleted file mode 100644 index 3f6f3ac41..000000000 Binary files a/e107_plugins/tagwords/images/tagwords_16.png and /dev/null differ diff --git a/e107_plugins/tagwords/images/tagwords_32.png b/e107_plugins/tagwords/images/tagwords_32.png deleted file mode 100644 index 2cf666524..000000000 Binary files a/e107_plugins/tagwords/images/tagwords_32.png and /dev/null differ diff --git a/e107_plugins/tagwords/languages/English.php b/e107_plugins/tagwords/languages/English.php deleted file mode 100644 index c89c392fd..000000000 --- a/e107_plugins/tagwords/languages/English.php +++ /dev/null @@ -1,76 +0,0 @@ -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"); \ No newline at end of file diff --git a/e107_plugins/tagwords/plugin.xml b/e107_plugins/tagwords/plugin.xml deleted file mode 100644 index 44f6ad621..000000000 --- a/e107_plugins/tagwords/plugin.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - A fully featured Tagword system - misc - - Configure Tagwords - - - Tagwords - - \ No newline at end of file diff --git a/e107_plugins/tagwords/section/e_tagwords_news.php b/e107_plugins/tagwords/section/e_tagwords_news.php deleted file mode 100644 index a3346df11..000000000 --- a/e107_plugins/tagwords/section/e_tagwords_news.php +++ /dev/null @@ -1,55 +0,0 @@ -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 "".e107::getParser()->toHTML($this->row['news_title'], TRUE, '').""; - } - - 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; - } -} -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/section/e_tagwords_page.php b/e107_plugins/tagwords/section/e_tagwords_page.php deleted file mode 100644 index 5ab689e6a..000000000 --- a/e107_plugins/tagwords/section/e_tagwords_page.php +++ /dev/null @@ -1,51 +0,0 @@ -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 "".e107::getParser()->toHTML($this->row['page_title'], TRUE, '').""; - } - - 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; - } -} -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords.php b/e107_plugins/tagwords/tagwords.php deleted file mode 100644 index 07948e248..000000000 --- a/e107_plugins/tagwords/tagwords.php +++ /dev/null @@ -1,43 +0,0 @@ -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); - -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords.sc b/e107_plugins/tagwords/tagwords.sc deleted file mode 100644 index 446003e66..000000000 --- a/e107_plugins/tagwords/tagwords.sc +++ /dev/null @@ -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); diff --git a/e107_plugins/tagwords/tagwords_class.php b/e107_plugins/tagwords/tagwords_class.php deleted file mode 100644 index 91839e807..000000000 --- a/e107_plugins/tagwords/tagwords_class.php +++ /dev/null @@ -1,895 +0,0 @@ -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 "".$word.""; - } - - /* - * 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 "
".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 "
".$message."
"; - break; - case 'return': - return "
".$message."
"; - break; - case 'ns': - default: - e107::getRender()->tablerender($caption, "
".$message."
"); - 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 - -?> diff --git a/e107_plugins/tagwords/tagwords_css.php b/e107_plugins/tagwords/tagwords_css.php deleted file mode 100644 index e40414b31..000000000 --- a/e107_plugins/tagwords/tagwords_css.php +++ /dev/null @@ -1,58 +0,0 @@ - - -.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; -} diff --git a/e107_plugins/tagwords/tagwords_menu.php b/e107_plugins/tagwords/tagwords_menu.php deleted file mode 100644 index 6cb1035eb..000000000 --- a/e107_plugins/tagwords/tagwords_menu.php +++ /dev/null @@ -1,30 +0,0 @@ -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); - -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_shortcodes.php b/e107_plugins/tagwords/tagwords_shortcodes.php deleted file mode 100644 index 091b43b3d..000000000 --- a/e107_plugins/tagwords/tagwords_shortcodes.php +++ /dev/null @@ -1,416 +0,0 @@ -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 " -
-
- - -
-
"; - break; - - case 'search': - if(vartrue($tag->pref['tagwords_view_search'])!=1) - { - return; - } - $id = 'tagwords_searchform'; - return " -
-
- - -
-
"; - break; - - default: - if(vartrue($tag->pref['tagwords_view_search'])!=1) - { - return; - } - return " - - "; - 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 "".LAN_TAG_MENU_1.""; - break; - case 'home': - return "".LAN_TAG_7.""; - 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 "".$tag->num." ".($tag->num==1 ? LAN_TAG_8 : LAN_TAG_9)." '".e107::getParser()->toHTML($_GET['q'],true)."'"; - 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 = " - "; - 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 = " - "; - return $text; - } - return; - } - - function sc_tag_area() - { - global $tag; - if(vartrue($tag->pref['tagwords_view_area'])==1) - { - $text = " - "; - 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 ""; - 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 ""; - } - - 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 "   - "; - } - - function sc_tag_opt_default_style() - { - global $tag; - $id = 'tagwords_default_style'; - return "   - "; - } - - function sc_tag_opt_view_sort() - { - global $tag; - $id = 'tagwords_view_sort'; - $sel = (isset($tag->pref[$id]) && $tag->pref[$id] ? "checked='checked'" : ""); - return " - "; - } - - function sc_tag_opt_view_style() - { - global $tag; - $id = 'tagwords_view_style'; - $sel = (isset($tag->pref[$id]) && $tag->pref[$id] ? "checked='checked'" : ""); - return " - "; - } - - function sc_tag_opt_view_area() - { - global $tag; - $id = 'tagwords_view_area'; - $sel = (isset($tag->pref[$id]) && $tag->pref[$id] ? "checked='checked'" : ""); - return " - "; - } - - 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 " - "; - } - - 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 " - "; - } - - function sc_tag_opt_caption() - { - global $tag; - $id = 'tagwords_menu_caption'; - return ""; - } - - function sc_tag_opt_seperator() - { - global $tag; - $id = 'tagwords_word_seperator'; - return ""; - } - - 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 .= " -
"; - - } - return $text; - } - - function sc_tag_opt_button() - { - return ""; - } - -} -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_sql.php b/e107_plugins/tagwords/tagwords_sql.php deleted file mode 100644 index e5d06acbd..000000000 --- a/e107_plugins/tagwords/tagwords_sql.php +++ /dev/null @@ -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; \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_template.php b/e107_plugins/tagwords/tagwords_template.php deleted file mode 100644 index be4acc1a6..000000000 --- a/e107_plugins/tagwords/tagwords_template.php +++ /dev/null @@ -1,204 +0,0 @@ -(".LAN_TAG_21.")"; -$TEMPLATE_TAGWORDS['form'] = "
"; - -//##### intro in the 'related content' list ------------------------- - -$sc_style['TAG_SEARCH|search']['pre'] = "
"; -$sc_style['TAG_SEARCH|search']['post'] = "
"; - -$sc_style['TAG_LINK|home']['pre'] = ""; -$sc_style['TAG_LINK|home']['post'] = "

"; - -$TEMPLATE_TAGWORDS['intro'] = " -{TAG_LINK|home} -{TAG_SEARCH|search} -
- {TAG_WORD|result}
-
-
"; - -//##### area heading in the 'related content' list ------------------ - -$TEMPLATE_TAGWORDS['area'] = "

{TAG_AREA_HEADING}

"; - -//##### link to an item present in the 'related content' list ------- - -$TEMPLATE_TAGWORDS['link_start'] = "
"; - -//##### options -------------------------------------------------- - -$TEMPLATE_TAGWORDS['options'] = " -
- {TAG_SEARCH} -
-
-
- {TAG_TYPE} {TAG_SORT} {TAG_AREA} {TAG_BUTTON} -
-
"; - -//##### cloud ------------------------------------------------------- - -$sc_style['TAG_NUMBER']['pre'] = " ("; -$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} -
-
- {TAG_CLOUD} -
-
"; - -//##### cloud list -------------------------------------------------- - -$sc_style['TAG_NUMBER|list']['pre'] = " ("; -$sc_style['TAG_NUMBER|list']['post'] = ")"; - -$TEMPLATE_TAGWORDS['cloudlist_start'] = ""; - -$TEMPLATE_TAGWORDS['cloudlist'] = " -{TAG_OPTIONS} -
- {TAG_CLOUD|list} -
"; - -//##### menu cloud -------------------------------------------------- - -$sc_style['TAG_NUMBER|menu']['pre'] = " ("; -$sc_style['TAG_NUMBER|menu']['post'] = ") "; - -$sc_style['TAG_SEARCH|menu']['pre'] = "
"; -$sc_style['TAG_SEARCH|menu']['post'] = "
"; - -$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'] = " -
- {TAG_SEARCH|menu} -
- {TAG_CLOUD|menu} -
- {TAG_LINK|menu} -
"; - -//##### admin ------------------------------------------------------- - -$TEMPLATE_TAGWORDS['admin_options'] = " -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".LAN_TAG_OPT_25."
".LAN_TAG_OPT_2."{TAG_OPT_MIN}
".LAN_TAG_OPT_3."{TAG_OPT_CLASS}
".LAN_TAG_OPT_16."
".LAN_TAG_OPT_4."{TAG_OPT_DEFAULT_SORT}
".LAN_TAG_OPT_7."{TAG_OPT_DEFAULT_STYLE}
".LAN_TAG_OPT_26." - {TAG_OPT_VIEW_SORT}
- {TAG_OPT_VIEW_STYLE}
- {TAG_OPT_VIEW_AREA}
- {TAG_OPT_VIEW_SEARCH}
- {TAG_OPT_VIEW_FREQ}
-
".LAN_TAG_OPT_17."
".LAN_TAG_OPT_18."{TAG_OPT_CAPTION|menu}
".LAN_TAG_OPT_15."{TAG_OPT_MIN|menu}
".LAN_TAG_OPT_4."{TAG_OPT_DEFAULT_SORT|menu}
".LAN_TAG_OPT_26." - {TAG_OPT_VIEW_SEARCH|menu}
- {TAG_OPT_VIEW_FREQ|menu}
-
".LAN_TAG_OPT_21."
".LAN_TAG_OPT_22."{TAG_OPT_SEPERATOR}
".LAN_TAG_OPT_23."
".LAN_TAG_OPT_24."{TAG_OPT_ACTIVEAREAS}
-
- {TAG_OPT_BUTTON} -
- -
"; - -?> \ No newline at end of file diff --git a/e107_plugins/tagwords/url/url.php b/e107_plugins/tagwords/url/url.php deleted file mode 100644 index 7dbbd9f0e..000000000 --- a/e107_plugins/tagwords/url/url.php +++ /dev/null @@ -1,76 +0,0 @@ - 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( - '/' => 'search/area', - '' => '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'; - } - } -}