• プラグイン一覧
    - 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 お気に入りリスト > クラス > WishlistPage
レファレンス
バージョン
3.1.6
絞り込み:
目的から探す
お気に入りデータを取得 お気に入りページのHTMLを取得 スナックバーアラート

目次

  • ソース
  • 関数

フック

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

ファンクション

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

クラス

WishlistPage

Wishlist page HTML and JS

ソース #ソース

ファイル: src/Views/WishlistPage/WishlistPage.php

class WishlistPage
{
    const SCRIPT_HANDLE = 'wcexwl-wishlist';

    /**
     * Master object
     *
     * @var Master
     */
    protected $master;

    /**
     * Injects `Master` object
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @param Master $master
     * @return void
     */
    public function __construct(Master $master) {
        $this->master = $master;
    }

    /**
     * Registers hooks
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @return void
     */
    public function init() {
        add_action('wp_enqueue_scripts', [$this, 'loadEssentialAssets']);
        add_filter('usces_filter_template_redirect', [$this, 'handleWishlistPageTemplateLoad'], 1, 1);

        // deprecated hook
        add_filter('asumil_filter_wishlist_batch_dropdown', 'wcexwl_get_wishlist_batch_action_section', 10, 1);
    }

    /**
     * If the current page is the wishlist page, loads theme's `wishlist.php` if it exists,
     * otherwise loads default HTML for wishlist page and exits.
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @param bool $flag
     * @return bool `false` when not exiting with template content
     */
    public function handleWishlistPageTemplateLoad($flag) {
        if (!Utils::isWishlistPage($_SERVER['REQUEST_URI'])) {
            return $flag;
        }

        $parent_path = get_template_directory();
        $child_path = get_stylesheet_directory();
        /**
         * Filters the absolute path to the `wishlist.php` for the **parent theme**
         *
         * @important
         * @param string $parent_path Default: `get_template_directory() . '/wishlist.php'`
         */
        $parent_file = apply_filters('wcexwl_filter_wishlist_page_parent_path', $parent_path . '/wishlist.php');
        /**
         * Filters the absolute path to the `wishlist.php` for the **child theme**
         *
         * @important
         * @param string $child_path Default: `get_stylesheet_directory() . '/wishlist.php'`
         */
        $child_file = apply_filters('wcexwl_filter_wishlist_page_child_path', $child_path . '/wishlist.php');
        if (!file_exists($child_file) && !file_exists($parent_file)) {
            include(WCEXWL_PLUGIN_DIR . '/src/templates/wishlist.php');
            exit;
        }

        return $flag;
    }

    /**
     * Loads CSS/JS for wishlist page
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @global bool $usces_gp
     * @return void
     */
    public function loadEssentialAssets() {
        if (!Utils::isWishlistPage($_SERVER['REQUEST_URI'])) {
            return;
        }

        /**
         * Return `false` with this hook to prevent wishlist page CSS from being loaded
         *
         * @important
         * @param bool $flag Default: `true`
         */
        if (apply_filters('wcexwl_filter_wishlist_page_load_css', true)) {
            // load semantic-ui and common css
            Utils::loadCommonCss();
            Semantic::loadButtonCss();
            Semantic::loadLoaderCss();
            Semantic::loadDividerCss();
            Semantic::loadIconCss();
            Semantic::loadImageCss();
            Semantic::loadCheckboxCss();

            // load css for page
            wp_enqueue_style(
                'wcexwl-wishlist-page',
                WCEXWL_PLUGIN_URL . '/src/Styles/wishlist.css',
                [],
                WCEXWL_VERSION
            );
        }

        // load JS client SDK
        $this->master->loadClientSdk();

        wp_enqueue_script(
            'wishlist-bootstrap',
            WCEXWL_PLUGIN_URL . '/src/Views/WishlistPage/bootstrap.js',
            [],
            WCEXWL_VERSION,
            true
        );
        wp_localize_script('wishlist-bootstrap', 'wlbootstrap', ['theme' => Master::getThemeConfig()['name']]);

        /**
         * Fires after all wishlist page common/default JS/CSS has been enqueued
         *
         * Use this hook to enqueue your own JS/CSS on the wishlist page if necessary.
         *
         * @important
         */
        do_action('wcexwl_wishlist_page_on_load_assets');
        if (!usces_is_login()) {
            return;
        }

        $this->loadImplementationAssets();
    }

    /**
     * Extend to load assets for the implementation view
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @return void
     */
    protected function loadImplementationAssets() {
        wp_enqueue_script(
            self::SCRIPT_HANDLE,
            WCEXWL_PLUGIN_URL . '/src/Views/WishlistPage/wishlist.js',
            [],
            WCEXWL_VERSION,
            true
        );
        wp_localize_script(self::SCRIPT_HANDLE, 'wcexwl', $this->master->getScriptInjectionVariables());
        Snackbar::load([self::SCRIPT_HANDLE]);
    }
}

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


関数 #関数

Top ↑

  • __construct — Injects `Master` object
  • handleWishlistPageTemplateLoad — If the current page is the wishlist page, loads theme's `wishlist.php` if it exists, otherwise loads default HTML for wishlist page and exits.
  • init — Registers hooks
  • loadEssentialAssets — Loads CSS/JS for wishlist page
  • loadImplementationAssets — Extend to load assets for the implementation view

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

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

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

© 2025 Aivec llc All Rights Reserved.