• プラグイン一覧
    - WCEX Item Combo Set
    - WCEX Amazon Pay
    - WCEX Wishlist お気に入りリスト
  • リリース情報
  • お役立ちコラム
  • お問い合わせ
  • サポート
    • よくある質問
      • WCEX Amazon Pay
      • WCEX Wishlist お気に入りリスト
      • wcex-item-combo-set
    • リファレンス
      • WCEX Amazon Pay
      • WCEX Wishlist お気に入りリスト
      • wcex-item-combo-set
新規会員登録
ログイン
新規会員登録
ログイン
カート
  • プラグイン一覧
    • - WCEX Item Combo Set
    • - WCEX Amazon Pay
    • - WCEX Wishlist お気に入りリスト
  • リリース情報
  • お役立ちコラム
  • サポート
    • - よくある質問
      • - WCEX Amazon Pay
      • - WCEX Wishlist お気に入りリスト
      • - wcex-item-combo-set
    • - リファレンス
      • - WCEX Amazon Pay
      • - WCEX Wishlist お気に入りリスト
      • - wcex-item-combo-set
  • お問い合わせ
Aivec APPs > WCEX Wishlist お気に入りリスト > クラス > Activation
レファレンス
バージョン
3.1.6
絞り込み:
目的から探す
お気に入りデータを取得 お気に入りページのHTMLを取得 スナックバーアラート

目次

  • ソース
  • 関数

フック

  • アクション
  • フィルター

ファンクション

  • データ取得
  • ユーティリティー
  • 条件判断
  • 表示系

クラス

Activation

Activation/setup methods

ソース #ソース

ファイル: src/Activation.php

class Activation
{
    /**
     * Runs on plugin activation. Creates wishlist page and table
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @return void
     */
    public function activate() {
        $this->makeWishlistPage();
        $this->createWishlistTable();
    }

    /**
     * Creates wishlist page
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @global \wpdb $wpdb
     * @return void
     */
    private function makeWishlistPage() {
        global $wpdb;

        $datetime = get_date_from_gmt(gmdate('Y-m-d H:i:s', time()));
        $datetime_gmt = gmdate('Y-m-d H:i:s', time());

        $query = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_name = %s", WCEXWL_PAGE_SLUG);
        $pageid = $wpdb->get_var($query);

        if ($pageid === null) {
            $query = $wpdb->prepare(
                "INSERT INTO $wpdb->posts
                (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status,
                comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified,
                post_modified_gmt, post_content_filtered, post_parent, guid, menu_order, post_type,
                post_mime_type, comment_count)
                VALUES (%d, %s, %s, %s, %s, %s, %s,
                %s, %s, %s, %s, %s, %s, %s, %s,
                %s, %d, %s, %d, %s, %s, %d)",
                1,
                $datetime,
                $datetime_gmt,
                '',
                __('Wishlist', 'wcexwl'),
                '',
                'publish',
                'closed',
                'closed',
                '',
                WCEXWL_PAGE_SLUG,
                '',
                '',
                $datetime,
                $datetime_gmt,
                '',
                0,
                '',
                0,
                'page',
                '',
                0
            );
            $wpdb->query($query);
            $pageid = $wpdb->insert_id;
            if ($pageid !== null) {
                update_post_meta($pageid, '_wp_page_template', 'wishlist.php');
            }
        }
        update_option('wcex_wishlist_post_id', $pageid);
    }

    /**
     * Creates wishlist table
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @global \wpdb $wpdb
     * @return void
     */
    private function createWishlistTable() {
        global $wpdb;

        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
        $charset_collate = $wpdb->get_charset_collate();
        $table = Master::getWishlistTableName();

        if ($wpdb->get_var("SHOW TABLES LIKE '$table'") !== $table) {
            $sql = "CREATE TABLE $table (
                id BIGINT(20) AUTO_INCREMENT PRIMARY KEY,
                mem_id BIGINT(20) NOT NULL,
                quantity INTEGER NOT NULL,
                price DECIMAL(15, 2) DEFAULT NULL,
                advance VARCHAR(100) DEFAULT NULL,
                item_serial TEXT
            ) ENGINE=InnoDB {$charset_collate};";
            dbDelta($sql);
        }
    }
}

ソースを伸ばす ソースを縮める


関数 #関数

Top ↑

  • activate — Runs on plugin activation. Creates wishlist page and table
  • createWishlistTable — Creates wishlist table
  • makeWishlistPage — Creates wishlist page

  • 新規会員登録
  • ログイン
    • プラグイン一覧
    • 会社概要
    • リリース情報
    • よくある質問
    • お役立ちコラム
    • お問い合わせ
    • 個人情報保護方針
    • 特定商取引法に基づく表記
    • 情報セキュリティ基本方針
    • 利用規約

アイベック合同会社は「Welcart」「Amazon Pay」の公式パートナーです。

※Amazon、Amazon.co.jp、Amazon Payおよびそれらのロゴは、Amazon.com,inc.またはその関連会社の商標です。

© 2025 Aivec llc All Rights Reserved.