PHP 8.3 Compatibility Code Changes
-
To make SimTerm plugin compatible with PHP 8.3+, apply the following code changes:
simterm.php
public static function Init()
{
/* Include main class */
$path = plugin_dir_path(__FILE__);
require_once($path.'simterm-core.php');
self::$st = new SimTerm;
// ... rest of code
}
public static function basic_init()
{
/* Nothing right here yet */
}
public static function settingsInit()
{
$sett = self::$st->settings();
$sett->register();
}
public static function load_textdomain()
{
load_plugin_textdomain( 'simterm', FALSE, dirname( plugin_basename( __FILE__ ) ).'/languages/' );
}simterm-settings.php
public function __wakeup()
{
}simterm-line.php
if ( (!empty($this->commandPrep)) && (!empty($this->line)) && (strchr($this->commandPrep, $this->line[0]) !== false) )
$this->linedata['type'] = 'command';
elseif ( (!empty($this->typePrep)) && (!empty($this->line)) && (strchr($this->typePrep, $this->line[0]) !== false) )
$this->linedata['type'] = 'type';
else
$this->linedata['type'] = 'line';mutils.php
function bool_from_str($str)
{
if (!is_string($str) && !is_numeric($str)) {
return false;
}
$str = strtolower((string)$str);
return ( ($str=='y') || ($str=='yes') || ($str=='true') || ($str=='enabled') || ((float)$str > 0) );
}simterm-core.php
public function enqueue_scripts()
{
// Scripts are enqueued in simterm_shortcode method
}
The topic ‘PHP 8.3 Compatibility Code Changes’ is closed to new replies.