mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 22:57:14 +02:00
Issue #2486 - e_url now supports multiple profiles.
This commit is contained in:
@@ -440,6 +440,13 @@ class eurl_admin_ui extends e_admin_controller_ui
|
||||
|
||||
$aliases = eRouter::adminSyncAliases(e107::getPref('url_aliases'), $config);
|
||||
|
||||
if(!empty($_POST['eurl_profile']))
|
||||
{
|
||||
e107::getConfig()->set('url_profiles', $_POST['eurl_profile']);
|
||||
unset($locations['download']);
|
||||
unset($config['download']);
|
||||
}
|
||||
|
||||
e107::getConfig()
|
||||
->set('url_aliases', $aliases)
|
||||
->set('url_config', $config)
|
||||
@@ -447,6 +454,9 @@ class eurl_admin_ui extends e_admin_controller_ui
|
||||
->set('url_locations', $locations)
|
||||
->save();
|
||||
|
||||
|
||||
|
||||
|
||||
eRouter::clearCache();
|
||||
}
|
||||
}
|
||||
@@ -487,6 +497,10 @@ class eurl_admin_ui extends e_admin_controller_ui
|
||||
<tbody>
|
||||
";
|
||||
|
||||
|
||||
$text .= $this->renderProfiles();
|
||||
|
||||
|
||||
$text .= $this->renderConfig($set['url_config'], $set['url_locations']);
|
||||
|
||||
$text .= "
|
||||
@@ -502,6 +516,44 @@ class eurl_admin_ui extends e_admin_controller_ui
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* New in v2.1.6
|
||||
*/
|
||||
private function renderProfiles()
|
||||
{
|
||||
|
||||
$PLUGINS_DIRECTORY = e107::getFolder("PLUGINS");
|
||||
$srch = array("{SITEURL}","{e_PLUGIN_ABS}");
|
||||
$repl = array(SITEURL,SITEURL.$PLUGINS_DIRECTORY);
|
||||
|
||||
$profiles = e107::getUrlConfig('profiles');
|
||||
|
||||
$form = $this->getUI();
|
||||
|
||||
$text = '';
|
||||
|
||||
$active = e107::getPref('url_profiles');
|
||||
|
||||
foreach($profiles as $plug=>$prof)
|
||||
{
|
||||
$arr = array();
|
||||
foreach($prof as $id=>$val)
|
||||
{
|
||||
$arr[$id] = $val['label'].": ". str_replace($srch,$repl,$val['examples'][0]);
|
||||
}
|
||||
|
||||
$sel = $active[$plug];
|
||||
|
||||
$selector = $form->select('eurl_profile['.$plug.']',$arr,$sel, array('size'=>'block-level'));
|
||||
|
||||
$text .= "<tr><td>".$plug."</td><td>".$selector."</td></tr>";
|
||||
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
public function renderConfig($current, $locations)
|
||||
{
|
||||
|
||||
@@ -637,13 +689,15 @@ class eurl_admin_form_ui extends e_admin_form_ui
|
||||
|
||||
$id = 'eurl_'.$this->name2id($title);
|
||||
|
||||
$text .= "<a data-toggle='modal' href='#".$id."' data-cache='false' data-target='#".$id."' class='e-tip' title='".LAN_MOREINFO."'>";
|
||||
$text = "<a data-toggle='modal' href='#".$id."' data-cache='false' data-target='#".$id."' class='e-tip' title='".LAN_MOREINFO."'>";
|
||||
$text .= $title;
|
||||
$text .= '</a>';
|
||||
|
||||
$text .= '
|
||||
|
||||
<div id="'.$id.'" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div id="'.$id.'" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4>'.$tp->toHtml($title,false,'TITLE').'</h4>
|
||||
@@ -659,7 +713,8 @@ class eurl_admin_form_ui extends e_admin_form_ui
|
||||
<div class="modal-footer">
|
||||
<a href="#" data-dismiss="modal" class="btn btn-primary">'.LAN_CLOSE.'</a>
|
||||
</div>
|
||||
</div>';
|
||||
</div>
|
||||
</div></div>';
|
||||
|
||||
return $text;
|
||||
|
||||
@@ -688,6 +743,8 @@ class eurl_admin_form_ui extends e_admin_form_ui
|
||||
$srch = array("{SITEURL}","{e_PLUGIN_ABS}");
|
||||
$repl = array(SITEURL,SITEURL.$PLUGINS_DIRECTORY);
|
||||
|
||||
|
||||
|
||||
foreach ($data as $obj)
|
||||
{
|
||||
$admin = $obj->config->admin();
|
||||
@@ -708,6 +765,9 @@ class eurl_admin_form_ui extends e_admin_form_ui
|
||||
$opt = "";
|
||||
$info = "<table class='table table-striped'>";
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($obj->locations as $index => $location)
|
||||
{
|
||||
$objSub = $obj->defaultLocation != $location ? eDispatcher::getConfigObject($obj->module, $location) : false;
|
||||
@@ -774,6 +834,8 @@ class eurl_admin_form_ui extends e_admin_form_ui
|
||||
|
||||
$title = vartrue($section['name'], eHelper::labelize($obj->module));
|
||||
|
||||
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".$this->moreInfo($title, $info)."</td>
|
||||
|
@@ -329,6 +329,8 @@ City, State, Country
|
||||
'search' => 'core',
|
||||
'system' => 'core',
|
||||
'user' => 'core',
|
||||
)]]></core>
|
||||
<core name="url_profiles"><![CDATA[array (
|
||||
)]]></core>
|
||||
<core name="url_disable_pathinfo">1</core>
|
||||
<core name="url_error_redirect">0</core>
|
||||
|
@@ -2418,6 +2418,7 @@ class e107
|
||||
|
||||
/**
|
||||
* Retrieves the e_url config - new v2.1.6
|
||||
* @param string $mode config | alias | profile
|
||||
* @return array
|
||||
*/
|
||||
public static function getUrlConfig($mode='config')
|
||||
@@ -2429,7 +2430,7 @@ class e107
|
||||
$className = substr($filename, 2); // remove 'e_'
|
||||
$methodName = 'config';
|
||||
|
||||
$profile = null; // for future use.
|
||||
$url_profiles = e107::getPref('url_profiles');
|
||||
|
||||
if(!empty($elist))
|
||||
{
|
||||
@@ -2437,6 +2438,8 @@ class e107
|
||||
{
|
||||
if(is_readable(e_PLUGIN.$key.'/'.$filename.'.php'))
|
||||
{
|
||||
|
||||
|
||||
include_once(e_PLUGIN.$key.'/'.$filename.'.php');
|
||||
|
||||
$class_name = $key.'_'.$className;
|
||||
@@ -2461,6 +2464,18 @@ class e107
|
||||
continue;
|
||||
}
|
||||
|
||||
if($mode === 'profiles')
|
||||
{
|
||||
if(!empty($obj->profiles))
|
||||
{
|
||||
$new_addon[$key] = $obj->profiles;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$profile = !empty($url_profiles[$key]) ? $url_profiles[$key] : null;
|
||||
|
||||
$array = self::callMethod($obj, $methodName,$profile);
|
||||
|
||||
if($array)
|
||||
|
Reference in New Issue
Block a user