Plugin Directory

Changeset 2418984


Ignore:
Timestamp:
11/15/2020 02:53:24 PM (4 years ago)
Author:
growniche
Message:

商品一覧のデフォルトの並び順を、商品コードの降順に変更。
サイトネットワークで有効化した場合でも、各種固定ページを自動生成できるよう修正。

Location:
simple-stripe-checkout/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • simple-stripe-checkout/trunk/readme.txt

    r2414739 r2418984  
    44Requires at least: 4.9.13
    55Tested up to: 5.5
    6 Stable tag: 1.1.0
     6Stable tag: 1.1.1
    77License: GPL v3 or later
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    4444= 1.1.0 =
    4545* 2020-11-08 定期支払に対応
     46= 1.1.1 =
     47* 2020-11-15 商品一覧のデフォルトの並び順を、商品コードの降順に変更
     48* 2020-11-15 サイトネットワークで有効化した場合でも、各種固定ページを自動生成できるよう修正
  • simple-stripe-checkout/trunk/simple-stripe-checkout.php

    r2414739 r2418984  
    1414}
    1515
    16 register_activation_hook(__FILE__, function() {
    17 
    18     // 固定ページ「決済完了」が未登録の場合
    19     if (!get_page_by_path(SimpleStripeCheckout::SLUG__CHECKEDOUT)) {
    20         // 決済完了の固定ページを作成
    21         $page_id = wp_insert_post(array(
    22             'post_name' => SimpleStripeCheckout::SLUG__CHECKEDOUT,
    23             'post_author' => 1,
    24             'post_title' => '決済完了',
    25             'post_content' => 'お支払いが完了しました。
     16register_activation_hook(__FILE__, function($network_wide) {
     17    $initialize_pages = function($name) {
     18        // 固定ページ「決済完了」が未登録の場合
     19        if (!get_page_by_path(SimpleStripeCheckout::SLUG__CHECKEDOUT)) {
     20            // 決済完了の固定ページを作成
     21            $page_id = wp_insert_post(array(
     22                'post_name' => SimpleStripeCheckout::SLUG__CHECKEDOUT,
     23                'post_author' => 1,
     24                'post_title' => '決済完了',
     25                'post_content' => 'お支払いが完了しました。
    2626
    2727ありがとうございます。
    2828引き続きよろしくお願いいたします。',
    29             'post_parent' => 0,
    30             'post_status' => 'publish',
    31             'post_type' => 'page'
    32         ));
    33         get_pages('include=' . $page_id);
    34     }
    35 
    36     // 固定ページ「キャンセル完了」が未登録の場合
    37     if (!get_page_by_path(SimpleStripeCheckout::SLUG__CANCEL)) {
    38         // キャンセル完了の固定ページを作成
    39         $page_id = wp_insert_post(array(
    40             'post_name' => SimpleStripeCheckout::SLUG__CANCEL,
    41             'post_author' => 1,
    42             'post_title' => 'キャンセル完了',
    43             'post_content' => 'お支払いのキャンセルを承りました。
     29                'post_parent' => 0,
     30                'post_status' => 'publish',
     31                'post_type' => 'page'
     32            ));
     33            get_pages('include=' . $page_id);
     34        }
     35        // 固定ページ「キャンセル完了」が未登録の場合
     36        if (!get_page_by_path(SimpleStripeCheckout::SLUG__CANCEL)) {
     37            // キャンセル完了の固定ページを作成
     38            $page_id = wp_insert_post(array(
     39                'post_name' => SimpleStripeCheckout::SLUG__CANCEL,
     40                'post_author' => 1,
     41                'post_title' => 'キャンセル完了',
     42                'post_content' => 'お支払いのキャンセルを承りました。
    4443
    4544ありがとうございます。
    4645またの機会がありましたらよろしくお願いいたします。',
    47             'post_parent' => 0,
    48             'post_status' => 'publish',
    49             'post_type' => 'page'
    50         ));
    51         get_pages('include=' . $page_id);
    52     }
    53 
    54     // 固定ページ「決済確定完了」が未登録の場合
    55     if (!get_page_by_path(SimpleStripeCheckout::SLUG__CAPTURE_COMPLETE)) {
    56         // 決済確定完了の固定ページを作成
    57         $page_id = wp_insert_post(array(
    58             'post_name' => SimpleStripeCheckout::SLUG__CAPTURE_COMPLETE,
    59             'post_author' => 1,
    60             'post_title' => '決済確定完了',
    61             'post_content' => '決済が確定し、お支払いが完了しました。
     46                'post_parent' => 0,
     47                'post_status' => 'publish',
     48                'post_type' => 'page'
     49            ));
     50            get_pages('include=' . $page_id);
     51        }
     52        // 固定ページ「決済確定完了」が未登録の場合
     53        if (!get_page_by_path(SimpleStripeCheckout::SLUG__CAPTURE_COMPLETE)) {
     54            // 決済確定完了の固定ページを作成
     55            $page_id = wp_insert_post(array(
     56                'post_name' => SimpleStripeCheckout::SLUG__CAPTURE_COMPLETE,
     57                'post_author' => 1,
     58                'post_title' => '決済確定完了',
     59                'post_content' => '決済が確定し、お支払いが完了しました。
    6260
    6361ありがとうございます。
    6462引き続きよろしくお願いいたします。',
    65             'post_parent' => 0,
    66             'post_status' => 'publish',
    67             'post_type' => 'page'
    68         ));
    69         get_pages('include=' . $page_id);
    70     }
    71 
    72     // 固定ページ「定期支払キャンセル完了」が未登録の場合
    73     if (!get_page_by_path(SimpleStripeCheckout::SLUG__CANCELED_SUBSCRIPTION)) {
    74         // 定期支払キャンセル完了の固定ページを作成
    75         $page_id = wp_insert_post(array(
    76             'post_name' => SimpleStripeCheckout::SLUG__CANCELED_SUBSCRIPTION,
    77             'post_author' => 1,
    78             'post_title' => '定期支払キャンセル完了',
    79             'post_content' => 'ご登録いただいていた定期支払いをキャンセルしました。
     63                'post_parent' => 0,
     64                'post_status' => 'publish',
     65                'post_type' => 'page'
     66            ));
     67            get_pages('include=' . $page_id);
     68        }
     69        // 固定ページ「定期支払キャンセル完了」が未登録の場合
     70        if (!get_page_by_path(SimpleStripeCheckout::SLUG__CANCELED_SUBSCRIPTION)) {
     71            // 定期支払キャンセル完了の固定ページを作成
     72            $page_id = wp_insert_post(array(
     73                'post_name' => SimpleStripeCheckout::SLUG__CANCELED_SUBSCRIPTION,
     74                'post_author' => 1,
     75                'post_title' => '定期支払キャンセル完了',
     76                'post_content' => 'ご登録いただいていた定期支払いをキャンセルしました。
    8077ご利用ありがとうございました。
    8178
    8279[gssc-product-name]',
    83             'post_parent' => 0,
    84             'post_status' => 'publish',
    85             'post_type' => 'page'
    86         ));
    87         get_pages('include=' . $page_id);
    88     }
    89 
     80                'post_parent' => 0,
     81                'post_status' => 'publish',
     82                'post_type' => 'page'
     83            ));
     84            get_pages('include=' . $page_id);
     85        }
     86    };
     87    if (is_multisite() && $network_wide) {
     88        foreach (get_sites(['fields'=>'ids']) as $blog_id) {
     89            switch_to_blog($blog_id);
     90            $initialize_pages();
     91        }
     92        restore_current_blog();
     93    }
     94    else {
     95        $initialize_pages();
     96    }
    9097});
    9198
     
    219226        };
    220227
    221         $orderby  = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : '';
     228        $orderby  = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'code';
    222229        $order    = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : '';
    223230        $orderDir = $order === 'asc' ? 1 : -1;
Note: See TracChangeset for help on using the changeset viewer.