Plugin Directory

Changeset 3795620


Ignore:
Timestamp:
11/11/2026 03:53:30 AM (less than one hour ago)
Author:
ThimPress
Message:

4.1.2

Location:
learnpress-wishlist/trunk
Files:
38 added
10 edited

Legend:

Unmodified
Added
Removed
  • learnpress-wishlist/trunk/config/elementor/wishlist.php

    r3143402 r3795620  
    33use Elementor\Controls_Manager;
    44use Elementor\Group_Control_Text_Shadow;
     5use Elementor\Group_Control_Border;
    56use Elementor\Group_Control_Typography;
    67use LearnPress\ExternalPlugin\Elementor\LPElementorControls;
    … …  
    1112        Controls_Manager::TAB_STYLE,
    1213        [
     14                'layout'       => LPElementorControls::add_control_type_select(
     15                        'layout',
     16                        esc_html__( 'Layout', 'learnpress-wishlist' ),
     17                        [
     18                                'classic'   => esc_html__( 'Classic', 'learnpress-wishlist' ),
     19                                'modern'    => esc_html__( 'Modern', 'learnpress-wishlist' ),
     20                                'icon-only' => esc_html__( 'Icon Only', 'learnpress-wishlist' ),
     21                        ],
     22                        'classic'
     23                ),
    1324                'add_button_color'              => LPElementorControls::add_control_type_color(
    1425                        'add_button_color',
    1526                        esc_html__( 'Color', 'learnpress-wishlist' ),
    1627                        [
    17                                 '{{WRAPPER}} .course-wishlist' => 'color: {{VALUE}};',
     28                                '{{WRAPPER}} .lp-button-wishlist-action , {{WRAPPER}} .lp-button-wishlist-action i' => 'color: {{VALUE}};',
    1829                        ]
    1930                ),
    … …  
    2233                        esc_html__( 'Color Active, Hover', 'learnpress-wishlist' ),
    2334                        [
    24                                 '{{WRAPPER}} .course-wishlist.on,{{WRAPPER}} .course-wishlist:hover' => 'color: {{VALUE}};',
     35                                '{{WRAPPER}} .lp-button-wishlist-action.wishlisted,{{WRAPPER}} .lp-button-wishlist-action:hover' => 'color: {{VALUE}};',
     36                                '{{WRAPPER}} .lp-button-wishlist-action:hover i, {{WRAPPER}} .lp-button-wishlist-action.wishlisted i' => 'color: {{VALUE}};'
    2537                        ]
    2638                ),
    … …  
    2941                        esc_html__( 'Background Color', 'learnpress-wishlist' ),
    3042                        [
    31                                 '{{WRAPPER}} .course-wishlist' => 'background-color: {{VALUE}};',
     43                                '{{WRAPPER}} .lp-button-wishlist-action' => 'background-color: {{VALUE}};',
    3244                        ]
    3345                ),
    … …  
    3648                        esc_html__( 'Background Color Hover', 'learnpress-wishlist' ),
    3749                        [
    38                                 '{{WRAPPER}} .course-wishlist:hover' => 'background-color: {{VALUE}};',
     50                                '{{WRAPPER}} .lp-button-wishlist-action:hover' => 'background-color: {{VALUE}};',
    3951                        ]
    4052                ),
    … …  
    4759                                'size_units' => [ 'px', '%', 'custom' ],
    4860                                'selectors'  => array(
    49                                         '{{WRAPPER}} .course-wishlist' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
     61                                        '{{WRAPPER}} .lp-button-wishlist-action' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
    5062                                ),
    5163                        ]
    … …  
    5466                        'button_typography',
    5567                        Group_Control_Typography::get_type(),
    56                         '{{WRAPPER}} .course-wishlist'
     68                        '{{WRAPPER}} .lp-button-wishlist-action'
     69                ),
     70                'button_border'     => LPElementorControls::add_group_control_type(
     71                        'button_border',
     72                        Group_Control_Border::get_type(),
     73                        '{{WRAPPER}} .lp-button-wishlist-action'
    5774                ),
    5875                'icon_size'                     => LPElementorControls::add_responsive_control_type(
    … …  
    6481                                'size_units' => [ 'px', 'em', 'custom' ],
    6582                                'selectors'  => array(
    66                                         '{{WRAPPER}} .course-wishlist:before' => 'font-size: {{SIZE}}{{UNIT}};',
     83                                        '{{WRAPPER}} .lp-button-wishlist-action i' => 'font-size: {{SIZE}}{{UNIT}};',
    6784                                ),
    6885                        ]
    … …  
    7693                                'size_units' => [ 'px', '%', 'custom' ],
    7794                                'selectors'  => array(
    78                                         '{{WRAPPER}} .course-wishlist:before' => 'margin-right: {{SIZE}}{{UNIT}};',
     95                                        '{{WRAPPER}} .lp-button-wishlist-action i' => 'margin-right: {{SIZE}}{{UNIT}};',
    7996                                ),
    8097                        ]
    … …  
    83100                        'button_shadow',
    84101                        Group_Control_Text_Shadow::get_type(),
    85                         '{{WRAPPER}} .course-wishlist'
     102                        '{{WRAPPER}} .lp-button-wishlist-action'
    86103                ),
    87104        ]
  • learnpress-wishlist/trunk/inc/Elementor/Widgets/CourseWishlistElementor.php

    r3143402 r3795620  
    44 *
    55 * @sicne 4.0.6
    6  * @version 1.0.0
     6 * @version 1.0.1
    77 */
    8 namespace LP_Addon_Wishlist\Elementor\Widgets;
     8namespace LearnPress\Wishlist\Elementor\Widgets;
    99
    1010use LearnPress\ExternalPlugin\Elementor\LPElementorWidgetBase;
    1111use LearnPress\ExternalPlugin\Elementor\Widgets\Course\SingleCourseBaseElementor;
    12 use LP_Addon_Wishlist_Preload;
     12use LearnPress\Wishlist\TemplateHooks\CourseWishlistTemplate;
     13use LP_Addon_Wishlist;
     14use LP_Debug;
     15use Throwable;
    1316
    1417class CourseWishlistElementor extends LPElementorWidgetBase {
    … …  
    1922                $this->name     = 'course_wishlist';
    2023                $this->keywords = [ 'course wishlist', 'wishlist' ];
     24                $this->add_script_depends( 'lp-course-wishlist-script' );
    2125                parent::__construct( $data, $args );
    2226        }
    2327
    2428        protected function register_controls() {
    25                 $this->controls = require_once LP_ADDON_WISHLIST_PATH . '/config/elementor/wishlist.php';
     29                $this->controls = require_once LP_Addon_Wishlist::instance()->plugin_folder_path . '/config/elementor/wishlist.php';
    2630                parent::register_controls();
    2731        }
    … …  
    3438        protected function render() {
    3539                try {
    36                         $course = $this->get_course();
    37                         if ( ! $course ) {
     40                        $courseModel = $this->get_course_model();
     41                        if ( ! $courseModel ) {
    3842                                return;
    3943                        }
    40                         wp_enqueue_script( 'lp-course-wishlist' );
    41                         LP_Addon_Wishlist_Preload::$addon->wishlist_button( $course->get_id() );
    42                 } catch ( \Throwable $e ) {
    43                         error_log( $e->getMessage() );
     44
     45                        $settings = $this->get_settings_for_display();
     46                        $layout   = $settings['layout'] ?? 'classic';
     47
     48                        echo CourseWishlistTemplate::instance()->html_button_action( $courseModel, [ 'layout' => $layout ] );
     49
     50                } catch ( Throwable $e ) {
     51                        LP_Debug::error_log( $e );
    4452                }
    4553        }
  • learnpress-wishlist/trunk/inc/Elementor/WishListElementorHandler.php

    r3143402 r3795620  
    66 *
    77 * @since 4.0.6
    8  * @version 1.0.0
     8 * @version 1.0.1
    99 */
    10 namespace LP_Addon_Wishlist\Elementor;
     10namespace LearnPress\Wishlist\Elementor;
    1111
    1212use LearnPress\Helpers\Singleton;
    13 use LP_Addon_Wishlist\Elementor\Widgets\CourseWishlistElementor;
     13use LearnPress\Wishlist\Elementor\Widgets\CourseWishlistElementor;
     14use LearnPress\Wishlist\Elementor\Widgets\CourseWishlistLoopElementor;
    1415
    1516class WishListElementorHandler {
    … …  
    3031         */
    3132        public function register_widgets( array $lp_widgets ): array {
    32                 include_once LP_ADDON_WISHLIST_INC . 'Elementor/Widgets/CourseWishlistElementor.php';
     33                //include_once LP_ADDON_WISHLIST_INC . 'Elementor/Widgets/CourseWishlistElementor.php';
    3334
    34                 $lp_widgets['course-wishlist'] = CourseWishlistElementor::class;
     35                $lp_widgets['course-wishlist']      = CourseWishlistElementor::class;
     36                $lp_widgets['course-wishlist-loop'] = CourseWishlistLoopElementor::class;
    3537
    3638                return $lp_widgets;
  • learnpress-wishlist/trunk/inc/functions.php

    r3143402 r3795620  
    2222         */
    2323        function learn_press_course_wishlist_template( $name, $args = [] ) {
     24                _deprecated_function( __FUNCTION__, '4.0.5' );
     25                return;
    2426                //_deprecated_function( __FUNCTION__, '4.0.5', 'LP_Addon_Wishlist_Preload::$addon->get_template' );
    25                 LP_Addon_Wishlist_Preload::$addon->get_template( $name, $args );
     27                //LP_Addon_Wishlist_Preload::$addon->get_template( $name, $args );
    2628                //learn_press_get_template( $name, $args, learn_press_template_path() . '/addons/wishlist/', LP_ADDON_WISHLIST_TEMPLATE );
    2729        }
    … …  
    3739         */
    3840        function learn_press_wishlist_get_template( $name, $args = null ) {
     41                _deprecated_function( __FUNCTION__, '4.0.5' );
     42                return;
    3943                //_deprecated_function( __FUNCTION__, '4.0.5', 'LP_Addon_Wishlist_Preload::$addon->get_template' );
    40                 learn_press_get_template( $name, $args, learn_press_template_path() . '/addons/wishlist/', LP_ADDON_WISHLIST_PATH . '/templates/' );
     44                //learn_press_get_template( $name, $args, learn_press_template_path() . '/addons/wishlist/', LP_ADDON_WISHLIST_PATH . '/templates/' );
    4145        }
    4246}
    4347
     48// Theme ivy-school is using this hook, override file user-wishlist.php
    4449add_action( 'learn_press_wishlist_loop_item_title', 'learn_press_wishlist_loop_item_title', 5 );
    4550
    … …  
    4752        /**
    4853         * Loop item title.
     54         *
     55         * Theme ivy-school is using this function.
    4956         */
    5057        function learn_press_wishlist_loop_item_title() {
    … …  
    6168         *
    6269         * @return bool
     70         * @using theme coaching is using
    6371         */
    6472        function learn_press_user_wishlist_has_course( $course_id = null, $user_id = null ) {
    … …  
    7179                }
    7280
    73                 $wish_list = (array) get_user_meta( $user_id, '_lpr_wish_list', true );
     81                $wish_list = LP_Addon_Wishlist::get_courses_wishlist( $user_id );
    7482
    7583                return in_array( $course_id, $wish_list );
    7684        }
    7785}
    78 
    79 if ( ! function_exists( 'learn_press_buddypress_is_active' ) ) {
    80         /**
    81          * Check BuddyPress active.
    82          *
    83          * @return bool
    84          */
    85         function learn_press_buddypress_is_active() {
    86                 if ( ! function_exists( 'is_plugin_active' ) ) {
    87                         include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    88                 }
    89 
    90                 return class_exists( 'BuddyPress' ) && is_plugin_active( 'buddypress/bp-loader.php' );
    91         }
    92 }
    93 
    94 if ( learn_press_buddypress_is_active() ) {
    95 
    96         /*
    97          * Set up sub admin bar wishlist.
    98          */
    99         add_filter( 'learn_press_bp_courses_bar', 'learn_press_bp_courses_bar_wishlist', 20 );
    100         function learn_press_bp_courses_bar_wishlist( $wp_admin_nav ) {
    101 
    102                 $courses_slug = apply_filters( 'learn_press_bp_courses_slug', '' );
    103                 $courses_link = learn_press_get_current_bp_link();
    104 
    105                 $wp_admin_nav[] = array(
    106                         'parent' => 'my-account-' . $courses_slug,
    107                         'id'     => 'my-account-' . $courses_slug . '-wishlist',
    108                         'title'  => __( 'Wishlist', 'learnpress_wishlist' ),
    109                         'href'   => trailingslashit( $courses_link . 'wishlist' ),
    110                 );
    111 
    112                 return $wp_admin_nav;
    113         }
    114 
    115         /*
    116          * Setup sub navigation wishlist.
    117          */
    118         if ( bp_is_my_profile() || current_user_can( 'manage_options' ) ) {
    119                 add_filter( 'learn_press_bp_courses_sub_navs', 'learn_press_bp_courses_nav_wishlist' );
    120 
    121                 function learn_press_bp_courses_nav_wishlist( $sub_navs ) {
    122                         $nav_wishlist = array(
    123                                 'name'                    => __( 'Wishlist', 'learnpress_wishlist' ),
    124                                 'slug'                    => 'wishlist',
    125                                 'show_for_displayed_user' => false,
    126                                 'position'                => 10,
    127                                 'screen_function'         => 'learn_press_bp_courses_wishlist',
    128                                 'parent_url'              => learn_press_get_current_bp_link(),
    129                                 'parent_slug'             => apply_filters( 'learn_press_bp_courses_slug', '' ),
    130                         );
    131                         array_push( $sub_navs, $nav_wishlist );
    132 
    133                         return $sub_navs;
    134                 }
    135 
    136                 function learn_press_bp_courses_wishlist() {
    137                         add_action( 'bp_template_title', 'learn_press_bp_courses_wishlist_title' );
    138                         add_action( 'bp_template_content', 'learn_press_bp_courses_wishlist_content' );
    139                         bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    140                 }
    141 
    142                 /*
    143                  * Setup title of navigation all.
    144                  */
    145                 function learn_press_bp_courses_wishlist_title() {
    146                         echo __( 'Your wishlist', 'learnpress_wishlist' );
    147                 }
    148 
    149                 /*
    150                  * Setup content of navigation all.
    151                  */
    152                 function learn_press_bp_courses_wishlist_content() {
    153                         global $bp;
    154                         echo apply_filters( 'learn_press_user_wishlist_tab_content', '', get_user_by( 'id', $bp->displayed_user->id ) );
    155                 }
    156         }
    157 }
  • learnpress-wishlist/trunk/inc/load.php

    r3143402 r3795620  
    99
    1010// Prevent loading this file directly
     11use LearnPress\Helpers\Template;
    1112use LearnPress\Models\CourseModel;
    1213use LearnPress\Models\UserModel;
    13 use LP_Addon_Wishlist\Elementor\WishListElementorHandler;
     14use LearnPress\Wishlist\Elementor\WishListElementorHandler;
     15use LearnPress\Wishlist\TemplateHooks\CoursesWishlistTemplate;
     16use LearnPress\Wishlist\TemplateHooks\CourseWishlistTemplate;
     17use LearnPress\Wishlist\Gutenberg\Blocks\ButtonWishListBlockType;
    1418
    1519defined( 'ABSPATH' ) || exit;
    … …  
    1923         */
    2024        class LP_Addon_Wishlist extends LP_Addon {
     25                public $version         = LP_ADDON_WISHLIST_VER;
     26                public $require_version = LP_ADDON_WISHLIST_REQUIRE_VER;
     27                public $plugin_file     = LP_ADDON_WISHLIST_FILE;
     28                public $text_domain     = 'learnpress-wishlist';
     29
     30                public static function instance() {
     31                        static $instance = null;
     32                        if ( is_null( $instance ) ) {
     33                                $instance = new self();
     34                        }
     35
     36                        return $instance;
     37                }
    2138
    2239                /**
    … …  
    2542                protected $_tab_slug = '';
    2643
    27                 /**
    28                  * @var string
    29                  */
    30                 public $version = LP_ADDON_WISHLIST_VER;
    31 
    32                 /**
    33                  * @var string
    34                  */
    35                 public $require_version = LP_ADDON_WISHLIST_REQUIRE_VER;
    36 
    37                 /**
    38                  * Path file addon
    39                  *
    40                  * @var string
    41                  */
    42                 public $plugin_file = LP_ADDON_WISHLIST_FILE;
     44                const META_KEY = '_lpr_wish_list';
    4345
    4446                /**
    … …  
    4749                public function __construct() {
    4850                        parent::__construct();
     51                        $this->hooks();
    4952                        add_filter( 'learn-press/profile-tabs', array( $this, 'wishlist_tab' ), 100, 1 );
    5053                        $this->_tab_slug = sanitize_title( __( 'wishlist', 'learnpress-wishlist' ) );
    51                 }
    52 
    53                 /**
    54                  * Defined constants.
    55                  */
    56                 protected function _define_constants() {
    57                         define( 'LP_ADDON_WISHLIST_PATH', dirname( LP_ADDON_WISHLIST_FILE ) );
    58                         define( 'LP_ADDON_WISHLIST_INC', LP_ADDON_WISHLIST_PATH . '/inc/' );
    59                         define( 'LP_ADDON_WISHLIST_TEMPLATE', LP_ADDON_WISHLIST_PATH . '/templates/' );
     54                        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ) );
     55                        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_style' ) );
    6056                }
    6157
    … …  
    6460                 */
    6561                protected function _includes() {
    66                         include_once LP_ADDON_WISHLIST_INC . 'functions.php';
     62                        include_once $this->plugin_folder_path . '/inc/functions.php';
    6763                        if ( is_plugin_active( 'elementor/elementor.php' ) ) {
    68                                 include_once LP_ADDON_WISHLIST_INC . 'Elementor/WishListElementorHandler.php';
     64                                //include_once LP_ADDON_WISHLIST_INC . 'Elementor/WishListElementorHandler.php';
    6965                                WishListElementorHandler::instance();
    7066                        }
    7167
    7268                        // Rest API
    73                         include_once LP_ADDON_WISHLIST_INC . 'rest-api/class-lp-rest-wishlist-v1-controller.php';
    74                         include_once LP_ADDON_WISHLIST_INC . 'rest-api/class-rest-api.php';
     69                        include_once $this->plugin_folder_path . '/inc/rest-api/class-lp-rest-wishlist-v1-controller.php';
     70                        include_once $this->plugin_folder_path . '/inc/rest-api/class-rest-api.php';
    7571                }
    7672
    … …  
    7874                 * Init hooks.
    7975                 */
    80                 protected function _init_hooks() {
     76                protected function hooks() {
    8177                        add_action( 'learn-press/after-course-buttons', array( $this, 'wishlist_button' ), 100 );
    8278                        add_filter( 'learn_press_profile_tab_endpoints', array( $this, 'profile_tab_endpoints' ) );
    83                         add_filter( 'lean-press/single-course/offline/info-bar', [ $this, 'single_course_offline' ], 10, 3 );
     79                        add_filter(
     80                                'learn-press/single-course/offline/section-right/info-meta',
     81                                [
     82                                        $this,
     83                                        'single_course_offline',
     84                                ],
     85                                10,
     86                                3
     87                        );
    8488                        add_action( 'lp/template/archive-course/description', [ $this, 'load_js_css_on_archive_course' ] );
     89                        add_action( 'learn-press/user-profile', [ $this, 'load_js_css_on_archive_course' ] );
    8590                        LP_Request::register_ajax( 'toggle_course_wishlist', array( $this, 'toggle_course_wishlist' ) );
     91                        add_filter( 'learn-press/config/block-elements', array( $this, 'add_block_elements' ) );
    8692
    8793                        //$this->rewrite_endpoint();
     94                        add_filter(
     95                                'learn-press/single-course/social-share/sections',
     96                                [
     97                                        $this,
     98                                        'display_on_single_course_modern_layout',
     99                                ],
     100                                10,
     101                                3
     102                        );
     103                        // Load js, css on list courses
     104                        add_action(
     105                                'learn-press/list-courses/layout',
     106                                function () {
     107                                        wp_enqueue_style( 'lp-course-wishlist' );
     108                                        wp_enqueue_script( 'lp-course-wishlist-script' );
     109                                }
     110                        );
     111                        add_action(
     112                                'learn-press/single-instructor/layout',
     113                                function () {
     114                                        wp_enqueue_style( 'lp-course-wishlist' );
     115                                        wp_enqueue_script( 'lp-course-wishlist-script' );
     116                                }
     117                        );
     118                        // Load js, css for course related section (fires BEFORE AJAX)
     119                        add_action(
     120                                'learn-press/single-course/courses-related/layout',
     121                                function () {
     122                                        wp_enqueue_style( 'lp-course-wishlist' );
     123                                        wp_enqueue_script( 'lp-course-wishlist-script' );
     124                                }
     125                        );
     126                        add_filter(
     127                                'learn-press/layout/list-courses/item/section-top',
     128                                [
     129                                        $this,
     130                                        'display_on_list_course_layout',
     131                                ],
     132                                10,
     133                                3
     134                        );
     135                        // Hook for course related section (uses different filter)
     136                        add_filter(
     137                                'learn-press/list-courses/related/layout/item/section',
     138                                [
     139                                        $this,
     140                                        'display_on_related_course_layout',
     141                                ],
     142                                10,
     143                                3
     144                        );
    88145                }
    89146
    … …  
    92149                 * Wishlist scripts.
    93150                 */
    94                 protected function _enqueue_assets() {
     151                public function enqueue_assets() {
    95152                        $ver = LP_ADDON_WISHLIST_VER;
    96153                        $min = '.min';
    … …  
    103160                        wp_register_style(
    104161                                'lp-course-wishlist',
    105                                 LP_Addon_Wishlist_Preload::$addon->get_plugin_url( "/assets/css/wishlist{$is_rtl}{$min}.css" ),
     162                                $this->get_plugin_url( "/assets/dist/css/wishlist{$is_rtl}{$min}.css" ),
    106163                                [],
    107164                                $ver
    … …  
    109166                        wp_register_script(
    110167                                'lp-course-wishlist',
    111                                 LP_Addon_Wishlist_Preload::$addon->get_plugin_url( "/assets/js/dist/wishlist{$min}.js" ),
     168                                $this->get_plugin_url( "/assets/dist/js/wishlist{$min}.js" ),
    112169                                [ 'jquery' ],
    113170                                $ver,
    114171                                [ 'strategy' => 'async' ]
    115172                        );
     173                        wp_register_script(
     174                                'lp-course-wishlist-script',
     175                                $this->get_plugin_url( "/assets/dist/js/lp-wishlist{$min}.js" ),
     176                                [],
     177                                $ver,
     178                                [ 'strategy' => 'async' ]
     179                        );
     180
     181                        // Load js for Eduma theme override old template button.
     182                        $path        = 'addons/' . str_replace( 'learnpress-', '', $this->plugin_folder_name ) . '/';
     183                        $is_override = Template::check_template_is_override( $path . 'button.php' );
     184                        if ( $is_override ) {
     185                                wp_enqueue_script( 'lp-course-wishlist' );
     186                        }
     187                }
     188
     189                /**
     190                 * Register or enqueue admin styles
     191                 *
     192                 * @param array $styles
     193                 *
     194                 * @return array
     195                 * @since 4.0.9
     196                 * @version 1.0.0
     197                 */
     198                public function enqueue_admin_style() {
     199                        // Only enqueue on Site Editor or Block Editor screens for performance optimization
     200                        $screen = get_current_screen();
     201                        if ( ! $screen ) {
     202                                return;
     203                        }
     204
     205                        // Check if we're in Site Editor, Block Editor, or widget block editor
     206                        $allowed_screens = [
     207                                'site-editor',           // Site Editor (FSE)
     208                                'widgets',               // Block-based widgets
     209                        ];
     210
     211                        $is_block_editor   = $screen->is_block_editor();
     212                        $is_allowed_screen = in_array( $screen->id, $allowed_screens, true );
     213
     214                        if ( ! $is_block_editor && ! $is_allowed_screen ) {
     215                                return;
     216                        }
     217
     218                        $ver = LP_ADDON_WISHLIST_VER;
     219                        $min = '.min';
     220                        if ( LP_Debug::is_debug() ) {
     221                                $min = '';
     222                                $ver = uniqid();
     223                        }
     224                        $is_rtl = is_rtl() ? '-rtl' : '';
     225
     226                        wp_register_style(
     227                                'lp-admin-wishlist-block',
     228                                LP_Addon_Wishlist_Preload::$addon->get_plugin_url( "/assets/dist/css/admin-wishlist-block{$is_rtl}{$min}.css" ),
     229                                [],
     230                                $ver
     231                        );
     232
     233                        wp_enqueue_style( 'lp-admin-wishlist-block' );
    116234                }
    117235
    … …  
    132250
    133251                public function toggle_course_wishlist() {
    134                         sleep( 1 );
    135252                        $nonce = ! empty( $_POST['nonce'] ) ? $_POST['nonce'] : null;
    136253                        if ( ! wp_verify_nonce( $nonce, 'course-toggle-wishlist' ) ) {
    … …  
    141258                        $user_id   = get_current_user_id();
    142259
     260                        $user = UserModel::find( $user_id, true );
     261                        if ( ! $user ) {
     262                                return;
     263                        }
     264
    143265                        if ( ( get_post_type( $course_id ) != 'lp_course' ) || ! $user_id ) {
    144266                                return;
    145267                        }
    146268                        $state    = ! empty( $_POST['state'] ) ? $_POST['state'] : false;
    147                         $wishlist = LP_Addon_Wishlist::get_courses_wishlist( $user_id );
     269                        $wishlist = self::get_courses_wishlist( $user_id );
    148270                        if ( $state === false ) {
    149271                                $state = in_array( $course_id, $wishlist ) ? 'off' : 'on';
    … …  
    160282                        }
    161283                        if ( sizeof( $wishlist ) ) {
    162                                 update_user_meta( $user_id, '_lpr_wish_list', $wishlist );
     284                                $user->set_meta_value_by_key( '_lpr_wish_list', $wishlist );
    163285                        } else {
    164286                                delete_user_meta( $user_id, '_lpr_wish_list' );
    165                         }
     287                                unset( $user->meta_data->_lpr_wish_list );
     288                        }
     289
    166290                        learn_press_send_json(
    167291                                array(
    … …  
    206330                 * Show wishlist button.
    207331                 *
    208                  * @param $course_id
     332                 * @param int $course_id
     333                 * @param string $layout
    209334                 *
    210335                 * @return void
    211336                 */
    212                 public function wishlist_button( $course_id = 0 ) {
     337                public function wishlist_button( $course_id = 0, $layout = 'modern' ) {
    213338                        $user_id = get_current_user_id();
    214339                        if ( ! $course_id ) {
    … …  
    216341                        }
    217342
    218                         //      If user or course are invalid then return.
     343                        //  If user or course are invalid then return.
    219344                        if ( ! $user_id || ! $course_id ) {
     345                                return;
     346                        }
     347
     348                        $course = CourseModel::find( $course_id, true );
     349                        if ( ! $course ) {
    220350                                return;
    221351                        }
    … …  
    226356                        }
    227357
    228                         wp_enqueue_style( 'lp-course-wishlist' );
    229                         wp_enqueue_script( 'lp-course-wishlist' );
    230 
    231                         $classes = array( 'course-wishlist' );
    232                         $state   = $this->has_in_wishlist( $course_id, $user ) ? 'on' : 'off';
    233 
    234                         if ( $state == 'on' ) {
    235                                 $classes[] = 'on';
    236                         }
    237                         $classes = apply_filters( 'learn_press_course_wishlist_button_classes', $classes, $course_id );
    238                         $title   = $this->_get_state_title( $state );
    239 
    240                         // fetch template
    241                         LP_Addon_Wishlist_Preload::$addon->get_template(
    242                                 'button.php',
    243                                 compact( 'user_id', 'course_id', 'classes', 'title', 'state' )
    244                         );
     358                        $path        = 'addons/' . str_replace( 'learnpress-', '', $this->plugin_folder_name ) . '/';
     359                        $is_override = Template::check_template_is_override( $path . 'button.php' );
     360                        if ( $is_override || $layout === 'old' ) {
     361                                // Load template old, for some themes override.
     362                                wp_enqueue_style( 'lp-course-wishlist' );
     363                                wp_enqueue_script( 'lp-course-wishlist' );
     364
     365                                $classes = array( 'course-wishlist' );
     366                                $state   = $this->has_in_wishlist( $course_id, $user ) ? 'on' : 'off';
     367
     368                                if ( $state == 'on' ) {
     369                                        $classes[] = 'on';
     370                                }
     371                                $classes = apply_filters( 'learn_press_course_wishlist_button_classes', $classes, $course_id );
     372                                $title   = $this->_get_state_title( $state );
     373
     374                                $this->get_template(
     375                                        'button.php',
     376                                        compact( 'user_id', 'course_id', 'classes', 'title', 'state' )
     377                                );
     378                        } else {
     379                                echo CourseWishlistTemplate::instance()->html_button_action( $course );
     380                        }
    245381                }
    246382
    … …  
    262398                                'callback' => array( $this, 'wishlist_tab_content' ),
    263399                                'priority' => 20,
    264                                 'icon'     => '<i class="fas fa-heart"></i>',
     400                                'icon'     => '<i class="lp-icon-heart-o"></i>',
    265401                        );
    266402
    … …  
    277413                        $profile      = LP_Profile::instance();
    278414                        $viewing_user = $profile->get_user();
    279                         LP_Addon_Wishlist_Preload::$addon->get_template(
    280                                 'user-wishlist.php',
    281                                 array(
    282                                         'wishlist' => $this->get_wishlist_courses( $viewing_user->get_id() ),
    283                                 )
    284                         );
     415
     416                        $path        = 'addons/' . str_replace( 'learnpress-', '', $this->plugin_folder_name ) . '/';
     417                        $is_override = Template::check_template_is_override( $path . 'user-wishlist.php' );
     418                        if ( $is_override ) {
     419                                $this->get_template(
     420                                        'user-wishlist.php',
     421                                        array(
     422                                                'wishlist' => $this->get_wishlist_courses( $viewing_user->get_id() ),
     423                                        )
     424                                );
     425                        } else {
     426                                echo CoursesWishlistTemplate::instance()->html_list_courses();
     427                        }
    285428                }
    286429
    … …  
    331474                        }
    332475
    333                         $wish_list = $user->get_meta_value_by_key( '_lpr_wish_list', [] );
     476                        $wish_list = $user->get_meta_value_by_key( self::META_KEY, [] );
    334477
    335478                        return $wish_list;
     479                }
     480
     481                /**
     482                 * Add or remove course to wishlist
     483                 *
     484                 * @param UserModel $userModel
     485                 * @param CourseModel $courseModel
     486                 *
     487                 * @return boolean
     488                 */
     489                public static function user_add_or_remove_wishlist_course(
     490                        UserModel $userModel,
     491                        CourseModel $courseModel
     492                ): bool {
     493                        $wishlist_courses = self::get_courses_wishlist( $userModel->get_id() );
     494
     495                        $course_id = $courseModel->get_id();
     496
     497                        if ( in_array( $course_id, $wishlist_courses, true ) ) {
     498                                // Remove from wishlist.
     499                                unset( $wishlist_courses[ array_search( $course_id, $wishlist_courses, true ) ] );
     500                                $status_wishlisted = false;
     501                        } else {
     502                                // Add to wishlist.
     503                                $wishlist_courses[] = $course_id;
     504                                $wishlist_courses   = array_unique( $wishlist_courses );
     505                                $status_wishlisted  = true;
     506                        }
     507
     508                        $userModel->set_meta_value_by_key( self::META_KEY, $wishlist_courses );
     509
     510                        return $status_wishlisted;
     511                }
     512
     513                /**
     514                 * Update course ids wishlist for user
     515                 *
     516                 * @param UserModel $user
     517                 * @param array $wish_list
     518                 *
     519                 * @return void
     520                 */
     521                public static function update_courses_wishlist( UserModel $user, array $wish_list ) {
     522                        $user->set_meta_value_by_key( self::META_KEY, $wish_list );
    336523                }
    337524
    … …  
    355542                 * Template button ico wishlist
    356543                 *
    357                  * @param int $course_id
     544                 * @param CourseModel $course
    358545                 * @param UserModel|false $user
    359546                 *
    360547                 * @return string
    361548                 * @since 4.0.8
    362                  * @version 1.0.0
    363                  */
    364                 public function html_btn_ico_wishlist( int $course_id, $user ): string {
     549                 * @version 1.0.1
     550                 */
     551                /*public function html_btn_ico_wishlist( CourseModel $course, $user ): string {
    365552                        if ( empty( $user ) ) {
    366553                                return '';
    … …  
    370557                        wp_enqueue_script( 'lp-course-wishlist' );
    371558
    372                         $is_in_wishlist = $this->has_in_wishlist( $course_id, $user );
    373 
    374                         $class = '';
     559                        $is_in_wishlist = $this->has_in_wishlist( $course->get_id(), $user );
     560
     561                        $class                = '';
     562                        $label                = __( 'add to wishlist', 'learnpress-wishlist' );
     563                        $profile_wishlist_url = '';
    375564                        if ( $is_in_wishlist ) {
    376565                                $class = 'active';
    377                         }
    378 
    379                         return sprintf( '<span class="lp-item-wishlist %s" data-item-id="%d"></span>', $class, $course_id );
    380                 }
     566                                $label = __( 'view', 'learnpress-wishlist' );
     567
     568                                $profile              = LP_Profile::instance( $user->get_id() );
     569                                $profile_wishlist_url = $profile->get_tab_link( 'wishlist' );
     570                        }
     571
     572                        return sprintf(
     573                                '<a class="lp-item-wishlist %s" data-item-id="%d" href="%s" target="_blank">%s</a>',
     574                                $class,
     575                                $course->get_id(),
     576                                $profile_wishlist_url,
     577                                $label
     578                        );
     579                }*/
    381580
    382581                /**
    383582                 * @param array $section
    384                  * @param CourseModel $course
     583                 * @param CourseModel $courseModel
    385584                 * @param false|UserModel $user
     585                 *
     586                 * @return array
     587                 * @since 4.0.8
     588                 * @version 1.0.1
     589                 */
     590                public function single_course_offline( array $section, CourseModel $courseModel, $user ): array {
     591                        return Template::insert_value_to_position_array(
     592                                $section,
     593                                'after',
     594                                'buttons',
     595                                'wishlist',
     596                                sprintf(
     597                                        '<div class="item-meta">%s</div>',
     598                                        CourseWishlistTemplate::instance()->html_button_action( $courseModel )
     599                                )
     600                        );
     601                }
     602
     603                public function add_block_elements( $elements ) {
     604                        $elements[] = new ButtonWishListBlockType();
     605
     606                        return $elements;
     607                }
     608
     609                /**
     610                 * Load js and css on archive course
     611                 */
     612                public function load_js_css_on_archive_course() {
     613                        wp_enqueue_style( 'lp-course-wishlist' );
     614                        wp_enqueue_script( 'lp-course-wishlist' );
     615                        wp_enqueue_script( 'lp-course-wishlist-script' );
     616                }
     617
     618                /**
     619                 * Show wishlist button on single course modern layout
     620                 *
     621                 * @param array $section
     622                 * @param $courseModel
     623                 * @param $data
    386624                 *
    387625                 * @return array
    … …  
    389627                 * @version 1.0.0
    390628                 */
    391                 public function single_course_offline( array $section, CourseModel $course, $user ): array {
    392                         $section_new = [];
    393                         if ( empty( $user ) ) {
     629                public function display_on_single_course_modern_layout( $section, $courseModel = null, $data = [] ): array {
     630                        // Skip for block themes, need add via block widget
     631                        if ( wp_is_block_theme() ) {
    394632                                return $section;
    395633                        }
    396634
    397                         foreach ( $section as $key => $value ) {
    398                                 if ( $key === 'wrapper_end' ) {
    399                                         $section_new['wishlist'] = sprintf( '<div class="item-meta">%s</div>', $this->html_btn_ico_wishlist( $course->get_id(), $user ) );
    400                                 }
    401                                 $section_new[ $key ] = $value;
    402                         }
    403 
     635                        // Return early if section is not array or courseModel is not provided
     636                        if ( ! is_array( $section ) || empty( $courseModel ) ) {
     637                                return is_array( $section ) ? $section : [];
     638                        }
     639
     640                        $html_button = CourseWishlistTemplate::instance()->html_button_action( $courseModel );
     641
     642                        $section_new = Template::insert_value_to_position_array(
     643                                $section,
     644                                'before',
     645                                'toggle',
     646                                'wishlist',
     647                                $html_button
     648                        );
    404649
    405650                        return $section_new;
    406651                }
    407652
    408                 /**
    409                  * Load js and css on archive course
    410                  */
    411                 public function load_js_css_on_archive_course() {
    412                         wp_enqueue_style( 'lp-course-wishlist' );
    413                         wp_enqueue_script( 'lp-course-wishlist' );
     653                public function display_on_list_course_layout( $section, $courseModel = null, $data = [] ): array {
     654                        // Skip for block themes, need add via block widget
     655                        if ( wp_is_block_theme()
     656                                && ! LP_Page_Controller::is_page_instructor()
     657                                && ! LP_Page_Controller::is_page_profile()
     658                                && ! ( isset( $data['id_url'] ) && $data['id_url'] ) == 'wishlist-courses' ) {
     659                                return $section;
     660                        }
     661
     662                        // Return early if section is not array or courseModel is not provided
     663                        if ( ! is_array( $section ) || empty( $courseModel ) ) {
     664                                return is_array( $section ) ? $section : [];
     665                        }
     666
     667                        $html_button = CourseWishlistTemplate::instance()->html_button_action( $courseModel, [ 'layout' => 'icon-only' ] );
     668
     669                        $section_new = Template::insert_value_to_position_array(
     670                                $section,
     671                                'before',
     672                                'img',
     673                                'wishlist',
     674                                $html_button
     675                        );
     676
     677                        return $section_new;
     678                }
     679
     680                /**
     681                 * Show wishlist button on course related layout
     682                 *
     683                 * @param array $section
     684                 * @param CourseModel $courseModel
     685                 * @param array $data
     686                 *
     687                 * @return array
     688                 * @since 4.0.9
     689                 */
     690                public function display_on_related_course_layout( $section, $courseModel = null, $data = [] ): array {
     691                        // Return early if section is not array or courseModel is not provided
     692                        if ( ! is_array( $section ) || empty( $courseModel ) ) {
     693                                return is_array( $section ) ? $section : [];
     694                        }
     695
     696                        $html_button = CourseWishlistTemplate::instance()->html_button_action( $courseModel, [ 'layout' => 'icon-only' ] );
     697
     698                        // Insert wishlist button after wrapper_start (before 'top' key)
     699                        $section_new = Template::insert_value_to_position_array(
     700                                $section,
     701                                'after',
     702                                'wrapper_start',
     703                                'wishlist',
     704                                $html_button
     705                        );
     706
     707                        return $section_new;
    414708                }
    415709        }
  • learnpress-wishlist/trunk/inc/rest-api/class-lp-rest-wishlist-v1-controller.php

    r3143402 r3795620  
    6060                        );
    6161
    62                         register_rest_route(
     62                        /*register_rest_route(
    6363                                $this->namespace,
    6464                                '/' . $this->rest_base . '/add_or_remove',
    … …  
    7777                                        ),
    7878                                )
    79                         );
     79                        );*/
    8080                }
    8181
    … …  
    175175                                }
    176176
    177                                 $wishlists     = LP_Addon_Wishlist::get_courses_wishlist( $user_id );
     177                                $wishlists = LP_Addon_Wishlist::get_courses_wishlist( $user_id );
    178178                                if ( ! empty( $wishlists ) && in_array( $course_id, $wishlists ) ) {
    179179                                        $pos = array_search( $course_id, $wishlists );
    … …  
    228228                 * @return LP_REST_Response
    229229                 * @since 4.0.8
    230                  * @version 1.0.0
     230                 * @version 1.0.1
    231231                 */
    232                 public function wishlist_toggle( WP_REST_Request $request ): LP_REST_Response {
     232                /*public function wishlist_toggle( WP_REST_Request $request ): LP_REST_Response {
    233233                        $course_id = $request->get_param( 'id' );
    234234                        $user_id   = get_current_user_id();
    … …  
    258258                                }
    259259
    260                                 update_user_meta( $user_id, '_lpr_wish_list', $wish_list );
     260                                LP_Addon_Wishlist::update_courses_wishlist( $user, $wish_list );
    261261
    262262                                $response->data->wishlist = $wish_list;
    263                                 $response->status = 'success';
     263                                $response->data->html     = LP_Addon_Wishlist_Preload::$addon->html_btn_ico_wishlist( $course, $user );
     264                                $response->status         = 'success';
    264265                        } catch ( Throwable $e ) {
    265266                                $response->message = $e->getMessage();
    … …  
    267268
    268269                        return $response;
    269                 }
     270                }*/
    270271        }
    271272}
  • learnpress-wishlist/trunk/languages/learnpress-wishlist.pot

    r3143402 r3795620  
    1 # SOME DESCRIPTIVE TITLE.
    2 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
    3 # This file is distributed under the same license as the PACKAGE package.
    4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
    5 #
    6 #, fuzzy
     1# Copyright (C) 2026 ThimPress
     2# This file is distributed under the same license as the LearnPress - Course Wishlist plugin.
    73msgid ""
    84msgstr ""
    9 "Project-Id-Version: PACKAGE VERSION\n"
    10 "Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2018-03-26 09:43+0700\n"
    12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     5"Project-Id-Version: LearnPress - Course Wishlist 4.1.1\n"
     6"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/learnpress-wishlist\n"
    137"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    148"Language-Team: LANGUAGE <LL@li.org>\n"
    15 "Language: \n"
    169"MIME-Version: 1.0\n"
    17 "Content-Type: text/plain; charset=CHARSET\n"
     10"Content-Type: text/plain; charset=UTF-8\n"
    1811"Content-Transfer-Encoding: 8bit\n"
    19 
    20 #: learnpress-wishlist.php:52
     12"POT-Creation-Date: 2026-04-22T05:46:18+03:00\n"
     13"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     14"X-Generator: WP-CLI 2.12.0\n"
     15"X-Domain: learnpress-wishlist\n"
     16
     17#. Plugin Name of the plugin
     18#: learnpress-wishlist.php
     19msgid "LearnPress - Course Wishlist"
     20msgstr ""
     21
     22#. Plugin URI of the plugin
     23#: learnpress-wishlist.php
     24msgid "https://thimpress.com/product/learnpress-course-wishlist/"
     25msgstr ""
     26
     27#. Description of the plugin
     28#: learnpress-wishlist.php
     29msgid "Wishlist feature."
     30msgstr ""
     31
     32#. Author of the plugin
     33#: learnpress-wishlist.php
     34msgid "ThimPress"
     35msgstr ""
     36
     37#. Author URI of the plugin
     38#: learnpress-wishlist.php
     39msgid "http://thimpress.com"
     40msgstr ""
     41
     42#: config/elementor/wishlist.php:11
     43#: config/elementor/wishlist_loop.php:11
     44msgid "Style"
     45msgstr ""
     46
     47#: config/elementor/wishlist.php:16
     48#: config/elementor/wishlist_loop.php:16
     49msgid "Layout"
     50msgstr ""
     51
     52#: config/elementor/wishlist.php:18
     53#: config/elementor/wishlist_loop.php:18
     54msgid "Classic"
     55msgstr ""
     56
     57#: config/elementor/wishlist.php:19
     58#: config/elementor/wishlist_loop.php:19
     59msgid "Modern"
     60msgstr ""
     61
     62#: config/elementor/wishlist.php:20
     63#: config/elementor/wishlist_loop.php:20
     64msgid "Icon Only"
     65msgstr ""
     66
     67#: config/elementor/wishlist.php:26
     68#: config/elementor/wishlist_loop.php:26
     69msgid "Color"
     70msgstr ""
     71
     72#: config/elementor/wishlist.php:33
     73#: config/elementor/wishlist_loop.php:33
     74msgid "Color Active, Hover"
     75msgstr ""
     76
     77#: config/elementor/wishlist.php:41
     78#: config/elementor/wishlist_loop.php:41
     79msgid "Background Color"
     80msgstr ""
     81
     82#: config/elementor/wishlist.php:48
     83#: config/elementor/wishlist_loop.php:48
     84msgid "Background Color Hover"
     85msgstr ""
     86
     87#: config/elementor/wishlist.php:55
     88#: config/elementor/wishlist_loop.php:55
     89msgid "Padding"
     90msgstr ""
     91
     92#: config/elementor/wishlist.php:77
     93#: config/elementor/wishlist_loop.php:77
     94msgid "Icon Size"
     95msgstr ""
     96
     97#: config/elementor/wishlist.php:89
     98#: config/elementor/wishlist_loop.php:89
     99msgid "Icon Space"
     100msgstr ""
     101
     102#: inc/Elementor/Widgets/CourseWishlistElementor.php:21
     103msgid "Course Wishlist"
     104msgstr ""
     105
     106#: inc/Elementor/Widgets/CourseWishlistLoopElementor.php:20
     107msgid "Course Wishlist Loop"
     108msgstr ""
     109
     110#: inc/Gutenberg/Blocks/ButtonWishListBlockType.php:210
     111#: inc/TemplateHooks/CourseWishlistTemplate.php:157
    21112#, php-format
    22 msgid ""
    23 "<strong>%s</strong> addon version %s requires %s version %s or higher is "
    24 "<strong>installed</strong> and <strong>activated</strong>."
    25 msgstr ""
    26 
    27 #: learnpress-wishlist.php:53
    28 msgid "LearnPress Wishlist"
    29 msgstr ""
    30 
    31 #: learnpress-wishlist.php:55
    32 msgid "LearnPress"
    33 msgstr ""
    34 
    35 #: inc/functions.php:114 inc/functions.php:174 inc/functions.php:189
    36 #: inc/load.php:197
     113msgid "Please %s to add this course to your wishlist."
     114msgstr ""
     115
     116#: inc/Gutenberg/Blocks/ButtonWishListBlockType.php:214
     117#: inc/TemplateHooks/CourseWishlistTemplate.php:161
     118msgid "login"
     119msgstr ""
     120
     121#: inc/Gutenberg/Blocks/ButtonWishListBlockType.php:234
     122#: inc/TemplateHooks/CourseWishlistTemplate.php:179
     123msgid "Course added to wishlist."
     124msgstr ""
     125
     126#: inc/Gutenberg/Blocks/ButtonWishListBlockType.php:238
     127#: inc/TemplateHooks/CourseWishlistTemplate.php:183
     128msgid "View Wishlist"
     129msgstr ""
     130
     131#: inc/Gutenberg/Blocks/ButtonWishListBlockType.php:243
     132#: inc/TemplateHooks/CourseWishlistTemplate.php:188
     133msgid "Course removed from wishlist."
     134msgstr ""
     135
     136#: inc/load.php:53
     137msgid "wishlist"
     138msgstr ""
     139
     140#: inc/load.php:254
     141msgid "You have not permission to do this action"
     142msgstr ""
     143
     144#: inc/load.php:297
     145#: inc/TemplateHooks/CourseWishlistTemplate.php:32
     146#: inc/TemplateHooks/CourseWishlistTemplate.php:213
     147#: templates/button.php:25
     148msgid "Add to Wishlist"
     149msgstr ""
     150
     151#: inc/load.php:300
     152#: inc/TemplateHooks/CourseWishlistTemplate.php:36
     153#: inc/TemplateHooks/CourseWishlistTemplate.php:218
     154#: templates/button.php:25
     155msgid "Remove from Wishlist"
     156msgstr ""
     157
     158#: inc/load.php:311
     159msgid "Remove this course from your wishlist"
     160msgstr ""
     161
     162#: inc/load.php:314
     163msgid "Add this course to your wishlist"
     164msgstr ""
     165
     166#: inc/load.php:323
     167msgid "This course added to your wishlist"
     168msgstr ""
     169
     170#: inc/load.php:326
     171msgid "This course removed from your wishlist"
     172msgstr ""
     173
     174#: inc/load.php:396
     175#: inc/TemplateHooks/CourseWishlistTemplate.php:238
     176#: inc/TemplateHooks/CourseWishlistTemplate.php:243
    37177msgid "Wishlist"
    38178msgstr ""
    39179
    40 #: inc/functions.php:212
    41 msgid "Your wishlist"
    42 msgstr ""
    43 
    44 #: inc/load.php:40
    45 msgid "wishlist"
    46 msgstr ""
    47 
    48 #: inc/load.php:98
    49 msgid "You have not permission to do this action"
    50 msgstr ""
    51 
    52 #: inc/load.php:134 templates/button.php:22
    53 msgid "Add to Wishlist"
    54 msgstr ""
    55 
    56 #: inc/load.php:134 templates/button.php:22
    57 msgid "Remove from Wishlist"
    58 msgstr ""
    59 
    60 #: inc/load.php:145
    61 msgid "Remove this course from your wishlist"
    62 msgstr ""
    63 
    64 #: inc/load.php:145
    65 msgid "Add this course to your wishlist"
    66 msgstr ""
    67 
    68 #: inc/load.php:154
    69 msgid "This course added to your wishlist"
    70 msgstr ""
    71 
    72 #: inc/load.php:154
    73 msgid "This course removed from your wishlist"
    74 msgstr ""
    75 
    76 #: templates/button.php:21
     180#: inc/rest-api/class-lp-rest-wishlist-v1-controller.php:116
     181#: inc/rest-api/class-lp-rest-wishlist-v1-controller.php:164
     182msgid "Add to wishlist"
     183msgstr ""
     184
     185#: inc/rest-api/class-lp-rest-wishlist-v1-controller.php:117
     186#: inc/rest-api/class-lp-rest-wishlist-v1-controller.php:165
     187msgid "Remove from wishlist"
     188msgstr ""
     189
     190#: inc/rest-api/class-lp-rest-wishlist-v1-controller.php:138
     191msgid "This course available in your wishlist"
     192msgstr ""
     193
     194#: inc/rest-api/class-lp-rest-wishlist-v1-controller.php:141
     195msgid "This course not in your wishlist"
     196msgstr ""
     197
     198#: inc/rest-api/class-lp-rest-wishlist-v1-controller.php:184
     199msgid "This course has been removed from your wishlists"
     200msgstr ""
     201
     202#: inc/rest-api/class-lp-rest-wishlist-v1-controller.php:189
     203msgid "This course has been added to your wishlists"
     204msgstr ""
     205
     206#: inc/TemplateHooks/CoursesWishlistTemplate.php:75
     207msgid "My Wishlist Courses"
     208msgstr ""
     209
     210#: templates/button.php:24
    77211msgid "Processing..."
    78212msgstr ""
  • learnpress-wishlist/trunk/languages/learnpress-woo-payment.pot

    r3143402 r3795620  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: LearnPress - Course Wishlist 4.0.8\n"
     5"Project-Id-Version: LearnPress - Course Wishlist 4.0.9-beta.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/learnpress-wishlist\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    … …  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-08-29T10:01:50+03:00\n"
     12"POT-Creation-Date: 2024-10-05T12:58:19+03:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.8.1\n"
    … …  
    7171msgstr ""
    7272
    73 #: inc/load.php:50
     73#: inc/load.php:53
    7474msgid "wishlist"
    7575msgstr ""
    7676
    77 #: inc/load.php:137
     77#: inc/load.php:140
    7878msgid "You have not permission to do this action"
    7979msgstr ""
    8080
    81 #: inc/load.php:173
     81#: inc/load.php:176
    8282#: templates/button.php:25
    8383msgid "Add to Wishlist"
    8484msgstr ""
    8585
    86 #: inc/load.php:176
     86#: inc/load.php:179
    8787#: templates/button.php:25
    8888msgid "Remove from Wishlist"
    8989msgstr ""
    9090
    91 #: inc/load.php:187
     91#: inc/load.php:190
    9292msgid "Remove this course from your wishlist"
    9393msgstr ""
    9494
    95 #: inc/load.php:190
     95#: inc/load.php:193
    9696msgid "Add this course to your wishlist"
    9797msgstr ""
    9898
    99 #: inc/load.php:199
     99#: inc/load.php:202
    100100msgid "This course added to your wishlist"
    101101msgstr ""
    102102
    103 #: inc/load.php:202
     103#: inc/load.php:205
    104104msgid "This course removed from your wishlist"
    105105msgstr ""
    106106
    107 #: inc/load.php:260
     107#: inc/load.php:277
    108108msgid "Wishlist"
     109msgstr ""
     110
     111#: inc/load.php:404
     112msgid "add to wishlist"
     113msgstr ""
     114
     115#: inc/load.php:408
     116msgid "view"
    109117msgstr ""
    110118
  • learnpress-wishlist/trunk/learnpress-wishlist.php

    r3143402 r3795620  
    22/**
    33 * Plugin Name: LearnPress - Course Wishlist
    4  * Plugin URI: http://thimpress.com/learnpress
     4 * Plugin URI: https://thimpress.com/product/learnpress-course-wishlist/
    55 * Description: Wishlist feature.
    66 * Author: ThimPress
    7  * Version: 4.0.8
     7 * Version: 4.1.2
    88 * Author URI: http://thimpress.com
    99 * Tags: learnpress
    1010 * Text Domain: learnpress-wishlist
    1111 * Domain Path: /languages/
    12  * Require_LP_Version: 4.2.7-beta.0
     12 * Require_LP_Version: 4.3.2.7
     13 * Requires Plugins: learnpress
    1314 *
    1415 * @package LearnPress-Course-Wishlist
    … …  
    1819 * Prevent loading this file directly
    1920 */
     21
     22use LearnPress\Wishlist\TemplateHooks\CoursesWishlistTemplate;
     23use LearnPress\Wishlist\TemplateHooks\CourseWishlistTemplate;
     24
    2025defined( 'ABSPATH' ) || exit();
    2126
    2227const LP_ADDON_WISHLIST_FILE = __FILE__;
     28const LP_ADDON_WISHLIST_PATH = __DIR__;
    2329
    2430/**
    … …  
    7480                        add_action( 'admin_notices', array( $this, 'show_note_errors_require_lp' ) );
    7581
    76                         deactivate_plugins( LP_ADDON_WISHLIST_BASENAME );
     82                        /*deactivate_plugins( LP_ADDON_WISHLIST_BASENAME );
    7783
    7884                        if ( isset( $_GET['activate'] ) ) {
    7985                                unset( $_GET['activate'] );
    80                         }
     86                        }*/
    8187
    8288                        return;
    8389                }
     90
     91                require_once LP_ADDON_WISHLIST_PATH . '/vendor/autoload.php';
    8492
    8593                // Sure LP loaded.
    … …  
    9199         */
    92100        public function load() {
    93                 self::$addon = LP_Addon::load( 'LP_Addon_Wishlist', 'inc/load.php', __FILE__ );
     101                include_once LP_ADDON_WISHLIST_PATH . '/inc/load.php';
     102                self::$addon = LP_Addon_Wishlist::instance();
     103                CourseWishlistTemplate::instance();
     104                CoursesWishlistTemplate::instance();
    94105        }
    95106
  • learnpress-wishlist/trunk/readme.txt

    r3660123 r3795620  
    44Tags: lms, elearning, e-learning, learning management system, education.
    55Requires at least: 6.0
    6 Tested up to: 7.1
     6Tested up to: 6.9
    77Requires PHP: 7.4
    8 Stable tag: 4.1.1
     8Stable tag: 4.1.2
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    … …  
    5656
    5757== Changelog ==
     58
     59= 4.1.2 (2026-11-11) =
     60* Fixed: security vulnerability in wishlist button AJAX callback — user_id must be derived from session instead of client input.
     61
     62= 4.1.0 (2026-04-22) =
     63~ Fixed: minor bugs.
     64
     65= 4.1.0 (2026-02-02) =
     66~ Fixed: build min js incorrect.
     67
     68= 4.0.9 (2026-01-31) =
     69~ Display button wishlist in single course (classic/modern/offline), list courses (archive course, single instructor, profile)
     70~ Improve add/remove wishlist.
     71~ Display toastify.
     72~ Check theme override file.
     73~ Handle with elementor.
     74~ Add widget block for Gutenberg.
     75~ Display with user not logged in.
    5876
    5977= 4.0.8 (2024-08-29) =
Note: See TracChangeset for help on using the changeset viewer.