| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/wordpress-seo/src/editors/framework/seo/posts/ |
Upload File : |
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
// phpcs:disable Yoast.NamingConventions.NamespaceName.MaxExceeded
namespace Yoast\WP\SEO\Editors\Framework\Seo\Posts;
use Yoast\WP\SEO\Editors\Domain\Seo\Description;
use Yoast\WP\SEO\Editors\Domain\Seo\Seo_Plugin_Data_Interface;
use Yoast\WP\SEO\Editors\Framework\Seo\Description_Data_Provider_Interface;
use Yoast\WP\SEO\Helpers\Date_Helper;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Describes if the description SEO data.
*/
class Description_Data_Provider extends Abstract_Post_Seo_Data_Provider implements Description_Data_Provider_Interface {
/**
* The date helper.
*
* @var Date_Helper
*/
private $date_helper;
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The constructor.
*
* @param Date_Helper $date_helper The date helper.
* @param Options_Helper $options_helper The options helper.
*/
public function __construct( Date_Helper $date_helper, Options_Helper $options_helper ) {
$this->date_helper = $date_helper;
$this->options_helper = $options_helper;
}
/**
* Retrieves the description template.
*
* @return string The description template.
*/
public function get_description_template(): string {
return $this->get_template( 'metadesc' );
}
/**
* Determines the date to be displayed in the snippet preview.
*
* @return string
*/
public function get_description_date(): string {
return $this->date_helper->format_translated( $this->post->post_date, 'M j, Y' );
}
/**
* Retrieves a template.
*
* @param string $template_option_name The name of the option in which the template you want to get is saved.
*
* @return string
*/
private function get_template( string $template_option_name ): string {
$needed_option = $template_option_name . '-' . $this->post->post_type;
if ( $this->options_helper->get( $needed_option, '' ) !== '' ) {
return $this->options_helper->get( $needed_option );
}
return '';
}
/**
* Method to return the Description domain object with SEO data.
*
* @return Seo_Plugin_Data_Interface The specific seo data.
*/
public function get_data(): Seo_Plugin_Data_Interface {
return new Description( $this->get_description_date(), $this->get_description_template() );
}
}