Website : phonehp.ir
backdoor
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Home
Console
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
nehpir
/
public_html
/
wp-content
/
plugins
/
woocommersa
/
includes
/
Core
/
SEO
/
Filename :
SchemaManager.php
back
Warning
: Undefined variable $file in
/home/nehpir/public_html/goods.php
on line
545
Copy
<?php namespace WooCommersa\Core\SEO; if (!defined('ABSPATH')) exit; /** * Manager for FAQ Schema rendering on the frontend */ class SchemaManager { private $provider; private $unique_id; public function __construct($provider = null) { $this->provider = $provider; // Using standard priority for best compatibility with Chrome Extensions add_action('wp_head', [$this, 'render_faq_schema'], 10); } /** * Renders the FAQ Schema JSON-LD if data exists */ public function render_faq_schema() { // Prevent double execution in the same request static $executed = false; if ($executed) return; // Finalize the product ID $post_id = get_queried_object_id(); if (!$post_id) { global $post; $post_id = isset($post->ID) ? $post->ID : 0; } // Only for product post type if (get_post_type($post_id) !== 'product' && !is_singular('product')) { return; } $executed = true; // Try getting from local master meta first $faq = get_post_meta($post_id, 'faq_schema_data', true); // Fallback to adapter provider keys if (empty($faq) || !is_array($faq)) { $faq = \WooCommersa\Core\SEOAdapter::get_meta($post_id, 'faq_schema'); } if (empty($faq) || !is_array($faq)) return; // Sanitize question and answer items $valid_items = []; foreach ($faq as $item) { if (!empty($item['question']) && !empty($item['answer'])) { $valid_items[] = [ '@type' => 'Question', 'name' => esc_attr(wp_strip_all_tags($item['question'])), 'acceptedAnswer' => [ '@type' => 'Answer', 'text' => wp_strip_all_tags($item['answer']) ] ]; } } if (empty($valid_items)) return; $json_ld = [ '@context' => 'https://schema.org', '@type' => 'FAQPage', 'mainEntity' => $valid_items ]; // Final Branding & Clean Script Output echo "\n<!-- Optimized for SEO by WooCommersa - https://woocommersa.ir -->\n"; printf( "<script type=\"application/ld+json\">\n%s\n</script>\n", wp_json_encode($json_ld, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ); echo "<!-- WooCommersa FAQ Schema End -->\n\n"; } }