From 605d4078ce1e167d744bacf491a7c7beec1a0f47 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 8 Apr 2015 00:16:03 -0700 Subject: [PATCH] Fix RSS atom link. Improved default styling on linkwords. e107::url() can now generate full or absolute urls. Sef-URL generation no longer strips numbers from titles. --- e107_handlers/application.php | 4 ++-- e107_handlers/e107_class.php | 19 ++++++++++++++----- e107_plugins/linkwords/linkwords.css | 3 ++- e107_plugins/rss_menu/rss.php | 17 +++++++++-------- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/e107_handlers/application.php b/e107_handlers/application.php index 934873cb1..e0a344893 100644 --- a/e107_handlers/application.php +++ b/e107_handlers/application.php @@ -4280,10 +4280,10 @@ class eHelper public static function title2sef($title, $type = null) { $title = str_replace(array("&",",","(",")"),'',$title); - $title = preg_replace('/[^\w\pL\s.]/u', '', strip_tags(e107::getParser()->toHTML($title, TRUE))); + $title = preg_replace('/[^\w\d\pL\s.]/u', '', strip_tags(e107::getParser()->toHTML($title, TRUE))); $title = trim(preg_replace('/[\s]+/', ' ', str_replace('_', ' ', $title))); - $words = str_word_count($title,1); + $words = str_word_count($title,1, '12345678990'); $limited = array_slice($words, 0, 14); // Limit number of words to 14. - any more and it ain't friendly. diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index ab6252611..bd85a61dd 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -2604,23 +2604,32 @@ class e107 } /** - * Experimental static (easy) sef-url creation method (works with e_url.php @see /index.php) + * Static (easy) sef-url creation method (works with e_url.php @see /index.php) * @param string $plugin * @param $key * @param array $row + * @param string $mode abs | full * @return string */ - public static function url($plugin='',$key, $row=array()) + public static function url($plugin='',$key, $row=array(), $mode='abs') { $tmp = e107::getAddonConfig('e_url'); $tp = e107::getParser(); if(varset($tmp[$plugin][$key]['sef'])) { - if(deftrue('e_MOD_REWRITE')) // Search-Engine-Friendly URL + if(deftrue('e_MOD_REWRITE')) // Search-Engine-Friendly URLs active. { $rawUrl = $tp->simpleParse($tmp[$plugin][$key]['sef'], $row); - return e_HTTP.$rawUrl; + + if($mode == 'full') + { + return SITEURL.$rawUrl; + } + else + { + return e_HTTP.$rawUrl; + } } else // Legacy URL. { @@ -2637,7 +2646,7 @@ class e107 } $urlTemplate = str_replace($srch,$repl,$tmp[$plugin][$key]['redirect']); - $urlTemplate = $tp->replaceConstants($urlTemplate,'abs'); + $urlTemplate = $tp->replaceConstants($urlTemplate, $mode); $legacyUrl = $tp->simpleParse($urlTemplate, $row); return $legacyUrl; diff --git a/e107_plugins/linkwords/linkwords.css b/e107_plugins/linkwords/linkwords.css index 71ce699c9..5cdf5a32c 100644 --- a/e107_plugins/linkwords/linkwords.css +++ b/e107_plugins/linkwords/linkwords.css @@ -1,4 +1,5 @@ -a.lw-tip { cursor: help } \ No newline at end of file +a.lw-tip { cursor: help; text-decoration-style:dotted } +a.lw-link { cursor: pointer; text-decoration-style:solid } \ No newline at end of file diff --git a/e107_plugins/rss_menu/rss.php b/e107_plugins/rss_menu/rss.php index f1f98fb91..0686f29b7 100644 --- a/e107_plugins/rss_menu/rss.php +++ b/e107_plugins/rss_menu/rss.php @@ -77,7 +77,7 @@ elseif (e_QUERY) // List available rss feeds -if (!$rss_type) +if (!empty($rss_type)) { // Display list of all feeds require_once(HEADERF); // require_once(e_PLUGIN.'rss_menu/rss_template.php'); Already loaded @@ -217,6 +217,7 @@ class rssCreate case 'news' : case 1: $path = e_PLUGIN."news/e_rss.php"; + $this->contentType = "news"; break;; case 2: $path=''; @@ -287,7 +288,7 @@ class rssCreate $path = e_PLUGIN."forum/e_rss.php"; break; - case download: + case 'download': case 12: $path = e_PLUGIN."download/e_rss.php"; break; @@ -437,7 +438,7 @@ class rssCreate $sitebutton = (strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", SITEBUTTON)); echo " - + toHtml($rss_custom_channel,FALSE)."\n"; // must not convert to CDATA. - echo "".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")." + echo " + ".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")." ".$tp->toRss(SITEDISCLAIMER)." ".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].") ".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].") @@ -462,9 +464,8 @@ class rssCreate e107 (http://e107.org) hourly 1 - 60\n"; - - echo "topicid."\" rel=\"self\" type=\"application/rss+xml\" />\n"; + 60 + $this->contentType, 'id'=>$this->topicid),'full')."\" rel=\"self\" type=\"application/rss+xml\" />\n"; if (trim(SITEBUTTON)) { @@ -645,7 +646,7 @@ class rssCreate echo " http://e107.org/\n \n - \n"; + $this->contentType, 'id'=>$this->topicid),'full')."' />\n"; // Optional include(e_ADMIN."ver.php");