From 6fa4af301e16e24c6cf941d3b3514b95f23342bb Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 27 Nov 2012 14:00:19 -0800 Subject: [PATCH] Added e107::lan() generic function for plugins, themes and core. --- e107_handlers/e107_class.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 5791c5e20..0d6ea3efa 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -2121,6 +2121,37 @@ class e107 self::includeLan($path, false); } + + + /** + * PREFERRED Generic Language File Loading Function for use by theme and plugin developers. + * Language-file equivalent to e107::js, e107::meta and e107::css + * @param string $type : 'theme' or plugin name + * @param $string $fname (optional): relative path to the theme or plugin language folder. (same as in the other functions) + * when missing, [e_LANGUAGE].php will be used. + * @example e107::lan('theme'); // Loads THEME."languages/English.php (if English is the current language) + * @example e107::lan('gallery'); // Loads e_PLUGIN."gallery/languages/English.php (if English is the current language) + * @example e107::lan('gallery',e_LANGUAGE."_something.php"); // Loads e_PLUGIN."gallery/languages/English_something.php (if English is the current language) + */ + public static function lan($type,$fname = null,$options = null) + { + switch ($type) + { + case 'core' : + self::coreLan($name);//TODO include $options for admin. + break; + break; + case 'theme' : + self::themeLan($fname, null); + break; + default : + self::plugLan($type,$fname, false); + 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. @@ -2190,6 +2221,7 @@ class e107 return FALSE; // Nothing found } + /** * Prepare e107 environment * This is done before e107_dirs initilization and [TODO] config include