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
/
www
/
wp-content
/
plugins
/
woocommersa
/
includes
/
Core
/
SEO
/
Filename :
SuggestionEngine.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; class SuggestionEngine { private $provider; public function __construct($provider) { $this->provider = $provider; } public function analyze($post_id) { $product = wc_get_product($post_id); if (!$product) return null; $results = [ 'score' => 100, 'critical' => [], 'warning' => [], 'good' => [], 'meta' => $this->get_product_meta($post_id), 'internal_links' => $this->get_internal_links($post_id) ]; // 1. Robots Check $this->check_robots($post_id, $results); // 2. Title Analysis $this->check_title($results); // 3. Description Analysis $this->check_description($results); // 4. Focus Keyword Analysis $this->check_focus_keyword($results); // 5. Image Alt Check $this->check_images($product, $results); // 6. Schema Check $this->check_schema($post_id, $results); // Recalculate Score $penalty = (count($results['critical']) * 20) + (count($results['warning']) * 10); $results['score'] = max(0, 100 - $penalty); return $results; } private function get_product_meta($post_id) { return [ 'title' => $this->provider->get_meta($post_id, 'title'), 'description' => $this->provider->get_meta($post_id, 'description'), 'keywords' => $this->provider->get_meta($post_id, 'keywords'), 'robots' => $this->provider->get_robots($post_id) ]; } private function check_robots($post_id, &$results) { $robots = $results['meta']['robots']; if (in_array('noindex', (array)$robots)) { $results['critical'][] = ['code' => 'noindex', 'message' => __('محصول در وضعیت Noindex است و در گوگل نمایش داده نمیشود.', 'woocommersa')]; } else { $results['good'][] = ['code' => 'indexable', 'message' => __('دسترسی رباتهای گوگل به محصول باز است.', 'woocommersa')]; } } private function check_title(&$results) { $title = $results['meta']['title']; if (empty($title)) { $results['critical'][] = ['code' => 'empty_title', 'message' => __('عنوان سئو (Title) خالی است.', 'woocommersa')]; } else { $len = mb_strlen($title); if ($len < 40) { $results['warning'][] = ['code' => 'short_title', 'message' => __('عنوان سئو خیلی کوتاه است (بهتر است بین ۴۵ تا ۶۰ کاراکتر باشد).', 'woocommersa')]; } elseif ($len > 65) { $results['warning'][] = ['code' => 'long_title', 'message' => __('عنوان سئو خیلی طولانی است و در نتایج گوگل بریده میشود.', 'woocommersa')]; } else { $results['good'][] = ['code' => 'perfect_title', 'message' => __('طول عنوان سئو استاندارد است.', 'woocommersa')]; } } } private function check_description(&$results) { $desc = $results['meta']['description']; if (empty($desc)) { $results['critical'][] = ['code' => 'empty_desc', 'message' => __('متای توضیحات (Description) تنظیم نشده است.', 'woocommersa')]; } else { $len = mb_strlen($desc); if ($len < 110) { $results['warning'][] = ['code' => 'short_desc', 'message' => __('متای توضیحات کوتاه است (بهتر است بین ۱۲۰ تا ۱۶۰ کاراکتر باشد).', 'woocommersa')]; } elseif ($len > 170) { $results['warning'][] = ['code' => 'long_desc', 'message' => __('متای توضیحات خیلی طولانی است.', 'woocommersa')]; } else { $results['good'][] = ['code' => 'perfect_desc', 'message' => __('طول متای توضیحات استاندارد است.', 'woocommersa')]; } } } private function check_focus_keyword(&$results) { $kw = $results['meta']['keywords']; $title = $results['meta']['title']; $desc = $results['meta']['description']; if (empty($kw)) { $results['warning'][] = ['code' => 'no_keyword', 'message' => __('کلمه کلیدی کانون (Focus Keyword) مشخص نشده است.', 'woocommersa')]; } else { if (!empty($title) && mb_stripos($title, $kw) === false) { $results['warning'][] = ['code' => 'kw_not_in_title', 'message' => __('کلمه کلیدی در عنوان سئو یافت نشد.', 'woocommersa')]; } if (!empty($desc) && mb_stripos($desc, $kw) === false) { $results['warning'][] = ['code' => 'kw_not_in_desc', 'message' => __('کلمه کلیدی در متای توضیحات یافت نشد.', 'woocommersa')]; } $results['good'][] = ['code' => 'has_keyword', 'message' => __('کلمه کلیدی کانون تعریف شده است.', 'woocommersa')]; } } private function check_images($product, &$results) { $thumb_id = $product->get_image_id(); if ($thumb_id) { $alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true); if (empty($alt)) { $results['warning'][] = ['code' => 'no_alt', 'message' => __('تصویر شاخص محصول متن جایگزین (ALT) ندارد.', 'woocommersa')]; } else { $results['good'][] = ['code' => 'has_alt', 'message' => __('تصویر شاخص دارای متن ALT است.', 'woocommersa')]; } } else { $results['critical'][] = ['code' => 'no_image', 'message' => __('محصول تصویر شاخص ندارد.', 'woocommersa')]; } } private function check_schema($post_id, &$results) { $faq = $this->provider->get_faq_schema($post_id); if (empty($faq)) { $results['warning'][] = ['code' => 'no_schema', 'message' => __('اسکیمای سوالات متداول (FAQ Schema) یافت نشد.', 'woocommersa')]; } else { $results['good'][] = ['code' => 'has_schema', 'message' => __('محصول دارای اسکیمای اختصاصی است.', 'woocommersa')]; } } public function get_internal_links($post_id) { $categories = wp_get_post_terms($post_id, 'product_cat', ['fields' => 'ids']); if (empty($categories) || is_wp_error($categories)) return []; $args = [ 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => 3, 'post__not_in' => [$post_id], 'tax_query' => [ [ 'taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => $categories ] ], 'orderby' => 'rand' ]; $query = new \WP_Query($args); $links = []; if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $links[] = [ 'id' => get_the_ID(), 'title' => get_the_title(), 'url' => get_permalink() ]; } wp_reset_postdata(); } return $links; } }