- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 170.150.155.74  /  Your IP : 3.145.99.84
Web Server : Apache/2.4.53 (Debian)
System : Linux b22bf132354b 5.4.0-162-generic #179-Ubuntu SMP Mon Aug 14 08:51:31 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.4.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/google-site-kit/includes/Core/Modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/google-site-kit/includes/Core/Modules/Module_Settings.php
<?php
/**
 * Class Google\Site_Kit\Core\Modules\Module_Settings
 *
 * @package   Google\Site_Kit\Core\Modules
 * @copyright 2021 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

namespace Google\Site_Kit\Core\Modules;

use Google\Site_Kit\Core\Storage\Setting;

/**
 * Base class for module settings.
 *
 * @since 1.2.0
 * @access private
 * @ignore
 */
abstract class Module_Settings extends Setting {

	/**
	 * Registers the setting in WordPress.
	 *
	 * @since 1.2.0
	 */
	public function register() {
		parent::register();
		$this->add_option_default_filters();
	}

	/**
	 * Merges an array of settings to update.
	 *
	 * Only existing keys will be updated.
	 *
	 * @since 1.3.0
	 *
	 * @param array $partial Partial settings array to save.
	 *
	 * @return bool True on success, false on failure.
	 */
	public function merge( array $partial ) {
		$settings = $this->get();
		$partial  = array_filter(
			$partial,
			function ( $value ) {
				return null !== $value;
			}
		);
		$updated  = array_intersect_key( $partial, $settings );

		return $this->set( array_merge( $settings, $updated ) );
	}

	/**
	 * Registers a filter to ensure default values are present in the saved option.
	 *
	 * @since 1.2.0
	 */
	protected function add_option_default_filters() {
		add_filter(
			'option_' . static::OPTION,
			function ( $option ) {
				if ( ! is_array( $option ) ) {
					return $this->get_default();
				}
				return $option;
			},
			0
		);

		// Fill in any missing keys with defaults.
		// Must run later to not conflict with legacy key migration.
		add_filter(
			'option_' . static::OPTION,
			function ( $option ) {
				if ( is_array( $option ) ) {
					return $option + $this->get_default();
				}
				return $option;
			},
			99
		);
	}

	/**
	 * Gets the expected value type.
	 *
	 * @since 1.2.0
	 *
	 * @return string The type name.
	 */
	protected function get_type() {
		return 'object';
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit