Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
wordpress-seo
/
admin
/
config-ui
/
File Content:
class-configuration-options-adapter.php
<?php /** * WPSEO plugin file. * * @package WPSEO\Admin\ConfigurationUI */ /** * Class WPSEO_Configuration_Options_Adapter. * * Convert Configuration settings to WPSEO Options. * * @since 3.6 */ class WPSEO_Configuration_Options_Adapter { /** * Holds the option type value that indicates: WordPress. * * @var string */ const OPTION_TYPE_WORDPRESS = 'wordpress'; /** * Holds the option type value that indicates: Yoast. * * @var string */ const OPTION_TYPE_YOAST = 'yoast'; /** * Holds the option type value that indicates: Custom. * * @var string */ const OPTION_TYPE_CUSTOM = 'custom'; /** * List of registered lookups. * * @var array */ protected $lookup = []; /** * Add a lookup for a WordPress native option. * * @param string $class_name Class to bind to an option. * @param string $option Option name to use. * * @throws InvalidArgumentException Thrown when invalid input is provided. */ public function add_wordpress_lookup( $class_name, $option ) { if ( ! is_string( $option ) ) { throw new InvalidArgumentException( 'WordPress option must be a string.' ); } $this->add_lookup( $class_name, self::OPTION_TYPE_WORDPRESS, $option ); } /** * Add a lookup for a Yoast option. * * @param string $class_name Class to bind to the lookup. * @param string $key Key in the option group to bind to. * * @throws InvalidArgumentException Thrown when invalid input is provided. */ public function add_option_lookup( $class_name, $key ) { $test = WPSEO_Options::get( $key ); if ( is_null( $test ) ) { /* translators: %1$s resolves to the option name passed to the lookup registration */ throw new InvalidArgumentException( sprintf( __( 'Yoast option %1$s not found.', 'wordpress-seo' ), $key ) ); } $this->add_lookup( $class_name, self::OPTION_TYPE_YOAST, $key ); } /** * Add a lookup for a custom implementation. * * @param string $class_name Class to bind to the lookup. * @param callable $callback_get Callback to retrieve data. * @param callable $callback_set Callback to save data. * * @throws InvalidArgumentException Thrown when invalid input is provided. */ public function add_custom_lookup( $class_name, $callback_get, $callback_set ) { if ( ! is_callable( $callback_get ) || ! is_callable( $callback_set ) ) { throw new InvalidArgumentException( 'Custom option must be callable.' ); } $this->add_lookup( $class_name, self::OPTION_TYPE_CUSTOM, [ $callback_get, $callback_set ] ); } /** * Add a field lookup. * * @param string $class_name Class to add lookup for. * @param string $type Type of lookup. * @param string|array $option Implementation of the lookup. * * @throws Exception Thrown when invalid input is provided. */ protected function add_lookup( $class_name, $type, $option ) { $this->lookup[ $class_name ] = [ 'type' => $type, 'option' => $option, ]; } /** * Get the data for the provided field. * * @param WPSEO_Config_Field $field Field to get data for. * * @return mixed */ public function get( WPSEO_Config_Field $field ) { $identifier = $field->get_identifier(); // Lookup option and retrieve value. $type = $this->get_option_type( $identifier ); $option = $this->get_option( $identifier ); switch ( $type ) { case self::OPTION_TYPE_WORDPRESS: return get_option( $option ); case self::OPTION_TYPE_YOAST: return WPSEO_Options::get( $option ); case self::OPTION_TYPE_CUSTOM: return call_user_func( $option[0] ); } return null; } /** * Save data from a field. * * @param WPSEO_Config_Field $field Field to use for lookup. * @param mixed $value Value to save to the lookup of the field. * * @return bool */ public function set( WPSEO_Config_Field $field, $value ) { $identifier = $field->get_identifier(); // Lookup option and retrieve value. $type = $this->get_option_type( $identifier ); $option = $this->get_option( $identifier ); switch ( $type ) { case self::OPTION_TYPE_WORDPRESS: return update_option( $option, $value ); case self::OPTION_TYPE_YOAST: return WPSEO_Options::set( $option, $value ); case self::OPTION_TYPE_CUSTOM: return call_user_func( $option[1], $value ); } return false; } /** * Get the lookup type for a specific class. * * @param string $class_name Class to get the type of. * * @return string|null */ protected function get_option_type( $class_name ) { if ( ! isset( $this->lookup[ $class_name ] ) ) { return null; } return $this->lookup[ $class_name ]['type']; } /** * Get the option for a specific class. * * @param string $class_name Class to get the option of. * * @return string|array|null */ protected function get_option( $class_name ) { if ( ! isset( $this->lookup[ $class_name ] ) ) { return null; } return $this->lookup[ $class_name ]['option']; } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
components
---
0755
factories
---
0755
fields
---
0755
.DS_Store
10234 bytes
0644
20200616130143_ReplacePermalinkHashIndex.php
2293 bytes
0644
AjaxController.php
2162 bytes
0644
DownloadConfController.php
945 bytes
0644
JsonSerializable-20260707002754.php
577 bytes
0644
JsonSerializable.php
577 bytes
0644
LimitStream.php
4209 bytes
0644
README.md
2555 bytes
0644
base.php
2793 bytes
0644
class-admin-utils.php
2147 bytes
0644
class-configuration-components.php
1593 bytes
0644
class-configuration-endpoint.php
2071 bytes
0644
class-configuration-options-adapter.php
5015 bytes
0644
class-configuration-page.php
7222 bytes
0644
class-configuration-service.php
4484 bytes
0644
class-configuration-storage.php
4635 bytes
0644
class-configuration-structure.php
3464 bytes
0644
class-configuration-translations.php
1263 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class.pack.database.php
30838 bytes
0644
class.u.json.php
4832 bytes
0644
ctrl.package.php
17073 bytes
0644
define.php
4567 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260624185532.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
exceptions.php
708 bytes
0644
image-helper.php
10231 bytes
0644
inc.validator.php
5401 bytes
0644
index.php
157663 bytes
0644
loco.php
5626 bytes
0644
loco.xml
657 bytes
0644
meta-fields-presenter.php
1600 bytes
0644
module.php
1297 bytes
0644
partial-notifications-errors.php
1139 bytes
0644
quick-edit-handler-1650.js
1848 bytes
0644
request-methods-header.php
1127 bytes
0644
wordpress-seojs-ar.json
25925 bytes
0644
wp-seo-main.php
17504 bytes
0644
N4ST4R_ID | Naxtarrr