| Server IP : 192.241.186.36 / Your IP : 216.73.216.164 Web Server : Apache/2.4.29 (Ubuntu) System : Linux webserver7 4.15.0-194-generic #205-Ubuntu SMP Fri Sep 16 19:49:27 UTC 2022 x86_64 User : root ( 0) PHP Version : 7.4.32 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/adsonicdigital/wp-content/plugins/seo-by-rank-math/includes/helpers/ |
Upload File : |
<?php
/**
* The Options helpers.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Helpers
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Helpers;
defined( 'ABSPATH' ) || exit;
/**
* Options class.
*/
trait Options {
/**
* Option handler.
*
* @codeCoverageIgnore
*
* @param string $key Option to perform action.
* @param mixed $value Pass null to get option,
* Pass false to delete option,
* Pass value to update option.
* @return mixed
*/
public static function option( $key, $value = null ) {
$key = 'rank_math_' . $key;
if ( false === $value ) {
return delete_option( $key );
}
if ( is_null( $value ) ) {
return get_option( $key, [] );
}
return update_option( $key, $value );
}
/**
* Normalize option value.
*
* @param mixed $value Value to normalize.
* @return mixed
*/
public static function normalize_data( $value ) {
if ( 'true' === $value || 'on' === $value ) {
$value = true;
} elseif ( 'false' === $value || 'off' === $value ) {
$value = false;
} elseif ( '0' === $value || '1' === $value ) {
$value = intval( $value );
}
return $value;
}
/**
* Update settings.
*
* @codeCoverageIgnore
*
* @param array|null $general Array to update settings.
* @param array|null $titles Array to update settings.
* @param array|null $sitemap Array to update settings.
*/
public static function update_all_settings( $general, $titles, $sitemap ) {
if ( ! is_null( $general ) ) {
update_option( 'rank-math-options-general', $general );
}
if ( ! is_null( $titles ) ) {
update_option( 'rank-math-options-titles', $titles );
}
if ( ! is_null( $sitemap ) ) {
update_option( 'rank-math-options-sitemap', $sitemap );
}
}
}