From 5430ae934794c08b9958b8ebd370a2293244515c Mon Sep 17 00:00:00 2001 From: kousikmukherjee Date: Tue, 28 May 2024 15:37:31 +0530 Subject: [PATCH] v3.0.2 --- includes/class-alg-wc-wish-list-core.php | 41 ++++++-------- langs/wish-list-for-woocommerce.pot | 68 ++++++++++++------------ templates/wish-list.php | 23 ++++++-- wish-list-for-woocommerce.php | 29 ++-------- 4 files changed, 74 insertions(+), 87 deletions(-) diff --git a/includes/class-alg-wc-wish-list-core.php b/includes/class-alg-wc-wish-list-core.php index aecf390..a2ffacb 100644 --- a/includes/class-alg-wc-wish-list-core.php +++ b/includes/class-alg-wc-wish-list-core.php @@ -2,7 +2,7 @@ /** * Wish List for WooCommerce - Core Class. * - * @version 3.0.1 + * @version 3.0.2 * @since 1.0.0 * @author WPFactory. */ @@ -21,7 +21,7 @@ final class Alg_WC_Wish_List_Core { * @var string * @since 1.0.0 */ - public $version = '3.0.1'; + public $version = '3.0.2'; /** * @var Alg_WC_Wish_List_Core The single instance of the class @@ -293,7 +293,7 @@ function __construct() { */ function declare_compatibility_with_hpos(){ if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { - \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', ALG_WC_WL_PRO_FILEPATH, true ); + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', ALG_WC_WL_FILEPATH, true ); } } @@ -578,18 +578,7 @@ public function add_description_wish_list( $params, $final_file, $path ) { */ public function handle_localization() { $domain = 'wish-list-for-woocommerce'; - load_plugin_textdomain( $domain, false, dirname( ALG_WC_WL_BASENAME ) . '/languages/' ); - - $locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain ); - if ( function_exists( 'pll_current_language' ) ) { - $locale = pll_current_language( 'locale' ); - } - - $loaded = load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $domain . '-' . $locale . '.mo' ); - if ( ! $loaded ) { - $path = WP_PLUGIN_DIR . '/' . trim( dirname( ALG_WC_WL_PRO_BASENAME ) . '/languages/', '/' ); - load_textdomain( $domain, $path . '/' . $domain . '-' . $locale . '.mo' ); - } + load_plugin_textdomain( $domain, false, dirname( ALG_WC_WL_BASENAME ) . '/langs/' ); } /** @@ -620,7 +609,7 @@ public function woocommerce_locate_template( $template, $template_name, $templat if ( strpos( $template_name, 'alg_wcwl' ) !== false ) { $template_path = 'woocommerce'; - $default_path = ALG_WC_WL_PRO_DIR . 'templates' . DIRECTORY_SEPARATOR; + $default_path = ALG_WC_WL_DIR . 'templates' . DIRECTORY_SEPARATOR; $template = locate_template( array( trailingslashit( $template_path ) . $template_name, @@ -699,9 +688,9 @@ private function handle_ajax() { */ public function locate_template( $final_file, $params, $path ) { $located = locate_template( array( - ALG_WC_WL_PRO_FOLDER_NAME . DIRECTORY_SEPARATOR . $path, + ALG_WC_WL_FOLDER_NAME . DIRECTORY_SEPARATOR . $path, ) ); - $plugin_path = ALG_WC_WL_PRO_DIR . 'templates' . DIRECTORY_SEPARATOR . $path; + $plugin_path = ALG_WC_WL_DIR . 'templates' . DIRECTORY_SEPARATOR . $path; if ( ! $located && file_exists( $plugin_path ) ) { $final_file = $plugin_path; } elseif ( $located ) { @@ -801,19 +790,19 @@ function enqueue_admin_scripts($hook){ // Fontawesome icon picker $css_file = 'assets/vendor/fontawesome-iconpicker/css/fontawesome-iconpicker.min.css'; - $css_ver = date( "ymd-Gis", filemtime( ALG_WC_WL_PRO_DIR. $css_file ) ); - wp_register_style( 'alg-wc-wl-fa-iconpicker', ALG_WC_WL_PRO_URL . $css_file, array(), $css_ver ); + $css_ver = date( "ymd-Gis", filemtime( ALG_WC_WL_DIR. $css_file ) ); + wp_register_style( 'alg-wc-wl-fa-iconpicker', ALG_WC_WL_URL . $css_file, array(), $css_ver ); wp_enqueue_style( 'alg-wc-wl-fa-iconpicker' ); $js_file = 'assets/vendor/fontawesome-iconpicker/js/fontawesome-iconpicker.min.js'; - $js_ver = date( "ymd-Gis", filemtime( ALG_WC_WL_PRO_DIR . $js_file ) ); - wp_register_script( 'alg-wc-wl-fa-iconpicker', ALG_WC_WL_PRO_URL . $js_file, array( 'jquery' ), $js_ver, true ); + $js_ver = date( "ymd-Gis", filemtime( ALG_WC_WL_DIR . $js_file ) ); + wp_register_script( 'alg-wc-wl-fa-iconpicker', ALG_WC_WL_URL . $js_file, array( 'jquery' ), $js_ver, true ); wp_enqueue_script( 'alg-wc-wl-fa-iconpicker' ); // Color picker Alpha $js_file = 'assets/vendor/color-picker-alpha/wp-color-picker-alpha.min.js'; - $js_ver = date( "ymd-Gis", filemtime( ALG_WC_WL_PRO_DIR . $js_file ) ); + $js_ver = date( "ymd-Gis", filemtime( ALG_WC_WL_DIR . $js_file ) ); wp_enqueue_style( 'wp-color-picker' ); - wp_enqueue_script( 'wp-color-picker-alpha', ALG_WC_WL_PRO_URL . $js_file, array( 'wp-color-picker' ), $js_ver, true ); + wp_enqueue_script( 'wp-color-picker-alpha', ALG_WC_WL_URL . $js_file, array( 'wp-color-picker' ), $js_ver, true ); wp_add_inline_script( 'wp-color-picker-alpha', 'jQuery( function() { jQuery( ".color-picker" ).wpColorPicker(); } );' @@ -821,8 +810,8 @@ function enqueue_admin_scripts($hook){ // Main js file for admin $js_file = 'assets/js/admin/alg-wc-wl-pro-admin.js'; - $js_ver = date( "ymd-Gis", filemtime( ALG_WC_WL_PRO_DIR . $js_file ) ); - wp_register_script( 'alg-wc-wl-pro-admin', ALG_WC_WL_PRO_URL . $js_file, array( 'jquery','alg-wc-wl-fa-iconpicker' ), $js_ver, true ); + $js_ver = date( "ymd-Gis", filemtime( ALG_WC_WL_DIR . $js_file ) ); + wp_register_script( 'alg-wc-wl-pro-admin', ALG_WC_WL_URL . $js_file, array( 'jquery','alg-wc-wl-fa-iconpicker' ), $js_ver, true ); wp_enqueue_script( 'alg-wc-wl-pro-admin' ); ?> diff --git a/langs/wish-list-for-woocommerce.pot b/langs/wish-list-for-woocommerce.pot index 817698b..993f8cd 100644 --- a/langs/wish-list-for-woocommerce.pot +++ b/langs/wish-list-for-woocommerce.pot @@ -2,16 +2,16 @@ # This file is distributed under the GNU General Public License v3.0. msgid "" msgstr "" -"Project-Id-Version: wish-list-for-woocommerce 3.0.1\n" +"Project-Id-Version: wish-list-for-woocommerce 3.0.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wish-list-for-woocommerce\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-05-21T22:09:28+02:00\n" +"POT-Creation-Date: 2024-05-28T12:06:33+02:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"X-Generator: WP-CLI 2.7.1\n" +"X-Generator: WP-CLI 2.9.0\n" "X-Domain: wish-list-for-woocommerce\n" #. Plugin Name of the plugin @@ -210,7 +210,7 @@ msgstr "" #: includes/admin/class-alg-wc-wish-list-settings-admin.php:233 #: includes/admin/class-alg-wc-wish-list-settings-list.php:155 -#: templates/wish-list.php:350 +#: templates/wish-list.php:367 msgid "SKU" msgstr "" @@ -718,8 +718,8 @@ msgid "Show product stock" msgstr "" #: includes/admin/class-alg-wc-wish-list-settings-list.php:141 -#: templates/wish-list.php:202 -#: templates/wish-list.php:314 +#: templates/wish-list.php:219 +#: templates/wish-list.php:331 msgid "Price" msgstr "" @@ -740,7 +740,7 @@ msgid "Show product SKU" msgstr "" #: includes/admin/class-alg-wc-wish-list-settings-list.php:162 -#: templates/wish-list.php:357 +#: templates/wish-list.php:374 msgid "Quantity" msgstr "" @@ -749,7 +749,7 @@ msgid "Show product quantity" msgstr "" #: includes/admin/class-alg-wc-wish-list-settings-list.php:169 -#: templates/wish-list.php:336 +#: templates/wish-list.php:353 msgid "Description" msgstr "" @@ -788,7 +788,7 @@ msgstr "" #: includes/admin/class-alg-wc-wish-list-settings-list.php:192 #: includes/admin/class-alg-wc-wish-list-settings-list.php:226 #: templates/alg_wcwl-subtotal.php:1 -#: templates/wish-list.php:367 +#: templates/wish-list.php:384 msgid "Subtotal" msgstr "" @@ -1148,7 +1148,7 @@ msgid "Style > Thumb button > Icon - Added" msgstr "" #: includes/admin/class-alg-wc-wish-list-settings-social.php:37 -#: includes/class-alg-wc-wish-list-core.php:1157 +#: includes/class-alg-wc-wish-list-core.php:1146 msgid "Share" msgstr "" @@ -1842,7 +1842,7 @@ msgid "The success notification after all items have been removed from wishlist. msgstr "" #: includes/admin/class-alg-wc-wish-list-settings-texts.php:172 -#: includes/class-alg-wc-wish-list-core.php:989 +#: includes/class-alg-wc-wish-list-core.php:978 msgid "All the items have been removed from your wishlist." msgstr "" @@ -1953,13 +1953,13 @@ msgstr "" msgid "All the items have been removed from your wish list." msgstr "" -#: includes/class-alg-wc-wish-list-core.php:889 +#: includes/class-alg-wc-wish-list-core.php:878 #: includes/pro/class-alg-wc-wish-list-pro-user-profile.php:92 -#: templates/wish-list.php:36 +#: templates/wish-list.php:38 msgid "The Wish list is empty." msgstr "" -#: includes/class-alg-wc-wish-list-core.php:988 +#: includes/class-alg-wc-wish-list-core.php:977 #: includes/free/class-alg-wc-wish-list-ajax.php:377 #: includes/free/class-alg-wc-wish-list-ajax.php:531 #: includes/free/class-alg-wc-wish-list-email-sharing.php:196 @@ -1967,28 +1967,28 @@ msgstr "" msgid "Sorry, Some error occurred. Please, try again later." msgstr "" -#: includes/class-alg-wc-wish-list-core.php:1401 +#: includes/class-alg-wc-wish-list-core.php:1390 msgid "Select Wishlist" msgstr "" -#: includes/class-alg-wc-wish-list-core.php:1407 -#: includes/class-alg-wc-wish-list-core.php:1415 +#: includes/class-alg-wc-wish-list-core.php:1396 +#: includes/class-alg-wc-wish-list-core.php:1404 msgid "Create Wishlist" msgstr "" -#: includes/class-alg-wc-wish-list-core.php:1408 +#: includes/class-alg-wc-wish-list-core.php:1397 msgid "Done" msgstr "" -#: includes/class-alg-wc-wish-list-core.php:1417 +#: includes/class-alg-wc-wish-list-core.php:1406 msgid "Wishlist Name" msgstr "" -#: includes/class-alg-wc-wish-list-core.php:1421 +#: includes/class-alg-wc-wish-list-core.php:1410 msgid "Save Wishlist" msgstr "" -#: includes/class-alg-wc-wish-list-core.php:1422 +#: includes/class-alg-wc-wish-list-core.php:1411 msgid "Cancel" msgstr "" @@ -2005,7 +2005,7 @@ msgid "Please login if you want to use msgstr "" #: includes/free/class-alg-wc-wish-list-ajax.php:631 -#: templates/wish-list.php:152 +#: templates/wish-list.php:169 msgid "Default Wishlist" msgstr "" @@ -2063,8 +2063,8 @@ msgstr "" #: includes/free/class-alg-wc-wish-list-stock-email.php:121 msgid "" -"Hello {username}, \r\n" -"\r\n" +"Hello {username}, \n" +"\n" "{product_name} is in stock. Please, check it out on {site_title}" msgstr "" @@ -2183,33 +2183,33 @@ msgstr "" msgid "Submit" msgstr "" -#: templates/wish-list.php:176 +#: templates/wish-list.php:193 msgid "Delete Wishlist" msgstr "" -#: templates/wish-list.php:198 -#: templates/wish-list.php:296 +#: templates/wish-list.php:215 +#: templates/wish-list.php:313 msgid "Product" msgstr "" -#: templates/wish-list.php:207 -#: templates/wish-list.php:321 +#: templates/wish-list.php:224 +#: templates/wish-list.php:338 msgid "Category" msgstr "" -#: templates/wish-list.php:252 -#: templates/wish-list.php:397 +#: templates/wish-list.php:269 +#: templates/wish-list.php:414 msgid "Remove" msgstr "" -#: templates/wish-list.php:266 +#: templates/wish-list.php:283 msgid "Drag and drop" msgstr "" -#: templates/wish-list.php:272 +#: templates/wish-list.php:289 msgid "Sort" msgstr "" -#: templates/wish-list.php:284 +#: templates/wish-list.php:301 msgid "Thumbnail" msgstr "" diff --git a/templates/wish-list.php b/templates/wish-list.php index 7e1d5fa..b108f2b 100644 --- a/templates/wish-list.php +++ b/templates/wish-list.php @@ -3,7 +3,7 @@ * Wish list template. * * @author WPFactory. - * @version 2.1.1 + * @version 3.0.2 * @since 1.0.0 */ @@ -13,6 +13,8 @@ ?> queried_object->ID ); $the_query = $params['the_query']; $can_remove_items = $params['can_remove_items']; @@ -57,9 +59,24 @@ $show_product_thumb = filter_var( get_option( Alg_WC_Wish_List_Settings_List::OPTION_IMAGES_ON_EMAILS, 'no' ), FILTER_VALIDATE_BOOLEAN ); $email_table_params = 'border="1" style="width:100%;border-collapse: collapse;border:1px solid #ccc" cellpadding="15"'; } -$current_page_id = get_the_ID(); + +// $current_page_id = get_the_ID(); + +$current_page_id = $theid; $wish_list_permalink = get_permalink( $current_page_id ); +$wl_tab_slug = get_option( 'alg_wc_wl_tab_slug', 'my-wish-list' ); +$query_string = '?'; +if( is_wc_endpoint_url( $wl_tab_slug ) ) { + $structure = get_option( 'permalink_structure', '' ); + if( $structure == '' ){ + $wish_list_permalink = untrailingslashit( $wish_list_permalink ) .'&' . $wl_tab_slug; + $query_string = '&'; + } else { + $wish_list_permalink = untrailingslashit( $wish_list_permalink ) .'/' . $wl_tab_slug; + $query_string = '?'; + } +} if ( is_user_logged_in() ) { $user = wp_get_current_user(); @@ -162,7 +179,7 @@ } ?>
- +
Wishlist. -Version: 3.0.1 +Version: 3.0.2 Author: WPFactory Author URI: https://wpfactory.com/ Copyright: © 2023 WPFactory. License: GNU General Public License v3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html Text Domain: wish-list-for-woocommerce +Domain Path: /langs WC requires at least: 3.0.0 WC tested up to: 8.9 */ @@ -160,28 +161,8 @@ function alg_wc_wishlist_for_woocommerce() { } -// Pro Constants -if ( ! defined( 'ALG_WC_WL_PRO_DIR' ) ) { - define( 'ALG_WC_WL_PRO_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR ); -} - -if ( ! defined( 'ALG_WC_WL_PRO_URL' ) ) { - define( 'ALG_WC_WL_PRO_URL', plugin_dir_url( __FILE__ ) ); -} - -if ( ! defined( 'ALG_WC_WL_PRO_BASENAME' ) ) { - define( 'ALG_WC_WL_PRO_BASENAME', plugin_basename( __FILE__ ) ); -} -if ( ! defined( 'ALG_WC_WL_PRO_FOLDER_NAME' ) ) { - define( 'ALG_WC_WL_PRO_FOLDER_NAME', untrailingslashit( plugin_dir_path( plugin_basename( __FILE__ ) ) ) ); -} - -if ( ! defined( 'ALG_WC_WL_PRO_FILEPATH' ) ) { - define( 'ALG_WC_WL_PRO_FILEPATH', __FILE__ ); -} - -// Free Constants +// Constants if ( ! defined( 'ALG_WC_WL_DIR' ) ) { define( 'ALG_WC_WL_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR ); } @@ -217,9 +198,9 @@ function alg_wc_wishlist_for_woocommerce() { */ function alg_wc_wl_pro_locate_template( $path, $params = null ) { $located = locate_template( array( - ALG_WC_WL_PRO_FOLDER_NAME . '/' . $path, + ALG_WC_WL_FOLDER_NAME . '/' . $path, ) ); - $plugin_path = ALG_WC_WL_PRO_DIR . 'templates' . DIRECTORY_SEPARATOR . $path; + $plugin_path = ALG_WC_WL_DIR . 'templates' . DIRECTORY_SEPARATOR . $path; if ( ! $located && file_exists( $plugin_path ) ) { $final_file = $plugin_path; } elseif ( $located ) {