Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

+31 -3
View File
@@ -11,15 +11,43 @@
namespace IPS\Lang\Upgrade;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Db;
use UnderflowException;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Setup Language Class
*/
class _Lang extends \IPS\_Lang
class Lang extends \IPS\Lang
{
/**
* Add to output stack
*
* @param string $key Language key
* @param bool|null $vle Add VLE tags?
* @param array $options Options
* @return string Unique id
*/
public function addToStack( string $key, ?bool $vle=TRUE, array $options=array() ): string
{
/* If the key is not in the words list, try to pull it from the DB */
if( !array_key_exists( $key, $this->words ) and !count( $options ) )
{
try
{
$row = Db::i()->select( '*', 'core_sys_lang_words', [ 'word_key=? and word_js=? and lang_id=?', $key, 0, static::defaultLanguage() ] )->first();
$this->words[ $key ] = $row['word_custom'] ?? $row['word_default'];
}
catch( UnderflowException ){}
}
return parent::addToStack( $key, $vle, $options );
}
}