$default_value Returned when the option is absent or not an array. * * @return array Stored value. */ public static function get_array( string $key, array $default_value = array() ): array { $value = self::get( $key ); return is_array( $value ) ? $value : $default_value; } /** * Writing an option under the Kordiam prefix. * * Pass $autoload false for anything bulky (e.g. API lists) or secret. * * @param string $key Unprefixed option key. * @param mixed $value Value to store. * @param bool|null $autoload Whether to load the value on every request; null for core's default. * * @return bool Whether the value changed. */ public static function set( string $key, $value, ?bool $autoload = null ): bool { self::mark_cleared( $key, false ); return update_option( self::name( $key ), $value, $autoload ); } /** * Deleting an option. * * Only the Kordiam name is removed; the Desk-Net original is left alone. * * @param string $key Unprefixed option key. * * @return bool Whether the option existed and was removed. */ public static function delete( string $key ): bool { $deleted = delete_option( self::name( $key ) ); self::mark_cleared( $key, true ); return $deleted; } /** * Checking whether a Kordiam value is stored, ignoring any legacy fallback. * * @param string $key Unprefixed option key. * * @return bool Whether the Kordiam option exists. */ public static function exists( string $key ): bool { return self::MISSING !== get_option( self::name( $key ), self::MISSING ); } /** * Checking an option against the "do not import" marker. * * Accepts the label form too, which legacy sites may have stored. * * @param string $key Unprefixed option key. * * @return bool Whether the mapping says to skip the item. */ public static function is_do_not_import( string $key ): bool { $value = strtolower( self::get_string( $key ) ); return Config::DO_NOT_IMPORT === $value || 'do not import' === $value; } /** * Checking an option against the "no sync" marker. * * @param string $key Unprefixed option key. * * @return bool Whether the mapping says to leave the field untouched. */ public static function is_no_sync( string $key ): bool { $value = strtolower( self::get_string( $key ) ); return Config::NO_SYNC === $value || 'no sync' === $value; } }