| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/./././././mahyarcake/./www/wp-content/plugins/wordpress-seo/src/helpers/ |
Upload File : |
<?php
namespace Yoast\WP\SEO\Helpers;
use WPSEO_Option_Social;
use WPSEO_Option_Titles;
use WPSEO_Options;
/**
* A helper object for options.
*/
class Options_Helper {
/**
* Retrieves a single field from any option for the SEO plugin. Keys are always unique.
*
* @codeCoverageIgnore We have to write test when this method contains own code.
*
* @param string $key The key it should return.
* @param mixed $default_value The default value that should be returned if the key isn't set.
*
* @return mixed|null Returns value if found, $default_value if not.
*/
public function get( $key, $default_value = null ) {
return WPSEO_Options::get( $key, $default_value );
}
/**
* Sets a single field to the options.
*
* @param string $key The key to set.
* @param mixed $value The value to set.
*
* @return mixed|null Returns value if found.
*/
public function set( $key, $value ) {
return WPSEO_Options::set( $key, $value );
}
/**
* Get a specific default value for an option.
*
* @param string $option_name The option for which you want to retrieve a default.
* @param string $key The key within the option who's default you want.
*
* @return mixed The default value.
*/
public function get_default( $option_name, $key ) {
return WPSEO_Options::get_default( $option_name, $key );
}
/**
* Retrieves the title separator.
*
* @return string The title separator.
*/
public function get_title_separator() {
$default = $this->get_default( 'wpseo_titles', 'separator' );
// Get the titles option and the separator options.
$separator = $this->get( 'separator' );
$seperator_options = $this->get_separator_options();
// This should always be set, but just to be sure.
if ( isset( $seperator_options[ $separator ] ) ) {
// Set the new replacement.
$replacement = $seperator_options[ $separator ];
}
elseif ( isset( $seperator_options[ $default ] ) ) {
$replacement = $seperator_options[ $default ];
}
else {
$replacement = \reset( $seperator_options );
}
/**
* Filter: 'wpseo_replacements_filter_sep' - Allow customization of the separator character(s).
*
* @param string $replacement The current separator.
*/
return \apply_filters( 'wpseo_replacements_filter_sep', $replacement );
}
/**
* Retrieves a default value from the option titles.
*
* @param string $option_titles_key The key of the option title you wish to get.
*
* @return string The option title.
*/
public function get_title_default( $option_titles_key ) {
$default_titles = $this->get_title_defaults();
if ( ! empty( $default_titles[ $option_titles_key ] ) ) {
return $default_titles[ $option_titles_key ];
}
return '';
}
/**
* Retrieves the default option titles.
*
* @codeCoverageIgnore We have to write test when this method contains own code.
*
* @return array The title defaults.
*/
protected function get_title_defaults() {
return WPSEO_Option_Titles::get_instance()->get_defaults();
}
/**
* Get the available separator options.
*
* @return array
*/
protected function get_separator_options() {
return WPSEO_Option_Titles::get_instance()->get_separator_options();
}
/**
* Checks whether a social URL is valid, with empty strings being valid social URLs.
*
* @param string $url The url to be checked.
*
* @return bool Whether the URL is valid.
*/
public function is_social_url_valid( $url ) {
return $url === '' || WPSEO_Option_Social::get_instance()->validate_social_url( $url );
}
/**
* Checks whether a twitter id is valid, with empty strings being valid twitter id.
*
* @param string $twitter_id The twitter id to be checked.
*
* @return bool Whether the twitter id is valid.
*/
public function is_twitter_id_valid( $twitter_id ) {
return empty( $twitter_id ) || WPSEO_Option_Social::get_instance()->validate_twitter_id( $twitter_id, false );
}
}