| Server IP : 80.74.154.100 / Your IP : 216.73.217.0 Web Server : Apache System : Linux marissa.metanet.ch 4.18.0-553.141.2.lve.el7h.x86_64 #1 SMP Wed Jul 8 17:20:31 UTC 2026 x86_64 User : onlineadmin ( 10487) PHP Version : 8.5.7 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/httpd/vhosts/comeonline.ch/httpdocs/wp-content/plugins/wpsso/lib/json/type/ |
Upload File : |
<?php
/*
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl.txt
* Copyright 2016-2026 Jean-Sebastien Morisset (https://wpsso.com/)
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'These aren\'t the droids you\'re looking for.' );
}
if ( ! class_exists( 'WpssoJsonTypeFAQPage' ) ) {
class WpssoJsonTypeFAQPage {
private $p; // Wpsso class object.
/*
* Instantiated by Wpsso->init_json_filters().
*/
public function __construct( &$plugin ) {
$this->p =& $plugin;
if ( $this->p->debug->enabled ) {
$this->p->debug->mark();
}
$this->p->util->add_plugin_filters( $this, array(
'json_data_https_schema_org_faqpage' => 5,
'json_data_validate_https_schema_org_faqpage' => 5,
) );
}
/*
* See https://developers.google.com/search/docs/appearance/structured-data/faqpage.
*/
public function filter_json_data_https_schema_org_faqpage( $json_data, $mod, $mt_og, $page_type_id, $is_main ) {
if ( $this->p->debug->enabled ) {
$this->p->debug->mark();
}
unset( $json_data[ 'mainEntityOfPage' ] );
$prop_type_ids = array( 'mainEntity' => 'question' );
WpssoSchema::add_posts_data( $json_data, $mod, $mt_og, $page_type_id, $is_main, $prop_type_ids );
return $json_data;
}
public function filter_json_data_validate_https_schema_org_faqpage( $json_data, $mod, $mt_og, $page_type_id, $is_main ) {
$is_admin = is_admin();
$user_id = get_current_user_id();
if ( $is_admin && $user_id ) {
$entity_count = 0;
if ( isset( $json_data[ 'mainEntity' ] ) ) {
if ( SucomUtil::is_non_assoc( $json_data[ 'mainEntity' ] ) ) {
$entity_count = count( $json_data[ 'mainEntity' ] );
}
}
$notice_key = $mod[ 'name' ] . '-' . $mod[ 'id' ] . '-questions-added-to-faqpage';
if ( $entity_count ) {
$notice_msg = sprintf( _n( '%d question added to the Schema FAQPage markup.',
'%d questions added to the Schema FAQPage markup.', $entity_count, 'wpsso' ), $entity_count );
$this->p->notice->inf( $notice_msg, $user_id, $notice_key );
} else {
$notice_msg = __( 'No question(s) found for the Schema FAQPage markup.', 'wpsso' ) . ' ';
$notice_msg .= __( 'Google requires at least one question for the Schema FAQPage markup.', 'wpsso' );
$this->p->notice->err( $notice_msg, $user_id, $notice_key );
}
}
return $json_data;
}
}
}