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

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.

This commit is contained in:
Cameron
2015-04-08 00:16:03 -07:00
parent d128b52576
commit 605d4078ce
4 changed files with 27 additions and 16 deletions

View File

@@ -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.

View File

@@ -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;

View File

@@ -1,4 +1,5 @@
a.lw-tip { cursor: help }
a.lw-tip { cursor: help; text-decoration-style:dotted }
a.lw-link { cursor: pointer; text-decoration-style:solid }

View File

@@ -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 "<?xml version=\"1.0\" encoding=\"utf-8\"?".">
<!-- generator=\"e107\" -->
<!-- content type=\"".$this -> contentType."\" -->
<!-- content type=\"".$this->contentType."\" -->
<rss {$rss_namespace} version=\"2.0\"
xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"
xmlns:atom=\"http://www.w3.org/2005/Atom\"
@@ -452,7 +453,8 @@ class rssCreate
echo $tp->toHtml($rss_custom_channel,FALSE)."\n"; // must not convert to CDATA.
echo "<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language>
echo "
<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language>
<copyright>".$tp->toRss(SITEDISCLAIMER)."</copyright>
<managingEditor>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</managingEditor>
<webMaster>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</webMaster>
@@ -462,9 +464,8 @@ class rssCreate
<generator>e107 (http://e107.org)</generator>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<ttl>60</ttl>\n";
echo "<atom:link href=\"".e_SELF."?".$content_type.".4.".$this->topicid."\" rel=\"self\" type=\"application/rss+xml\" />\n";
<ttl>60</ttl>
<atom:link href=\"".e107::url('rss_menu','atom', array('rss_url'=>$this->contentType, 'id'=>$this->topicid),'full')."\" rel=\"self\" type=\"application/rss+xml\" />\n";
if (trim(SITEBUTTON))
{
@@ -645,7 +646,7 @@ class rssCreate
echo "
<uri>http://e107.org/</uri>\n
</author>\n
<link rel='self' href='".SITEURLBASE.e_PLUGIN_ABS.'rss_menu/'.e_PAGE.'?'.e_QUERY."' />\n";
<link rel='self' href='".e107::url('rss_menu','atom', array('rss_url'=>$this->contentType, 'id'=>$this->topicid),'full')."' />\n";
// Optional
include(e_ADMIN."ver.php");