Version Description
- 10/03/2017 =
- Tweak - WooCommerce 2.7 support. Kudos @webmandesign.
- Dev - Scripts and styles now versioned correctly.
Download this release
Release Info
Developer | jameskoster |
Plugin | WooCommerce Cart Tab |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.1.1
- Gruntfile.js +0 -190
- cart-tab.php +36 -2
- includes/class-cart-tab-frontend.php +17 -7
- package.json +0 -29
- readme.txt +6 -2
Gruntfile.js
DELETED
@@ -1,190 +0,0 @@
|
|
1 |
-
/* jshint node:true */
|
2 |
-
module.exports = function( grunt ) {
|
3 |
-
'use strict';
|
4 |
-
|
5 |
-
grunt.initConfig({
|
6 |
-
|
7 |
-
// JavaScript linting with JSHint.
|
8 |
-
jshint: {
|
9 |
-
options: {
|
10 |
-
jshintrc: '.jshintrc'
|
11 |
-
},
|
12 |
-
all: [
|
13 |
-
'Gruntfile.js',
|
14 |
-
'assets/js/*.js',
|
15 |
-
'!assets/js/*.min.js'
|
16 |
-
]
|
17 |
-
},
|
18 |
-
|
19 |
-
// Minify .js files.
|
20 |
-
uglify: {
|
21 |
-
options: {
|
22 |
-
preserveComments: 'some'
|
23 |
-
},
|
24 |
-
main: {
|
25 |
-
files: [{
|
26 |
-
expand: true,
|
27 |
-
cwd: 'assets/js/',
|
28 |
-
src: [
|
29 |
-
'*.js',
|
30 |
-
'!*.min.js'
|
31 |
-
],
|
32 |
-
dest: 'assets/js/',
|
33 |
-
ext: '.min.js'
|
34 |
-
}]
|
35 |
-
}
|
36 |
-
},
|
37 |
-
|
38 |
-
// Compile all .scss files.
|
39 |
-
sass: {
|
40 |
-
dist: {
|
41 |
-
options: {
|
42 |
-
require: 'susy',
|
43 |
-
sourcemap: 'none',
|
44 |
-
includePaths: require( 'node-bourbon' ).includePaths
|
45 |
-
},
|
46 |
-
files: [{
|
47 |
-
'assets/css/style.css': 'assets/scss/style.scss',
|
48 |
-
'assets/css/style-storefront.css': 'assets/scss/style-storefront.scss',
|
49 |
-
}]
|
50 |
-
}
|
51 |
-
},
|
52 |
-
|
53 |
-
// Minify all .css files.
|
54 |
-
cssmin: {
|
55 |
-
minify: {
|
56 |
-
expand: true,
|
57 |
-
cwd: 'assets/css/',
|
58 |
-
src: ['*.css'],
|
59 |
-
dest: 'assets/css/',
|
60 |
-
ext: '.css'
|
61 |
-
}
|
62 |
-
},
|
63 |
-
|
64 |
-
// Watch changes for assets.
|
65 |
-
watch: {
|
66 |
-
css: {
|
67 |
-
files: [
|
68 |
-
'assets/scss/*.scss'
|
69 |
-
],
|
70 |
-
tasks: [
|
71 |
-
'sass',
|
72 |
-
'css'
|
73 |
-
]
|
74 |
-
},
|
75 |
-
js: {
|
76 |
-
files: [
|
77 |
-
// Main js
|
78 |
-
'assets/js/*js',
|
79 |
-
'assets/js/**/*.js',
|
80 |
-
'!assets/js/*.min.js'
|
81 |
-
],
|
82 |
-
tasks: ['uglify']
|
83 |
-
}
|
84 |
-
},
|
85 |
-
|
86 |
-
// Generate POT files.
|
87 |
-
makepot: {
|
88 |
-
options: {
|
89 |
-
type: 'wp-plugin',
|
90 |
-
domainPath: 'languages',
|
91 |
-
potHeaders: {
|
92 |
-
'report-msgid-bugs-to': 'https://github.com/jameskoster/woocommerce-cart-tab/issues',
|
93 |
-
'language-team': 'LANGUAGE <EMAIL@ADDRESS>'
|
94 |
-
}
|
95 |
-
},
|
96 |
-
frontend: {
|
97 |
-
options: {
|
98 |
-
potFilename: 'woocommerce-cart-tab.pot',
|
99 |
-
exclude: [
|
100 |
-
'woocommerce-cart-tab/.*' // Exclude deploy directory
|
101 |
-
],
|
102 |
-
processPot: function( pot ) {
|
103 |
-
pot.headers['project-id-version'];
|
104 |
-
return pot;
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
},
|
109 |
-
|
110 |
-
// Check textdomain errors.
|
111 |
-
checktextdomain: {
|
112 |
-
options:{
|
113 |
-
text_domain: 'woocommerce-cart-tab',
|
114 |
-
keywords: [
|
115 |
-
'__:1,2d',
|
116 |
-
'_e:1,2d',
|
117 |
-
'_x:1,2c,3d',
|
118 |
-
'esc_html__:1,2d',
|
119 |
-
'esc_html_e:1,2d',
|
120 |
-
'esc_html_x:1,2c,3d',
|
121 |
-
'esc_attr__:1,2d',
|
122 |
-
'esc_attr_e:1,2d',
|
123 |
-
'esc_attr_x:1,2c,3d',
|
124 |
-
'_ex:1,2c,3d',
|
125 |
-
'_n:1,2,4d',
|
126 |
-
'_nx:1,2,4c,5d',
|
127 |
-
'_n_noop:1,2,3d',
|
128 |
-
'_nx_noop:1,2,3c,4d'
|
129 |
-
]
|
130 |
-
},
|
131 |
-
files: {
|
132 |
-
src: [
|
133 |
-
'**/*.php', // Include all files
|
134 |
-
'!node_modules/**' // Exclude node_modules/
|
135 |
-
],
|
136 |
-
expand: true
|
137 |
-
}
|
138 |
-
},
|
139 |
-
|
140 |
-
// Creates deploy-able plugin
|
141 |
-
copy: {
|
142 |
-
deploy: {
|
143 |
-
src: [
|
144 |
-
'**',
|
145 |
-
'!.*',
|
146 |
-
'!.*/**',
|
147 |
-
'.htaccess',
|
148 |
-
'!Gruntfile.js',
|
149 |
-
'!package.json',
|
150 |
-
'!node_modules/**',
|
151 |
-
'!.DS_Store',
|
152 |
-
'!npm-debug.log'
|
153 |
-
],
|
154 |
-
dest: 'woocommerce-cart-tab',
|
155 |
-
expand: true,
|
156 |
-
dot: true
|
157 |
-
}
|
158 |
-
}
|
159 |
-
});
|
160 |
-
|
161 |
-
// Load NPM tasks to be used here
|
162 |
-
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
|
163 |
-
grunt.loadNpmTasks( 'grunt-wp-i18n' );
|
164 |
-
grunt.loadNpmTasks( 'grunt-checktextdomain' );
|
165 |
-
grunt.loadNpmTasks( 'grunt-sass' );
|
166 |
-
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
|
167 |
-
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
168 |
-
grunt.loadNpmTasks( 'grunt-contrib-copy' );
|
169 |
-
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
|
170 |
-
|
171 |
-
// Register tasks
|
172 |
-
grunt.registerTask( 'default', [
|
173 |
-
'css',
|
174 |
-
'uglify'
|
175 |
-
]);
|
176 |
-
|
177 |
-
grunt.registerTask( 'css', [
|
178 |
-
'sass'
|
179 |
-
]);
|
180 |
-
|
181 |
-
grunt.registerTask( 'dev', [
|
182 |
-
'default',
|
183 |
-
'makepot'
|
184 |
-
]);
|
185 |
-
|
186 |
-
grunt.registerTask( 'deploy', [
|
187 |
-
'makepot',
|
188 |
-
'copy'
|
189 |
-
]);
|
190 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cart-tab.php
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Cart Tab
|
4 |
* Plugin URI: http://jameskoster.co.uk/tag/cart-tab/
|
5 |
-
* Version: 1.1.
|
6 |
* Description: Displays a sitewide link to the cart which reveals the cart contents on hover.
|
7 |
* Author: jameskoster
|
8 |
-
* Tested up to: 4.7.
|
9 |
* Author URI: http://jameskoster.co.uk
|
10 |
* Text Domain: woocommerce-cart-tab
|
11 |
* Domain Path: /languages/
|
@@ -33,15 +33,49 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
33 |
*/
|
34 |
class WooCommerce_Cart_Tab {
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Set up all the things
|
38 |
*/
|
39 |
public function __construct() {
|
|
|
|
|
40 |
$this->setup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
* Setup
|
|
|
45 |
* @return void
|
46 |
*/
|
47 |
public function setup() {
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Cart Tab
|
4 |
* Plugin URI: http://jameskoster.co.uk/tag/cart-tab/
|
5 |
+
* Version: 1.1.1
|
6 |
* Description: Displays a sitewide link to the cart which reveals the cart contents on hover.
|
7 |
* Author: jameskoster
|
8 |
+
* Tested up to: 4.7.3
|
9 |
* Author URI: http://jameskoster.co.uk
|
10 |
* Text Domain: woocommerce-cart-tab
|
11 |
* Domain Path: /languages/
|
33 |
*/
|
34 |
class WooCommerce_Cart_Tab {
|
35 |
|
36 |
+
/**
|
37 |
+
* The token.
|
38 |
+
*
|
39 |
+
* @var string
|
40 |
+
* @access public
|
41 |
+
* @since 1.1.1
|
42 |
+
*/
|
43 |
+
public $token;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* The version number.
|
47 |
+
*
|
48 |
+
* @var string
|
49 |
+
* @access public
|
50 |
+
* @since 1.1.1
|
51 |
+
*/
|
52 |
+
public $version;
|
53 |
+
|
54 |
/**
|
55 |
* Set up all the things
|
56 |
*/
|
57 |
public function __construct() {
|
58 |
+
$this->token = 'woocommerce-cart-tab';
|
59 |
+
$this->version = '1.1.1';
|
60 |
$this->setup();
|
61 |
+
register_activation_hook( __FILE__, array( $this, 'install' ) );
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Installation.
|
66 |
+
* Runs on activation. Logs the version number.
|
67 |
+
*
|
68 |
+
* @access public
|
69 |
+
* @since 1.1.1
|
70 |
+
* @return void
|
71 |
+
*/
|
72 |
+
public function install() {
|
73 |
+
update_option( $this->token . '-version', $this->version );
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
* Setup
|
78 |
+
*
|
79 |
* @return void
|
80 |
*/
|
81 |
public function setup() {
|
includes/class-cart-tab-frontend.php
CHANGED
@@ -24,10 +24,15 @@ if ( ! class_exists( 'WooCommerce_Cart_Tab_Frontend' ) ) :
|
|
24 |
* @since 1.0.0
|
25 |
*/
|
26 |
public function __construct() {
|
27 |
-
add_action( 'wp_enqueue_scripts',
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
add_action( 'wp_footer',
|
31 |
}
|
32 |
|
33 |
/**
|
@@ -36,13 +41,15 @@ if ( ! class_exists( 'WooCommerce_Cart_Tab_Frontend' ) ) :
|
|
36 |
* @return void
|
37 |
*/
|
38 |
function setup_styles() {
|
|
|
|
|
39 |
if ( ! is_cart() && ! is_checkout() ) {
|
40 |
if ( 'storefront' == get_option( 'template' ) ) {
|
41 |
-
wp_enqueue_style( 'cart-tab-styles-storefront', plugins_url( '../assets/css/style-storefront.css', __FILE__ ) );
|
42 |
} else {
|
43 |
-
wp_enqueue_style( 'cart-tab-styles', plugins_url( '../assets/css/style.css', __FILE__ ) );
|
44 |
}
|
45 |
-
wp_enqueue_script( 'cart-tab-script', plugins_url( '../assets/js/cart-tab.min.js', __FILE__ ), array( 'jquery' ),
|
46 |
}
|
47 |
}
|
48 |
|
@@ -61,4 +68,7 @@ if ( ! class_exists( 'WooCommerce_Cart_Tab_Frontend' ) ) :
|
|
61 |
|
62 |
endif;
|
63 |
|
64 |
-
|
|
|
|
|
|
24 |
* @since 1.0.0
|
25 |
*/
|
26 |
public function __construct() {
|
27 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'setup_styles' ), 999 );
|
28 |
+
|
29 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
30 |
+
add_filter( 'add_to_cart_fragments', array( $this, 'woocommerce_cart_tab_add_to_cart_fragment' ) );
|
31 |
+
} else {
|
32 |
+
add_filter( 'woocommerce_add_to_cart_fragments', array( $this, 'woocommerce_cart_tab_add_to_cart_fragment' ) );
|
33 |
+
}
|
34 |
|
35 |
+
add_action( 'wp_footer', 'woocommerce_cart_tab' );
|
36 |
}
|
37 |
|
38 |
/**
|
41 |
* @return void
|
42 |
*/
|
43 |
function setup_styles() {
|
44 |
+
$version = get_option( 'woocommerce-cart-tab-version' );
|
45 |
+
|
46 |
if ( ! is_cart() && ! is_checkout() ) {
|
47 |
if ( 'storefront' == get_option( 'template' ) ) {
|
48 |
+
wp_enqueue_style( 'cart-tab-styles-storefront', plugins_url( '../assets/css/style-storefront.css', __FILE__ ), '', $version );
|
49 |
} else {
|
50 |
+
wp_enqueue_style( 'cart-tab-styles', plugins_url( '../assets/css/style.css', __FILE__ ), '', $version );
|
51 |
}
|
52 |
+
wp_enqueue_script( 'cart-tab-script', plugins_url( '../assets/js/cart-tab.min.js', __FILE__ ), array( 'jquery' ), $version );
|
53 |
}
|
54 |
}
|
55 |
|
68 |
|
69 |
endif;
|
70 |
|
71 |
+
function woocommerce_cart_tab_frontend() {
|
72 |
+
return new WooCommerce_Cart_Tab_Frontend();
|
73 |
+
}
|
74 |
+
add_action( 'init', 'woocommerce_cart_tab_frontend' );
|
package.json
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "woocommerce-cart-tab",
|
3 |
-
"title": "WooCommerce Cart Tab",
|
4 |
-
"version": "1.0.0",
|
5 |
-
"homepage": "http://wordpress.org/plugins/woocommerce-cart-tab/",
|
6 |
-
"repository": {
|
7 |
-
"type": "git",
|
8 |
-
"url": "https://github.com/jameskoster/woocommerce-cart-tab.git"
|
9 |
-
},
|
10 |
-
"main": "Gruntfile.js",
|
11 |
-
"devDependencies": {
|
12 |
-
"grunt": "~0.4.5",
|
13 |
-
"grunt-contrib-uglify": "~0.9.1",
|
14 |
-
"grunt-checktextdomain": "^1.0.0",
|
15 |
-
"grunt-wp-i18n": "^0.5.2",
|
16 |
-
"grunt-contrib-cssmin": "~0.12.3",
|
17 |
-
"grunt-contrib-watch": "~0.6.1",
|
18 |
-
"grunt-sass": "^1.0.0",
|
19 |
-
"node-sass": "^3.2.0",
|
20 |
-
"susy": "^2.2.5",
|
21 |
-
"node-bourbon": "~4.2.3",
|
22 |
-
"grunt-contrib-copy": "~0.8.0",
|
23 |
-
"grunt-contrib-jshint": "^0.11.2"
|
24 |
-
},
|
25 |
-
"engines": {
|
26 |
-
"node": ">=0.8.0",
|
27 |
-
"npm": ">=1.1.0"
|
28 |
-
}
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: jameskoster
|
3 |
Tags: woocommerce, ecommerce, cart
|
4 |
Requires at least: 4.4
|
5 |
-
Tested up to: 4.7.
|
6 |
-
Stable tag: 1.1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -44,6 +44,10 @@ Thanks! Please fork the repo on <a href="https://github.com/jameskoster/woocomme
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
|
|
|
|
|
|
|
|
47 |
= 1.1.0 - 08/02/2017 =
|
48 |
* New - Cart tab is now hidden when the cart is empty.
|
49 |
* Tweak - Overlay styling.
|
2 |
Contributors: jameskoster
|
3 |
Tags: woocommerce, ecommerce, cart
|
4 |
Requires at least: 4.4
|
5 |
+
Tested up to: 4.7.3
|
6 |
+
Stable tag: 1.1.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 1.1.1 - 10/03/2017 =
|
48 |
+
* Tweak - WooCommerce 2.7 support. Kudos @webmandesign.
|
49 |
+
* Dev - Scripts and styles now versioned correctly.
|
50 |
+
|
51 |
= 1.1.0 - 08/02/2017 =
|
52 |
* New - Cart tab is now hidden when the cart is empty.
|
53 |
* Tweak - Overlay styling.
|