. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 54.36.91.62 / Your IP :
216.73.216.168 [
Web Server : Apache System : Linux webm002.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : eticmes ( 123698) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/eticmes/www/wp-content/plugins/meta-box/src/Updater/ |
Upload File : |
<?php
namespace MetaBox\Updater;
/**
* This class handles getting and saving the updater option.
*/
class Option {
/**
* Option name.
*
* @var string
*/
private $option = 'meta_box_updater';
/**
* Get an option.
*
* @param ?string $name Option name. Pass null to return the option array.
* @param mixed $default Default value.
*
* @return mixed Option value or option array.
*/
public function get( $name = null, $default = null ) {
$option = $this->is_network_activated() ? get_site_option( $this->option, [] ) : get_option( $this->option, [] );
return null === $name ? $option : ( $option[ $name ] ?? $default );
}
public function get_api_key() : string {
return defined( 'META_BOX_KEY' ) ? META_BOX_KEY : $this->get( 'api_key', '' );
}
public function get_license_status() : string {
return $this->get_api_key() ? $this->get( 'status', 'active' ) : 'no_key';
}
/**
* Update the option array.
*
* @param array $option Option value.
*/
public function update( $option ) {
$old_option = (array) $this->get();
$option = array_merge( $old_option, $option );
if ( $this->is_network_activated() ) {
update_site_option( $this->option, $option );
} else {
update_option( $this->option, $option );
}
}
public function is_network_activated() : bool {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
return is_multisite() && is_plugin_active_for_network( 'meta-box/meta-box.php' );
}
}