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

Added e107::pref() - Generic Pref-array retrieval for core, themes and plugins.

ie. $pref = e107::pref(); or $plugPref = e107::pref('gallery'); or $themePref = e107::pref('theme'); // currently installed theme.
This commit is contained in:
Cameron
2012-12-06 16:36:22 -08:00
parent 1972441858
commit b42d87e6bf
2 changed files with 38 additions and 5 deletions

View File

@@ -816,15 +816,21 @@ class e107
* List of allowed $name values (aliases) could be found
* in {@link e_core_pref} class
*
* @param string $name core|core_backup|emote|menu|search|notify|ipool
* @param string $name core|core_backup|emote|menu|search|notify
* @return e_core_pref
*/
public static function getConfig($name = 'core', $load = true)
{
if(isset(self::$_plug_config_arr[$name])) //FIXME Load pluginPref Object instead - Not quite working with calendar_menu.
{
return self::getPlugConfig($name);
}
if(!isset(self::$_core_config_arr[$name]))
{
e107_require_once(e_HANDLER.'pref_class.php');
self::$_core_config_arr[$name] = new e_core_pref($name, $load);
e107_require_once(e_HANDLER.'pref_class.php');
self::$_core_config_arr[$name] = new e_core_pref($name, $load);
}
return self::$_core_config_arr[$name];
@@ -2163,8 +2169,8 @@ class e107
{
case 'core' :
self::coreLan($fname,$options);
break;
break;
break;
case 'theme' :
self::themeLan($fname, null);
break;
@@ -2176,6 +2182,33 @@ class e107
}
/**
* Generic PREF retrieval Method for use by theme and plugin developers.
*/
public static function pref($type='core', $pname='')
{
switch ($type)
{
case 'core' :
return self::getPref();
break;
case 'theme' :
return self::getThemePref();
break;
default :
return self::getPlugConfig($type)->getPref();
break;
}
}
/**
* Routine looks in standard paths for language files associated with a plugin or
* theme - primarily for core routines, which won't know for sure where the author has put them.