1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +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,11 +816,17 @@ class e107
* List of allowed $name values (aliases) could be found * List of allowed $name values (aliases) could be found
* in {@link e_core_pref} class * 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 * @return e_core_pref
*/ */
public static function getConfig($name = 'core', $load = true) 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])) if(!isset(self::$_core_config_arr[$name]))
{ {
e107_require_once(e_HANDLER.'pref_class.php'); e107_require_once(e_HANDLER.'pref_class.php');
@@ -2163,8 +2169,8 @@ class e107
{ {
case 'core' : case 'core' :
self::coreLan($fname,$options); self::coreLan($fname,$options);
break; break;
break;
case 'theme' : case 'theme' :
self::themeLan($fname, null); self::themeLan($fname, null);
break; 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 * 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. * theme - primarily for core routines, which won't know for sure where the author has put them.