Version Description
Released on 13 Aug 2021
- New: support for WooCommerce 5.6
- Update: YITH plugin framework
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Compare |
Version | 2.5.4 |
Comparing to | |
See all releases |
Code changes from version 2.5.3 to 2.5.4
- init.php +4 -4
- plugin-fw/.distignore +0 -29
- plugin-fw/.jshintrc +0 -26
- plugin-fw/Gruntfile.js +0 -198
- plugin-fw/bin/clean-language-files.js +0 -36
- plugin-fw/bin/download-translations-config.json +0 -27
- plugin-fw/bin/download-translations.js +0 -57
- plugin-fw/composer.json +0 -24
- plugin-fw/docker-compose.yml +0 -76
- plugin-fw/package.json +0 -49
- plugin-fw/phpcs.xml +0 -52
- plugin-fw/phpunit.xml.dist +0 -15
- plugin-fw/templates/fields/inline-fields.php +2 -2
- plugin-fw/templates/fields/upload.php +1 -1
- plugin-fw/tests/bootstrap.php +0 -167
- plugin-fw/tests/framework/fixtures/panel-all-options.php +0 -240
- plugin-fw/tests/framework/helpers/class-yith-plugin-fw-panels-helper.php +0 -83
- plugin-fw/tests/framework/plugin-options/wc-panel-options.php +0 -43
- plugin-fw/tests/unit-tests/class-yith-plugin-fw-tests-plugin-panel-wc.php +0 -49
- plugin-fw/tools/local-env/docker/phpunit/Dockerfile +0 -12
- plugin-fw/tools/local-env/install-wp-tests.sh +0 -154
- plugin-fw/tools/local-env/mysql-init.sql +0 -7
- plugin-fw/tools/local-env/phpunit-config.ini +0 -6
- plugin-fw/tools/local-env/scripts/docker.js +0 -6
- plugin-fw/tools/local-env/scripts/install.js +0 -15
- plugin-fw/tools/local-env/scripts/start.js +0 -7
- plugin-fw/tools/local-env/yith-plugin-fw-loader.php +0 -50
- readme.txt +9 -4
init.php
CHANGED
@@ -3,17 +3,17 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Compare
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
|
5 |
* Description: The <code><strong>YITH WooCommerce Compare</strong></code> plugin allow you to compare in a simple and efficient way products on sale in your shop and analyze their main features in a single table. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
-
* Version: 2.5.
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-compare
|
10 |
* Domain Path: /languages/
|
11 |
* WC requires at least: 5.3
|
12 |
-
* WC tested up to: 5.
|
13 |
*
|
14 |
* @author YITH
|
15 |
* @package YITH WooCommerce Compare
|
16 |
-
* @version 2.5.
|
17 |
*/
|
18 |
|
19 |
/*
|
@@ -75,7 +75,7 @@ if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
|
|
75 |
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
76 |
|
77 |
if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ) {
|
78 |
-
define( 'YITH_WOOCOMPARE_VERSION', '2.5.
|
79 |
}
|
80 |
if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
|
81 |
define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
|
3 |
* Plugin Name: YITH WooCommerce Compare
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
|
5 |
* Description: The <code><strong>YITH WooCommerce Compare</strong></code> plugin allow you to compare in a simple and efficient way products on sale in your shop and analyze their main features in a single table. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
+
* Version: 2.5.4
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-compare
|
10 |
* Domain Path: /languages/
|
11 |
* WC requires at least: 5.3
|
12 |
+
* WC tested up to: 5.6
|
13 |
*
|
14 |
* @author YITH
|
15 |
* @package YITH WooCommerce Compare
|
16 |
+
* @version 2.5.4
|
17 |
*/
|
18 |
|
19 |
/*
|
75 |
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
76 |
|
77 |
if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ) {
|
78 |
+
define( 'YITH_WOOCOMPARE_VERSION', '2.5.4' );
|
79 |
}
|
80 |
if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
|
81 |
define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
|
plugin-fw/.distignore
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
# Hidden files and folders
|
2 |
-
.*
|
3 |
-
.*/
|
4 |
-
*/.*
|
5 |
-
|
6 |
-
# NPM, composer, grunt and other utilities
|
7 |
-
*.lock
|
8 |
-
node_modules
|
9 |
-
vendor
|
10 |
-
package.json
|
11 |
-
package-lock.json
|
12 |
-
composer.json
|
13 |
-
Gruntfile.js
|
14 |
-
|
15 |
-
# Local environment and scripts
|
16 |
-
bin
|
17 |
-
tests
|
18 |
-
tools
|
19 |
-
docker-compose.yml
|
20 |
-
docker-compose.yaml
|
21 |
-
phpunit.xml
|
22 |
-
phpunit.xml.dist
|
23 |
-
phpcs.xml.dist
|
24 |
-
|
25 |
-
# Gutenberg blocks sources
|
26 |
-
includes/builders/gutenberg/src
|
27 |
-
|
28 |
-
# SCSS folder
|
29 |
-
assets/css/scss
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/.jshintrc
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"boss": true,
|
3 |
-
"curly": true,
|
4 |
-
"eqeqeq": true,
|
5 |
-
"eqnull": true,
|
6 |
-
"es3": true,
|
7 |
-
"expr": true,
|
8 |
-
"immed": true,
|
9 |
-
"noarg": true,
|
10 |
-
"onevar": true,
|
11 |
-
"trailing": true,
|
12 |
-
"undef": true,
|
13 |
-
"unused": true,
|
14 |
-
|
15 |
-
"browser": true,
|
16 |
-
|
17 |
-
"globals": {
|
18 |
-
"_": false,
|
19 |
-
"Backbone": false,
|
20 |
-
"jQuery": true,
|
21 |
-
"console": true,
|
22 |
-
"alert": true,
|
23 |
-
"JSON": false,
|
24 |
-
"wp": false
|
25 |
-
}
|
26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/Gruntfile.js
DELETED
@@ -1,198 +0,0 @@
|
|
1 |
-
const potInfo = {
|
2 |
-
languageFolderPath: './languages/',
|
3 |
-
filename : 'yith-plugin-fw.pot',
|
4 |
-
headers : {
|
5 |
-
poedit : true, // Includes common Poedit headers.
|
6 |
-
'x-poedit-keywordslist': true, // Include a list of all possible gettext functions.
|
7 |
-
'report-msgid-bugs-to' : 'YITH <plugins@yithemes.com>',
|
8 |
-
'language-team' : 'YITH <info@yithemes.com>'
|
9 |
-
}
|
10 |
-
};
|
11 |
-
|
12 |
-
module.exports = function ( grunt ) {
|
13 |
-
'use strict';
|
14 |
-
|
15 |
-
var sass = require( 'node-sass' );
|
16 |
-
|
17 |
-
grunt.initConfig( {
|
18 |
-
dirs: {
|
19 |
-
css : 'assets/css',
|
20 |
-
scss: 'assets/css/scss',
|
21 |
-
js : 'assets/js'
|
22 |
-
},
|
23 |
-
|
24 |
-
uglify: {
|
25 |
-
options: {
|
26 |
-
ie8 : true,
|
27 |
-
parse : {
|
28 |
-
strict: false
|
29 |
-
},
|
30 |
-
output: {
|
31 |
-
comments: /@license|@preserve|^!/
|
32 |
-
}
|
33 |
-
},
|
34 |
-
common : {
|
35 |
-
files: [{
|
36 |
-
expand: true,
|
37 |
-
cwd : '<%= dirs.js %>/',
|
38 |
-
src : ['*.js', '!*.min.js'],
|
39 |
-
dest : '<%= dirs.js %>/',
|
40 |
-
rename: function ( dst, src ) {
|
41 |
-
// To keep the source js files and make new files as `*.min.js`:
|
42 |
-
return dst + '/' + src.replace( '.js', '.min.js' );
|
43 |
-
}
|
44 |
-
}]
|
45 |
-
}
|
46 |
-
},
|
47 |
-
|
48 |
-
// Compile all .scss files.
|
49 |
-
sass: {
|
50 |
-
compile: {
|
51 |
-
options: {
|
52 |
-
implementation: sass,
|
53 |
-
outputStyle: 'expanded'
|
54 |
-
},
|
55 |
-
files : [{
|
56 |
-
expand: true,
|
57 |
-
cwd : '<%= dirs.scss %>/',
|
58 |
-
src : ['*.scss'],
|
59 |
-
dest : '<%= dirs.css %>/',
|
60 |
-
ext : '.css'
|
61 |
-
}]
|
62 |
-
}
|
63 |
-
},
|
64 |
-
|
65 |
-
jshint: {
|
66 |
-
options: {
|
67 |
-
jshintrc: '.jshintrc'
|
68 |
-
},
|
69 |
-
all : [
|
70 |
-
'<%= dirs.js %>/*.js',
|
71 |
-
'!<%= dirs.js %>/*.min.js'
|
72 |
-
]
|
73 |
-
},
|
74 |
-
|
75 |
-
|
76 |
-
// Watch changes for assets.
|
77 |
-
watch: {
|
78 |
-
css: {
|
79 |
-
files: ['<%= dirs.scss %>/**/*.scss'],
|
80 |
-
tasks: ['sass']
|
81 |
-
}
|
82 |
-
},
|
83 |
-
|
84 |
-
makepot : {
|
85 |
-
options: {
|
86 |
-
type : 'wp-plugin',
|
87 |
-
domainPath : 'languages',
|
88 |
-
domain : 'yith-plugin-fw',
|
89 |
-
potHeaders : potInfo.headers,
|
90 |
-
updatePoFiles: false
|
91 |
-
},
|
92 |
-
dist : {
|
93 |
-
options: {
|
94 |
-
potFilename: potInfo.filename,
|
95 |
-
exclude : [
|
96 |
-
'bin/.*',
|
97 |
-
'dist/.*',
|
98 |
-
'node_modules/.*',
|
99 |
-
'tests/.*',
|
100 |
-
'tmp/.*',
|
101 |
-
'vendor/.*'
|
102 |
-
]
|
103 |
-
}
|
104 |
-
}
|
105 |
-
},
|
106 |
-
update_po: {
|
107 |
-
options: {
|
108 |
-
template: potInfo.languageFolderPath + potInfo.filename
|
109 |
-
},
|
110 |
-
build : {
|
111 |
-
src: potInfo.languageFolderPath + '*.po'
|
112 |
-
}
|
113 |
-
},
|
114 |
-
|
115 |
-
// PHP Code Sniffer.
|
116 |
-
phpcs: {
|
117 |
-
options: {
|
118 |
-
bin: 'vendor/bin/phpcs'
|
119 |
-
},
|
120 |
-
dist : {
|
121 |
-
src: [
|
122 |
-
'**/*.php', // Include all php files.
|
123 |
-
'!bin/**',
|
124 |
-
'!dist/**',
|
125 |
-
'!node_modules/**',
|
126 |
-
'!tests/**',
|
127 |
-
'!tools/**',
|
128 |
-
'!tmp/**',
|
129 |
-
'!vendor/**'
|
130 |
-
]
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
} );
|
135 |
-
|
136 |
-
grunt.registerMultiTask( 'update_po', 'This task update .po strings by .pot', function () {
|
137 |
-
grunt.log.writeln( 'Updating .po files.' );
|
138 |
-
|
139 |
-
var done = this.async(),
|
140 |
-
options = this.options(),
|
141 |
-
template = options.template;
|
142 |
-
this.files.forEach( function ( file ) {
|
143 |
-
if ( file.src.length ) {
|
144 |
-
var counter = file.src.length;
|
145 |
-
|
146 |
-
grunt.log.writeln( 'Processing ' + file.src.length + ' files.' );
|
147 |
-
|
148 |
-
file.src.forEach( function ( fileSrc ) {
|
149 |
-
grunt.util.spawn( {
|
150 |
-
cmd : 'msgmerge',
|
151 |
-
args: ['-U', fileSrc, template]
|
152 |
-
}, function ( error, result, code ) {
|
153 |
-
const output = fileSrc.replace( '.po', '.mo' );
|
154 |
-
grunt.log.writeln( 'Updating: ' + fileSrc + ' ...' );
|
155 |
-
|
156 |
-
if ( error ) {
|
157 |
-
grunt.verbose.error();
|
158 |
-
} else {
|
159 |
-
grunt.verbose.ok();
|
160 |
-
}
|
161 |
-
|
162 |
-
// Updating also the .mo files
|
163 |
-
grunt.util.spawn( {
|
164 |
-
cmd : 'msgfmt',
|
165 |
-
args: [fileSrc, '-o', output]
|
166 |
-
}, function ( moError, moResult, moCode ) {
|
167 |
-
grunt.log.writeln( 'Updating MO for: ' + fileSrc + ' ...' );
|
168 |
-
counter--;
|
169 |
-
if ( moError || counter === 0 ) {
|
170 |
-
done( moError );
|
171 |
-
}
|
172 |
-
} );
|
173 |
-
if ( error ) {
|
174 |
-
done( error );
|
175 |
-
}
|
176 |
-
} );
|
177 |
-
} );
|
178 |
-
} else {
|
179 |
-
grunt.log.writeln( 'No file to process.' );
|
180 |
-
}
|
181 |
-
} );
|
182 |
-
} );
|
183 |
-
|
184 |
-
// Load NPM tasks to be used here.
|
185 |
-
grunt.loadNpmTasks( 'grunt-wp-i18n' );
|
186 |
-
grunt.loadNpmTasks( 'grunt-phpcs' );
|
187 |
-
grunt.loadNpmTasks( 'grunt-sass' );
|
188 |
-
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
189 |
-
|
190 |
-
// Use uglify-es (instead of uglify) to uglify also JS for ES6.
|
191 |
-
grunt.loadNpmTasks( 'grunt-contrib-uglify-es' );
|
192 |
-
|
193 |
-
// Register tasks.
|
194 |
-
grunt.registerTask( 'js', ['uglify'] );
|
195 |
-
|
196 |
-
grunt.registerTask( 'css', ['sass'] );
|
197 |
-
grunt.registerTask( 'assets', ['js', 'css'] );
|
198 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/bin/clean-language-files.js
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
/* jshint ignore: start */
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
7 |
-
*/
|
8 |
-
|
9 |
-
const fs = require( 'fs' );
|
10 |
-
const glob = require( 'glob' );
|
11 |
-
const chalk = require( 'chalk' );
|
12 |
-
|
13 |
-
const DELETED = chalk.reset.inverse.bold.green( ' DELETED ' );
|
14 |
-
const ERROR = chalk.reset.inverse.bold.red( ' ERROR ' );
|
15 |
-
|
16 |
-
console.log( chalk.green( '\nCleaning language files...' ) );
|
17 |
-
glob( "languages/*.po~", function ( er, files ) {
|
18 |
-
|
19 |
-
if ( files.length ) {
|
20 |
-
console.log( `Processing ${files.length} files:` );
|
21 |
-
|
22 |
-
files.forEach( ( file ) => {
|
23 |
-
fs.unlink( file, ( err ) => {
|
24 |
-
if ( err ) {
|
25 |
-
console.log( chalk.bold( ` - ${file} ` ) + ERROR );
|
26 |
-
console.error( err );
|
27 |
-
return;
|
28 |
-
}
|
29 |
-
console.log( chalk.bold( ` - ${file} ` ) + DELETED );
|
30 |
-
} );
|
31 |
-
} );
|
32 |
-
} else {
|
33 |
-
console.log( `No file to clean.\n` );
|
34 |
-
}
|
35 |
-
|
36 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/bin/download-translations-config.json
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"projectPath": "https://translate.yithemes.com/gp/projects/yith-framework/",
|
3 |
-
"textDomain": "yith-plugin-fw",
|
4 |
-
"destFolder": "languages/",
|
5 |
-
"languages": [
|
6 |
-
{
|
7 |
-
"id": "es",
|
8 |
-
"name": "Spanish",
|
9 |
-
"slug": "es_ES"
|
10 |
-
},
|
11 |
-
{
|
12 |
-
"id": "it",
|
13 |
-
"name": "Italian",
|
14 |
-
"slug": "it_IT"
|
15 |
-
},
|
16 |
-
{
|
17 |
-
"id": "nl",
|
18 |
-
"name": "Dutch",
|
19 |
-
"slug": "nl_NL"
|
20 |
-
},
|
21 |
-
{
|
22 |
-
"id": "el",
|
23 |
-
"name": "Greek",
|
24 |
-
"slug": "el"
|
25 |
-
}
|
26 |
-
]
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/bin/download-translations.js
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
/* jshint ignore: start */
|
2 |
-
|
3 |
-
/**
|
4 |
-
* This script download translations from https://translate.yithemes.com/
|
5 |
-
*
|
6 |
-
* @version 1.1.0
|
7 |
-
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
8 |
-
*/
|
9 |
-
|
10 |
-
const fs = require( 'fs' );
|
11 |
-
const path = require( 'path' );
|
12 |
-
const axios = require( 'axios' );
|
13 |
-
const chalk = require( 'chalk' );
|
14 |
-
const options = require( './download-translations-config' );
|
15 |
-
|
16 |
-
const SPACE = '\t';
|
17 |
-
const DONE = chalk.reset.inverse.bold.green( ' DONE ' );
|
18 |
-
const ERROR = chalk.reset.inverse.bold.red( ' ERROR ' );
|
19 |
-
|
20 |
-
async function download( url, dest ) {
|
21 |
-
const destPath = path.resolve( dest );
|
22 |
-
const writer = fs.createWriteStream( destPath );
|
23 |
-
|
24 |
-
const response = await axios( {
|
25 |
-
url,
|
26 |
-
method : 'GET',
|
27 |
-
responseType: 'stream'
|
28 |
-
} );
|
29 |
-
|
30 |
-
response.data.pipe( writer );
|
31 |
-
|
32 |
-
return new Promise( ( resolve, reject ) => {
|
33 |
-
writer.on( 'finish', resolve );
|
34 |
-
writer.on( 'error', reject );
|
35 |
-
} )
|
36 |
-
}
|
37 |
-
|
38 |
-
const downloadLanguage = function ( language ) {
|
39 |
-
const languageName = language.name || language.id;
|
40 |
-
const source = options.projectPath + language.id + "/default/export-translations/";
|
41 |
-
const fileName = options.textDomain + '-' + language.slug + '.po';
|
42 |
-
const dest = options.destFolder + fileName;
|
43 |
-
const message = ' - ' + chalk.bold( languageName ) + SPACE;
|
44 |
-
|
45 |
-
download( source, dest ).then( () => {
|
46 |
-
console.log( message + DONE );
|
47 |
-
} ).catch( ( err ) => {
|
48 |
-
console.log( message + ERROR );
|
49 |
-
throw err;
|
50 |
-
} );
|
51 |
-
};
|
52 |
-
|
53 |
-
console.log( chalk.green( '\nDownloading Transations from translate.yithemes.com...' ) );
|
54 |
-
|
55 |
-
options.languages.forEach( ( language ) => {
|
56 |
-
downloadLanguage( language );
|
57 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/composer.json
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "yith/plugin-fw",
|
3 |
-
"description": "YITH Plugin Framework",
|
4 |
-
"type": "wordpress-plugin",
|
5 |
-
"license": "GPL-3.0-or-later",
|
6 |
-
"prefer-stable": true,
|
7 |
-
"minimum-stability": "dev",
|
8 |
-
"require-dev": {
|
9 |
-
"wp-coding-standards/wpcs": "^2.2",
|
10 |
-
"squizlabs/php_codesniffer": "^3.5",
|
11 |
-
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1"
|
12 |
-
},
|
13 |
-
"scripts": {
|
14 |
-
"phpcs": [
|
15 |
-
"phpcs -s -p"
|
16 |
-
],
|
17 |
-
"phpcs-pre-commit": [
|
18 |
-
"phpcs -s -p -n"
|
19 |
-
],
|
20 |
-
"phpcbf": [
|
21 |
-
"phpcbf -p --standard=WordPress"
|
22 |
-
]
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/docker-compose.yml
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
version: '3.7'
|
2 |
-
|
3 |
-
services:
|
4 |
-
|
5 |
-
mysql:
|
6 |
-
image: "mariadb:latest"
|
7 |
-
environment:
|
8 |
-
MYSQL_DATABASE: "yith_plugin_fw_tests"
|
9 |
-
MYSQL_ROOT_PASSWORD: "password"
|
10 |
-
ports:
|
11 |
-
- "3306"
|
12 |
-
networks:
|
13 |
-
- yithdevnet
|
14 |
-
volumes:
|
15 |
-
- ./tools/local-env/mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
|
16 |
-
- mysql:/var/lib/mysql
|
17 |
-
|
18 |
-
##
|
19 |
-
# The WP CLI container.
|
20 |
-
##
|
21 |
-
cli:
|
22 |
-
image: wordpress:cli-php7.4
|
23 |
-
environment:
|
24 |
-
APACHE_RUN_USER: "www-data"
|
25 |
-
APACHE_RUN_GROUP: "www-data"
|
26 |
-
depends_on:
|
27 |
-
- mysql
|
28 |
-
|
29 |
-
networks:
|
30 |
-
- yithdevnet
|
31 |
-
|
32 |
-
volumes:
|
33 |
-
- html:/var/www/html
|
34 |
-
- ./tools/local-env/install-wp-tests.sh:/var/www/html/install-wp-tests.sh
|
35 |
-
|
36 |
-
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
37 |
-
init: true
|
38 |
-
|
39 |
-
##
|
40 |
-
# The PHPUnit container.
|
41 |
-
##
|
42 |
-
phpunit:
|
43 |
-
build:
|
44 |
-
context: ./tools/local-env/docker/phpunit
|
45 |
-
|
46 |
-
networks:
|
47 |
-
- yithdevnet
|
48 |
-
|
49 |
-
volumes:
|
50 |
-
- ./tools/local-env/phpunit-config.ini:/usr/local/etc/php/conf.d/phpunit-config.ini
|
51 |
-
- ./tools/local-env/install-wp-tests.sh:/var/www/html/install-wp-tests.sh
|
52 |
-
- ./tools/local-env/yith-plugin-fw-loader.php:/var/www/html/wp-content/plugins/yith-plugin-fw-loader/yith-plugin-fw-loader.php
|
53 |
-
- .:/var/www/html/wp-content/plugins/yith-plugin-fw-loader/plugin-fw
|
54 |
-
- ../../woocommerce:/var/www/html/wp-content/plugins/woocommerce
|
55 |
-
- html:/var/www/html
|
56 |
-
- phpunit-uploads:/var/www/html/wp-content/uploads
|
57 |
-
- testsuite:/tmp
|
58 |
-
|
59 |
-
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
60 |
-
init: true
|
61 |
-
|
62 |
-
depends_on:
|
63 |
-
- mysql
|
64 |
-
|
65 |
-
volumes:
|
66 |
-
# So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
|
67 |
-
mysql: {}
|
68 |
-
# Using a volume for the uploads directory improves PHPUnit performance.
|
69 |
-
phpunit-uploads: {}
|
70 |
-
html: {}
|
71 |
-
testsuite: {}
|
72 |
-
|
73 |
-
networks:
|
74 |
-
# Creating our own network allows us to connect between containers using their service name.
|
75 |
-
yithdevnet:
|
76 |
-
driver: bridge
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/package.json
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "yith-plugin-framewowrk",
|
3 |
-
"version": "3.7.4",
|
4 |
-
"description": "YITH Plugin Framework",
|
5 |
-
"main": "Gruntfile.js",
|
6 |
-
"scripts": {
|
7 |
-
"build": "npm run -s blocks:build && npm run assets && npm run i18n",
|
8 |
-
"assets": "grunt assets",
|
9 |
-
"watch": "grunt watch",
|
10 |
-
"i18n": "npm run -s i18n:build && npm run -s i18n:translations",
|
11 |
-
"i18n:build": "grunt makepot",
|
12 |
-
"i18n:translations": "npm run -s i18n:download-translations && npm run -s i18n:update-po && npm run -s i18n:clean",
|
13 |
-
"i18n:download-translations": "node ./bin/download-translations.js",
|
14 |
-
"i18n:update-po": "grunt update_po",
|
15 |
-
"i18n:clean": "node ./bin/clean-language-files.js",
|
16 |
-
"phpcs": "grunt phpcs",
|
17 |
-
"env:start": "node ./tools/local-env/scripts/start.js",
|
18 |
-
"env:stop": "node ./tools/local-env/scripts/docker.js down",
|
19 |
-
"env:restart": "npm run env:stop && npm run env:start",
|
20 |
-
"env:clean": "node ./tools/local-env/scripts/docker.js down -v --remove-orphans",
|
21 |
-
"env:reset": "node ./tools/local-env/scripts/docker.js down --rmi all -v --remove-orphans",
|
22 |
-
"env:install": "node ./tools/local-env/scripts/install.js",
|
23 |
-
"env:cli": "node ./tools/local-env/scripts/docker.js run cli",
|
24 |
-
"blocks:watch": "wp-scripts start ./includes/builders/gutenberg/src/index.js --output-path=dist/gutenberg --progress --colors --watch --mode=development",
|
25 |
-
"blocks:build": "wp-scripts build ./includes/builders/gutenberg/src/index.js --output-path=dist/gutenberg --progress --colors",
|
26 |
-
"test:php": "node ./tools/local-env/scripts/docker.js run --rm phpunit phpunit"
|
27 |
-
},
|
28 |
-
"author": "YITH",
|
29 |
-
"license": "GPL-3.0+",
|
30 |
-
"keywords": [],
|
31 |
-
"devDependencies": {
|
32 |
-
"@wordpress/scripts": "^12.3.0",
|
33 |
-
"axios": "^0.21.1",
|
34 |
-
"dotenv": "^8.2.0",
|
35 |
-
"grunt": "^1.0.3",
|
36 |
-
"grunt-cli": "^1.3.2",
|
37 |
-
"grunt-contrib-jshint": "^2.0.0",
|
38 |
-
"grunt-contrib-uglify-es": "github:gruntjs/grunt-contrib-uglify#harmony",
|
39 |
-
"grunt-contrib-watch": "^1.1.0",
|
40 |
-
"grunt-phpcs": "^0.4.0",
|
41 |
-
"grunt-sass": "^3.1.0",
|
42 |
-
"grunt-wp-i18n": "^1.0.2",
|
43 |
-
"node-sass": "^4.0.0",
|
44 |
-
"wait-on": "^5.2.1"
|
45 |
-
},
|
46 |
-
"dependencies": {
|
47 |
-
"md5": "^2.3.0"
|
48 |
-
}
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/phpcs.xml
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<ruleset name="WordPress Coding Standards">
|
3 |
-
<description>YITH Plugin Framework - PHP_CodeSniffer ruleset.</description>
|
4 |
-
|
5 |
-
<file>.</file>
|
6 |
-
|
7 |
-
<!-- Exclude paths -->
|
8 |
-
<exclude-pattern>Gruntfile.js</exclude-pattern>
|
9 |
-
<exclude-pattern>/assets/*</exclude-pattern>
|
10 |
-
<exclude-pattern>/bin/*</exclude-pattern>
|
11 |
-
<exclude-pattern>/dist/*</exclude-pattern>
|
12 |
-
<exclude-pattern>/languages/*</exclude-pattern>
|
13 |
-
<exclude-pattern>*/node_modules/*</exclude-pattern>
|
14 |
-
<exclude-pattern>*/tests/*</exclude-pattern>
|
15 |
-
<exclude-pattern>*/tools/*</exclude-pattern>
|
16 |
-
<exclude-pattern>*/vendor/*</exclude-pattern>
|
17 |
-
|
18 |
-
<!-- Show progress, show the error codes for each message (source). -->
|
19 |
-
<arg value="ps"/>
|
20 |
-
|
21 |
-
<!-- Strip the filepaths in reports down to the relevant bit. -->
|
22 |
-
<arg name="basepath" value="./"/>
|
23 |
-
|
24 |
-
<!-- Check up to 8 files simultaneously. -->
|
25 |
-
<arg name="parallel" value="8"/>
|
26 |
-
|
27 |
-
<!-- Configs -->
|
28 |
-
<config name="minimum_supported_wp_version" value="5.2"/>
|
29 |
-
<!-- Check for cross-version support for PHP 5.6 and higher. -->
|
30 |
-
<config name="testVersion" value="5.6-"/>
|
31 |
-
|
32 |
-
<!-- Rules -->
|
33 |
-
|
34 |
-
<!-- WordPress -->
|
35 |
-
<rule ref="WordPress">
|
36 |
-
<exclude name="WordPress.DB.DirectDatabaseQuery.NoCaching" />
|
37 |
-
<exclude name="WordPress.DB.DirectDatabaseQuery.DirectQuery" />
|
38 |
-
<exclude name="WordPress.DB.DirectDatabaseQuery.SchemaChange" />
|
39 |
-
</rule>
|
40 |
-
|
41 |
-
<rule ref="WordPress.Security.ValidatedSanitizedInput">
|
42 |
-
<properties>
|
43 |
-
<property name="customSanitizingFunctions" type="array" value="wc_clean,wc_sanitize_tooltip,wc_format_decimal,wc_stock_amount,wc_sanitize_permalink,wc_sanitize_textarea"/>
|
44 |
-
</properties>
|
45 |
-
</rule>
|
46 |
-
|
47 |
-
<rule ref="WordPress.Security.EscapeOutput">
|
48 |
-
<properties>
|
49 |
-
<property name="customEscapingFunctions" type="array" value="wc_help_tip,wc_sanitize_tooltip,wc_selected,wc_kses_notice,wc_esc_json,wc_query_string_form_fields,wc_make_phone_clickable,yith_plugin_fw_html_data_to_string,yith_field_deps_data,yith_panel_field_deps_data"/>
|
50 |
-
</properties>
|
51 |
-
</rule>
|
52 |
-
</ruleset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/phpunit.xml.dist
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<phpunit
|
3 |
-
bootstrap="tests/bootstrap.php"
|
4 |
-
backupGlobals="false"
|
5 |
-
colors="true"
|
6 |
-
convertErrorsToExceptions="true"
|
7 |
-
convertNoticesToExceptions="true"
|
8 |
-
convertWarningsToExceptions="true"
|
9 |
-
>
|
10 |
-
<testsuites>
|
11 |
-
<testsuite>
|
12 |
-
<directory suffix=".php">./tests/unit-tests</directory>
|
13 |
-
</testsuite>
|
14 |
-
</testsuites>
|
15 |
-
</phpunit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/templates/fields/inline-fields.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
|
9 |
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
|
10 |
|
11 |
-
list ( $field_id, $name, $class, $fields, $value ) = yith_plugin_fw_extract( $field, 'id', 'name', 'class', 'fields', 'value' );
|
12 |
|
13 |
$class = ! ! $class ? $class : '';
|
14 |
$value = maybe_unserialize( $value );
|
@@ -16,7 +16,7 @@ $allowed_types = array( 'select', 'select-buttons', 'number', 'text', 'slider',
|
|
16 |
$default_args = array( 'type' => 'select' );
|
17 |
?>
|
18 |
<?php if ( ! empty( $fields ) && is_array( $fields ) ) : ?>
|
19 |
-
<div id="<?php echo esc_attr( $field_id ); ?>" class="<?php echo esc_attr( $class ); ?> yith-inline-fields"
|
20 |
<?php foreach ( $fields as $key => $inline_field ) : ?>
|
21 |
<?php
|
22 |
if ( ! in_array( $inline_field['type'], $allowed_types, true ) ) {
|
8 |
|
9 |
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
|
10 |
|
11 |
+
list ( $field_id, $name, $class, $fields, $value, $custom_attributes ) = yith_plugin_fw_extract( $field, 'id', 'name', 'class', 'fields', 'value', 'custom_attributes' );
|
12 |
|
13 |
$class = ! ! $class ? $class : '';
|
14 |
$value = maybe_unserialize( $value );
|
16 |
$default_args = array( 'type' => 'select' );
|
17 |
?>
|
18 |
<?php if ( ! empty( $fields ) && is_array( $fields ) ) : ?>
|
19 |
+
<div id="<?php echo esc_attr( $field_id ); ?>" class="<?php echo esc_attr( $class ); ?> yith-inline-fields" <?php echo $custom_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
20 |
<?php foreach ( $fields as $key => $inline_field ) : ?>
|
21 |
<?php
|
22 |
if ( ! in_array( $inline_field['type'], $allowed_types, true ) ) {
|
plugin-fw/templates/fields/upload.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
|
9 |
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
|
10 |
|
11 |
-
list ( $field_id, $class, $name, $value, $std, $custom_attributes, $data ) = yith_plugin_fw_extract( $field, 'id', 'class', 'name', 'value', 'std', 'custom_attributes', 'data' );
|
12 |
|
13 |
$file = $value;
|
14 |
?>
|
8 |
|
9 |
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
|
10 |
|
11 |
+
list ( $field_id, $class, $name, $value, $std, $default, $custom_attributes, $data ) = yith_plugin_fw_extract( $field, 'id', 'class', 'name', 'value', 'std', 'default', 'custom_attributes', 'data' );
|
12 |
|
13 |
$file = $value;
|
14 |
?>
|
plugin-fw/tests/bootstrap.php
DELETED
@@ -1,167 +0,0 @@
|
|
1 |
-
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
|
2 |
-
/**
|
3 |
-
* PHPUnit bootstrap file.
|
4 |
-
*
|
5 |
-
* @package YITH Plugin Framework
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* YITH_Plugin_FW_Unit_Tests_Bootstrap class
|
10 |
-
*/
|
11 |
-
class YITH_Plugin_FW_Unit_Tests_Bootstrap {
|
12 |
-
/**
|
13 |
-
* Instance of the class
|
14 |
-
*
|
15 |
-
* @var YITH_Plugin_FW_Unit_Tests_Bootstrap
|
16 |
-
*/
|
17 |
-
protected static $instance = null;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Directory where wordpress-tests-lib is installed.
|
21 |
-
*
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
public $wp_tests_dir;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Testing directory
|
28 |
-
*
|
29 |
-
* @var string
|
30 |
-
*/
|
31 |
-
public $tests_dir;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* The plugin directory.
|
35 |
-
*
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
public $plugin_dir;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* WooCommerce directory.
|
42 |
-
*
|
43 |
-
* @var string
|
44 |
-
*/
|
45 |
-
public $woocommerce_dir;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Singleton implementation
|
49 |
-
*
|
50 |
-
* @return YITH_Plugin_FW_Unit_Tests_Bootstrap
|
51 |
-
*/
|
52 |
-
public static function instance() {
|
53 |
-
return ! is_null( self::$instance ) ? self::$instance : self::$instance = new self();
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Setup the unit testing environment.
|
58 |
-
*/
|
59 |
-
protected function __construct() {
|
60 |
-
|
61 |
-
ini_set( 'display_errors', 'on' );
|
62 |
-
error_reporting( E_ALL );
|
63 |
-
|
64 |
-
// Ensure server variable is set for WP email functions.
|
65 |
-
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
|
66 |
-
$_SERVER['SERVER_NAME'] = 'localhost';
|
67 |
-
}
|
68 |
-
|
69 |
-
$this->tests_dir = dirname( __FILE__ );
|
70 |
-
$this->plugin_dir = dirname( $this->tests_dir, 2 );
|
71 |
-
$this->woocommerce_dir = dirname( $this->plugin_dir ) . '/woocommerce';
|
72 |
-
$this->wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : ( rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib' );
|
73 |
-
|
74 |
-
define( 'YITH_PLUGIN_FRAMEWORK_TESTS_DIR', $this->tests_dir );
|
75 |
-
|
76 |
-
if ( ! file_exists( $this->wp_tests_dir . '/includes/functions.php' ) ) {
|
77 |
-
$this->message( "Could not find {$this->wp_tests_dir}/includes/functions.php, have you run [npm run env:install] ?" );
|
78 |
-
exit( 1 );
|
79 |
-
}
|
80 |
-
|
81 |
-
require_once $this->wp_tests_dir . '/includes/functions.php';
|
82 |
-
|
83 |
-
// load plugins.
|
84 |
-
tests_add_filter( 'muplugins_loaded', array( $this, 'load_plugins' ) );
|
85 |
-
tests_add_filter( 'setup_theme', array( $this, 'install_wc' ) );
|
86 |
-
tests_add_filter( 'setup_theme', array( $this, 'show_info' ), 20 );
|
87 |
-
|
88 |
-
// load the WP testing environment.
|
89 |
-
require_once $this->wp_tests_dir . '/includes/bootstrap.php';
|
90 |
-
|
91 |
-
// load testing framework.
|
92 |
-
$this->includes();
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Load plugins
|
97 |
-
*
|
98 |
-
* @return void
|
99 |
-
*/
|
100 |
-
public function load_plugins() {
|
101 |
-
require_once $this->woocommerce_dir . '/woocommerce.php';
|
102 |
-
require_once $this->plugin_dir . '/yith-plugin-fw-loader.php';
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Install WooCommerce
|
107 |
-
*
|
108 |
-
* @return void
|
109 |
-
*/
|
110 |
-
public function install_wc() {
|
111 |
-
// Clean existing install first.
|
112 |
-
define( 'WP_UNINSTALL_PLUGIN', true );
|
113 |
-
define( 'WC_REMOVE_ALL_DATA', true );
|
114 |
-
include $this->woocommerce_dir . '/uninstall.php';
|
115 |
-
|
116 |
-
WC_Install::install();
|
117 |
-
|
118 |
-
// Reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374.
|
119 |
-
if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) {
|
120 |
-
$GLOBALS['wp_roles']->reinit();
|
121 |
-
} else {
|
122 |
-
$GLOBALS['wp_roles'] = null;
|
123 |
-
wp_roles();
|
124 |
-
}
|
125 |
-
|
126 |
-
$this->message( 'Installing WooCommerce...' );
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Include files
|
131 |
-
*
|
132 |
-
* @return void
|
133 |
-
*/
|
134 |
-
public function includes() {
|
135 |
-
$helpers_dir = YITH_PLUGIN_FRAMEWORK_TESTS_DIR . '/framework/helpers';
|
136 |
-
|
137 |
-
require_once $helpers_dir . '/class-yith-plugin-fw-panels-helper.php';
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Print a message
|
142 |
-
*
|
143 |
-
* @param string $message The message to be shown.
|
144 |
-
* @return void
|
145 |
-
*/
|
146 |
-
public function message( $message ) {
|
147 |
-
echo $message . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Show installation information
|
152 |
-
*
|
153 |
-
* @return void
|
154 |
-
*/
|
155 |
-
public function show_info() {
|
156 |
-
$this->message( '' );
|
157 |
-
$this->message( 'I N S T A L L A T I O N I N F O :' );
|
158 |
-
$this->message( '> WP Version: ' . get_bloginfo( 'version', 'display' ) );
|
159 |
-
$this->message( '> WC Version: ' . get_plugin_data( $this->woocommerce_dir . '/woocommerce.php' )['Version'] );
|
160 |
-
$this->message( '> Plugin Dir: ' . $this->plugin_dir );
|
161 |
-
$this->message( '> ABSPATH: ' . ( defined( 'ABSPATH' ) ? ABSPATH : 'not defined!' ) );
|
162 |
-
$this->message( '' );
|
163 |
-
}
|
164 |
-
|
165 |
-
}
|
166 |
-
|
167 |
-
YITH_Plugin_FW_Unit_Tests_Bootstrap::instance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tests/framework/fixtures/panel-all-options.php
DELETED
@@ -1,240 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Options for YITH Plugin Panel WooCommerce
|
4 |
-
*
|
5 |
-
* @package YITH Plugin Framework
|
6 |
-
*/
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'ajax-customers' => array(
|
10 |
-
'type' => 'ajax-customers',
|
11 |
-
'value' => 1,
|
12 |
-
'php_unit_expected' => 1,
|
13 |
-
),
|
14 |
-
|
15 |
-
'ajax-customers-multiple' => array(
|
16 |
-
'type' => 'ajax-customers',
|
17 |
-
'multiple' => true,
|
18 |
-
'value' => array( 1, 2, 3 ),
|
19 |
-
'php_unit_expected' => array( 1, 2, 3 ),
|
20 |
-
),
|
21 |
-
|
22 |
-
'ajax-posts' => array(
|
23 |
-
'type' => 'ajax-posts',
|
24 |
-
'value' => 1,
|
25 |
-
'php_unit_expected' => 1,
|
26 |
-
),
|
27 |
-
|
28 |
-
'ajax-posts-multiple' => array(
|
29 |
-
'type' => 'ajax-posts',
|
30 |
-
'multiple' => true,
|
31 |
-
'value' => array( 1, 2, 3 ),
|
32 |
-
'php_unit_expected' => array( 1, 2, 3 ),
|
33 |
-
),
|
34 |
-
|
35 |
-
'ajax-products' => array(
|
36 |
-
'type' => 'ajax-products',
|
37 |
-
'value' => 1,
|
38 |
-
'php_unit_expected' => 1,
|
39 |
-
),
|
40 |
-
|
41 |
-
'ajax-products-multiple' => array(
|
42 |
-
'type' => 'ajax-products',
|
43 |
-
'multiple' => true,
|
44 |
-
'value' => array( 1, 2, 3 ),
|
45 |
-
'php_unit_expected' => array( 1, 2, 3 ),
|
46 |
-
),
|
47 |
-
|
48 |
-
'ajax-terms' => array(
|
49 |
-
'type' => 'ajax-terms',
|
50 |
-
'value' => 1,
|
51 |
-
'php_unit_expected' => 1,
|
52 |
-
),
|
53 |
-
|
54 |
-
'ajax-terms-multiple' => array(
|
55 |
-
'type' => 'ajax-terms',
|
56 |
-
'multiple' => true,
|
57 |
-
'value' => array( 1, 2, 3 ),
|
58 |
-
'php_unit_expected' => array( 1, 2, 3 ),
|
59 |
-
),
|
60 |
-
|
61 |
-
'checkbox' => array(
|
62 |
-
'type' => 'checkbox',
|
63 |
-
'value' => 1,
|
64 |
-
'php_unit_expected' => 'yes',
|
65 |
-
),
|
66 |
-
|
67 |
-
'checkbox-off' => array(
|
68 |
-
'type' => 'checkbox',
|
69 |
-
'value' => 0,
|
70 |
-
'php_unit_expected' => 'no',
|
71 |
-
),
|
72 |
-
|
73 |
-
'checkbox-array' => array(
|
74 |
-
'type' => 'checkbox-array',
|
75 |
-
'value' => array( 'one', 'two', 'three' ),
|
76 |
-
'php_unit_expected' => array( 'one', 'two', 'three' ),
|
77 |
-
),
|
78 |
-
|
79 |
-
'colorpicker' => array(
|
80 |
-
'type' => 'colorpicker',
|
81 |
-
'value' => '#123456',
|
82 |
-
'php_unit_expected' => '#123456',
|
83 |
-
),
|
84 |
-
|
85 |
-
'country-select' => array(
|
86 |
-
'type' => 'country-select',
|
87 |
-
'value' => 'US:NY',
|
88 |
-
'php_unit_expected' => 'US:NY',
|
89 |
-
),
|
90 |
-
|
91 |
-
'date-format' => array(
|
92 |
-
'type' => 'date-format',
|
93 |
-
'value' => 'Y-m-d',
|
94 |
-
'php_unit_expected' => 'Y-m-d',
|
95 |
-
),
|
96 |
-
|
97 |
-
'datepicker' => array(
|
98 |
-
'type' => 'datepicker',
|
99 |
-
'value' => '2020-12-25',
|
100 |
-
'php_unit_expected' => '2020-12-25',
|
101 |
-
),
|
102 |
-
|
103 |
-
'dimensions' => array(
|
104 |
-
'type' => 'dimensions',
|
105 |
-
'value' => array(
|
106 |
-
'unit' => 'px',
|
107 |
-
'dimensions' => array(
|
108 |
-
'top' => 10,
|
109 |
-
'right' => 20,
|
110 |
-
'bottom' => 10,
|
111 |
-
'left' => 20,
|
112 |
-
),
|
113 |
-
'linked' => 'yes',
|
114 |
-
),
|
115 |
-
'php_unit_expected' => array(
|
116 |
-
'unit' => 'px',
|
117 |
-
'dimensions' => array(
|
118 |
-
'top' => 10,
|
119 |
-
'right' => 20,
|
120 |
-
'bottom' => 10,
|
121 |
-
'left' => 20,
|
122 |
-
),
|
123 |
-
'linked' => 'yes',
|
124 |
-
),
|
125 |
-
),
|
126 |
-
|
127 |
-
'hidden' => array(
|
128 |
-
'type' => 'hidden',
|
129 |
-
'value' => 'This is a dummy test!',
|
130 |
-
'php_unit_expected' => 'This is a dummy test!',
|
131 |
-
),
|
132 |
-
|
133 |
-
'icons' => array(
|
134 |
-
'type' => 'icons',
|
135 |
-
'value' => 'FontAwesome:music',
|
136 |
-
'php_unit_expected' => 'FontAwesome:music',
|
137 |
-
),
|
138 |
-
|
139 |
-
'image-gallery' => array(
|
140 |
-
'type' => 'image-gallery',
|
141 |
-
'value' => '1,2,3',
|
142 |
-
'php_unit_expected' => '1,2,3',
|
143 |
-
),
|
144 |
-
|
145 |
-
'multi-colorpicker' => array(
|
146 |
-
'type' => 'multi-colorpicker',
|
147 |
-
'value' => array( '#ffffff', '#000000' ),
|
148 |
-
'php_unit_expected' => array( '#ffffff', '#000000' ),
|
149 |
-
),
|
150 |
-
|
151 |
-
'multi-select' => array(
|
152 |
-
'type' => 'multi-select',
|
153 |
-
'value' => array( 'one', 'two' ),
|
154 |
-
'php_unit_expected' => array( 'one', 'two' ),
|
155 |
-
),
|
156 |
-
|
157 |
-
'number' => array(
|
158 |
-
'type' => 'number',
|
159 |
-
'value' => 10,
|
160 |
-
'php_unit_expected' => 10,
|
161 |
-
),
|
162 |
-
|
163 |
-
'onoff' => array(
|
164 |
-
'type' => 'onoff',
|
165 |
-
'value' => 1,
|
166 |
-
'php_unit_expected' => 'yes',
|
167 |
-
),
|
168 |
-
|
169 |
-
'onoff-off' => array(
|
170 |
-
'type' => 'onoff',
|
171 |
-
'value' => 0,
|
172 |
-
'php_unit_expected' => 'no',
|
173 |
-
),
|
174 |
-
|
175 |
-
'password' => array(
|
176 |
-
'type' => 'password',
|
177 |
-
'value' => 'password',
|
178 |
-
'php_unit_expected' => 'password',
|
179 |
-
),
|
180 |
-
|
181 |
-
'radio' => array(
|
182 |
-
'type' => 'radio',
|
183 |
-
'value' => 'one',
|
184 |
-
'php_unit_expected' => 'one',
|
185 |
-
),
|
186 |
-
|
187 |
-
'select' => array(
|
188 |
-
'type' => 'select',
|
189 |
-
'value' => 'one',
|
190 |
-
'php_unit_expected' => 'one',
|
191 |
-
),
|
192 |
-
|
193 |
-
'select-images' => array(
|
194 |
-
'type' => 'select-images',
|
195 |
-
'value' => 'one',
|
196 |
-
'php_unit_expected' => 'one',
|
197 |
-
),
|
198 |
-
|
199 |
-
'slider' => array(
|
200 |
-
'type' => 'slider',
|
201 |
-
'value' => 50,
|
202 |
-
'php_unit_expected' => 50,
|
203 |
-
),
|
204 |
-
|
205 |
-
'text' => array(
|
206 |
-
'type' => 'text',
|
207 |
-
'value' => 'This is a dummy test!',
|
208 |
-
'php_unit_expected' => 'This is a dummy test!',
|
209 |
-
),
|
210 |
-
|
211 |
-
'text-array' => array(
|
212 |
-
'type' => 'text-array',
|
213 |
-
'value' => array('one', 'two', "Let's testing quotes and double quotes \""),
|
214 |
-
'php_unit_expected' => array('one', 'two', "Let's testing quotes and double quotes \""),
|
215 |
-
),
|
216 |
-
|
217 |
-
'textarea' => array(
|
218 |
-
'type' => 'textarea',
|
219 |
-
'value' => "Let's testing quotes, double quotes \" and <h1>HTML tags</h1>",
|
220 |
-
'php_unit_expected' => "Let's testing quotes, double quotes \" and <h1>HTML tags</h1>",
|
221 |
-
),
|
222 |
-
|
223 |
-
'textarea-codemirror' => array(
|
224 |
-
'type' => 'textarea-codemirror',
|
225 |
-
'value' => "Let's testing quotes, double quotes \" and <h1>HTML tags</h1>",
|
226 |
-
'php_unit_expected' => "Let's testing quotes, double quotes \" and <h1>HTML tags</h1>",
|
227 |
-
),
|
228 |
-
|
229 |
-
'textarea-editor' => array(
|
230 |
-
'type' => 'textarea-editor',
|
231 |
-
'value' => "Let's testing quotes, double quotes \" and <h1>HTML tags</h1>",
|
232 |
-
'php_unit_expected' => "Let's testing quotes, double quotes \" and <h1>HTML tags</h1>",
|
233 |
-
),
|
234 |
-
|
235 |
-
'upload' => array(
|
236 |
-
'type' => 'upload',
|
237 |
-
'value' => 'http://example.com/image.jpg',
|
238 |
-
'php_unit_expected' => 'http://example.com/image.jpg',
|
239 |
-
),
|
240 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tests/framework/helpers/class-yith-plugin-fw-panels-helper.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Panels Helper
|
4 |
-
*
|
5 |
-
* @package YITH Plugin Framework
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Plugin Panels Helper class.
|
10 |
-
*/
|
11 |
-
class YITH_Plugin_FW_Panels_Helper {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* The WooCommerce Panel page.
|
15 |
-
*
|
16 |
-
* @var string
|
17 |
-
*/
|
18 |
-
public static $wc_panel_page = 'yith_plugin_fw_test_wc_panel';
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Create WC Panel
|
22 |
-
*
|
23 |
-
* @return YIT_Plugin_Panel_WooCommerce
|
24 |
-
*/
|
25 |
-
public static function create_wc_panel() {
|
26 |
-
|
27 |
-
$admin_tabs = array(
|
28 |
-
'wc-panel' => 'WooCommerce Panel',
|
29 |
-
);
|
30 |
-
|
31 |
-
$args = array(
|
32 |
-
'create_menu_page' => true,
|
33 |
-
'parent_slug' => '',
|
34 |
-
'page_title' => 'WooCommerce Panel',
|
35 |
-
'menu_title' => 'WooCommerce Panel',
|
36 |
-
'capability' => 'manage_options',
|
37 |
-
'parent' => '',
|
38 |
-
'parent_page' => 'yit_plugin_panel',
|
39 |
-
'page' => self::$wc_panel_page,
|
40 |
-
'admin-tabs' => $admin_tabs,
|
41 |
-
'options-path' => YITH_PLUGIN_FRAMEWORK_TESTS_DIR . '/framework/plugin-options',
|
42 |
-
);
|
43 |
-
|
44 |
-
return new YIT_Plugin_Panel_WooCommerce( $args );
|
45 |
-
}
|
46 |
-
|
47 |
-
public static function init_vars_wc_panel_options_for_saving( $panel, $tab, $subtab = '' ) {
|
48 |
-
|
49 |
-
set_current_screen( 'yith-plugins_page_' . $panel->settings['page'] );
|
50 |
-
$_POST = array();
|
51 |
-
$_GET = array();
|
52 |
-
|
53 |
-
$_GET['page'] = $panel->settings['page'];
|
54 |
-
$_GET['tab'] = $tab;
|
55 |
-
$_GET['sub_tab'] = $subtab;
|
56 |
-
$_POST['yit_panel_wc_options_nonce'] = wp_create_nonce( 'yit_panel_wc_options_' . $panel->settings['page'] );
|
57 |
-
|
58 |
-
$prefix = $tab . '-';
|
59 |
-
|
60 |
-
$options = self::get_fixture( 'all-options' );
|
61 |
-
$new_options = array();
|
62 |
-
|
63 |
-
foreach ( $options as $key => $option ) {
|
64 |
-
$prefixed_key = $prefix . $key;
|
65 |
-
$value = $option['value'];
|
66 |
-
$_POST[ $prefixed_key ] = $value;
|
67 |
-
|
68 |
-
$new_options[ $prefixed_key ] = $option;
|
69 |
-
}
|
70 |
-
|
71 |
-
return $new_options;
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Get a fixture
|
76 |
-
*
|
77 |
-
* @param string $fixture The fixture.
|
78 |
-
* @return array
|
79 |
-
*/
|
80 |
-
public static function get_fixture( $fixture ) {
|
81 |
-
return include YITH_PLUGIN_FRAMEWORK_TESTS_DIR . '/framework/fixtures/panel-' . $fixture . '.php';
|
82 |
-
}
|
83 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tests/framework/plugin-options/wc-panel-options.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php // phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
|
2 |
-
/**
|
3 |
-
* Options for YITH Plugin Panel WooCommerce
|
4 |
-
*
|
5 |
-
* @package YITH Plugin Framework
|
6 |
-
*/
|
7 |
-
|
8 |
-
$prefix = str_replace( '-options.php', '', basename( __FILE__ ) ) . '-';
|
9 |
-
$options = YITH_Plugin_FW_Panels_Helper::get_fixture( 'all-options' );
|
10 |
-
$fields = array();
|
11 |
-
|
12 |
-
$fields[ $prefix . 'general-options' ] = array(
|
13 |
-
'title' => 'General',
|
14 |
-
'type' => 'title',
|
15 |
-
'id' => 'general-options',
|
16 |
-
);
|
17 |
-
|
18 |
-
foreach ( $options as $key => $values ) {
|
19 |
-
$type = $values['type'];
|
20 |
-
$prefixed_key = $prefix . $key;
|
21 |
-
|
22 |
-
$id_title = array(
|
23 |
-
'id' => $prefixed_key,
|
24 |
-
'title' => $prefixed_key,
|
25 |
-
);
|
26 |
-
|
27 |
-
$fields[ $prefixed_key ] = wp_parse_args( $values, $id_title );
|
28 |
-
$fields[ $prefixed_key ]['type'] = 'yith-field';
|
29 |
-
$fields[ $prefixed_key ]['yith-type'] = $type;
|
30 |
-
if ( isset( $fields[ $prefixed_key ]['value'] ) ) {
|
31 |
-
unset( $fields[ $prefixed_key ]['value'] );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
$fields[ $prefix . 'general-options-end' ] = array(
|
37 |
-
'type' => 'sectionend',
|
38 |
-
'id' => 'general-options',
|
39 |
-
);
|
40 |
-
|
41 |
-
return array(
|
42 |
-
'wc-panel' => $fields,
|
43 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tests/unit-tests/class-yith-plugin-fw-tests-plugin-panel-wc.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Test class for Plugin Panel WooCommerce
|
4 |
-
*
|
5 |
-
* @package YITH Plugin Framework
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class YITH_Plugin_FW_Tests_Plugin_Panel_WC
|
10 |
-
*/
|
11 |
-
class YITH_Plugin_FW_Tests_Plugin_Panel_WC extends WP_UnitTestCase {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* The panel.
|
15 |
-
*
|
16 |
-
* @var YIT_Plugin_Panel_WooCommerce
|
17 |
-
*/
|
18 |
-
protected $panel;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Set Up
|
22 |
-
*
|
23 |
-
* @return void
|
24 |
-
*/
|
25 |
-
public function setUp() {
|
26 |
-
$this->panel = YITH_Plugin_FW_Panels_Helper::create_wc_panel();
|
27 |
-
|
28 |
-
// Include admin functions to use woocommerce_update_options().
|
29 |
-
include_once WC_ABSPATH . '/includes/admin/wc-admin-functions.php';
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Test simple tab with options.
|
34 |
-
*/
|
35 |
-
public function test_simple_tab() {
|
36 |
-
$options = YITH_Plugin_FW_Panels_Helper::init_vars_wc_panel_options_for_saving( $this->panel, 'wc-panel' );
|
37 |
-
|
38 |
-
$this->panel->woocommerce_update_options();
|
39 |
-
|
40 |
-
foreach ( $options as $key => $option ) {
|
41 |
-
$value = get_option( $key );
|
42 |
-
$expected = $option['php_unit_expected'];
|
43 |
-
$message = sprintf( 'Test for %s [type: %s]', $key, $option['type'] );
|
44 |
-
|
45 |
-
$this->assertEquals( $expected, $value, $message );
|
46 |
-
}
|
47 |
-
|
48 |
-
}
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tools/local-env/docker/phpunit/Dockerfile
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
FROM phpunit/phpunit:latest
|
2 |
-
|
3 |
-
RUN apk update && \
|
4 |
-
apk add --no-cache sqlite bash mariadb-client php7-mysqli subversion wget
|
5 |
-
|
6 |
-
RUN apk upgrade subversion
|
7 |
-
|
8 |
-
ENTRYPOINT []
|
9 |
-
|
10 |
-
WORKDIR /var/www/html/wp-content/plugins/yith-plugin-fw-loader/plugin-fw
|
11 |
-
|
12 |
-
CMD /bin/true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tools/local-env/install-wp-tests.sh
DELETED
@@ -1,154 +0,0 @@
|
|
1 |
-
#!/usr/bin/env bash
|
2 |
-
|
3 |
-
if [ $# -lt 3 ]; then
|
4 |
-
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
|
5 |
-
exit 1
|
6 |
-
fi
|
7 |
-
|
8 |
-
|
9 |
-
echo "INSTALLING...";
|
10 |
-
DB_NAME=$1
|
11 |
-
DB_USER=$2
|
12 |
-
DB_PASS=$3
|
13 |
-
DB_HOST=${4-localhost}
|
14 |
-
WP_VERSION=${5-latest}
|
15 |
-
SKIP_DB_CREATE=${6-false}
|
16 |
-
|
17 |
-
TMPDIR=${TMPDIR-/tmp}
|
18 |
-
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
|
19 |
-
WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
|
20 |
-
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}
|
21 |
-
|
22 |
-
download() {
|
23 |
-
if [ `which curl` ]; then
|
24 |
-
curl -s "$1" > "$2";
|
25 |
-
elif [ `which wget` ]; then
|
26 |
-
wget -nv -O "$2" "$1"
|
27 |
-
fi
|
28 |
-
}
|
29 |
-
|
30 |
-
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
|
31 |
-
WP_TESTS_TAG="branches/$WP_VERSION"
|
32 |
-
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
33 |
-
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
|
34 |
-
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
|
35 |
-
WP_TESTS_TAG="tags/${WP_VERSION%??}"
|
36 |
-
else
|
37 |
-
WP_TESTS_TAG="tags/$WP_VERSION"
|
38 |
-
fi
|
39 |
-
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
|
40 |
-
WP_TESTS_TAG="trunk"
|
41 |
-
else
|
42 |
-
# http serves a single offer, whereas https serves multiple. we only want one
|
43 |
-
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
|
44 |
-
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
|
45 |
-
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
|
46 |
-
if [[ -z "$LATEST_VERSION" ]]; then
|
47 |
-
echo "Latest WordPress version could not be found"
|
48 |
-
exit 1
|
49 |
-
fi
|
50 |
-
WP_TESTS_TAG="tags/$LATEST_VERSION"
|
51 |
-
fi
|
52 |
-
|
53 |
-
set -ex
|
54 |
-
|
55 |
-
install_wp() {
|
56 |
-
|
57 |
-
if [ -d $WP_CORE_DIR ]; then
|
58 |
-
return;
|
59 |
-
fi
|
60 |
-
|
61 |
-
mkdir -p $WP_CORE_DIR
|
62 |
-
|
63 |
-
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
|
64 |
-
mkdir -p $TMPDIR/wordpress-nightly
|
65 |
-
download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip
|
66 |
-
unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/
|
67 |
-
mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
|
68 |
-
else
|
69 |
-
if [ $WP_VERSION == 'latest' ]; then
|
70 |
-
local ARCHIVE_NAME='latest'
|
71 |
-
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then
|
72 |
-
# https serves multiple offers, whereas http serves single.
|
73 |
-
download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json
|
74 |
-
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
|
75 |
-
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
|
76 |
-
LATEST_VERSION=${WP_VERSION%??}
|
77 |
-
else
|
78 |
-
# otherwise, scan the releases and get the most up to date minor version of the major release
|
79 |
-
local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'`
|
80 |
-
LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1)
|
81 |
-
fi
|
82 |
-
if [[ -z "$LATEST_VERSION" ]]; then
|
83 |
-
local ARCHIVE_NAME="wordpress-$WP_VERSION"
|
84 |
-
else
|
85 |
-
local ARCHIVE_NAME="wordpress-$LATEST_VERSION"
|
86 |
-
fi
|
87 |
-
else
|
88 |
-
local ARCHIVE_NAME="wordpress-$WP_VERSION"
|
89 |
-
fi
|
90 |
-
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz
|
91 |
-
tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR
|
92 |
-
fi
|
93 |
-
|
94 |
-
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
|
95 |
-
}
|
96 |
-
|
97 |
-
install_test_suite() {
|
98 |
-
# portable in-place argument for both GNU sed and Mac OSX sed
|
99 |
-
if [[ $(uname -s) == 'Darwin' ]]; then
|
100 |
-
local ioption='-i .bak'
|
101 |
-
else
|
102 |
-
local ioption='-i'
|
103 |
-
fi
|
104 |
-
|
105 |
-
# set up testing suite if it doesn't yet exist
|
106 |
-
if [ ! -d $WP_TESTS_DIR ]; then
|
107 |
-
# set up testing suite
|
108 |
-
mkdir -p $WP_TESTS_DIR
|
109 |
-
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
|
110 |
-
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
|
111 |
-
fi
|
112 |
-
|
113 |
-
if [ ! -f wp-tests-config.php ]; then
|
114 |
-
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
|
115 |
-
# remove all forward slashes in the end
|
116 |
-
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
|
117 |
-
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
|
118 |
-
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
|
119 |
-
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
|
120 |
-
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
|
121 |
-
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
|
122 |
-
fi
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
install_db() {
|
127 |
-
|
128 |
-
if [ ${SKIP_DB_CREATE} = "true" ]; then
|
129 |
-
return 0
|
130 |
-
fi
|
131 |
-
|
132 |
-
# parse DB_HOST for port or socket references
|
133 |
-
local PARTS=(${DB_HOST//\:/ })
|
134 |
-
local DB_HOSTNAME=${PARTS[0]};
|
135 |
-
local DB_SOCK_OR_PORT=${PARTS[1]};
|
136 |
-
local EXTRA=""
|
137 |
-
|
138 |
-
if ! [ -z $DB_HOSTNAME ] ; then
|
139 |
-
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
|
140 |
-
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
|
141 |
-
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
|
142 |
-
EXTRA=" --socket=$DB_SOCK_OR_PORT"
|
143 |
-
elif ! [ -z $DB_HOSTNAME ] ; then
|
144 |
-
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
|
145 |
-
fi
|
146 |
-
fi
|
147 |
-
|
148 |
-
# create database
|
149 |
-
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA;
|
150 |
-
}
|
151 |
-
|
152 |
-
install_wp
|
153 |
-
install_test_suite
|
154 |
-
install_db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tools/local-env/mysql-init.sql
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* MySQL server init.
|
3 |
-
*
|
4 |
-
* SQL queries in this file will be executed the first time the MySQL server is started.
|
5 |
-
*/
|
6 |
-
|
7 |
-
CREATE DATABASE IF NOT EXISTS yith_plugin_fw_tests;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tools/local-env/phpunit-config.ini
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
upload_max_filesize = 1G
|
2 |
-
post_max_size = 1G
|
3 |
-
|
4 |
-
opcache.enable = 1
|
5 |
-
opcache.enable_cli = 1
|
6 |
-
opache.file_cache = /tmp/php-opcache
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tools/local-env/scripts/docker.js
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
const dotenv = require( 'dotenv' );
|
2 |
-
const { execSync } = require( 'child_process' );
|
3 |
-
dotenv.config();
|
4 |
-
|
5 |
-
// Execute any docker-compose command passed to this script.
|
6 |
-
execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tools/local-env/scripts/install.js
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
const dotenv = require( 'dotenv' );
|
2 |
-
const { execSync } = require( 'child_process' );
|
3 |
-
|
4 |
-
dotenv.config();
|
5 |
-
|
6 |
-
phpunitExec('/var/www/html/install-wp-tests.sh yith_plugin_fw_tests root password mysql latest true');
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Runs commands in the Docker PHPUnit environment.
|
10 |
-
*
|
11 |
-
* @param {string} cmd The command to run.
|
12 |
-
*/
|
13 |
-
function phpunitExec( cmd ) {
|
14 |
-
execSync( `docker-compose run --rm phpunit ${cmd}`, { stdio: 'inherit' } );
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tools/local-env/scripts/start.js
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
const dotenv = require( 'dotenv' );
|
2 |
-
const { execSync } = require( 'child_process' );
|
3 |
-
|
4 |
-
dotenv.config();
|
5 |
-
|
6 |
-
// Start the local-env containers.
|
7 |
-
execSync( 'docker-compose up -d', { stdio: 'inherit' } );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/tools/local-env/yith-plugin-fw-loader.php
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: YITH Plugin Framework Loader
|
4 |
-
* Plugin URI:
|
5 |
-
* Description: YITH Plugin Framework Loader
|
6 |
-
* Version: 1.0.0
|
7 |
-
* Author: YITH
|
8 |
-
* Author URI: http://yithemes.com/
|
9 |
-
* Text Domain: yith-plugin-framework-loader
|
10 |
-
* Domain Path: /languages/
|
11 |
-
*
|
12 |
-
* @author YITH
|
13 |
-
* @package YITH Plugin Framework Loader
|
14 |
-
* @version 1.0.0
|
15 |
-
*/
|
16 |
-
|
17 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
18 |
-
exit;
|
19 |
-
} // Exit if accessed directly
|
20 |
-
|
21 |
-
if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
|
22 |
-
require_once 'plugin-fw/yit-plugin-registration-hook.php';
|
23 |
-
}
|
24 |
-
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
25 |
-
|
26 |
-
|
27 |
-
add_action( 'plugins_loaded', 'yith_plugin_fw_loader_load_plugin_fw', 15 );
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Plugin Framework Loader.
|
31 |
-
*
|
32 |
-
* @return void
|
33 |
-
*/
|
34 |
-
function yith_plugin_fw_loader_load_plugin_fw() {
|
35 |
-
|
36 |
-
if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
|
37 |
-
global $plugin_fw_data;
|
38 |
-
if ( ! empty( $plugin_fw_data ) ) {
|
39 |
-
$plugin_fw_file = array_shift( $plugin_fw_data );
|
40 |
-
require_once $plugin_fw_file;
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
/* Plugin Framework Version Check */
|
47 |
-
if ( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( plugin_dir_path( __FILE__ ) . 'plugin-fw/init.php' ) ) {
|
48 |
-
require_once plugin_dir_path( __FILE__ ) . 'plugin-fw/init.php';
|
49 |
-
}
|
50 |
-
yit_maybe_plugin_fw_loader( plugin_dir_path( __FILE__ ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: yith, woocommerce compare, compare products, product compare, product comparison
|
5 |
Requires at least: 5.6
|
6 |
Tested up to: 5.8
|
7 |
-
Stable tag: 2.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -66,7 +66,12 @@ yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
-
= 2.5.
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
* New: support for WooCommerce 5.5
|
72 |
* New: support for WordPress 5.8
|
@@ -468,7 +473,7 @@ Full documentation is available [here](https://docs.yithemes.com/yith-woocommerc
|
|
468 |
|
469 |
== Upgrade notice ==
|
470 |
|
471 |
-
= 2.5.
|
472 |
|
473 |
-
* New: support for WooCommerce 5.
|
474 |
* Update: YITH plugin framework
|
4 |
Tags: yith, woocommerce compare, compare products, product compare, product comparison
|
5 |
Requires at least: 5.6
|
6 |
Tested up to: 5.8
|
7 |
+
Stable tag: 2.5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 2.5.4 = Released on 13 Aug 2021
|
70 |
+
|
71 |
+
* New: support for WooCommerce 5.6
|
72 |
+
* Update: YITH plugin framework
|
73 |
+
|
74 |
+
= 2.5.3 = Released on 14 Jul 2021
|
75 |
|
76 |
* New: support for WooCommerce 5.5
|
77 |
* New: support for WordPress 5.8
|
473 |
|
474 |
== Upgrade notice ==
|
475 |
|
476 |
+
= 2.5.4 = Released on 13 Aug 2021
|
477 |
|
478 |
+
* New: support for WooCommerce 5.6
|
479 |
* Update: YITH plugin framework
|