901 lines
41 KiB
PHP
901 lines
41 KiB
PHP
<?php
|
|
/**
|
|
* صفحات اختصاصی ماژولها / راهحلها — محتوا، URL، ایجاد خودکار برگه
|
|
*
|
|
* @package Hesabix2
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$hesabix2_mpc = get_template_directory() . '/inc/module-pages-content.php';
|
|
if (is_readable($hesabix2_mpc)) {
|
|
require_once $hesabix2_mpc;
|
|
}
|
|
$hesabix2_mpp = get_template_directory() . '/inc/module-pages-plugins.php';
|
|
if (is_readable($hesabix2_mpp)) {
|
|
require_once $hesabix2_mpp;
|
|
}
|
|
$hesabix2_mpi = get_template_directory() . '/inc/module-pages-industries.php';
|
|
if (is_readable($hesabix2_mpi)) {
|
|
require_once $hesabix2_mpi;
|
|
}
|
|
$hesabix2_mpd = get_template_directory() . '/inc/module-pages-depth.php';
|
|
if (is_readable($hesabix2_mpd)) {
|
|
require_once $hesabix2_mpd;
|
|
}
|
|
$hesabix2_mpu = get_template_directory() . '/inc/module-pages-unique.php';
|
|
if (is_readable($hesabix2_mpu)) {
|
|
require_once $hesabix2_mpu;
|
|
}
|
|
$hesabix2_mpr = get_template_directory() . '/inc/module-page-rich.php';
|
|
if (is_readable($hesabix2_mpr)) {
|
|
require_once $hesabix2_mpr;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<string, mixed>>
|
|
*/
|
|
function hesabix2_module_pages_registry() {
|
|
static $cached = null;
|
|
if (null !== $cached) {
|
|
return $cached;
|
|
}
|
|
|
|
$arc = function_exists('hesabix2_fp_arc_url') ? hesabix2_fp_arc_url() : 'https://arc.hesabix.ir';
|
|
|
|
$registry = array(
|
|
'platform' => array(
|
|
'slug' => 'platform',
|
|
'title' => __('امکانات پلتفرم حسابیکس', 'hesabix2'),
|
|
'badge' => __('نمای کلی', 'hesabix2'),
|
|
'kind' => 'meta',
|
|
'lead' => __('از مغازه تا کارخانه و پتروشیمی: مالی، فروش، انبار، تولید، پخش و ایجنت MCP — یک هستهٔ متنباز که با افزونه رشد میکند.', 'hesabix2'),
|
|
'intro' => __('حسابیکس (نسخهٔ آرک) ERP و اتاق فرمان کسبوکار است، نه فقط نرمافزار حسابداری. هسته برای صنف کوچک ساده میماند؛ همان هسته برای هلدینگ، کارخانه و مجتمع صنعتی با نقش، دارایی، تولید و دستیار عاملمحور مقیاس میگیرد.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('یک پنل واحد', 'hesabix2'), 'text' => __('فاکتور، موجودی، مشتری و مالی بدون پراکندگی بین چند ابزار.', 'hesabix2')),
|
|
array('title' => __('رایگان برای هسته', 'hesabix2'), 'text' => __('استفاده از پلتفرم و دسترسی به دادههای خود بدون هزینهٔ اشتراک پایه.', 'hesabix2')),
|
|
array('title' => __('متنباز', 'hesabix2'), 'text' => __('مخازن کد باز؛ امکان بررسی، سفارشیسازی و اعتماد بیشتر.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('حسابداری، خزانه، حقوق و دارایی ثابت', 'hesabix2'),
|
|
__('فاکتور، CRM، باشگاه و مودیان', 'hesabix2'),
|
|
__('انبار، پخش مویرگی، تولید و BOM', 'hesabix2'),
|
|
__('گارانتی، تعمیرگاه و پروژه', 'hesabix2'),
|
|
__('چت، ورکفلو و ایجنت MCP', 'hesabix2'),
|
|
__('مقیاس از مغازه تا مجتمع صنعتی', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(
|
|
__('مغازه، خردهفروشی و فروش آنلاین', 'hesabix2'),
|
|
__('پخش، کارخانه و صنایع غذایی', 'hesabix2'),
|
|
__('دارو، انرژی، خدمات و هلدینگ', 'hesabix2'),
|
|
),
|
|
'related' => array('accounting', 'agents', 'for-factory', 'for-holding'),
|
|
'layout' => 'overview',
|
|
),
|
|
'accounting' => array(
|
|
'slug' => 'accounting',
|
|
'title' => __('حسابداری و گزارش مالی', 'hesabix2'),
|
|
'badge' => __('مالی', 'hesabix2'),
|
|
'lead' => __('تراز و داشبورد در پنل؛ خلاصهٔ فروش و مانده در بله و تلگرام — بدون انتظار برای حسابدار.', 'hesabix2'),
|
|
'intro' => __('فاکتور در چت صادر میشود، سند مالی خودکار ثبت میشود. مدیر از پیامرسان وضعیت روز را میبیند؛ حسابدار در پنل جزئیات را کنترل میکند.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('دفتر کل و معین', 'hesabix2'), 'text' => __('ساختار حسابها مطابق نیاز کسبوکار شما.', 'hesabix2')),
|
|
array('title' => __('گزارش آماده', 'hesabix2'), 'text' => __('تراز، سود و زیان و گردش حساب در چند کلیک.', 'hesabix2')),
|
|
array('title' => __('هماهنگ با فروش', 'hesabix2'), 'text' => __('فاکتور و دریافت/پرداخت بهصورت خودکار در مالی منعکس میشود.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('ثبت سند حسابداری دستی و خودکار', 'hesabix2'),
|
|
__('خلاصهٔ مالی در بله و تلگرام', 'hesabix2'),
|
|
__('داشبورد مالی لحظهای', 'hesabix2'),
|
|
__('گزارشهای دورهای و مقایسهای', 'hesabix2'),
|
|
__('خروجی برای حسابدار و حسابرسی', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(
|
|
__('شرکتهای کوچک و متوسط', 'hesabix2'),
|
|
__('استارتآپهای در حال رشد', 'hesabix2'),
|
|
),
|
|
'related' => array('invoicing', 'tax-moudian', 'platform'),
|
|
),
|
|
'tax-moudian' => array(
|
|
'slug' => 'tax-moudian',
|
|
'title' => __('یکپارچهسازی مودیان', 'hesabix2'),
|
|
'badge' => __('مالی · انطباق', 'hesabix2'),
|
|
'lead' => __('اتصال به سامانههای مالیاتی و ارسال اطلاعات صورتحساب مطابق مقررات.', 'hesabix2'),
|
|
'intro' => __('برای کسبوکارهای مشمول، یکپارچگی با مودیان بار اداری را کم میکند. فاکتورهای صادرشده در حسابیکس میتوانند در مسیر ارسال به سامانه مالیاتی قرار گیرند (بسته به پیکربندی و افزونه).', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('کاهش خطای دستی', 'hesabix2'), 'text' => __('اطلاعات از همان منبع فاکتور خوانده میشود.', 'hesabix2')),
|
|
array('title' => __('ردیابی وضعیت', 'hesabix2'), 'text' => __('مشخص است کدام صورتحساب ارسال یا نیاز به اصلاح دارد.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('اتصال به سامانه مودیان', 'hesabix2'),
|
|
__('هماهنگی با ماژول فاکتور', 'hesabix2'),
|
|
__('مستندات راهاندازی در دانشنامه', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('فروشگاهها و شرکتهای مشمول مودیان', 'hesabix2')),
|
|
'related' => array('invoicing', 'integrations', 'accounting'),
|
|
),
|
|
'invoicing' => array(
|
|
'slug' => 'invoicing',
|
|
'title' => __('فاکتور و فروش', 'hesabix2'),
|
|
'badge' => __('فروش', 'hesabix2'),
|
|
'lead' => __('صدور فاکتور از پنل یا مستقیم در بله و تلگرام — بدون باز کردن برنامه؛ ارسال PDF و پیگیری مانده برای مشتری.', 'hesabix2'),
|
|
'intro' => __('حسابیکس از همیشه با پیامرسانهای محبوب شما یکی بوده: مشتری در چت سفارش میدهد، شما فاکتور میزنید و مانده را همانجا میبینید. موجودی و مالی همزمان بهروز میشوند.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('سرعت صدور', 'hesabix2'), 'text' => __('قالبها و مشتریان ذخیرهشده؛ فاکتور در کمترین زمان.', 'hesabix2')),
|
|
array('title' => __('چاپ و ارسال', 'hesabix2'), 'text' => __('خروجی PDF و ارسال برای مشتری.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('فاکتور فروش و برگشت', 'hesabix2'),
|
|
__('پیشفاکتور و تبدیل به فاکتور', 'hesabix2'),
|
|
__('تخفیف، مالیات و اقلام چندگانه', 'hesabix2'),
|
|
__('پیوند به انبار و حسابداری', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('خردهفروشی', 'hesabix2'), __('عمدهفروشی', 'hesabix2'), __('خدمات', 'hesabix2')),
|
|
'related' => array('crm', 'inventory', 'accounting'),
|
|
),
|
|
'crm' => array(
|
|
'slug' => 'crm',
|
|
'title' => __('CRM و مدیریت مشتریان', 'hesabix2'),
|
|
'badge' => __('فروش و CRM', 'hesabix2'),
|
|
'lead' => __('گفتگوی بله و تلگرام، چت سایت، فاکتور و تماس — همه روی یک پرونده؛ بدون اکسل و بدون از دست دادن تاریخچه.', 'hesabix2'),
|
|
'intro' => __('حسابیکس از همیشه نزدیک مشتری بوده: هر پیام در بله یا تلگرام روی همان مخاطب در CRM مینشیند. تیم قبل از تماس بعدی میداند چه گفتهاید و چه فاکتوری زدهاید.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('قیف فروش', 'hesabix2'), 'text' => __('از سرنخ تا قرارداد با مراحل قابل تنظیم.', 'hesabix2')),
|
|
array('title' => __('هماهنگ با فاکتور', 'hesabix2'), 'text' => __('خرید و پرداخت مشتری روی همان پرونده.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('مخاطب حقیقی و حقوقی', 'hesabix2'),
|
|
__('فرصت و پیشبینی فروش', 'hesabix2'),
|
|
__('فعالیت و یادآور', 'hesabix2'),
|
|
__('پیام بله و تلگرام روی پرونده', 'hesabix2'),
|
|
__('تاریخچه یکپارچه با چت و فاکتور', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('تیم فروش B2B', 'hesabix2'), __('پشتیبانی مشتری', 'hesabix2')),
|
|
'related' => array('loyalty', 'live-chat', 'invoicing'),
|
|
),
|
|
'loyalty' => array(
|
|
'slug' => 'loyalty',
|
|
'title' => __('باشگاه مشتریان', 'hesabix2'),
|
|
'badge' => __('فروش و CRM', 'hesabix2'),
|
|
'lead' => __('امتیاز، سطحبندی، پاداش و وفاداری بر اساس رفتار خرید.', 'hesabix2'),
|
|
'intro' => __('مشتریان وفادار ارزشمندترند. باشگاه مشتریان خرید مکرر را تشویق میکند و دادهٔ رفتاری برای بازاریابی هدفمند میدهد.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('افزایش بازگشت مشتری', 'hesabix2'), 'text' => __('پاداش شفاف و قابل پیگیری.', 'hesabix2')),
|
|
array('title' => __('یکپارچه با فاکتور', 'hesabix2'), 'text' => __('امتیاز از خرید واقعی محاسبه میشود.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('قوانین امتیازدهی', 'hesabix2'),
|
|
__('سطح عضویت', 'hesabix2'),
|
|
__('گزارش وفاداری', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('فروشگاه و خردهفروشی', 'hesabix2')),
|
|
'related' => array('crm', 'invoicing'),
|
|
),
|
|
'inventory' => array(
|
|
'slug' => 'inventory',
|
|
'title' => __('انبار و مدیریت موجودی', 'hesabix2'),
|
|
'badge' => __('عملیات', 'hesabix2'),
|
|
'lead' => __('موجودی لحظهای در پنل؛ استعلام از بله/تلگرام قبل از قول تحویل به مشتری.', 'hesabix2'),
|
|
'intro' => __('فروش در پیامرسان بدون چک انبار خطرناک است. با حسابیکس قبل از تأیید سفارش موجودی را میبینید؛ با فاکتور، خروج خودکار ثبت میشود.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('چند انبار', 'hesabix2'), 'text' => __('انتقال بین انبارها و موجودی تفکیکشده.', 'hesabix2')),
|
|
array('title' => __('کاردکس', 'hesabix2'), 'text' => __('ردیابی هر حرکت کالا.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('تعریف کالا و واحد', 'hesabix2'),
|
|
__('استعلام موجودی در بله و تلگرام', 'hesabix2'),
|
|
__('حواله ورود و خروج', 'hesabix2'),
|
|
__('هماهنگی خودکار با فاکتور فروش', 'hesabix2'),
|
|
__('هشدار موجودی کم', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('پخش و توزیع', 'hesabix2'), __('فروشگاه پوشاک و کالا', 'hesabix2')),
|
|
'related' => array('invoicing', 'integrations'),
|
|
),
|
|
'live-chat' => array(
|
|
'slug' => 'live-chat',
|
|
'title' => __('چت آنلاین با مشتری', 'hesabix2'),
|
|
'badge' => __('عملیات · آنلاین', 'hesabix2'),
|
|
'lead' => __('چت سایت + بله + تلگرام در یک خط پشتیبانی؛ مشتری از هر کانالی بنویسد، تاریخچه یکجا بماند.', 'hesabix2'),
|
|
'intro' => __('ویجت وب برای لحظهٔ تصمیم خرید؛ پیامرسان برای ادامهٔ رابطه — هر دو به CRM وصلاند. مشتری برای صحبت نیازی به ورود به برنامه ندارد.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('اعتماد بیشتر', 'hesabix2'), 'text' => __('پاسخ سریع در لحظهٔ تصمیم خرید.', 'hesabix2')),
|
|
array('title' => __('یک پرونده', 'hesabix2'), 'text' => __('چت، فاکتور و تماس در یک جا.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('ویجت چت وب', 'hesabix2'),
|
|
__('ادامهٔ گفتگو در بله و تلگرام', 'hesabix2'),
|
|
__('تخصیص به اپراتور', 'hesabix2'),
|
|
__('افزونه وردپرس', 'hesabix2'),
|
|
__('تاریخچه یکپارچه در CRM', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('فروشگاه آنلاین', 'hesabix2'), __('خدمات و مشاوره', 'hesabix2')),
|
|
'related' => array('online-business', 'crm', 'integrations'),
|
|
),
|
|
'integrations' => array(
|
|
'slug' => 'integrations',
|
|
'title' => __('یکپارچهسازی و افزونهها', 'hesabix2'),
|
|
'badge' => __('عملیات', 'hesabix2'),
|
|
'lead' => __('بله، تلگرام، ووکامرس، API و مودیان — هر کانالی که مشتری از آن میآید به یک پنل واحد وصل میشود.', 'hesabix2'),
|
|
'intro' => __('اتصال به پیامرسان یعنی کار با سیستم بدون ورود به برنامه؛ اتصال به فروشگاه یعنی سفارش خودکار در آرک. همهٔ کانالها در یک اکوسیستم.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('API باز', 'hesabix2'), 'text' => __('اتوماسیون و اتصال سیستمهای داخلی.', 'hesabix2')),
|
|
array('title' => __('افزونه آماده', 'hesabix2'), 'text' => __('ووکامرس و چت بدون توسعه از صفر.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('افزونه ووکامرس', 'hesabix2'),
|
|
__('مرجع API و OpenAPI', 'hesabix2'),
|
|
__('وبهوک و یکپارچگی سفارشی', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('فروشگاه وردپرس', 'hesabix2'), __('توسعهدهندگان نرمافزار', 'hesabix2')),
|
|
'related' => array('tax-moudian', 'live-chat'),
|
|
'extra_link' => array(
|
|
'label' => __('افزونهها و یکپارچهسازی', 'hesabix2'),
|
|
'url' => home_url('/integrations/'),
|
|
),
|
|
),
|
|
'workflow' => array(
|
|
'slug' => 'workflow',
|
|
'title' => __('ورکفلو و اتوماسیون', 'hesabix2'),
|
|
'badge' => __('هوشمندسازی', 'hesabix2'),
|
|
'lead' => __('قوانین «اگر این شد، آن انجام شود» بین فاکتور، CRM، انبار و پیام.', 'hesabix2'),
|
|
'intro' => __('کارهای تکراری را به سیستم بسپارید: تأیید، اعلان، بهروزرسانی موجودی یا ایجاد فعالیت CRM بر اساس رویداد.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('صرفهجویی زمان', 'hesabix2'), 'text' => __('کاهش خطای انسانی در تکرار.', 'hesabix2')),
|
|
array('title' => __('شفافیت', 'hesabix2'), 'text' => __('مسیر هر فرایند قابل مشاهده است.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('تریگر رویدادمحور', 'hesabix2'),
|
|
__('شاخه و شرط', 'hesabix2'),
|
|
__('هماهنگی با AI برای سناریوهای پیچیده', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('تیم عملیات', 'hesabix2'), __('فروش سازمانی', 'hesabix2')),
|
|
'related' => array('ai', 'crm'),
|
|
),
|
|
'ai' => array(
|
|
'slug' => 'ai',
|
|
'title' => __('هوش مصنوعی در حسابیکس', 'hesabix2'),
|
|
'badge' => __('هوشمندسازی', 'hesabix2'),
|
|
'lead' => __('تحلیل داده، پیشنهاد اقدام بعدی و کمک در طراحی اتوماسیون.', 'hesabix2'),
|
|
'intro' => __('AI جایگزین تیم نیست؛ در کنار آن برای تحلیل رویدادها، پیشنهاد و بهینهسازی ورکفلو به کار میآید.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('بینش سریعتر', 'hesabix2'), 'text' => __('خلاصه و الگو از دادههای کسبوکار.', 'hesabix2')),
|
|
array('title' => __('کمک در اتوماسیون', 'hesabix2'), 'text' => __('پیشنهاد سناریو برای فرایندهای چندمرحلهای.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('دستیار در پنل', 'hesabix2'),
|
|
__('تحلیل رویداد', 'hesabix2'),
|
|
__('هماهنگی با ورکفلو', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('مدیران کسبوکار', 'hesabix2')),
|
|
'related' => array('workflow', 'platform'),
|
|
),
|
|
'online-business' => array(
|
|
'slug' => 'online-business',
|
|
'title' => __('کسبوکار آنلاین', 'hesabix2'),
|
|
'badge' => __('راهحل', 'hesabix2'),
|
|
'lead' => __('چت، جذب بازدیدکننده، پیام هدفمند و تجربهٔ خرید یکپارچه.', 'hesabix2'),
|
|
'intro' => __('سایت یا فروشگاه شما با پشتیبانی زنده و دادهٔ مشتری در حسابیکس به «تعامل واقعی» تبدیل میشود، نه فقط ویترین.', 'hesabix2'),
|
|
'benefits' => array(
|
|
array('title' => __('گفتگوی آنلاین', 'hesabix2'), 'text' => __('چت امن روی سایت.', 'hesabix2')),
|
|
array('title' => __('جذب و پیگیری', 'hesabix2'), 'text' => __('سرنخ از بازدید تا مشتری.', 'hesabix2')),
|
|
),
|
|
'features' => array(
|
|
__('چت وب یکپارچه', 'hesabix2'),
|
|
__('CRM و باشگاه مشتریان', 'hesabix2'),
|
|
__('اتصال ووکامرس', 'hesabix2'),
|
|
),
|
|
'use_cases' => array(__('فروشگاه آنلاین', 'hesabix2'), __('خدمات آنلاین', 'hesabix2')),
|
|
'related' => array('live-chat', 'integrations', 'crm'),
|
|
),
|
|
'faq' => array(
|
|
'slug' => 'faq',
|
|
'title' => __('پرسشهای متداول', 'hesabix2'),
|
|
'badge' => __('منابع', 'hesabix2'),
|
|
'kind' => 'meta',
|
|
'lead' => __('پاسخ کوتاه به سوالات رایج قبل از شروع با آرک.', 'hesabix2'),
|
|
'layout' => 'faq',
|
|
'related' => array('guide', 'platform'),
|
|
),
|
|
'guide' => array(
|
|
'slug' => 'guide',
|
|
'title' => __('راهنمای شروع با حسابیکس', 'hesabix2'),
|
|
'badge' => __('منابع', 'hesabix2'),
|
|
'kind' => 'meta',
|
|
'lead' => __('مسیر ثبتنام، راهاندازی و بهرهبرداری در چند گام.', 'hesabix2'),
|
|
'intro' => __('چه خردهفروشی باشید چه توزیع؛ وقتی فاکتور، موجودی و مشتری در یک جا جمع شود، هزینه و خطا کم میشود.', 'hesabix2'),
|
|
'layout' => 'guide',
|
|
'steps' => array(
|
|
array('title' => __('ثبتنام رایگان', 'hesabix2'), 'text' => __('بدون کارت بانکی؛ در چند دقیقه پنل آرک را بسازید.', 'hesabix2')),
|
|
array('title' => __('راهاندازی', 'hesabix2'), 'text' => __('کسبوکار، مخاطب، انبار و اولین فاکتور.', 'hesabix2')),
|
|
array('title' => __('بهرهبرداری', 'hesabix2'), 'text' => __('وب و موبایل؛ پشتیبانی از تماس، تلگرام، بله و انجمن.', 'hesabix2')),
|
|
),
|
|
'related' => array('platform', 'faq'),
|
|
),
|
|
);
|
|
|
|
$registry = apply_filters('hesabix2_module_pages_registry', $registry);
|
|
|
|
if (function_exists('hesabix2_module_pages_merge_content')) {
|
|
$registry = hesabix2_module_pages_merge_content($registry);
|
|
}
|
|
|
|
$cached = $registry;
|
|
|
|
return $registry;
|
|
}
|
|
|
|
/**
|
|
* URL صفحهٔ درباره ما
|
|
*
|
|
* @return string
|
|
*/
|
|
function hesabix2_about_page_url() {
|
|
$page = get_page_by_path('about');
|
|
if ($page && 'publish' === $page->post_status) {
|
|
return get_permalink($page);
|
|
}
|
|
return hesabix2_page_url_by_template('page-about.php', '/about/');
|
|
}
|
|
|
|
/**
|
|
* ایجاد برگهٔ درباره (یکبار)
|
|
*/
|
|
function hesabix2_maybe_create_about_page() {
|
|
if (get_option('hesabix2_about_page_created')) {
|
|
return;
|
|
}
|
|
$existing = get_pages(
|
|
array(
|
|
'meta_key' => '_wp_page_template',
|
|
'meta_value' => 'page-about.php',
|
|
'number' => 1,
|
|
)
|
|
);
|
|
if (!empty($existing)) {
|
|
$by_path = get_page_by_path('about');
|
|
if ($by_path) {
|
|
update_post_meta($by_path->ID, '_wp_page_template', 'page-about.php');
|
|
}
|
|
update_option('hesabix2_about_page_created', 1);
|
|
return;
|
|
}
|
|
$by_path = get_page_by_path('about');
|
|
if ($by_path) {
|
|
update_post_meta($by_path->ID, '_wp_page_template', 'page-about.php');
|
|
update_option('hesabix2_about_page_created', 1);
|
|
return;
|
|
}
|
|
$page_id = wp_insert_post(
|
|
array(
|
|
'post_title' => __('داستان حسابیکس', 'hesabix2'),
|
|
'post_name' => 'about',
|
|
'post_status' => 'publish',
|
|
'post_type' => 'page',
|
|
),
|
|
true
|
|
);
|
|
if (!is_wp_error($page_id) && $page_id) {
|
|
update_post_meta($page_id, '_wp_page_template', 'page-about.php');
|
|
update_option('hesabix2_about_page_created', 1);
|
|
}
|
|
}
|
|
add_action('after_setup_theme', 'hesabix2_maybe_create_about_page', 33);
|
|
|
|
/**
|
|
* عنوان SEO صفحهٔ ماژول
|
|
*
|
|
* @param string $key
|
|
* @param array<string, mixed> $def
|
|
* @return string
|
|
*/
|
|
function hesabix2_module_page_seo_title($key, $def) {
|
|
if (!empty($def['seo_title'])) {
|
|
return (string) $def['seo_title'];
|
|
}
|
|
$title = isset($def['title']) ? (string) $def['title'] : '';
|
|
return $title ? $title . ' | ' . get_bloginfo('name') : get_bloginfo('name');
|
|
}
|
|
|
|
/**
|
|
* توضیح SEO صفحهٔ ماژول
|
|
*
|
|
* @param array<string, mixed> $def
|
|
* @return string
|
|
*/
|
|
function hesabix2_module_page_seo_description($def) {
|
|
if (!empty($def['seo_description'])) {
|
|
return (string) $def['seo_description'];
|
|
}
|
|
if (!empty($def['lead'])) {
|
|
return (string) $def['lead'];
|
|
}
|
|
return '';
|
|
}
|
|
|
|
/**
|
|
* @param string $title
|
|
* @return string
|
|
*/
|
|
function hesabix2_seo_yoast_module_title_filter($title) {
|
|
if (is_page_template('page-about.php')) {
|
|
return __('داستان حسابیکس', 'hesabix2') . ' | ' . get_bloginfo('name');
|
|
}
|
|
if (!function_exists('hesabix2_is_module_page') || !hesabix2_is_module_page()) {
|
|
return $title;
|
|
}
|
|
$key = get_post_meta(get_queried_object_id(), '_hesabix_module_key', true);
|
|
$def = $key ? hesabix2_module_page_def((string) $key) : null;
|
|
if (!$def) {
|
|
return $title;
|
|
}
|
|
return hesabix2_module_page_seo_title((string) $key, $def);
|
|
}
|
|
add_filter('wpseo_title', 'hesabix2_seo_yoast_module_title_filter');
|
|
add_filter('wpseo_opengraph_title', 'hesabix2_seo_yoast_module_title_filter');
|
|
|
|
/**
|
|
* @param string $desc
|
|
* @return string
|
|
*/
|
|
function hesabix2_seo_yoast_module_desc_filter($desc) {
|
|
if (is_page_template('page-about.php')) {
|
|
return __('آشنایی با ماموریت، مسیر محصول آرک و شادمان، و جامعهٔ متنباز حسابیکس.', 'hesabix2');
|
|
}
|
|
if (!function_exists('hesabix2_is_module_page') || !hesabix2_is_module_page()) {
|
|
return $desc;
|
|
}
|
|
$key = get_post_meta(get_queried_object_id(), '_hesabix_module_key', true);
|
|
$def = $key ? hesabix2_module_page_def((string) $key) : null;
|
|
if (!$def) {
|
|
return $desc;
|
|
}
|
|
$custom = hesabix2_module_page_seo_description($def);
|
|
return $custom ?: $desc;
|
|
}
|
|
add_filter('wpseo_metadesc', 'hesabix2_seo_yoast_module_desc_filter');
|
|
add_filter('wpseo_opengraph_desc', 'hesabix2_seo_yoast_module_desc_filter');
|
|
|
|
/**
|
|
* meta و OG وقتی Yoast نیست
|
|
*/
|
|
function hesabix2_seo_module_pages_head() {
|
|
$is_module = function_exists('hesabix2_is_module_page') && hesabix2_is_module_page();
|
|
$is_about = is_page_template('page-about.php');
|
|
if (!$is_module && !$is_about) {
|
|
return;
|
|
}
|
|
if (function_exists('hesabix2_seo_yoast_active') && hesabix2_seo_yoast_active()) {
|
|
return;
|
|
}
|
|
if ($is_about) {
|
|
$title = __('داستان حسابیکس | ', 'hesabix2') . get_bloginfo('name');
|
|
$desc = __('آشنایی با ماموریت، مسیر محصول آرک و شادمان، و جامعهٔ متنباز حسابیکس.', 'hesabix2');
|
|
} else {
|
|
$key = get_post_meta(get_queried_object_id(), '_hesabix_module_key', true);
|
|
$def = $key ? hesabix2_module_page_def((string) $key) : null;
|
|
if (!$def) {
|
|
return;
|
|
}
|
|
$title = hesabix2_module_page_seo_title((string) $key, $def);
|
|
$desc = hesabix2_module_page_seo_description($def);
|
|
}
|
|
$url = get_permalink();
|
|
$image = function_exists('hesabix2_seo_default_image_url') ? hesabix2_seo_default_image_url() : '';
|
|
|
|
if ($desc) {
|
|
echo '<meta name="description" content="' . esc_attr($desc) . '" />' . "\n";
|
|
}
|
|
echo '<meta property="og:title" content="' . esc_attr($title) . '" />' . "\n";
|
|
if ($desc) {
|
|
echo '<meta property="og:description" content="' . esc_attr($desc) . '" />' . "\n";
|
|
}
|
|
echo '<meta property="og:type" content="article" />' . "\n";
|
|
echo '<meta property="og:url" content="' . esc_url($url) . '" />' . "\n";
|
|
if ($image) {
|
|
echo '<meta property="og:image" content="' . esc_url($image) . '" />' . "\n";
|
|
}
|
|
}
|
|
add_action('wp_head', 'hesabix2_seo_module_pages_head', 5);
|
|
|
|
/**
|
|
* document_title برای صفحات ماژول
|
|
*
|
|
* @param array<string, string> $parts
|
|
* @return array<string, string>
|
|
*/
|
|
function hesabix2_module_document_title($parts) {
|
|
if (is_page_template('page-about.php')) {
|
|
$parts['title'] = __('داستان حسابیکس', 'hesabix2');
|
|
return $parts;
|
|
}
|
|
if (!function_exists('hesabix2_is_module_page') || !hesabix2_is_module_page()) {
|
|
return $parts;
|
|
}
|
|
$key = get_post_meta(get_queried_object_id(), '_hesabix_module_key', true);
|
|
$def = $key ? hesabix2_module_page_def((string) $key) : null;
|
|
if ($def) {
|
|
$parts['title'] = hesabix2_module_page_seo_title((string) $key, $def);
|
|
}
|
|
return $parts;
|
|
}
|
|
add_filter('document_title_parts', 'hesabix2_module_document_title', 20);
|
|
|
|
/**
|
|
* @param string $key
|
|
* @return array<string, mixed>|null
|
|
*/
|
|
function hesabix2_module_page_def($key) {
|
|
$registry = hesabix2_module_pages_registry();
|
|
return isset($registry[$key]) ? $registry[$key] : null;
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed>|string $def_or_key
|
|
* @return string module|plugin|industry|meta
|
|
*/
|
|
function hesabix2_module_kind($def_or_key) {
|
|
$def = is_string($def_or_key) ? hesabix2_module_page_def($def_or_key) : $def_or_key;
|
|
if (!is_array($def)) {
|
|
return 'module';
|
|
}
|
|
$kind = isset($def['kind']) ? (string) $def['kind'] : '';
|
|
return $kind !== '' ? $kind : 'module';
|
|
}
|
|
|
|
/**
|
|
* @param string $kind
|
|
* @return array<string, array<string, mixed>>
|
|
*/
|
|
function hesabix2_module_pages_of_kind($kind) {
|
|
$out = array();
|
|
foreach (hesabix2_module_pages_registry() as $key => $def) {
|
|
if (hesabix2_module_kind($def) === $kind) {
|
|
$out[$key] = $def;
|
|
}
|
|
}
|
|
return $out;
|
|
}
|
|
|
|
/**
|
|
* کارتهای کاتالوگ برای هاب امکانات
|
|
*
|
|
* @param string $kind
|
|
* @param array<int, string> $skip
|
|
*/
|
|
function hesabix2_render_module_catalog_cards($kind, array $skip = array()) {
|
|
$pages = hesabix2_module_pages_of_kind($kind);
|
|
if (empty($pages)) {
|
|
return;
|
|
}
|
|
echo '<div class="hx-module-grid hx-module-grid--modules">';
|
|
foreach ($pages as $mod_key => $mod) {
|
|
if (in_array($mod_key, $skip, true) || empty($mod['slug']) || empty($mod['title'])) {
|
|
continue;
|
|
}
|
|
echo '<a href="' . esc_url(hesabix2_module_page_url($mod_key)) . '" class="hx-module-card">';
|
|
echo '<span class="hx-module-card__badge">' . esc_html($mod['badge'] ?? '') . '</span>';
|
|
echo '<h3 class="hx-module-card__title">' . esc_html($mod['title']) . '</h3>';
|
|
echo '<p class="hx-module-card__text">' . esc_html($mod['lead'] ?? '') . '</p>';
|
|
echo '</a>';
|
|
}
|
|
echo '</div>';
|
|
}
|
|
|
|
/**
|
|
* URL برگهٔ ماژول
|
|
*
|
|
* @param string $key
|
|
* @return string
|
|
*/
|
|
function hesabix2_module_page_url($key) {
|
|
$def = hesabix2_module_page_def($key);
|
|
if (!$def || empty($def['slug'])) {
|
|
return home_url('/');
|
|
}
|
|
|
|
$pages = get_posts(
|
|
array(
|
|
'post_type' => 'page',
|
|
'post_status' => 'publish',
|
|
'posts_per_page' => 1,
|
|
'meta_key' => '_hesabix_module_key',
|
|
'meta_value' => $key,
|
|
'fields' => 'ids',
|
|
)
|
|
);
|
|
|
|
if (!empty($pages)) {
|
|
$url = get_permalink((int) $pages[0]);
|
|
if ($url) {
|
|
return $url;
|
|
}
|
|
}
|
|
|
|
return home_url('/' . $def['slug'] . '/');
|
|
}
|
|
|
|
/**
|
|
* URL برگه با قالب مشخص
|
|
*
|
|
* @param string $template فایل قالب، مثلاً page-development.php
|
|
* @param string $fallback
|
|
* @return string
|
|
*/
|
|
function hesabix2_page_url_by_template($template, $fallback = '') {
|
|
$pages = get_pages(
|
|
array(
|
|
'meta_key' => '_wp_page_template',
|
|
'meta_value' => $template,
|
|
'number' => 1,
|
|
)
|
|
);
|
|
if (!empty($pages)) {
|
|
return get_permalink($pages[0]->ID);
|
|
}
|
|
return $fallback ? home_url($fallback) : home_url('/');
|
|
}
|
|
|
|
/**
|
|
* پشتیبانی سازمانی — هر دو اسلاگ رایج
|
|
*
|
|
* @return string
|
|
*/
|
|
function hesabix2_enterprise_support_url() {
|
|
$by_slug = get_page_by_path('professional-support');
|
|
if ($by_slug && 'publish' === $by_slug->post_status) {
|
|
return get_permalink($by_slug);
|
|
}
|
|
return hesabix2_page_url_by_template('page-pishibani-sazmani.php', '/professional-support/');
|
|
}
|
|
|
|
/**
|
|
* تماس
|
|
*
|
|
* @return string
|
|
*/
|
|
function hesabix2_contact_page_url() {
|
|
$tamas = get_page_by_path('tamas');
|
|
if ($tamas && 'publish' === $tamas->post_status) {
|
|
return get_permalink($tamas);
|
|
}
|
|
return hesabix2_page_url_by_template('page-tamas.php', '/contact/');
|
|
}
|
|
|
|
/**
|
|
* همگامسازی برگههای ماژول / افزونه / صنعت با رجیستری
|
|
*/
|
|
function hesabix2_sync_module_pages() {
|
|
if (!function_exists('wp_insert_post')) {
|
|
return;
|
|
}
|
|
|
|
$registry = hesabix2_module_pages_registry();
|
|
$have = 0;
|
|
|
|
foreach ($registry as $key => $def) {
|
|
if (empty($def['slug']) || empty($def['title'])) {
|
|
continue;
|
|
}
|
|
|
|
$existing = get_posts(
|
|
array(
|
|
'post_type' => 'page',
|
|
'post_status' => 'any',
|
|
'posts_per_page' => 1,
|
|
'meta_key' => '_hesabix_module_key',
|
|
'meta_value' => $key,
|
|
'fields' => 'ids',
|
|
)
|
|
);
|
|
if (!empty($existing)) {
|
|
++$have;
|
|
continue;
|
|
}
|
|
|
|
$by_path = get_page_by_path($def['slug']);
|
|
if ($by_path) {
|
|
update_post_meta($by_path->ID, '_hesabix_module_key', $key);
|
|
update_post_meta($by_path->ID, '_wp_page_template', 'page-hesabix-module.php');
|
|
++$have;
|
|
continue;
|
|
}
|
|
|
|
$page_id = wp_insert_post(
|
|
array(
|
|
'post_title' => $def['title'],
|
|
'post_name' => $def['slug'],
|
|
'post_status' => 'publish',
|
|
'post_type' => 'page',
|
|
'post_content' => '',
|
|
),
|
|
true
|
|
);
|
|
|
|
if (!is_wp_error($page_id) && $page_id) {
|
|
update_post_meta($page_id, '_hesabix_module_key', $key);
|
|
update_post_meta($page_id, '_wp_page_template', 'page-hesabix-module.php');
|
|
++$have;
|
|
}
|
|
}
|
|
|
|
update_option('hesabix2_module_pages_created', 1);
|
|
update_option('hesabix2_module_pages_synced', $have);
|
|
}
|
|
add_action('after_setup_theme', 'hesabix2_sync_module_pages', 32);
|
|
|
|
/**
|
|
* سازگاری با نام قبلی
|
|
*/
|
|
function hesabix2_maybe_create_module_pages() {
|
|
hesabix2_sync_module_pages();
|
|
}
|
|
|
|
/**
|
|
* نانراه صفحات ماژول
|
|
*
|
|
* @param array<int, array{label: string, url?: string}> $items
|
|
* @return array<int, array{label: string, url?: string}>
|
|
*/
|
|
function hesabix2_module_page_breadcrumb($items) {
|
|
if (is_page_template('page-about.php')) {
|
|
return array(
|
|
array(
|
|
'label' => __('خانه', 'hesabix2'),
|
|
'url' => home_url('/'),
|
|
),
|
|
array('label' => __('داستان حسابیکس', 'hesabix2')),
|
|
);
|
|
}
|
|
if (!function_exists('hesabix2_is_module_page') || !hesabix2_is_module_page()) {
|
|
return $items;
|
|
}
|
|
$key = get_post_meta(get_queried_object_id(), '_hesabix_module_key', true);
|
|
$def = $key ? hesabix2_module_page_def((string) $key) : null;
|
|
$label = $def && !empty($def['title']) ? (string) $def['title'] : get_the_title();
|
|
|
|
$items = array(
|
|
array(
|
|
'label' => __('خانه', 'hesabix2'),
|
|
'url' => home_url('/'),
|
|
),
|
|
);
|
|
|
|
if ('platform' === $key) {
|
|
$items[] = array('label' => $label);
|
|
return $items;
|
|
}
|
|
|
|
if (in_array($key, array('faq', 'guide'), true)) {
|
|
$items[] = array(
|
|
'label' => __('منابع', 'hesabix2'),
|
|
'url' => hesabix2_module_page_url('guide'),
|
|
);
|
|
$items[] = array('label' => $label);
|
|
return $items;
|
|
}
|
|
|
|
$kind = hesabix2_module_kind($def ?: array());
|
|
$items[] = array(
|
|
'label' => __('امکانات پلتفرم', 'hesabix2'),
|
|
'url' => hesabix2_module_page_url('platform'),
|
|
);
|
|
if ('industry' === $kind) {
|
|
$items[] = array(
|
|
'label' => __('کسبوکار شما', 'hesabix2'),
|
|
'url' => hesabix2_module_page_url('platform') . '#scope',
|
|
);
|
|
} elseif ('plugin' === $kind) {
|
|
$items[] = array(
|
|
'label' => __('افزونهها', 'hesabix2'),
|
|
'url' => hesabix2_module_page_url('platform') . '#plugins',
|
|
);
|
|
}
|
|
$items[] = array('label' => $label);
|
|
|
|
return $items;
|
|
}
|
|
add_filter('hesabix2_seo_breadcrumb_items', 'hesabix2_module_page_breadcrumb', 12);
|
|
|
|
/**
|
|
* آیتمهای FAQ برای برگهٔ faq (و ادغام با faq ماژول در صورت وجود)
|
|
*
|
|
* @param string $key
|
|
* @return array<int, array{q: string, a: string}>
|
|
*/
|
|
function hesabix2_module_faq_items($key = 'faq') {
|
|
$items = array();
|
|
if ('faq' === $key && function_exists('hesabix2_fp_faq_items')) {
|
|
$items = hesabix2_fp_faq_items();
|
|
}
|
|
|
|
$def = hesabix2_module_page_def($key);
|
|
if (!empty($def['faq']) && is_array($def['faq'])) {
|
|
$existing_q = array();
|
|
foreach ($items as $item) {
|
|
$existing_q[$item['q']] = true;
|
|
}
|
|
foreach ($def['faq'] as $extra) {
|
|
if (empty($extra['q']) || isset($existing_q[$extra['q']])) {
|
|
continue;
|
|
}
|
|
$items[] = $extra;
|
|
$existing_q[$extra['q']] = true;
|
|
}
|
|
}
|
|
|
|
return apply_filters('hesabix2_module_faq_items', $items, $key);
|
|
}
|
|
|
|
/**
|
|
* تشخیص صفحهٔ ماژول جاری
|
|
*/
|
|
function hesabix2_is_module_page($key = '') {
|
|
if (!is_page_template('page-hesabix-module.php')) {
|
|
return false;
|
|
}
|
|
if ('' === $key) {
|
|
return true;
|
|
}
|
|
$current = get_post_meta(get_queried_object_id(), '_hesabix_module_key', true);
|
|
return $key === $current;
|
|
}
|
|
|
|
/**
|
|
* enqueue استایل/اسکریپت صفحات ماژول
|
|
*/
|
|
function hesabix2_module_pages_assets() {
|
|
if (!hesabix2_is_module_page() && !is_page_template('page-about.php')) {
|
|
return;
|
|
}
|
|
$dir = get_template_directory();
|
|
$uri = get_template_directory_uri();
|
|
$css = $dir . '/assets/css/module-page.css';
|
|
if (is_readable($css)) {
|
|
wp_enqueue_style(
|
|
'hesabix2-module-page',
|
|
$uri . '/assets/css/module-page.css',
|
|
array(),
|
|
(string) filemtime($css)
|
|
);
|
|
}
|
|
$rich_css = $dir . '/assets/css/module-page-rich.css';
|
|
if (is_readable($rich_css)) {
|
|
wp_enqueue_style(
|
|
'hesabix2-module-page-rich',
|
|
$uri . '/assets/css/module-page-rich.css',
|
|
array('hesabix2-module-page'),
|
|
(string) filemtime($rich_css)
|
|
);
|
|
}
|
|
$key = get_post_meta(get_queried_object_id(), '_hesabix_module_key', true);
|
|
$def = $key ? hesabix2_module_page_def((string) $key) : null;
|
|
if ($def && !empty($def['page_design']) && 'rich' === $def['page_design']) {
|
|
$rich_js = $dir . '/assets/js/module-page.js';
|
|
if (is_readable($rich_js)) {
|
|
wp_enqueue_script(
|
|
'hesabix2-module-page',
|
|
$uri . '/assets/js/module-page.js',
|
|
array(),
|
|
(string) filemtime($rich_js),
|
|
true
|
|
);
|
|
}
|
|
}
|
|
$needs_faq_js = ('faq' === ($def['layout'] ?? ''))
|
|
|| ('story' === ($def['layout'] ?? ''))
|
|
|| (!empty($def['faq']) && is_array($def['faq']))
|
|
|| ('overview' === ($def['layout'] ?? '') && !empty($def['faq']));
|
|
if ($needs_faq_js) {
|
|
$fp = $dir . '/assets/js/front-page.js';
|
|
if (is_readable($fp)) {
|
|
wp_enqueue_script(
|
|
'hesabix2-front-page',
|
|
$uri . '/assets/js/front-page.js',
|
|
array(),
|
|
(string) filemtime($fp),
|
|
true
|
|
);
|
|
}
|
|
}
|
|
}
|
|
add_action('wp_enqueue_scripts', 'hesabix2_module_pages_assets', 20);
|