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

SEF Urls can be enabled/disable on a per plugin basis.

This commit is contained in:
Cameron
2016-12-06 06:55:47 -08:00
parent 5273f41ab1
commit 626c1b2a4f
3 changed files with 26 additions and 7 deletions

View File

@@ -211,18 +211,24 @@ class eurl_admin_ui extends e_admin_controller_ui
$frm = e107::getForm();
$tp = e107::getParser();
$cfg = e107::getConfig();
$pref = e107::getPref();
if(!empty($_POST['saveSimpleSef']))
{
if(is_string($this->getConfig()->get('e_url_alias')))
/*if(is_string($this->getConfig()->get('e_url_alias')))
{
$cfg->setPostedData('e_url_alias', array(e_LAN => $_POST['e_url_alias']), false);
}
else
{
$cfg->setPref('e_url_alias/'.e_LAN, $_POST['e_url_alias']);
}*/
foreach($_POST['urlstatus'] as $k=>$v)
{
$val = (!empty($v)) ? $tp->filter($k,'w') : 0;
$cfg->setPref('e_url_list/'.$k, $val);
}
$cfg->save(true, true, true);
@@ -230,10 +236,11 @@ class eurl_admin_ui extends e_admin_controller_ui
}
$pref = e107::getPref('e_url_alias');
$sefActive = e107::getPref('e_url_list');
if(empty($eUrl))
{
return;
return false;
}
$text = "<div class='e-container'>";
@@ -243,9 +250,12 @@ class eurl_admin_ui extends e_admin_controller_ui
$home = "<small>".SITEURL.'</small>';
// e107::getDebug()->log($sefActive);
foreach($eUrl as $plug=>$val)
{
$active = !empty($pref['e_url_list'][$plug]) ? 1 : 0;
$active = !empty($sefActive[$plug]) ? true : false;
$text .= "<table class='table table-striped table-bordered' style='margin-bottom:40px'>
<colgroup>
<col style='min-width:200px' />
@@ -253,7 +263,8 @@ class eurl_admin_ui extends e_admin_controller_ui
<col style='width:45%' />
</colgroup>";
$text .= "<tr class='active'><td ><h4>".$plug."</h4></td><td colspan='2'>".$frm->radio_switch($plug,$plug,$active)."</td></tr>";
$name = 'urlstatus['.$plug.']';
$text .= "<tr class='active'><td ><h4>".$plug."</h4></td><td colspan='2'>".$frm->radio_switch($name,$active)."</td></tr>";
$text .= "<tr><th>Key</th><th>Regular Expression</th>
@@ -283,7 +294,7 @@ class eurl_admin_ui extends e_admin_controller_ui
$text .= "</table>";
}
// $text .= "<div class='buttons-bar center'>".$frm->button('saveSimpleSef',LAN_SAVE." (".e_LANGUAGE.")",'submit')."</div>";
$text .= "<div class='buttons-bar center'>".$frm->button('saveSimpleSef',LAN_SAVE, 'submit')."</div>";
$text .= $frm->close();
$text .= "</div>";
return $text;

View File

@@ -2909,6 +2909,7 @@ class e107
$tp = e107::getParser();
$pref = self::getPref('e_url_alias');
$sefActive = self::getPref('e_url_list');
if(is_string($options)) // backwards compat.
{
@@ -2952,6 +2953,13 @@ class e107
}
}
if(empty($sefActive[$plugin])) // SEF disabled.
{
self::getDebug()->log('SEF URL for <b>'.$plugin.'</b> disabled.');
$active = false;
}
if(deftrue('e_MOD_REWRITE') && ($active == true) && empty($options['legacy'])) // Search-Engine-Friendly URLs active.
{

View File

@@ -98,7 +98,7 @@
{
if(empty($pref['e_url_list'][$plug])) // disabled.
{
e107::getDebug()->log('e_URL for <b>'.$plug.'</b> disabled.');
e107::getDebug()->log('e_URL for <b>'.$plug.'</b> is disabled.');
continue;
}