Plugin Directory

Changeset 3366500


Ignore:
Timestamp:
09/23/2025 12:38:40 PM (6 months ago)
Author:
Goback2
Message:

New ver 2.1

Location:
wc-software-license-manager
Files:
17 added
9 edited

Legend:

Unmodified
Added
Removed
  • wc-software-license-manager/trunk/.gitignore

    r2509622 r3366500  
    22.idea
    33.git
     4.*
  • wc-software-license-manager/trunk/README.txt

    r2509631 r3366500  
    1 === WooCommerce Software License Manager ===
    2 Contributors: goback2,ahortin
     1=== Software License Manager for Woocommerce ===
     2Contributors: goback2
    33Tags: wc, wc license, wc software license, software license, software license manager, woocommerce, wc licensing
    44Requires at least: 3.5.1
    5 Tested up to: 5.7
    6 Stable tag: 2.0.2
     5Tested up to: 6.8.2
     6Stable tag: 2.1
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    217217
    218218== Changelog ==
     219= 2.1 =
     220- Some improvment
     221- HPOS compatibility
     222
    219223
    220224= 2.0.1 =
  • wc-software-license-manager/trunk/includes/emails.php

    r2509622 r3366500  
    2222
    2323        // Check if licenses were generated
    24         $licenses = get_post_meta($order->get_id(), '_wc_slm_payment_licenses', true);
     24        $licenses = wc_slm_get_post_meta($order->get_id(), '_wc_slm_payment_licenses', true);
    2525
    2626        if ($licenses && count($licenses) != 0) {
  • wc-software-license-manager/trunk/includes/helper.php

    r2509622 r3366500  
    4040    wc_slm_log($msg);
    4141}
     42
     43function wc_slm_get_post_meta($order_id, $meta_key, $single)
     44{
     45
     46    if (wc_slm_is_hpos_enabled() && wc_slm_get_post_type($order_id) == 'shop_order') {
     47        $order = wc_get_order($order_id);
     48        return $order->get_meta($meta_key, $single);
     49    } else {
     50        return get_post_meta($order_id, $meta_key, $single);
     51    }
     52
     53
     54}
     55
     56function wc_slm_update_post_meta($order_id, $meta_key, $meta_value)
     57{
     58
     59    if (wc_slm_is_hpos_enabled() && wc_slm_get_post_type($order_id) == 'shop_order') {
     60        $order = wc_get_order($order_id);
     61        $order->update_meta_data($meta_key, $meta_value);
     62        return $order->save();
     63    } else {
     64        return update_post_meta($order_id, $meta_key, $meta_value);
     65    }
     66}
     67
     68function wc_slm_get_post_type($order_id)
     69{
     70
     71    if (wc_slm_is_hpos_enabled()) {
     72        return Automattic\WooCommerce\Utilities\OrderUtil::get_order_type($order_id);
     73    } else {
     74        return get_post_type($order_id);
     75    }
     76}
     77
     78function wc_slm_is_hpos_enabled()
     79{
     80    if (class_exists('Automattic\WooCommerce\Utilities\OrderUtil') && Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled()) {
     81        // HPOS usage is enabled.
     82        return true;
     83    }
     84    // Traditional CPT-based orders are in use.
     85    return false;
     86}
     87
  • wc-software-license-manager/trunk/includes/meta-boxes.php

    r2509622 r3366500  
    1515    $post_id = $post->ID;
    1616    $wc_slm_licensing_enabled = get_post_meta($post_id, '_wc_slm_licensing_enabled', true) ? true : false;
    17     $wc_slm_sites_allowed = esc_attr(get_post_meta($post_id, '_wc_slm_sites_allowed', true));
    18     $_wc_slm_licensing_renewal_period = esc_attr(get_post_meta($post_id, '_wc_slm_licensing_renewal_period', true));
     17
     18    $wc_slm_sites_allowed = esc_attr(wc_slm_get_post_meta($post_id, '_wc_slm_sites_allowed', true));
     19    $_wc_slm_licensing_renewal_period = esc_attr(wc_slm_get_post_meta($post_id, '_wc_slm_licensing_renewal_period', true));
    1920    $wc_slm_display = $wc_slm_licensing_enabled ? '' : ' style="display:none;"';
    2021
     
    7576    $_wc_slm_licensing_renewal_period = $_POST['_wc_slm_licensing_renewal_period'];
    7677
    77     update_post_meta(
     78    wc_slm_update_post_meta(
    7879        $post_id,
    7980        '_wc_slm_licensing_enabled',
     
    8283
    8384    if (isset($woocommerce_wc_slm_sites_allowed)) {
    84         update_post_meta(
     85        wc_slm_update_post_meta(
    8586            $post_id,
    8687            '_wc_slm_sites_allowed',
     
    8990    }
    9091
    91     update_post_meta(
     92    wc_slm_update_post_meta(
    9293        $post_id,
    9394        '_wc_slm_licensing_renewal_period',
  • wc-software-license-manager/trunk/includes/purchase.php

    r2509622 r3366500  
    178178
    179179    // Get License data
    180     $json = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', utf8_encode(wp_remote_retrieve_body($response)));
     180    $json = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', mb_convert_encoding(wp_remote_retrieve_body($response), "UTF-8"));
    181181    $license_data = json_decode($json);
    182182
     
    228228    if (count($licenses) != 0) {
    229229        wc_slm_log_msg(__('License Key assigned to Order ', 'wc-slm') . $order_id);
    230         update_post_meta($order_id, '_wc_slm_payment_licenses', $licenses);
     230        wc_slm_update_post_meta($order_id, '_wc_slm_payment_licenses', $licenses);
    231231    } else {
    232232        wc_slm_log_msg(__('License Key does not exist so cannot assign to order', 'wc-slm'));
     
    243243{
    244244
    245     $wc_slm_sites_allowed = absint(get_post_meta($product_id, '_wc_slm_sites_allowed', true));
     245    $wc_slm_sites_allowed = absint(wc_slm_get_post_meta($product_id, '_wc_slm_sites_allowed', true));
    246246
    247247    if (empty($wc_slm_sites_allowed)) {
     
    261261{
    262262
    263     $wc_slm_sites_allowed = absint(get_post_meta($product_id, '_wc_slm_licensing_renewal_period', true));
     263    $wc_slm_sites_allowed = absint(wc_slm_get_post_meta($product_id, '_wc_slm_licensing_renewal_period', true));
    264264
    265265    if (empty($wc_slm_sites_allowed)) {
     
    278278function wc_slm_is_licensing_enabled($download_id)
    279279{
    280     $licensing_enabled = absint(get_post_meta($download_id, '_wc_slm_licensing_enabled', true));
     280    $licensing_enabled = absint(wc_slm_get_post_meta($download_id, '_wc_slm_licensing_enabled', true));
    281281
    282282    // Set defaults
     
    310310function wc_get_payment_transaction_id($order_id)
    311311{
    312     return get_post_meta($order_id, '_transaction_id', true);
     312    return wc_slm_get_post_meta($order_id, '_transaction_id', true);
    313313}
    314314
     
    321321{
    322322    $output = '';
    323     $licenses = get_post_meta($order->get_id(), '_wc_slm_payment_licenses', true);
     323    $licenses = wc_slm_get_post_meta($order->get_id(), '_wc_slm_payment_licenses', true);
    324324
    325325    if ($licenses && count($licenses) != 0) {
     
    397397    if (is_array($response)) {
    398398        $json = $response['body'];
    399         $json = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', utf8_encode($json));
     399        $json = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', mb_convert_encoding($json, "UTF-8"));
    400400        $license_data = json_decode($json);
    401401    }
  • wc-software-license-manager/trunk/languages/wc-slm-fa_IR.po

    r2509622 r3366500  
    22msgstr ""
    33"Project-Id-Version: WC Software License Manager\n"
    4 "POT-Creation-Date: 2021-04-05 22:35+0430\n"
    5 "PO-Revision-Date: 2021-04-05 22:47+0430\n"
     4"POT-Creation-Date: 2025-09-23 15:24+0330\n"
     5"PO-Revision-Date: 2025-09-23 15:25+0330\n"
    66"Last-Translator: wp-master.ir <wp@wp-master.ir>\n"
    77"Language-Team: wp-master.ir <wp@wp-master.ir>\n"
     
    1818"esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
    1919"esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
    20 "X-Generator: Poedit 2.3\n"
     20"X-Generator: Poedit 3.4.2\n"
    2121"X-Loco-Target-Locale: es_ES\n"
    2222"X-Poedit-SearchPath-0: ..\n"
    2323
    24 #: ../includes/emails.php:20
     24#: ../includes/emails.php:21 ../old/includes/emails.php:21
    2525msgid "Order Completed. Adding License Key details for Order ID "
    2626msgstr "سفارش تکمیل شد. افزودن جزئیات لایسنسها برای سفارش "
    2727
    28 #: ../includes/emails.php:26
     28#: ../includes/emails.php:27 ../old/includes/emails.php:27
    2929msgid "License Key(s) found. Generating output for email content"
    3030msgstr "دارای لایسنس (های). تولید خروجی برای محتوای ایمیل"
    3131
    32 #: ../includes/emails.php:27 ../includes/purchase.php:315
     32#: ../includes/emails.php:28 ../includes/purchase.php:328
     33#: ../old/includes/emails.php:28 ../old/includes/purchase.php:328
    3334msgid "Your Licenses"
    3435msgstr "لایسنس(های) شما"
    3536
    36 #: ../includes/emails.php:29 ../includes/purchase.php:317
     37#: ../includes/emails.php:30 ../includes/purchase.php:330
     38#: ../old/includes/emails.php:30 ../old/includes/purchase.php:330
    3739msgid "Item"
    3840msgstr "محصول"
    3941
    40 #: ../includes/emails.php:30 ../includes/purchase.php:318
     42#: ../includes/emails.php:31 ../includes/purchase.php:331
     43#: ../old/includes/emails.php:31 ../old/includes/purchase.php:331
    4144msgid "License"
    4245msgstr "لایسنس"
    4346
    44 #: ../includes/emails.php:31
     47#: ../includes/emails.php:32 ../old/includes/emails.php:32
    4548msgid "Expire Date"
    4649msgstr "تاریخ انقضا"
    4750
    48 #: ../includes/emails.php:51
     51#: ../includes/emails.php:51 ../old/includes/emails.php:51
    4952msgid "Adding License Key details to Order email"
    5053msgstr "اضافه کردن جزئیات کلید لایسنس به ایمیل سفارش"
    5154
    52 #: ../includes/meta-boxes.php:39
     55#: ../includes/meta-boxes.php:42 ../old/includes/meta-boxes.php:41
    5356msgid "Enable Software Licensing"
    5457msgstr "فعال سازی لایسنس گذاری برای این محصول"
    5558
    56 #: ../includes/meta-boxes.php:45
     59#: ../includes/meta-boxes.php:48 ../old/includes/meta-boxes.php:47
    5760msgid "Renewal period (Yearly)"
    5861msgstr "دوره تمدید (سالانه)"
    5962
    60 #: ../includes/meta-boxes.php:48
     63#: ../includes/meta-boxes.php:53 ../old/includes/meta-boxes.php:52
    6164msgid ""
    6265"Enter the number of years for the Renewal Period. Enter 0 (zero) or leave "
     
    6669"را وارد کنید یا خالی بگذارید."
    6770
    68 #: ../includes/meta-boxes.php:51
     71#: ../includes/meta-boxes.php:56 ../old/includes/meta-boxes.php:55
    6972msgid "Number of Sites Allowed"
    7073msgstr "تعداد سایتهای اجازه داده شده"
    7174
    72 #: ../includes/meta-boxes.php:53
     75#: ../includes/meta-boxes.php:60 ../old/includes/meta-boxes.php:59
    7376msgid ""
    7477"Enter the number of sites that can be activated for a single License Key. "
     
    7881"باید بیشتر از 0 (صفر) باشد"
    7982
    80 #: ../includes/purchase.php:20
     83#: ../includes/purchase.php:21 ../old/includes/purchase.php:21
    8184msgid "Start of Software License Key creation"
    8285msgstr "شروع ساخت کلید لایسنس"
    8386
    84 #: ../includes/purchase.php:22
     87#: ../includes/purchase.php:23 ../old/includes/purchase.php:23
    8588msgid "API URL and API Secret Supplied. Attempting to create License key"
    8689msgstr "URL API و API Secret عرضه شده است. تلاش برای ایجاد کلید مجوز"
    8790
    88 #: ../includes/purchase.php:68
     91#: ../includes/purchase.php:71 ../old/includes/purchase.php:71
    8992msgid "Checking if licensing is enabled"
    9093msgstr "بررسی برای فعال بودن لایسنس"
    9194
    92 #: ../includes/purchase.php:71
     95#: ../includes/purchase.php:74 ../old/includes/purchase.php:74
    9396msgid "Checking if product is Downloadable"
    9497msgstr "بررسی برای دانلودی بودن محصول"
    9598
    96 #: ../includes/purchase.php:74
     99#: ../includes/purchase.php:77 ../old/includes/purchase.php:77
    97100msgid "Product is Downloadable"
    98101msgstr "محصول دانلودیست"
    99102
    100 #: ../includes/purchase.php:82 ../includes/purchase.php:85
     103#: ../includes/purchase.php:85 ../includes/purchase.php:88
     104#: ../old/includes/purchase.php:85 ../old/includes/purchase.php:88
    101105msgid "License Renewal Period for Product ID "
    102106msgstr "دوره تمدید برای شناسه محصول "
    103107
    104 #: ../includes/purchase.php:82
     108#: ../includes/purchase.php:85 ../old/includes/purchase.php:85
    105109msgid " is set to Lifetime"
    106110msgstr " بر روی مادام العمر تنظیم شده است"
    107111
    108 #: ../includes/purchase.php:85
     112#: ../includes/purchase.php:88 ../old/includes/purchase.php:88
    109113msgid " is set to "
    110114msgstr " تنظیم شده است "
    111115
    112 #: ../includes/purchase.php:85
     116#: ../includes/purchase.php:88 ../old/includes/purchase.php:88
    113117msgid " year"
    114118msgid_plural " years"
     
    116120msgstr[1] " سال"
    117121
    118 #: ../includes/purchase.php:91
     122#: ../includes/purchase.php:94 ../old/includes/purchase.php:94
    119123msgid "Product ID "
    120124msgstr "شناسه محصول "
    121125
    122 #: ../includes/purchase.php:91
     126#: ../includes/purchase.php:94 ../old/includes/purchase.php:94
    123127msgid " can be assigned to "
    124128msgstr " می تواند اختصاص داده شود به "
    125129
    126 #: ../includes/purchase.php:91
     130#: ../includes/purchase.php:94 ../old/includes/purchase.php:94
    127131msgid " sites"
    128132msgstr " سایت(ها)"
    129133
    130 #: ../includes/purchase.php:93
     134#: ../includes/purchase.php:96 ../old/includes/purchase.php:96
    131135msgid "License could not be created: Invalid sites allowed number."
    132136msgstr ""
     
    134138"است."
    135139
    136 #: ../includes/purchase.php:107
     140#: ../includes/purchase.php:110 ../old/includes/purchase.php:110
    137141msgid "Building query to send to the Software License Manager"
    138142msgstr "ساخت کوئری برای ارسال به Software License Manager"
    139143
    140 #: ../includes/purchase.php:129
     144#: ../includes/purchase.php:132 ../old/includes/purchase.php:132
    141145msgid "Attempting to create License Key for "
    142146msgstr "تلاش برای ساخت لایسنس برای "
    143147
    144 #: ../includes/purchase.php:140
     148#: ../includes/purchase.php:143 ../old/includes/purchase.php:143
    145149msgid "SUCCESS! License Key created for "
    146150msgstr "موفق! لایسنس ساخته شد برای "
    147151
    148 #: ../includes/purchase.php:151
     152#: ../includes/purchase.php:154 ../old/includes/purchase.php:154
    149153msgid "Licensing is not enabled for Product ID "
    150154msgstr "لایسنس برای شناسه محصول فعال نشده است "
    151155
    152 #: ../includes/purchase.php:171
     156#: ../includes/purchase.php:175 ../old/includes/purchase.php:175
    153157msgid "Error! Unable to Create License Key."
    154158msgstr "خطا! نمی توان لایسنس ساخت."
    155159
    156 #: ../includes/purchase.php:180
     160#: ../includes/purchase.php:184 ../old/includes/purchase.php:184
    157161msgid "Error! License created but can't retrieve Key"
    158162msgstr "خطا! لایسنس ساخته شد اما قابل بازیابی نیست"
    159163
    160 #: ../includes/purchase.php:197
     164#: ../includes/purchase.php:202 ../old/includes/purchase.php:202
    161165msgid "License Key(s) generated"
    162166msgstr "لایسنس(ها) ایجاد شدند"
    163167
    164 #: ../includes/purchase.php:202
     168#: ../includes/purchase.php:207 ../old/includes/purchase.php:207
    165169msgid "Payment Note created for Order "
    166170msgstr "یادداشت پرداخت ساخته شد برای سفارش "
    167171
    168 #: ../includes/purchase.php:205
     172#: ../includes/purchase.php:210 ../old/includes/purchase.php:210
    169173msgid ""
    170174"Error! License Key(s) could not be created or was not enabled on Product ID "
     
    172176"خطا! کلید (های) لایسنس را نمی توان برای شناسه محصول ایجاد کرد یا فعال نکرد "
    173177
    174 #: ../includes/purchase.php:206
     178#: ../includes/purchase.php:211 ../old/includes/purchase.php:211
    175179msgid "License Key(s) could not be created or was not enabled on product."
    176180msgstr "کلید (های) لایسنس در محصول ایجاد نمی شود یا فعال نیست."
    177181
    178 #: ../includes/purchase.php:211
     182#: ../includes/purchase.php:216 ../old/includes/purchase.php:216
    179183msgid "Payment Note saved for Order "
    180184msgstr "یادداشت پرداخت ذخیره شد برای سفارش "
    181185
    182 #: ../includes/purchase.php:223
     186#: ../includes/purchase.php:229 ../old/includes/purchase.php:229
    183187msgid "License Key assigned to Order "
    184188msgstr "کلید لایسنس به سفارش اختصاص داده شده است "
    185189
    186 #: ../includes/purchase.php:226
     190#: ../includes/purchase.php:232 ../old/includes/purchase.php:232
    187191msgid "License Key does not exist so cannot assign to order"
    188192msgstr "لایسنس وجود ندارد، بنابراین نمی توان به سفارش اختصاص داد"
    189193
    190 #: ../includes/purchase.php:274 ../includes/purchase.php:277
     194#: ../includes/purchase.php:284 ../includes/purchase.php:287
     195#: ../old/includes/purchase.php:284 ../old/includes/purchase.php:287
    191196msgid "Licensing for Product ID "
    192197msgstr "دادن لایسنس برای شناسه محصول "
    193198
    194 #: ../includes/purchase.php:274
     199#: ../includes/purchase.php:284 ../old/includes/purchase.php:284
    195200msgid " is ENABLED"
    196201msgstr " فعال شده است"
    197202
    198 #: ../includes/purchase.php:277
     203#: ../includes/purchase.php:287 ../old/includes/purchase.php:287
    199204msgid " is DISABLED"
    200205msgstr " غیرفعال شده است"
    201206
    202 #: ../includes/purchase.php:314
     207#: ../includes/purchase.php:327 ../old/includes/purchase.php:327
    203208msgid "Customer ID "
    204209msgstr "شناسه مشتری "
    205210
    206 #: ../includes/purchase.php:314
     211#: ../includes/purchase.php:327 ../old/includes/purchase.php:327
    207212msgid " is viewing License Keys for Order ID "
    208213msgstr " در حال مشاهده لایسنسها برای شناسه سفارش  "
    209214
    210 #: ../includes/purchase.php:338
     215#: ../includes/purchase.php:351 ../old/includes/purchase.php:351
    211216msgid "No Item assigned"
    212217msgstr "موردی اختصاص داده نشده است"
    213218
    214 #: ../includes/purchase.php:339
     219#: ../includes/purchase.php:352 ../old/includes/purchase.php:352
    215220msgid "No License Key assigned"
    216221msgstr "کلید لایسنسی اختصاص داده نشده است"
    217222
    218 #: ../includes/purchase.php:366
     223#: ../includes/purchase.php:381 ../old/includes/purchase.php:381
    219224msgid "Verifying License Key and Retrieving Registered Domains"
    220225msgstr "تأیید و بررسی لایسنس و بازیابی دامنه های ثبت شده"
    221226
    222 #: ../includes/purchase.php:378
     227#: ../includes/purchase.php:393 ../old/includes/purchase.php:393
    223228msgid "Error! Invalid response when verifying License Key"
    224229msgstr "خطا! هنگام تأیید لایسنس ، پاسخ نامعتبر است"
    225230
    226 #: ../includes/purchase.php:389
     231#: ../includes/purchase.php:404 ../old/includes/purchase.php:404
    227232msgid "License Key verified. Retrieving registered domains"
    228233msgstr "لایسنس تأیید شد. بازیابی دامنه های ثبت شده"
    229234
    230 #: ../includes/purchase.php:402
     235#: ../includes/purchase.php:415 ../old/includes/purchase.php:415
    231236msgid "Error! Unable to verify License Key"
    232237msgstr "خطا! تأیید لایسنس امکان پذیر نیست"
    233238
    234 #: ../includes/settings.php:18
     239#: ../includes/settings.php:19 ../old/includes/settings.php:19
    235240msgid "License Manager"
    236241msgstr "مدیریت لایسنس"
    237242
    238 #: ../includes/settings.php:34
     243#: ../includes/settings.php:37 ../old/includes/settings.php:37
    239244msgid "Software License Manager Settings"
    240245msgstr "تنظیمات پلاگین SLM"
    241246
    242 #: ../includes/settings.php:42
     247#: ../includes/settings.php:45 ../old/includes/settings.php:45
    243248msgid "API URL"
    244249msgstr "لینک API"
    245250
    246 #: ../includes/settings.php:43
     251#: ../includes/settings.php:46 ../old/includes/settings.php:46
    247252msgid ""
    248253"The URL for the site that has the Software License Manager plugin installed."
    249254msgstr "آدرس سایتی که افزونه Software License Manager نصب شده است."
    250255
    251 #: ../includes/settings.php:50
     256#: ../includes/settings.php:53 ../old/includes/settings.php:53
    252257msgid "Secret Key for Creation"
    253258msgstr "کدرمز برای ساخت"
    254259
    255 #: ../includes/settings.php:51
     260#: ../includes/settings.php:54 ../old/includes/settings.php:54
    256261msgid ""
    257262"This secret key will be used to authenticate any license creation request. "
     
    263268"افزونه Software License Manager تنظیم کرده اید."
    264269
    265 #: ../includes/settings.php:59
     270#: ../includes/settings.php:62 ../old/includes/settings.php:62
    266271msgid "Secret Key for Verfication"
    267272msgstr "کدرمز برای تایید"
    268273
    269 #: ../includes/settings.php:60
     274#: ../includes/settings.php:63 ../old/includes/settings.php:63
    270275msgid ""
    271276"This secret key will be used to authenticate any license verfication "
     
    278283"تنظیمات افزونه Software License Manager تنظیم کرده اید."
    279284
    280 #: ../includes/settings.php:68
     285#: ../includes/settings.php:71 ../old/includes/settings.php:71
    281286msgid "Enable Debug Logging"
    282287msgstr "فعال سازی حالت دیباگ"
    283288
    284 #: ../includes/settings.php:71
     289#: ../includes/settings.php:74 ../old/includes/settings.php:74
    285290msgid ""
    286291"If checked, debug messages will be written to slm_log.txt in the root of "
     
    290295"نوشته می شوند"
    291296
     297#: ../wc-software-license-manager.php:156
     298msgid "Software License Manager for Woocommerce"
     299msgstr "لایسنس منیجر برای ووکامرس بر مبنای SLM"
     300
     301#: ../wc-software-license-manager.php:157
     302msgid "Seamless integration between Woocommerce and Software License Manager"
     303msgstr "یکپارچه سازی ووکارس با پلاگین مدیریت لایسنس(Software License Manager)"
     304
    292305#~ msgid "Enable licensing for this download."
    293306#~ msgstr "فعال سازی لایسنس برای این محصول"
     
    301314#~ msgid "Secret Key"
    302315#~ msgstr "کد رمز پلاگین SLM"
    303 
    304 #~ msgid ""
    305 #~ "Seamless integration between Woocommerce and Software License "
    306 #~ "Manager(adopted from EDD Software License Manager -thanks to flowdee "
    307 #~ "<coder@flowdee.de>)"
    308 #~ msgstr ""
    309 #~ "یکپارچه سازی ووکارس با پلاگین مدیریت لایسنس(برگرفته از پلاگین EDD "
    310 #~ "Software License Manager - سپاس از نویسنده آن flowdee <coder@flowdee.de> )"
    311316
    312317#~ msgid "EDD Software License Manager Settings"
  • wc-software-license-manager/trunk/wc-software-license-manager.php

    r2509622 r3366500  
    11<?php
    22/**
    3  * Plugin Name:                 WC Software License Manager
     3 * Plugin Name:                 Software License Manager for Woocommerce
    44 * Plugin URI:                  https://github.com/shamloo/wc-software-license-manager
    55 * Description:                 Seamless integration between Woocommerce and Software License Manager
    6  * Version:                     2.0.2
    7  * Author:                      Omid Shamlu
    8  * Author URI:                  http://wp-master.ir
     6 * Version:                     2.1
     7 * Author:                      Omid Shamloo
     8 * Author URI:                  https://wp-master.ir
    99 * Text Domain:                 wc-slm
    1010 * Domain Path:                 /languages
    1111 * WC requires at least         2.5.0
    12  * WC tested up to:             3.2.0
     12 * WC tested up to:             10.2.1
     13 * Requires Plugins: woocommerce
    1314 *
    1415 *
    15  * Copyright 2015-2017 Omid Shamloo - http://wp-master.ir
     16 * Copyright 2015-2017 Omid Shamloo - https://wp-master.ir
    1617 * Copyright 2017-2018 Anthony Hortin - https://maddisondesigns.com
     18 * Copyright 2018-2025 Omid Shamloo - https://wp-master.ir
    1719 */
    1820
    1921// TODO:
    2022// https://wordpress.org/support/topic/modifying-for-variable-products
    21 // Add option to recreate manual linense in order edit page
     23// Add option to recreate manual license in order edit page
    2224// Add license columns in order table lists
    2325
     
    2628    exit;
    2729}
     30
     31
     32/**
     33 * activate action
     34 * like redirect to admin settings and ...
     35 */
     36register_activation_hook(__FILE__, ['WC_SLM', 'activation_hook']);
     37add_action('plugins_loaded', ['WC_SLM', 'plugins_loaded']);
     38
     39
     40// WC Hpos
     41add_action('before_woocommerce_init', function () {
     42    if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
     43        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
     44    }
     45});
     46
    2847
    2948if (!class_exists('WC_SLM')) {
     
    135154            // Load the default language files
    136155            load_plugin_textdomain('wc-slm', false, 'wc-software-license-manager/languages');
     156            __('Software License Manager for Woocommerce', 'wc-slm');
     157            __('Seamless integration between Woocommerce and Software License Manager', 'wc-slm');
    137158        }
    138159
     
    159180        {
    160181            // nothing
     182        }
     183
     184        public static function activation_hook()
     185        {
     186            add_option('wpm_wcslm_redirect_after_activation_option', true);
     187        }
     188
     189        public static function plugins_loaded()
     190        {
     191
     192            if (get_option('wpm_wcslm_redirect_after_activation_option', false)) {
     193                delete_option('wpm_wcslm_redirect_after_activation_option');
     194                exit(wp_redirect(admin_url('admin.php?page=wc-settings&tab=products&section=wc_slm')));
     195            }
     196
    161197        }
    162198    }
Note: See TracChangeset for help on using the changeset viewer.