Changeset 3054029
- Timestamp:
- 03/19/2024 04:44:13 AM (21 months ago)
- Location:
- cart-notify/trunk
- Files:
-
- 1 added
- 12 edited
-
README.txt (modified) (1 diff)
-
admin/config.php (modified) (1 diff)
-
admin/options/design.php (added)
-
admin/options/general.php (modified) (1 diff)
-
admin/options/optimization.php (modified) (1 diff)
-
admin/options/others.php (modified) (1 diff)
-
assets/js/CartNAdmin.js (modified) (1 diff)
-
assets/js/frontend.js (modified) (1 diff)
-
cartnotify.php (modified) (8 diffs)
-
includes/Admin.php (modified) (1 diff)
-
includes/Admin/CartnotiSetpage.php (modified) (1 diff)
-
includes/Assets.php (modified) (1 diff)
-
includes/Necessary.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cart-notify/trunk/README.txt
r3033994 r3054029 73 73 - New design added 74 74 - A new Admin option added 75 76 = 1.1.2 = ( March 19, 2024 ) 77 - improvement performance 78 - Ajax install & activate WooCommerce issues fix 79 - Js improved -
cart-notify/trunk/admin/config.php
r3033994 r3054029 2 2 3 3 // Control core classes for avoid errors 4 if ( class_exists( 'CSF' ) ) {4 if ( class_exists( 'CSF' ) ) { 5 5 6 6 7 // Set a unique slug-like ID8 $prefix = 'CartCNS';7 // Set a unique slug-like ID 8 $prefix = 'CartCNS'; 9 9 10 // CNS Create options11 CSF::createOptions( $prefix, array(12 'framework_title'=> __( 'Cart Notify Settings <small>by <a style="color: #bfbfbf;text-decoration:none;" href="https://mhemelhasan.com" target="_blank">M Hemel Hasan</a></small>', 'cartnotify' ),13 'menu_title'=> __( 'Cart Notify', 'cartnotify' ),14 'menu_slug'=> 'cart_notify_opt',15 'menu_icon'=> 'dashicons-cart',16 'menu_position'=> 10,17 'footer_credit' => __('<em>Enjoyed <strong>Cart Notify</strong>? Please leave us a <a style="color:#e9570a;" href="https://wordpress.org/support/plugin/cart-notify/reviews/?filter=5/#new-post" target="_blank">★★★★★</a> rating. We really appreciate your support!</em>', 'cartnotify'),18 'show_bar_menu'=> true,19 ));10 // CNS Create options 11 CSF::createOptions( $prefix, array( 12 'framework_title' => __( 'Cart Notify Settings <small>by <a style="color: #bfbfbf;text-decoration:none;" href="https://mhemelhasan.com" target="_blank">M Hemel Hasan</a></small>', 'cartnotify' ), 13 'menu_title' => __( 'Cart Notify', 'cartnotify' ), 14 'menu_slug' => 'cart_notify_opt', 15 'menu_icon' => 'dashicons-cart', 16 'menu_position' => 10, 17 'footer_credit' => __( '<em>Enjoyed <strong>Cart Notify</strong>? Please leave us a <a style="color:#e9570a;" href="https://wordpress.org/support/plugin/cart-notify/reviews/?filter=5/#new-post" target="_blank">★★★★★</a> rating. We really appreciate your support!</em>', 'cartnotify' ), 18 'show_bar_menu' => true, 19 ) ); 20 20 21 /*22 * Design Parent23 */ 24 CSF::createSection( $prefix, array(25 'id'=> 'general', // Set a unique slug-like ID26 'title' => __( 'General', 'cartnotify' ),27 'icon'=> 'fas fa-cogs',28 ));21 /* 22 * Design Parent 23 */ 24 CSF::createSection( $prefix, array( 25 'id' => 'general', // Set a unique slug-like ID 26 'title' => __( 'General', 'cartnotify' ), 27 'icon' => 'fas fa-cogs', 28 ) ); 29 29 30 /*31 * Design Parent32 */ 33 CSF::createSection( $prefix, array(34 'id'=> 'design', // Set a unique slug-like ID35 'title' => __( 'Design', 'cartnotify' ),36 'icon'=> 'fas fa-palette',37 ));30 /* 31 * Design Parent 32 */ 33 CSF::createSection( $prefix, array( 34 'id' => 'design', // Set a unique slug-like ID 35 'title' => __( 'Design', 'cartnotify' ), 36 'icon' => 'fas fa-palette', 37 ) ); 38 38 39 /*40 * Backup41 */ 42 CSF::createSection( $prefix, array(43 'title' => __('Import/Export', 'cartnotify'),44 'icon'=> 'fas fa-hdd',45 'fields'=> array(46 array(47 'type'=> 'backup',48 ),49 )50 ));39 /* 40 * Backup 41 */ 42 CSF::createSection( $prefix, array( 43 'title' => __( 'Import/Export', 'cartnotify' ), 44 'icon' => 'fas fa-hdd', 45 'fields' => array( 46 array( 47 'type' => 'backup', 48 ), 49 ) 50 ) ); 51 51 52 52 53 /* 54 * Including General Options 55 */ 56 if ( file_exists( dirname( __FILE__ ) . '/options/general.php' ) ) { 57 require_once dirname( __FILE__ ) . '/options/general.php'; 58 } 53 /* 54 * Including General Options 55 */ 56 if ( file_exists( dirname( __FILE__ ) . '/options/general.php' ) ) { 57 require_once dirname( __FILE__ ) . '/options/general.php'; 58 } 59 60 /* 61 * Including design Options 62 */ 63 if ( file_exists( dirname( __FILE__ ) . '/options/design.php' ) ) { 64 require_once dirname( __FILE__ ) . '/options/design.php'; 65 } 59 66 60 67 61 /*62 * Including Others Options63 */ 64 if ( file_exists( dirname( __FILE__ ) . '/options/others.php' ) ) {65 require_once dirname( __FILE__ ) . '/options/others.php';66 }68 /* 69 * Including Others Options 70 */ 71 if ( file_exists( dirname( __FILE__ ) . '/options/others.php' ) ) { 72 require_once dirname( __FILE__ ) . '/options/others.php'; 73 } 67 74 75 /* 76 * Including Optimization Options 77 */ 78 if ( file_exists( dirname( __FILE__ ) . '/options/optimization.php' ) ) { 79 // require_once dirname( __FILE__ ) . '/options/optimization.php'; 80 } 68 81 69 /*70 * Including Optimization Options71 */72 if ( file_exists( dirname( __FILE__ ) . '/options/optimization.php' ) ) {73 // require_once dirname( __FILE__ ) . '/options/optimization.php';74 }75 76 82 } 77 78 ?> -
cart-notify/trunk/admin/options/general.php
r3033994 r3054029 3 3 defined( 'ABSPATH' ) || exit; 4 4 5 $badge_up = '<div class="ins-csf-badge"><span class="ins-upcoming">' .__("Upcoming", "instantio"). '</span></div>';6 $badge_pro = '<div class="ins-csf-badge"><span class="ins-pro">' .__("Pro Feature", "instantio"). '</span></div>';7 $badge_up_pro = '<div class="ins-csf-badge"><span class="ins-upcoming">' .__("Upcoming", "instantio"). '</span><span class="ins-pro">' .__("Pro Feature", "instantio"). '</span></div>';5 $badge_up = '<div class="cns-csf-badge"><span class="cns-upcoming">' . __( "Upcoming", "cartnotify" ) . '</span></div>'; 6 $badge_pro = '<div class="cns-csf-badge"><span class="cns-pro">' . __( "Pro Feature", "cartnotify" ) . '</span></div>'; 7 $badge_up_pro = '<div class="cns-csf-badge"><span class="cns-upcoming">' . __( "Upcoming", "cartnotify" ) . '</span><span class="cns-pro">' . __( "Pro Feature", "cartnotify" ) . '</span></div>'; 8 8 9 // General Settings10 CSF::createSection( $prefix, array(11 'parent' => 'general', // The slug id of the parent section 12 'title'=> __( 'Main Setting', 'cartnotify' ),13 'fields' => array( 14 array( 15 'id'=> 'cns-notify-opt',16 'type'=> 'select',17 'title' => __('Select Notification Option', 'cartnotify'),18 'subtitle' => __('Choose Notification Option', 'cartnotify'),19 'placeholder' => __('Notification Option', 'cartnotify'),20 'options'=> array(21 __('Free', 'notify')=> array(22 'notify' => __('Notification', 'cartnotify'),23 ),24 __('Only (Pro)', 'cartnotify')=> array(25 'PopUp' => __('Pop Up', 'cartnotify'),26 ),27 ),28 'default'=> 'notify'29 ),9 // General Settings 10 CSF::createSection( $prefix, array( 11 'parent' => 'general', 12 'title' => __( 'Main Setting', 'cartnotify' ), 13 'fields' => [ 14 [ 15 'id' => 'cns-notify-opt', 16 'type' => 'select', 17 'title' => __( 'Select Notification Option', 'cartnotify' ), 18 'subtitle' => __( 'Choose Notification Option', 'cartnotify' ), 19 'placeholder' => __( 'Notification Option', 'cartnotify' ), 20 'options' => array( 21 __( 'Free', 'notify' ) => array( 22 'notify' => __( 'Notification', 'cartnotify' ), 23 ), 24 __( 'Only (Pro)', 'cartnotify' ) => array( 25 'PopUp' => __( 'Pop Up', 'cartnotify' ), 26 ), 27 ), 28 'default' => 'notify' 29 ], 30 30 31 array( 32 'id' => 'cns-prestyle', 33 'type' => 'image_select', 34 'title' => __('Notificaion Design', 'cartnotify'), 35 'subtitle' => __('Select Notificaion design', 'cartnotify'), 36 'options' => array( 37 'cns-prestyle-1' => CART_NOTIFY_ASSETS.'/img/cartnotify_layout_1.png', 38 ), 39 'default' => 'tog-1', 40 //'dependency' => array('cns-layout', '!=', '1', '', 'visible'), 41 ), 42 array( 43 'id' => 'cns-notify-position', 44 'type' => 'select', 45 'title' => __('Select Notification Position', 'cartnotify'), 46 'subtitle' => __('Choose Notification Position', 'cartnotify'), 47 'placeholder' => __('Notification Position', 'cartnotify'), 48 'options' => array( 49 __('Free', 'notify') => array( 50 'right-top' => __('Right Top', 'cartnotify'), 51 'right-bottom' => __('Right Bttom', 'cartnotify'), 52 ), 53 54 ), 55 'default' => 'right-bottom' 56 ), 57 ), 58 )); 31 [ 32 'id' => 'cns-prestyle', 33 'type' => 'image_select', 34 'title' => __( 'Notificaion Design', 'cartnotify' ), 35 'subtitle' => __( 'Select Notificaion design', 'cartnotify' ), 36 'options' => array( 37 'cns-prestyle-1' => CART_NOTIFY_ASSETS . '/img/cartnotify_layout_1.png', 38 ), 39 'default' => 'tog-1', 40 //'dependency' => array('cns-layout', '!=', '1', '', 'visible'), 41 ], 59 42 60 ?> 43 [ 44 'id' => 'cns-notify-position', 45 'type' => 'select', 46 'title' => __( 'Select Notification Position', 'cartnotify' ), 47 'subtitle' => __( 'Choose Notification Position', 'cartnotify' ), 48 'placeholder' => __( 'Notification Position', 'cartnotify' ), 49 'options' => array( 50 __( 'Free', 'notify' ) => array( 51 'right-top' => __( 'Right Top', 'cartnotify' ), 52 'right-bottom' => __( 'Right Bttom', 'cartnotify' ), 53 ), 54 55 ), 56 'default' => 'right-bottom' 57 ], 58 59 [ 60 'id' => 'cns-order-notify-all', 61 'type' => 'switcher', 62 'title' => __( 'Enable order notify', 'cartnotify' ), 63 'subtitle' => __( 'It will enable notifications for all users when an order or product is successfully purchased.', 'cartnotify' ), 64 65 ], 66 ], 67 ) ); -
cart-notify/trunk/admin/options/optimization.php
r3033994 r3054029 3 3 defined( 'ABSPATH' ) || exit; 4 4 5 $badge_up = '<div class=" ins-csf-badge"><span class="ins-upcoming">' .__("Upcoming", "cartnotify"). '</span></div>';6 $badge_pro = '<div class=" ins-csf-badge"><span class="ins-pro">' .__("Pro Feature", "cartnotify"). '</span></div>';7 $badge_up_pro = '<div class=" ins-csf-badge"><span class="ins-upcoming">' .__("Upcoming", "cartnotify"). '</span><span class="ins-pro">' .__("Pro Feature", "cartnotify"). '</span></div>';5 $badge_up = '<div class="cns-csf-badge"><span class="cns-upcoming">' . __( "Upcoming", "cartnotify" ) . '</span></div>'; 6 $badge_pro = '<div class="cns-csf-badge"><span class="cns-pro">' . __( "Pro Feature", "cartnotify" ) . '</span></div>'; 7 $badge_up_pro = '<div class="cns-csf-badge"><span class="cns-upcoming">' . __( "Upcoming", "cartnotify" ) . '</span><span class="cns-pro">' . __( "Pro Feature", "cartnotify" ) . '</span></div>'; 8 8 9 9 CSF::createSection( $prefix, array( 10 'id' => 'optimization', 11 'title' => __( 'Optimization', 'cartnotify' ), 12 'icon' => 'fas fa-bolt', 13 'fields' => array( 10 'id' => 'optimization', 11 'title' => __( 'Optimization', 'cartnotify' ), 12 'icon' => 'fas fa-bolt', 13 'fields' => [ 14 [ 15 'id' => 'css-min', 16 'class' => 'cns-csf-disable cns-csf-pro', 17 'type' => 'switcher', 18 'title' => __( 'Minify CSS', 'cartnotify' ), 19 'subtitle' => __( 'Enable/disable Cart Notify CSS minification' . $badge_pro, 'cartnotify' ), 20 'text_on' => __( 'Enabled', 'cartnotify' ), 21 'text_off' => __( 'Disabled', 'cartnotify' ), 22 'text_width' => 100, 23 'default' => false, 24 ], 14 25 15 array( 16 'id' => 'css-min', 17 'class' => 'ins-csf-disable ins-csf-pro', 18 'type' => 'switcher', 19 'title' => __('Minify CSS', 'cartnotify'), 20 'subtitle' => __('Enable/disable Cart Notify CSS minification' .$badge_pro, 'cartnotify'), 21 'text_on' => __('Enabled', 'cartnotify'), 22 'text_off' => __('Disabled', 'cartnotify'), 23 'text_width' => 100, 24 'default' => false, 25 ), 26 27 array( 28 'id' => 'js-min', 29 'class' => 'ins-csf-disable ins-csf-pro', 30 'type' => 'switcher', 31 'title' => __('Minify JS', 'cartnotify'), 32 'subtitle' => __('Enable/disable Cart Notify JS minification' .$badge_pro, 'cartnotify'), 33 'text_on' => __('Enabled', 'cartnotify'), 34 'text_off' => __('Disabled', 'cartnotify'), 35 'text_width' => 100, 36 'default' => false, 37 ), 38 39 ) 26 [ 27 'id' => 'js-min', 28 'class' => 'cns-csf-disable cns-csf-pro', 29 'type' => 'switcher', 30 'title' => __( 'Minify JS', 'cartnotify' ), 31 'subtitle' => __( 'Enable/disable Cart Notify JS minification' . $badge_pro, 'cartnotify' ), 32 'text_on' => __( 'Enabled', 'cartnotify' ), 33 'text_off' => __( 'Disabled', 'cartnotify' ), 34 'text_width' => 100, 35 'default' => false, 36 ], 37 ] 40 38 ) ); 41 39 42 ?> -
cart-notify/trunk/admin/options/others.php
r3033994 r3054029 1 <?php 1 <?php 2 2 // don't load directly 3 3 defined( 'ABSPATH' ) || exit; 4 4 5 $badge_up = '<div class="ins-csf-badge"><span class="ins-upcoming">' . __("Upcoming", "cartnotify"). '</span></div>';6 $badge_pro = '<div class="ins-csf-badge"><span class="ins-pro">' . __("Pro Feature", "cartnotify"). '</span></div>';7 $badge_up_pro = '<div class="ins-csf-badge"><span class="ins-upcoming">' . __("Upcoming", "cartnotify"). '</span><span class="ins-pro">' .__("Pro Feature", "cartnotify"). '</span></div>';5 $badge_up = '<div class="ins-csf-badge"><span class="ins-upcoming">' . __( "Upcoming", "cartnotify" ) . '</span></div>'; 6 $badge_pro = '<div class="ins-csf-badge"><span class="ins-pro">' . __( "Pro Feature", "cartnotify" ) . '</span></div>'; 7 $badge_up_pro = '<div class="ins-csf-badge"><span class="ins-upcoming">' . __( "Upcoming", "cartnotify" ) . '</span><span class="ins-pro">' . __( "Pro Feature", "cartnotify" ) . '</span></div>'; 8 8 9 9 CSF::createSection( $prefix, array( 10 'parent' => 'design', // The slug id of the parent section11 'title' => __( 'Others', 'cartnotify' ),12 'fields' => array(10 'parent' => 'design', // The slug id of the parent section 11 'title' => __( 'Others', 'cartnotify' ), 12 'fields' => array( 13 13 14 array(15 'type'=> 'subheading',16 'content' => __('Others', 'cartnotify'),17 ),14 array( 15 'type' => 'subheading', 16 'content' => __( 'Others', 'cartnotify' ), 17 ), 18 18 19 array(20 'id'=> 'wi-custom-css',21 'type'=> 'code_editor',22 'title'=> 'Custom CSS',23 'subtitle' => __( 'If you want to make extra CSS then you can do it from here', 'cartnotify' ),24 'settings' => array(25 'theme'=> 'monokai',26 'mode'=> 'css',27 ),28 ),19 array( 20 'id' => 'wi-custom-css', 21 'type' => 'code_editor', 22 'title' => 'Custom CSS', 23 'subtitle' => __( 'If you want to make extra CSS then you can do it from here', 'cartnotify' ), 24 'settings' => array( 25 'theme' => 'monokai', 26 'mode' => 'css', 27 ), 28 ), 29 29 30 )30 ) 31 31 ) ); 32 33 ?> -
cart-notify/trunk/assets/js/CartNAdmin.js
r3033994 r3054029 5 5 // CNS_Options 6 6 7 8 /** 9 * Ajax install WooCommerce 10 * 11 * @since 3.0 12 */ 13 $(document).on('click', '.cartnotify-install-woocommerce', function (e) { 14 e.preventDefault(); 15 16 var current = $(this); 17 var plugin_slug = current.attr("data-plugin-slug"); 18 19 current.addClass('updating-message').text('Installing...'); 20 21 var data = { 22 action: 'cartnotify_ajax_install_plugin', 23 _ajax_nonce: CNS_admin.cns_ajax_nonce, 24 slug: plugin_slug, 25 }; 26 27 jQuery.post(CNS_admin.cns_admin_ajax, data, function (response) { 28 // console.log(response); 29 // console.log(response.data.activateUrl); 30 current.removeClass('updating-message'); 31 current.addClass('updated-message').text('Installed!'); 32 current.attr("href", response.data.activateUrl); 33 }) 34 .fail(function () { 35 current.removeClass('updating-message').text('Failed!'); 36 }) 37 .always(function () { 38 current.removeClass('cartnotify-install-woocommerce updated-message').addClass('activate-now button-primary').text('Activating...'); 39 current.unbind(e); 40 current[0].click(); 41 }); 42 }); 43 7 44 }) 8 45 })(jQuery); -
cart-notify/trunk/assets/js/frontend.js
r3033994 r3054029 1 1 (function ($) { 2 "use strict";2 "use strict"; 3 3 4 var closing= "<svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='15' height='15' viewBox='0 0 24 24'><path d='M12,2C6.47,2,2,6.47,2,12c0,5.53,4.47,10,10,10s10-4.47,10-10C22,6.47,17.53,2,12,2z M16.707,15.293 c0.391,0.391,0.391,1.023,0,1.414C16.512,16.902,16.256,17,16,17s-0.512-0.098-0.707-0.293L12,13.414l-3.293,3.293 C8.512,16.902,8.256,17,8,17s-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414L10.586,12L7.293,8.707 c-0.391-0.391-0.391-1.023,0-1.414s1.023-0.391,1.414,0L12,10.586l3.293-3.293c0.391-0.391,1.023-0.391,1.414,0 s0.391,1.023,0,1.414L13.414,12L16.707,15.293z'></path></svg>";4 var closing = "<svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='15' height='15' viewBox='0 0 24 24'><path d='M12,2C6.47,2,2,6.47,2,12c0,5.53,4.47,10,10,10s10-4.47,10-10C22,6.47,17.53,2,12,2z M16.707,15.293 c0.391,0.391,0.391,1.023,0,1.414C16.512,16.902,16.256,17,16,17s-0.512-0.098-0.707-0.293L12,13.414l-3.293,3.293 C8.512,16.902,8.256,17,8,17s-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414L10.586,12L7.293,8.707 c-0.391-0.391-0.391-1.023,0-1.414s1.023-0.391,1.414,0L12,10.586l3.293-3.293c0.391-0.391,1.023-0.391,1.414,0 s0.391,1.023,0,1.414L13.414,12L16.707,15.293z'></path></svg>"; 5 5 6 jQuery(document).ready(function () { 7 $.notiny.addTheme("CNS_dark", { 8 notification_class: "notify-theme-CNS-dark notiny-default-vars", 6 console.log(closing); 7 8 9 jQuery(document).ready(function () { 10 $.notiny.addTheme("CNS_dark", { 11 notification_class: "notify-theme-CNS-dark notiny-default-vars", 12 }); 13 14 console.log(CNS_params.notifyposition); 15 16 // add_to_cart_button function 17 $(document).on( 18 "click", 19 ".add_to_cart_button:not(.product_type_variable)", 20 function () { 21 var productthumnail = $(this) 22 .closest(".product") 23 .find("img") 24 .attr("src"); 25 26 var productTitle = $(this).closest(".product").find("h2").text(); 27 productTitle = "<h2> " + productTitle + " </h2>"; 28 29 var successMessage = 30 "<span>The product has been successfully added to the cart</span>" + "<span class='cns_close'>" + closing + "</span>"; 31 32 var all = productTitle + " " + successMessage; 33 $.notiny({ 34 theme: "CNS_dark", 35 width: '400', 36 // autohide: false, 37 image: productthumnail, 38 text: all, 39 position: CNS_params.notifyposition, 40 }); 41 } 42 ); 43 44 // single_add_to_cart_button function 45 $(document).on( 46 "click", 47 ".single_add_to_cart_button:not(.disabled)", 48 function () { 49 var productthumnail = $(this) 50 .closest(".product") 51 .find("figure") 52 .find("img") 53 .attr("src"); 54 55 var productthumnail = $(this) 56 .closest(".product") 57 .find(".woocommerce-product-gallery__wrapper") 58 .find("img"); 59 60 if (productthumnail.length == 0) { 61 var productthumnail = $(this) 62 .closest(".product") 63 .find("a") 64 .find("img"); 65 } 66 if ( 67 typeof productthumnail == "undefined" || 68 productthumnail.length == 0 69 ) { 70 return false; 71 } 72 73 var productThumb_src = productthumnail.attr("src"); 74 75 var producttitle = $(this) 76 .closest(".product") 77 .find(".product_title") 78 .text(); 79 80 var successMessage = 81 "<span>The product has been successfully added to the cart</span>" + "<span class='cns_close'>" + closing + "</span>"; 82 83 var all = producttitle + " " + successMessage; 84 85 $.notiny({ 86 theme: "CNS_dark", 87 width: '400', 88 image: productThumb_src, 89 text: all, 90 position: CNS_params.notifyposition, 91 // position: 'right-top', 92 }); 93 } 94 ); 9 95 }); 10 11 console.log(CNS_params.notifyposition);12 13 // add_to_cart_button function14 $(document).on(15 "click",16 ".add_to_cart_button:not(.product_type_variable)",17 function () {18 var productthumnail = $(this)19 .closest(".product")20 .find("img")21 .attr("src");22 23 var productTitle = $(this).closest(".product").find("h2").text();24 productTitle = "<h2> " + productTitle + " </h2>";25 26 var successMessage =27 "<span>The product has been successfully added to the cart</span>" + "<span class='cns_close'>"+closing+"</span>";28 29 var all = productTitle + " " + successMessage;30 console.log(CNS_params.notifyposition);31 $.notiny({32 theme: "CNS_dark",33 width: '400',34 // autohide: false,35 image: productthumnail,36 text: all,37 position: CNS_params.notifyposition,38 });39 }40 );41 42 // single_add_to_cart_button function43 $(document).on(44 "click",45 ".single_add_to_cart_button:not(.disabled)",46 function () {47 var productthumnail = $(this)48 .closest(".product")49 .find("figure")50 .find("img")51 .attr("src");52 53 var productthumnail = $(this)54 .closest(".product")55 .find(".woocommerce-product-gallery__wrapper")56 .find("img");57 58 if (productthumnail.length == 0) {59 var productthumnail = $(this)60 .closest(".product")61 .find("a")62 .find("img");63 }64 if (65 typeof productthumnail == "undefined" ||66 productthumnail.length == 067 ) {68 return false;69 }70 71 var productThumb_src = productthumnail.attr("src");72 73 var producttitle = $(this)74 .closest(".product")75 .find(".product_title")76 .text();77 78 var successMessage =79 "<span>The product has been successfully added to the cart</span>" + "<span class='cns_close'>"+closing+"</span>";80 81 var all = producttitle + " " + successMessage;82 83 $.notiny({84 theme: "CNS_dark",85 width: '400',86 image: productThumb_src,87 text: all,88 position: CNS_params.notifyposition,89 // position: 'right-top',90 });91 }92 );93 });94 96 })(jQuery); -
cart-notify/trunk/cartnotify.php
r3033994 r3054029 6 6 * Author: M Hemel Hasan 7 7 * Author URI: https://mhemelhasan.com 8 * Version: 1.1. 18 * Version: 1.1.2 9 9 * Text Domain: cartnotify 10 10 * License: GPL3 or later … … 13 13 * Tested up to: 6.4.3 14 14 * Requires PHP: 7.2 15 * WC tested up to: 8. 5.215 * WC tested up to: 8.6.1 16 16 * 17 17 */ … … 29 29 * @since 1.0 30 30 */ 31 include_once ( ABSPATH . 'wp-admin/includes/plugin.php' );31 include_once ( ABSPATH . 'wp-admin/includes/plugin.php' ); 32 32 33 33 … … 47 47 * @var string 48 48 */ 49 const version = '1.1. 1';49 const version = '1.1.2'; 50 50 51 51 /** … … 55 55 $this->define_constants(); 56 56 57 register_activation_hook( __FILE__, [ $this, 'activate' ] ); 57 register_activation_hook( __FILE__, [ $this, 'cart_notify_activate' ] ); 58 register_deactivation_hook( __FILE__, [ $this, 'cart_notify_deactivate' ] ); 58 59 add_action( 'plugins_loaded', [ $this, 'init_plugin' ] ); 59 60 60 $this->appsero_init_tracker_cart_notify();61 $this->appsero_init_tracker_cart_notify(); 61 62 } 62 63 … … 83 84 public function define_constants() { 84 85 define( 'CART_NOTIFY_VERSION', self::version ); 86 define( 'CART_NOTIFY_BASE_LOCATION', plugin_basename( __FILE__ ) ); 85 87 // URLs 86 88 define( 'CART_NOTIFY_FILE', __FILE__ ); … … 120 122 * @return void 121 123 */ 122 public function activate() {124 public function cart_notify_activate() { 123 125 $installed = get_option( 'cart_notify_installed' ); 124 126 … … 129 131 update_option( 'cart_notify_version', CART_NOTIFY_VERSION ); 130 132 } 133 134 // Deactivation Hooks 135 public function cart_notify_deactivate() { 136 $installed = get_option( 'cart_notify_installed' ); 137 if ( $installed ) { 138 delete_option( 'cart_notify_installed' ); 139 delete_option( 'cart_notify_version' ); 140 } 141 } 142 131 143 132 144 /** -
cart-notify/trunk/includes/Admin.php
r3033994 r3054029 8 8 class Admin { 9 9 10 /** 11 * Initialize the class 12 */ 13 function __construct() { 10 /** 11 * Initialize the class 12 */ 13 function __construct() { 14 new Admin\CartnotiSetpage(); 14 15 15 new Admin\CartnotiSetpage(); 16 } 16 // Define Plugin Action Links. 17 add_filter( 'plugin_action_links_' . CART_NOTIFY_BASE_LOCATION, [ $this, 'cart_notify_plugin_action_links' ] ); 18 } 19 20 /** 21 * Add plugin action links. 22 * 23 */ 24 public function cart_notify_plugin_action_links( $links ) { 25 26 $settings_link = array( 27 '<a href="admin.php?page=cart_notify_opt#tab=general">' . esc_html__( 'Settings', 'cartnotify' ) . '</a>', 28 ); 29 return array_merge( $settings_link, $links ); 30 } 31 17 32 } 18 -
cart-notify/trunk/includes/Admin/CartnotiSetpage.php
r3033994 r3054029 6 6 // Setting Page Contnet handler class 7 7 class CartnotiSetpage { 8 /** 9 * Initialize the class 10 */ 11 function __construct() { 12 $this->PluginOption(); 13 14 } 8 /** 9 * Initialize the class 10 */ 11 function __construct() { 12 $this->PluginOption(); 15 13 16 public function PluginOption(){ 17 // Option Framework 18 if ( file_exists( CART_NOTIFY_ADMIN_PATH .'/framework/framework.php' ) ) { 19 require_once( CART_NOTIFY_ADMIN_PATH .'/framework/framework.php' ); 14 } 15 16 public function PluginOption() { 17 // Option Framework 18 if ( file_exists( CART_NOTIFY_ADMIN_PATH . '/framework/framework.php' ) ) { 19 require_once ( CART_NOTIFY_ADMIN_PATH . '/framework/framework.php' ); 20 20 } 21 21 22 // Options23 if ( file_exists( WP_PLUGIN_DIR . '/cart-notify-pro/admin/config.php' ) && defined( 'INSTANTIO_PRO_CONFIG' ) && defined( 'INSTANTIO_PRO' ) ) {24 require_once ( WP_PLUGIN_DIR .'/cart-notify-pro/admin/config.php' );25 } elseif ( file_exists( CART_NOTIFY_ADMIN_PATH . '/config.php' ) ) {26 require_once ( CART_NOTIFY_ADMIN_PATH .'/config.php' );22 // Options 23 if ( file_exists( WP_PLUGIN_DIR . '/cart-notify-pro/admin/config.php' ) ) { 24 require_once ( WP_PLUGIN_DIR . '/cart-notify-pro/admin/config.php' ); 25 } elseif ( file_exists( CART_NOTIFY_ADMIN_PATH . '/config.php' ) ) { 26 require_once ( CART_NOTIFY_ADMIN_PATH . '/config.php' ); 27 27 } 28 }28 } 29 29 30 30 } -
cart-notify/trunk/includes/Assets.php
r3033994 r3054029 8 8 class Assets { 9 9 10 /** 11 * Class constructor 12 */ 13 function __construct() { 14 15 add_action( 'admin_enqueue_scripts', [ $this, 'register_assets' ] ); 16 add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ] ); 10 /** 11 * Class constructor 12 */ 13 function __construct() { 17 14 18 // Js Variable 19 add_action( 'wp_enqueue_scripts', [ $this, 'cartnotify_script_custom_js' ]); 20 add_action( 'wp_enqueue_scripts', [ $this, 'cns_custom_enqueue_scripts' ] ); 21 } 15 add_action( 'admin_enqueue_scripts', [ $this, 'register_assets' ] ); 16 add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ] ); 22 17 23 /** 24 * All available scripts 25 * 26 * @return array 27 */ 28 public function get_scripts() { 29 return [ 30 'cartnotify-script' => [ 31 'src' => CART_NOTIFY_ASSETS . '/js/frontend.js', 32 'version' => filemtime( CART_NOTIFY_PATH . '/assets/js/frontend.js' ), 33 'deps' => [ 'jquery' ] 34 ], 18 // Js localization 19 add_action( 'admin_enqueue_scripts', [ $this, 'cart_notify_localize_script' ] ); 35 20 36 'cartnotify-libs-script' => [ 37 'src' => CART_NOTIFY_ASSETS . '/libs/notiny.js', 38 'version' => filemtime( CART_NOTIFY_PATH . '/assets/libs/notiny.js' ), 39 'deps' => [ 'jquery' ] 40 ], 41 42 'cartnotify-admin-script' => [ 43 'src' => CART_NOTIFY_ASSETS . '/js/CartNAdmin.js', 44 'version' => filemtime( CART_NOTIFY_PATH . '/assets/js/CartNAdmin.js' ), 45 'deps' => [ 'jquery' ] 46 ] 47 ]; 48 } 21 // Js Variable 22 add_action( 'wp_enqueue_scripts', [ $this, 'cartnotify_script_custom_js' ] ); 23 add_action( 'wp_enqueue_scripts', [ $this, 'cns_custom_enqueue_scripts' ] ); 24 } 49 25 50 /** 51 * All available styles 52 * 53 * @return array 54 */ 55 public function get_styles() { 56 return [ 57 'cartnotify-libs-style' => [ 58 'src' => CART_NOTIFY_ASSETS . '/libs/notiny.css', 59 'version' => filemtime( CART_NOTIFY_PATH . '/assets/libs/notiny.css' ) 60 ], 26 /** 27 * All available scripts 28 * 29 * @return array 30 */ 31 public function get_scripts() { 32 return [ 33 'cartnotify-script' => [ 34 'src' => CART_NOTIFY_ASSETS . '/js/frontend.js', 35 'version' => filemtime( CART_NOTIFY_PATH . '/assets/js/frontend.js' ), 36 'deps' => [ 'jquery' ] 37 ], 61 38 62 'cartnotify-style' => [ 63 'src' => CART_NOTIFY_ASSETS . '/css/frontend.css', 64 'version' => filemtime( CART_NOTIFY_PATH . '/assets/css/frontend.css' ) 65 ], 39 'cartnotify-libs-script' => [ 40 'src' => CART_NOTIFY_ASSETS . '/libs/notiny.js', 41 'version' => filemtime( CART_NOTIFY_PATH . '/assets/libs/notiny.js' ), 42 'deps' => [ 'jquery' ] 43 ], 66 44 67 'cartnotifyadmin-style' => [ 68 'src' => CART_NOTIFY_ASSETS . '/css/cartnotifyadmin.css',69 'version' => filemtime( CART_NOTIFY_PATH . '/assets/css/cartnotifyadmin.css' ) 70 ]71 72 ];73 }45 'cartnotify-admin-script' => [ 46 'src' => CART_NOTIFY_ASSETS . '/js/CartNAdmin.js', 47 'version' => filemtime( CART_NOTIFY_PATH . '/assets/js/CartNAdmin.js' ), 48 'deps' => [ 'jquery' ] 49 ] 50 ]; 51 } 74 52 75 /** 76 * Register scripts and styles 77 * 78 * @return void 79 */ 80 public function register_assets() { 81 $scripts = $this->get_scripts(); 82 $styles = $this->get_styles(); 53 /** 54 * All available styles 55 * 56 * @return array 57 */ 58 public function get_styles() { 59 return [ 60 'cartnotify-libs-style' => [ 61 'src' => CART_NOTIFY_ASSETS . '/libs/notiny.css', 62 'version' => filemtime( CART_NOTIFY_PATH . '/assets/libs/notiny.css' ) 63 ], 83 64 84 foreach ( $scripts as $handle => $script ) { 85 $deps = isset( $script['deps'] ) ? $script['deps'] : false; 65 'cartnotify-style' => [ 66 'src' => CART_NOTIFY_ASSETS . '/css/frontend.css', 67 'version' => filemtime( CART_NOTIFY_PATH . '/assets/css/frontend.css' ) 68 ], 86 69 87 wp_register_script( $handle, $script['src'], $deps, $script['version'], true ); 88 } 70 'cartnotifyadmin-style' => [ 71 'src' => CART_NOTIFY_ASSETS . '/css/cartnotifyadmin.css', 72 'version' => filemtime( CART_NOTIFY_PATH . '/assets/css/cartnotifyadmin.css' ) 73 ] 89 74 90 foreach ( $styles as $handle => $style ) { 91 $deps = isset( $style['deps'] ) ? $style['deps'] : false; 75 ]; 76 } 92 77 93 wp_register_style( $handle, $style['src'], $deps, $style['version'] ); 94 } 95 96 } 78 /** 79 * Register scripts and styles 80 * 81 * @return void 82 */ 83 public function register_assets() { 84 $scripts = $this->get_scripts(); 85 $styles = $this->get_styles(); 97 86 98 /** 99 * Extra script var 100 * 101 * @return array 102 */ 103 public function cns_custom_enqueue_scripts(){ 104 // Enqueue the script 105 $cns_notify_position = !empty(notify_opts( 'cns-notify-position' )) ? notify_opts( 'cns-notify-position' ) : ''; 87 foreach ( $scripts as $handle => $script ) { 88 $deps = isset ( $script['deps'] ) ? $script['deps'] : false; 106 89 107 wp_localize_script( 'cartnotify-script', 'CNS_params', 108 array( 109 'cns_ajax_nonce' => wp_create_nonce( 'ins_ajax_nonce' ), 110 'ajax_url' => admin_url( 'admin-ajax.php' ), 111 'cns_raw_ajax_url' => WC()->ajax_url(), 112 'wc_ajax_url' => \WC_AJAX::get_endpoint( '%%endpoint%%' ), 113 'notifyposition' => $cns_notify_position, 114 ) 115 ); 116 } 90 wp_register_script( $handle, $script['src'], $deps, $script['version'], true ); 91 } 117 92 118 /** 119 * Register scripts Extra 120 * 121 * @return void 122 */ 123 public function cartnotify_script_custom_js(){ 124 // icons All 125 include_once( CART_NOTIFY_ASSETS_PATH . '/icons/closing.php'); 126 93 foreach ( $styles as $handle => $style ) { 94 $deps = isset ( $style['deps'] ) ? $style['deps'] : false; 95 96 wp_register_style( $handle, $style['src'], $deps, $style['version'] ); 97 } 98 99 } 100 101 102 /** 103 * Js script localization 104 * 105 * @return array 106 */ 107 public function cart_notify_localize_script() { 108 109 wp_enqueue_script( 'cartnotify-admin-script' ); 110 111 wp_localize_script( 'cartnotify-admin-script', 'CNS_admin', [ 112 'cns_admin_ajax' => admin_url( 'admin-ajax.php' ), 113 'cns_ajax_nonce' => wp_create_nonce( 'updates' ), 114 ] ); 115 } 116 117 /** 118 * Extra script var 119 * 120 * @return array 121 */ 122 public function cns_custom_enqueue_scripts() { 123 // Enqueue the script 124 $cns_notify_position = ! empty ( notify_opts( 'cns-notify-position' ) ) ? notify_opts( 'cns-notify-position' ) : ''; 125 126 wp_localize_script( 'cartnotify-script', 'CNS_params', 127 [ 128 'cns_ajax_nonce' => wp_create_nonce( 'ins_ajax_nonce' ), 129 'ajax_url' => admin_url( 'admin-ajax.php' ), 130 'cns_raw_ajax_url' => WC()->ajax_url(), 131 'wc_ajax_url' => \WC_AJAX::get_endpoint( '%%endpoint%%' ), 132 'notifyposition' => $cns_notify_position, 133 ] 134 ); 135 } 136 137 /** 138 * Register scripts Extra 139 * 140 * @return void 141 */ 142 public function cartnotify_script_custom_js() { 143 // icons All 144 include_once ( CART_NOTIFY_ASSETS_PATH . '/icons/closing.php' ); 145 127 146 // Backend options as variables 128 $cns_notify_opt = !empty(notify_opts( 'cns-notify-opt' )) ? notify_opts( 'cns-notify-opt' ) : ''; 129 $cns_notify_position = !empty(notify_opts( 'cns-notify-position' )) ? notify_opts( 'cns-notify-position' ) : ''; 130 131 // add all options 132 $output = ''; 133 134 $output .= " var clsoing_icon = '$notify_close'; " ; 135 $output .= " var notifyopt = '$cns_notify_opt'; " ; 136 $output .= " var notifyposition = '$cns_notify_position'; " ; 147 $cns_notify_opt = ! empty ( notify_opts( 'cns-notify-opt' ) ) ? notify_opts( 'cns-notify-opt' ) : ''; 148 $cns_notify_position = ! empty ( notify_opts( 'cns-notify-position' ) ) ? notify_opts( 'cns-notify-position' ) : ''; 137 149 138 150 // add all options 151 $output = ''; 152 153 $output .= " var clsoing_icon = '$notify_close'; "; 154 $output .= " var notifyopt = '$cns_notify_opt'; "; 155 $output .= " var notifyposition = '$cns_notify_position'; "; 156 157 139 158 wp_add_inline_script( 'cartnotify-script', $output ); 140 159 } 141 160 142 161 } -
cart-notify/trunk/includes/Necessary.php
r3033994 r3054029 7 7 * Necessary Plugin handler class 8 8 */ 9 class Necessary {9 class Necessary { 10 10 11 /**12 * Initialize the class13 */14 function __construct() {15 $this->WooComCheck();16 }11 /** 12 * Initialize the class 13 */ 14 function __construct() { 15 $this->WooComCheck(); 16 } 17 17 18 public function WooComCheck() {19 /**20 * Check if WooCommerce is active, and if it isn't, disable the plugin.21 *22 * @since 1.023 */24 if ( !is_plugin_active( 'woocommerce/woocommerce.php' ) ) {25 add_action( 'admin_notices', [$this, 'cartnotify_Is_Woo'] );18 public function WooComCheck() { 19 /** 20 * Check if WooCommerce is active, and if it isn't, disable the plugin. 21 * 22 * @since 1.0 23 */ 24 if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) { 25 add_action( 'admin_notices', [ $this, 'cartnotify_Is_Woo' ] ); 26 26 27 /**28 * Ajax install & activate WooCommerce29 *30 * @since 1.031 * @link https://developer.wordpress.org/reference/functions/wp_ajax_install_plugin/32 */33 add_action("wp_ajax_cartnotify_ajax_install_plugin" , "wp_ajax_install_plugin");27 /** 28 * Ajax install & activate WooCommerce 29 * 30 * @since 1.0 31 * @link https://developer.wordpress.org/reference/functions/wp_ajax_install_plugin/ 32 */ 33 add_action( "wp_ajax_cartnotify_ajax_install_plugin", "wp_ajax_install_plugin" ); 34 34 35 return;36 }37 }35 return; 36 } 37 } 38 38 39 /** 40 * Called when WooCommerce is inactive to display an inactive notice. 41 * 42 * @since 1.0 43 */ 44 public function cartnotify_Is_Woo() { 45 if ( current_user_can( 'activate_plugins' ) ) { 46 if ( !is_plugin_active( 'woocommerce/woocommerce.php' ) && !file_exists( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ) ) { 47 ?> 48 <div id="message" class="error"> 49 <p><?php printf( __( 'Cart Notify requires %1$s WooCommerce %2$s to be activated.', 'cartnotify' ), '<strong><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">', '</a></strong>' ); ?></p> 50 <p><a class="install-now button tf-install" data-plugin-slug="woocommerce"><?php esc_attr_e( 'Install Now', 'cartnotify' ); ?></a></p> 51 </div> 39 /** 40 * Called when WooCommerce is inactive to display an inactive notice. 41 * 42 * @since 1.0 43 */ 44 public function cartnotify_Is_Woo() { 45 if ( current_user_can( 'activate_plugins' ) ) { 46 if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) && ! file_exists( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ) ) { 47 ?> 48 <div id="message" class="error"> 49 <p> 50 <?php printf( __( 'Cart Notify requires %1$s WooCommerce %2$s to be activated in order to function properly.', 'cartnotify' ), '<strong><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">', '</a></strong>' ); ?> 51 </p> 52 <p> 53 <a class="cartnotify-install-woocommerce button" data-plugin-slug="woocommerce"> 54 <?php esc_attr_e( 'Install Now', 'cartnotify' ); ?> 55 </a> 56 </p> 57 </div> 52 58 53 <?php 54 } elseif ( !is_plugin_active( 'woocommerce/woocommerce.php' ) && file_exists( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ) ) {55 ?>59 <?php 60 } elseif ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) && file_exists( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ) ) { 61 ?> 56 62 57 <div id="message" class="error"> 58 <p><?php printf( __( 'Cart Notify requires %1$s WooCommerce %2$s to be activated.', 'cartnotify' ), '<strong><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">', '</a></strong>' ); ?></p> 59 <p><a href="<?php echo get_admin_url(); ?>plugins.php?_wpnonce=<?php echo wp_create_nonce( 'activate-plugin_woocommerce/woocommerce.php' ); ?>&action=activate&plugin=woocommerce/woocommerce.php" class="button activate-now button-primary"><?php esc_attr_e( 'Activate', 'cartnotify' ); ?></a></p> 60 </div> 63 <div id="message" class="error"> 64 <p> 65 <?php printf( __( 'Cart Notify requires %1$s WooCommerce %2$s to be activated.', 'cartnotify' ), '<strong><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">', '</a></strong>' ); ?> 66 </p> 67 <p><a href="<?php echo get_admin_url(); ?>plugins.php?_wpnonce=<?php echo wp_create_nonce( 'activate-plugin_woocommerce/woocommerce.php' ); ?>&action=activate&plugin=woocommerce/woocommerce.php" 68 class="button activate-now button-primary"> 69 <?php esc_attr_e( 'Activate', 'cartnotify' ); ?> 70 </a></p> 71 </div> 61 72 62 <?php 63 } elseif ( version_compare( get_option( 'woocommerce_db_version' ), '2.5', '<' ) ) {64 ?>73 <?php 74 } elseif ( version_compare( get_option( 'woocommerce_db_version' ), '5.0', '<' ) ) { 75 ?> 65 76 66 <div id="message" class="error"> 67 <p><?php printf( __( '%sCart Notify is inactive.%s This plugin requires WooCommerce 2.5 or newer. Please %supdate WooCommerce to version 2.5 or newer%s', 'cartnotify' ), '<strong>', '</strong>', '<a href="' . admin_url( 'plugins.php' ) . '">', ' »</a>' ); ?></p> 68 </div> 77 <div id="message" class="error"> 78 <p> 79 <?php printf( __( '%sCart Notify is inactive.%s This plugin requires WooCommerce 5.0 or newer. Please %supdate WooCommerce to version 5.0 or newer%s', 'cartnotify' ), '<strong>', '</strong>', '<a href="' . admin_url( 'plugins.php' ) . '">', ' »</a>' ); ?> 80 </p> 81 </div> 69 82 70 <?php 71 }72 }73 }83 <?php 84 } 85 } 86 } 74 87 75 88
Note: See TracChangeset
for help on using the changeset viewer.