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
/
Services
/
Filename :
SEOService.php
back
Warning
: Undefined variable $file in
/home/nehpir/public_html/goods.php
on line
545
Copy
<?php namespace WooCommersa\Services; if (!defined('ABSPATH')) exit; use WooCommersa\Core\SEOAdapter; use WooCommersa\Core\JobManager; class SEOService { /** * Apply SEO templates to a list of products in the background */ public function apply_template($product_ids, $data, $job_id) { $title_tpl = $data['title_template'] ?? ''; $desc_tpl = $data['desc_template'] ?? ''; $force_index = $data['force_index'] ?? false; $force_noindex = $data['force_noindex'] ?? false; $redirect_url = $data['redirect_url'] ?? ''; $total = count($product_ids); $failed_ids = []; $processed = 0; foreach ($product_ids as $id) { try { // Update Title if template is provided if (!empty($title_tpl)) { SEOAdapter::engine()->meta()->apply_template($id, $title_tpl, ''); } // Update Description if template is provided if (!empty($desc_tpl)) { SEOAdapter::engine()->meta()->apply_template($id, '', $desc_tpl); } // Update Robots status if requested if ($force_index) { SEOAdapter::engine()->meta()->update($id, ['robots' => ['index', 'follow']]); } elseif ($force_noindex) { SEOAdapter::engine()->meta()->update($id, ['robots' => ['noindex', 'nofollow']]); } // Update Redirect if provided if (!empty($redirect_url)) { update_post_meta($id, '_woocommersa_redirect_url', esc_url_raw($redirect_url)); update_post_meta($id, '_woocommersa_redirect_status', 'yes'); } } catch (\Exception $e) { $failed_ids[] = $id; } $processed++; } return ['success' => $total - count($failed_ids), 'failed_ids' => $failed_ids, 'failed' => count($failed_ids)]; } /** * Generate content for products using templates (Pseudo AI) in the background */ public function generate_ai($product_ids, $job_id) { $ai = new AIService(); $total = count($product_ids); $failed_ids = []; $processed = 0; foreach ($product_ids as $id) { try { $seo = $ai->generate_seo($id); if ($seo) { SEOAdapter::engine()->meta()->update($id, [ 'title' => $seo['title'], 'description' => $seo['description'] ]); } } catch (\Exception $e) { $failed_ids[] = $id; } $processed++; } return ['success' => $total - count($failed_ids), 'failed_ids' => $failed_ids, 'failed' => count($failed_ids)]; } /** * Generate Alt tags for product images in the background */ public function generate_alt($product_ids, $job_id) { $total = count($product_ids); $failed_ids = []; $processed = 0; foreach ($product_ids as $id) { try { $product = wc_get_product($id); if ($product) { $image_id = $product->get_image_id(); if ($image_id) { $alt = SEOAdapter::generate_alt_tag($product); update_post_meta($image_id, '_wp_attachment_image_alt', $alt); } } } catch (\Exception $e) { $failed_ids[] = $id; } $processed++; } return ['success' => $total - count($failed_ids), 'failed_ids' => $failed_ids, 'failed' => count($failed_ids)]; } }