Skip to content

Commit

Permalink
Restore, just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
bloatware committed May 30, 2020
1 parent c695dc8 commit 4123cc6
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions textpattern/lib/txplib_admin.php
Expand Up @@ -1689,6 +1689,42 @@ function load_lang_dates($lang)
return false;
}

/**
* Gets language strings for the given event.
*
* If no $lang is specified, the strings are loaded from the currently
* active language.
*
* @param string $event The event to get, e.g. "common", "admin", "public"
* @param string $lang The language code
* @return array|string Array of string on success, or an empty string when no strings were found
* @package L10n
* @see load_lang()
* @example
* print_r(
* load_lang_event('common')
* );
*/

function load_lang_event($event, $lang = LANG)
{
$installed = (false !== safe_field("name", 'txp_lang', "lang = '".doSlash($lang)."' LIMIT 1"));

$lang_code = ($installed) ? $lang : TEXTPATTERN_DEFAULT_LANG;

$rs = safe_rows_start("name, data", 'txp_lang', "lang = '".doSlash($lang_code)."' AND event = '".doSlash($event)."'");

$out = array();

if ($rs && !empty($rs)) {
while ($a = nextRow($rs)) {
$out[$a['name']] = $a['data'];
}
}

return ($out) ? $out : '';
}

/**
* Installs localisation strings from a Textpack.
*
Expand Down

0 comments on commit 4123cc6

Please sign in to comment.