$name = strtolower(self::ori_cls());
return 'litespeed.' . $name . '.' . $id;
* Dropin with prefix for WP's get_option
public static function get_option( $id, $default_v = false ) {
$v = get_option(self::name($id), $default_v);
if (is_array($default_v)) {
$v = self::_maybe_decode($v);
* Dropin with prefix for WP's get_site_option
public static function get_site_option( $id, $default_v = false ) {
$v = get_site_option(self::name($id), $default_v);
if (is_array($default_v)) {
$v = self::_maybe_decode($v);
* Dropin with prefix for WP's add_option
public static function add_option( $id, $v ) {
add_option(self::name($id), self::_maybe_encode($v));
* Dropin with prefix for WP's add_site_option
public static function add_site_option( $id, $v ) {
add_site_option(self::name($id), self::_maybe_encode($v));
* Dropin with prefix for WP's update_option
public static function update_option( $id, $v ) {
update_option(self::name($id), self::_maybe_encode($v));
* Dropin with prefix for WP's update_site_option
public static function update_site_option( $id, $v ) {
update_site_option(self::name($id), self::_maybe_encode($v));
protected static function _maybe_decode( $v ) {
$v2 = \json_decode($v, true);
private static function _maybe_encode( $v ) {
$v = \json_encode($v) ?: $v; // Non utf-8 encoded value will get failed, then used ori value
* Dropin with prefix for WP's delete_option
public static function delete_option( $id ) {
delete_option(self::name($id));
* Dropin with prefix for WP's delete_site_option
public static function delete_site_option( $id ) {
delete_site_option(self::name($id));
public static function get_summary( $field = false ) {
$summary = self::get_option('_summary', array());
if (!is_array($summary)) {
if (array_key_exists($field, $summary)) {
public static function save_summary( $data = false, $reload = false, $overwrite = false ) {
if ($reload || empty(static::cls()->_summary)) {
$existing_summary = static::cls()->_summary;
if ($overwrite || !is_array($existing_summary)) {
$existing_summary = array();
$new_summary = array_merge($existing_summary, $data ?: array());
// self::debug2('Save after Reloaded summary', $new_summary);
static::cls()->_summary = $new_summary;
self::update_option('_summary', $new_summary);
public static function reload_summary() {
static::cls()->_summary = self::get_summary();
// self::debug2( 'Reloaded summary', static::cls()->_summary );
* Get the current instance object. To be inherited.
public static function get_instance() {