248 lines
9.5 KiB
PHP
248 lines
9.5 KiB
PHP
<?php
|
||
/**
|
||
* اپلیکیشن ویندوز حسابیکس — URLها، ایجاد برگه، متادیتا
|
||
*
|
||
* @package Hesabix2
|
||
*/
|
||
|
||
if (!defined('ABSPATH')) {
|
||
exit;
|
||
}
|
||
|
||
/**
|
||
* آدرس صفحهٔ انتشار ویندوز.
|
||
*
|
||
* @return string
|
||
*/
|
||
function hesabix2_windows_page_url() {
|
||
static $cached = null;
|
||
if ($cached !== null) {
|
||
return $cached;
|
||
}
|
||
$pages = get_pages(
|
||
array(
|
||
'meta_key' => '_wp_page_template',
|
||
'meta_value' => 'page-windows.php',
|
||
'number' => 1,
|
||
)
|
||
);
|
||
$cached = !empty($pages)
|
||
? get_permalink($pages[0]->ID)
|
||
: home_url('/windows/');
|
||
return apply_filters('hesabix2_windows_page_url', $cached);
|
||
}
|
||
|
||
/**
|
||
* آدرس صفحهٔ ریلیزهای آرک در Forgejo.
|
||
*
|
||
* @return string
|
||
*/
|
||
function hesabix2_windows_releases_url() {
|
||
$url = get_option(
|
||
'hesabix2_windows_releases_url',
|
||
'https://source.hesabix.ir/hesabix/arc/releases'
|
||
);
|
||
if (!is_string($url) || $url === '') {
|
||
$url = 'https://source.hesabix.ir/hesabix/arc/releases';
|
||
}
|
||
return esc_url_raw(apply_filters('hesabix2_windows_releases_url', $url));
|
||
}
|
||
|
||
/**
|
||
* لینک مستقیم دانلود فایل MSI.
|
||
*
|
||
* @return string
|
||
*/
|
||
function hesabix2_windows_msi_url() {
|
||
$default = 'https://source.hesabix.ir/hesabix/arc/releases/download/70.11.900/hesabix-windows.70.11.900.msi';
|
||
$option = get_option('hesabix2_windows_msi_url', $default);
|
||
$url = is_string($option) && $option !== '' ? $option : $default;
|
||
return esc_url_raw(apply_filters('hesabix2_windows_msi_url', $url));
|
||
}
|
||
|
||
/**
|
||
* نسخهٔ نمایشی اپ.
|
||
*
|
||
* @return string
|
||
*/
|
||
function hesabix2_windows_app_version() {
|
||
$ver = get_option('hesabix2_windows_app_version', '70.11.900');
|
||
if (!is_string($ver) || $ver === '') {
|
||
$ver = '70.11.900';
|
||
}
|
||
return apply_filters('hesabix2_windows_app_version', $ver);
|
||
}
|
||
|
||
/**
|
||
* حداقل نسخهٔ ویندوز.
|
||
*
|
||
* @return string
|
||
*/
|
||
function hesabix2_windows_min_os() {
|
||
$os = get_option('hesabix2_windows_min_os', 'Windows 10 / 11 (64-bit)');
|
||
if (!is_string($os) || $os === '') {
|
||
$os = 'Windows 10 / 11 (64-bit)';
|
||
}
|
||
return apply_filters('hesabix2_windows_min_os', $os);
|
||
}
|
||
|
||
/**
|
||
* اندازهٔ تقریبی پکیج.
|
||
*
|
||
* @return string
|
||
*/
|
||
function hesabix2_windows_msi_size() {
|
||
$size = get_option('hesabix2_windows_msi_size', '≈ ۳۳ مگابایت');
|
||
if (!is_string($size) || $size === '') {
|
||
$size = '≈ ۳۳ مگابایت';
|
||
}
|
||
return apply_filters('hesabix2_windows_msi_size', $size);
|
||
}
|
||
|
||
/**
|
||
* ویژگیهای اپ برای صفحهٔ انتشار.
|
||
*
|
||
* @return array<int, array{title: string, desc: string, icon: string}>
|
||
*/
|
||
function hesabix2_windows_features() {
|
||
$features = array(
|
||
array(
|
||
'icon' => 'desktop',
|
||
'title' => __('داشبورد دسکتاپ', 'hesabix2'),
|
||
'desc' => __('همان پنل آرک در پنجرهٔ مستقل — بدون باز کردن مرورگر هر بار.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'icon' => 'invoice',
|
||
'title' => __('فاکتور و فروش', 'hesabix2'),
|
||
'desc' => __('صدور فاکتور، چاپ و پیگیری پرداخت با کیبورد و ماوس سریعتر.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'icon' => 'warehouse',
|
||
'title' => __('انبار و موجودی', 'hesabix2'),
|
||
'desc' => __('گردش کالا، چند انبار و هشدار کمبود روی میز کار.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'icon' => 'crm',
|
||
'title' => __('CRM یکپارچه', 'hesabix2'),
|
||
'desc' => __('مشتری، فرصت فروش و فعالیتها در کنار مالی و عملیات.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'icon' => 'reports',
|
||
'title' => __('گزارشهای مالی', 'hesabix2'),
|
||
'desc' => __('تراز، داشبورد و گزارشهای دورهای با فضای نمایش بزرگتر.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'icon' => 'secure',
|
||
'title' => __('ورود امن', 'hesabix2'),
|
||
'desc' => __('همان حساب آرک؛ نقشها و سطح دسترسی روی دسکتاپ هم اعمال میشود.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'icon' => 'notify',
|
||
'title' => __('اعلان دسکتاپ', 'hesabix2'),
|
||
'desc' => __('یادآوری سررسید، هشدار موجودی و رویدادهای مهم در نوار وظیفه.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'icon' => 'sync',
|
||
'title' => __('همگام با وب و موبایل', 'hesabix2'),
|
||
'desc' => __('یک منبع حقیقت روی سرور آرک — داده در همهٔ پلتفرمها یکسان است.', 'hesabix2'),
|
||
),
|
||
);
|
||
return apply_filters('hesabix2_windows_features', $features);
|
||
}
|
||
|
||
/**
|
||
* مراحل نصب MSI.
|
||
*
|
||
* @return array<int, array{title: string, desc: string}>
|
||
*/
|
||
function hesabix2_windows_install_steps() {
|
||
$steps = array(
|
||
array(
|
||
'title' => __('دانلود فایل MSI', 'hesabix2'),
|
||
'desc' => __('با دکمهٔ دانلود در همین صفحه، آخرین نسخه را از مخزن رسمی حسابیکس دریافت کنید.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'title' => __('اجرای نصبکننده', 'hesabix2'),
|
||
'desc' => __('فایل را باز کنید. در صورت هشدار SmartScreen، «اطلاعات بیشتر» و سپس «اجرای با این حال» را بزنید.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'title' => __('ورود به حساب', 'hesabix2'),
|
||
'desc' => __('پس از نصب، برنامه را از منوی استارت اجرا کنید و با همان حساب آرک وارد شوید.', 'hesabix2'),
|
||
),
|
||
);
|
||
return apply_filters('hesabix2_windows_install_steps', $steps);
|
||
}
|
||
|
||
/**
|
||
* پرسشهای متداول صفحهٔ ویندوز.
|
||
*
|
||
* @return array<int, array{q: string, a: string}>
|
||
*/
|
||
function hesabix2_windows_faq_items() {
|
||
$releases = hesabix2_windows_releases_url();
|
||
$items = array(
|
||
array(
|
||
'q' => __('چرا در Microsoft Store نیست؟', 'hesabix2'),
|
||
'a' => __('نسخهٔ ویندوز فعلاً بهصورت مستقیم از مخزن رسمی حسابیکس منتشر میشود تا بهروزرسانی سریعتر و کنترل نسخه برای کاربران آرک ممکن باشد.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'q' => __('فایل MSI امن است؟', 'hesabix2'),
|
||
'a' => __('فقط از همین صفحه یا صفحهٔ ریلیزهای رسمی آرک دانلود کنید. فایل از سرور source.hesabix.ir سرو میشود.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'q' => __('با نسخهٔ وب چه تفاوتی دارد؟', 'hesabix2'),
|
||
'a' => __('هستهٔ داده همان آرک است. اپ ویندوز برای کار روزمره روی دسکتاپ، اعلان سیستم و دسترسی سریعتر از آیکن استارت طراحی شده است.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'q' => __('چگونه بهروزرسانی میشود؟', 'hesabix2'),
|
||
'a' => __('نسخههای جدید در صفحهٔ ریلیزهای آرک منتشر میشوند. در اپ نیز در صورت وجود نسخهٔ جدید اعلان دریافت میکنید.', 'hesabix2'),
|
||
),
|
||
array(
|
||
'q' => __('روی چند رایانه نصب میشود؟', 'hesabix2'),
|
||
'a' => __('با حساب کاربری خود روی دستگاههای مجاز تیمتان. سطح دسترسی هر کاربر مطابق نقش تعریفشده در آرک است.', 'hesabix2'),
|
||
),
|
||
);
|
||
return apply_filters('hesabix2_windows_faq_items', $items);
|
||
}
|
||
|
||
/**
|
||
* ایجاد یکبارهٔ برگهٔ ویندوز.
|
||
*/
|
||
function hesabix2_maybe_create_windows_page() {
|
||
if (get_option('hesabix2_windows_page_created')) {
|
||
return;
|
||
}
|
||
$existing = get_pages(
|
||
array(
|
||
'meta_key' => '_wp_page_template',
|
||
'meta_value' => 'page-windows.php',
|
||
'number' => 1,
|
||
)
|
||
);
|
||
if (!empty($existing)) {
|
||
update_option('hesabix2_windows_page_created', 1);
|
||
return;
|
||
}
|
||
$by_path = get_page_by_path('windows');
|
||
if ($by_path) {
|
||
update_post_meta($by_path->ID, '_wp_page_template', 'page-windows.php');
|
||
update_option('hesabix2_windows_page_created', 1);
|
||
return;
|
||
}
|
||
$page_id = wp_insert_post(
|
||
array(
|
||
'post_title' => __('اپلیکیشن ویندوز حسابیکس', 'hesabix2'),
|
||
'post_name' => 'windows',
|
||
'post_status' => 'publish',
|
||
'post_type' => 'page',
|
||
'post_content' => '',
|
||
'post_excerpt' => __('دانلود مستقیم اپلیکیشن ویندوز حسابیکس — مدیریت کسبوکار روی دسکتاپ.', 'hesabix2'),
|
||
),
|
||
true
|
||
);
|
||
if (!is_wp_error($page_id) && $page_id) {
|
||
update_post_meta($page_id, '_wp_page_template', 'page-windows.php');
|
||
update_option('hesabix2_windows_page_created', 1);
|
||
}
|
||
}
|
||
add_action('after_setup_theme', 'hesabix2_maybe_create_windows_page', 34);
|