/** * load from language files * * @since 2.2.0 * * @param mixed $json single or multiple language paths */ public static function load($json = null) { /* handle json */ if (!is_array($json)) { $json = array($json); } /* merge language files */ foreach ($json as $file) { if (file_exists($file)) { $contents = file_get_contents($file); $values = json_decode($contents, true); if (is_array($values)) { self::$_values = array_merge(self::$_values, $values); } } } }
/** * load from language files * * @since 2.2.0 * * @param mixed $json single or multiple language paths */ public static function load($json = null) { /* handle json */ if (is_string($json)) { $json = array($json); } /* merge language files */ foreach ($json as $file) { if (file_exists($file)) { $contents = file_get_contents($file); $languageArray = json_decode($contents, true); if (is_array($languageArray)) { self::$_languageArray = array_merge(self::$_languageArray, $languageArray); } } } }
/** * load from language path * * @since 3.0.0 * * @param mixed $path single or multiple language path */ public function load($path = null) { $reader = new Reader(); /* handle json */ if (is_string($path)) { $path = [$path]; } /* load and merge files */ foreach ($path as $file) { if (file_exists($file)) { $languageArray = $reader->loadJSON($file)->getArray(); if (is_array($languageArray)) { self::$_languageArray = array_merge(self::$_languageArray, $languageArray); } } } }