YITH WooCommerce Zoom Magnifier - Version 1.3.18

Version Description

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Zoom Magnifier
Version 1.3.18
Comparing to
See all releases

Code changes from version 1.3.17 to 1.3.18

README.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
4
  Tags: zoom, magnifier, slider, carousel, woocommerce
5
  Requires at least: 4.0
6
  Tested up to: 5.5
7
- Stable tag: 1.3.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
@@ -52,6 +52,11 @@ YITH WooCommerce Zoom Magnifier will add a new tab called "Zoom Magnifier" in "Y
52
 
53
  == Changelog ==
54
 
 
 
 
 
 
55
  = Version 1.3.17 - Released: Sept 17, 2020 =
56
 
57
  * New: support for WooCommerce 4.5
4
  Tags: zoom, magnifier, slider, carousel, woocommerce
5
  Requires at least: 4.0
6
  Tested up to: 5.5
7
+ Stable tag: 1.3.18
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
52
 
53
  == Changelog ==
54
 
55
+ = Version 1.3.18 - Released: Sept 29, 2020 =
56
+
57
+ * Fix: Loading banner on product page for some images
58
+ * Update: Plugin-fw
59
+
60
  = Version 1.3.17 - Released: Sept 17, 2020 =
61
 
62
  * New: support for WooCommerce 4.5
assets/js/yith_magnifier.js CHANGED
@@ -215,11 +215,10 @@
215
 
216
  self._loading();
217
 
218
- self.element.imagesLoaded(function () {
219
- self.options.onLoad();
220
- self._initZoom();
221
- self._initGallery();
222
- });
223
 
224
  $(document).trigger('yith_magnifier_after_init');
225
  },
@@ -243,6 +242,7 @@
243
  if ( gallery.length > 0 ) {
244
  gallery.on('click', function (e) {
245
  e.preventDefault();
 
246
 
247
  if ( $( '#yith_wczm_traffic_light' ).val() == 'free' ){
248
 
215
 
216
  self._loading();
217
 
218
+ self.options.onLoad();
219
+ self._initZoom();
220
+ self._initGallery();
221
+
 
222
 
223
  $(document).trigger('yith_magnifier_after_init');
224
  },
242
  if ( gallery.length > 0 ) {
243
  gallery.on('click', function (e) {
244
  e.preventDefault();
245
+ e.stopImmediatePropagation();
246
 
247
  if ( $( '#yith_wczm_traffic_light' ).val() == 'free' ){
248
 
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Zoom Magnifier
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
5
  * Description: <code><strong>YITH WooCommerce Zoom Magnifier</strong></code> allows you to add a zoom effect to product images and a thumbnail slider for the product image gallery. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
- * Version: 1.3.17
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-zoom-magnifier
@@ -78,7 +78,7 @@ register_activation_hook ( __FILE__, 'yith_plugin_registration_hook' );
78
 
79
  defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
80
  defined ( 'YITH_YWZM_SLUG' ) || define ( 'YITH_YWZM_SLUG', 'yith-woocommerce-zoom-magnifier' );
81
- defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.3.17' );
82
  defined ( 'YITH_YWZM_JS_VERSION' ) || define ( 'YITH_YWZM_JS_VERSION', '1.3.100' );
83
 
84
  defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
3
  * Plugin Name: YITH WooCommerce Zoom Magnifier
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
5
  * Description: <code><strong>YITH WooCommerce Zoom Magnifier</strong></code> allows you to add a zoom effect to product images and a thumbnail slider for the product image gallery. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
+ * Version: 1.3.18
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-zoom-magnifier
78
 
79
  defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
80
  defined ( 'YITH_YWZM_SLUG' ) || define ( 'YITH_YWZM_SLUG', 'yith-woocommerce-zoom-magnifier' );
81
+ defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.3.18' );
82
  defined ( 'YITH_YWZM_JS_VERSION' ) || define ( 'YITH_YWZM_JS_VERSION', '1.3.100' );
83
 
84
  defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
plugin-fw/Gruntfile.js CHANGED
@@ -1,12 +1,7 @@
1
- /**
2
- * in vagrant ssh, launch:
3
- * - npm install
4
- * - grunt (or use npm scripts in package.json)
5
- */
6
-
7
  const potInfo = {
8
- potFilename: 'yith-plugin-fw.pot',
9
- potHeaders : {
 
10
  poedit : true, // Includes common Poedit headers.
11
  'x-poedit-keywordslist': true, // Include a list of all possible gettext functions.
12
  'report-msgid-bugs-to' : 'YITH <plugins@yithemes.com>',
@@ -63,23 +58,81 @@ module.exports = function ( grunt ) {
63
  type : 'wp-plugin',
64
  domainPath : 'languages',
65
  domain : 'yith-plugin-fw',
66
- potHeaders : potInfo.potHeaders,
67
- updatePoFiles: true
68
  },
69
  dist : {
70
  options: {
71
- potFilename: potInfo.potFilename,
72
  exclude : [
 
73
  'node_modules/.*',
74
  'tests/.*',
75
- 'tmp/.*'
 
76
  ]
77
  }
78
  }
 
 
 
 
 
 
 
 
79
  }
80
 
81
  } );
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  // Load NPM tasks to be used here.
84
  grunt.loadNpmTasks( 'grunt-wp-i18n' );
85
 
@@ -88,9 +141,4 @@ module.exports = function ( grunt ) {
88
 
89
  // Register tasks.
90
  grunt.registerTask( 'js', ['uglify'] );
91
- grunt.registerTask( 'i18n', ['makepot'] );
92
- grunt.registerTask( 'default', [
93
- 'js',
94
- 'i18n'
95
- ] );
96
  };
 
 
 
 
 
 
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>',
58
  type : 'wp-plugin',
59
  domainPath : 'languages',
60
  domain : 'yith-plugin-fw',
61
+ potHeaders : potInfo.headers,
62
+ updatePoFiles: false
63
  },
64
  dist : {
65
  options: {
66
+ potFilename: potInfo.filename,
67
  exclude : [
68
+ 'bin/.*',
69
  'node_modules/.*',
70
  'tests/.*',
71
+ 'tmp/.*',
72
+ 'vendor/.*'
73
  ]
74
  }
75
  }
76
+ },
77
+ update_po: {
78
+ options: {
79
+ template: potInfo.languageFolderPath + potInfo.filename
80
+ },
81
+ build : {
82
+ src: potInfo.languageFolderPath + '*.po'
83
+ }
84
  }
85
 
86
  } );
87
 
88
+ grunt.registerMultiTask( 'update_po', 'This task update .po strings by .pot', function () {
89
+ grunt.log.writeln( 'Updating .po files.' );
90
+
91
+ var done = this.async(),
92
+ options = this.options(),
93
+ template = options.template;
94
+ this.files.forEach( function ( file ) {
95
+ if ( file.src.length ) {
96
+ var counter = file.src.length;
97
+
98
+ grunt.log.writeln( 'Processing ' + file.src.length + ' files.' );
99
+
100
+ file.src.forEach( function ( fileSrc ) {
101
+ grunt.util.spawn( {
102
+ cmd : 'msgmerge',
103
+ args: ['-U', fileSrc, template]
104
+ }, function ( error, result, code ) {
105
+ const output = fileSrc.replace( '.po', '.mo' );
106
+ grunt.log.writeln( 'Updating: ' + fileSrc + ' ...' );
107
+
108
+ if ( error ) {
109
+ grunt.verbose.error();
110
+ } else {
111
+ grunt.verbose.ok();
112
+ }
113
+
114
+ // Updating also the .mo files
115
+ grunt.util.spawn( {
116
+ cmd : 'msgfmt',
117
+ args: [fileSrc, '-o', output]
118
+ }, function ( moError, moResult, moCode ) {
119
+ grunt.log.writeln( 'Updating MO for: ' + fileSrc + ' ...' );
120
+ counter--;
121
+ if ( moError || counter === 0 ) {
122
+ done( moError );
123
+ }
124
+ } );
125
+ if ( error ) {
126
+ done( error );
127
+ }
128
+ } );
129
+ } );
130
+ } else {
131
+ grunt.log.writeln( 'No file to process.' );
132
+ }
133
+ } );
134
+ } );
135
+
136
  // Load NPM tasks to be used here.
137
  grunt.loadNpmTasks( 'grunt-wp-i18n' );
138
 
141
 
142
  // Register tasks.
143
  grunt.registerTask( 'js', ['uglify'] );
 
 
 
 
 
144
  };
plugin-fw/bin/clean-language-files.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/lib/yit-plugin-panel.php CHANGED
@@ -67,6 +67,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
67
  * Constructor
68
  *
69
  * @param array $args
 
70
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
71
  * @since 1.0
72
  */
@@ -84,8 +85,9 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
84
  );
85
 
86
  $args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
87
- if ( isset( $args['parent_page'] ) && 'yit_plugin_panel' === $args['parent_page'] )
88
  $args['parent_page'] = 'yith_plugin_panel';
 
89
 
90
  $this->settings = $args;
91
  $this->_tabs_path_files = $this->get_tabs_path_files();
@@ -113,10 +115,10 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
113
 
114
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
115
 
116
- //yith-plugin-ui
117
- add_action( 'yith_plugin_fw_before_yith_panel', array( $this, 'add_plugin_banner' ), 10, 1 );
118
- add_action( 'wp_ajax_yith_plugin_fw_save_toggle_element', array( $this, 'save_toggle_element_options' ) );
119
- }
120
 
121
  /**
122
  * Is this a custom post type page?
@@ -130,7 +132,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
130
  $excluded_post_types = array( 'product', 'page', 'post' );
131
 
132
  return in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true ) &&
133
- ! in_array( $post_type, $excluded_post_types, true );
134
  }
135
 
136
  /**
@@ -145,7 +147,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
145
  $excluded_taxonomies = array( 'category', 'post_tag', 'product_cat', 'product_tag' );
146
 
147
  return in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) &&
148
- ! in_array( $taxonomy, $excluded_taxonomies, true );
149
  }
150
 
151
  /**
@@ -168,6 +170,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
168
  $tabs = $this->get_taxonomy_tabs( $taxonomy );
169
  }
170
 
 
 
171
  if ( $tabs ) {
172
  // tabs_in_edit
173
  $current_tab_args = array(
@@ -176,14 +180,18 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
176
  'current_sub_tab' => isset( $tabs['sub_tab'] ) ? $tabs['sub_tab'] : '',
177
  );
178
 
179
- wp_enqueue_style( 'yit-plugin-style' );
180
- wp_enqueue_style( 'yith-plugin-fw-fields' );
181
- wp_enqueue_script( 'yith-plugin-fw-wp-pages' );
 
 
182
 
183
  if ( ! self::$_panel_tabs_in_wp_pages ) {
184
  self::$_panel_tabs_in_wp_pages = $current_tab_args;
185
- add_action( 'all_admin_notices', array( $this, 'print_panel_tabs_in_wp_pages' ) );
186
- add_action( 'admin_footer', array( $this, 'print_panel_tabs_in_wp_pages_end' ) );
 
 
187
  add_filter( 'parent_file', array( $this, 'set_parent_file_to_handle_menu_for_wp_pages' ) );
188
  add_filter( 'submenu_file', array( $this, 'set_submenu_file_to_handle_menu_for_wp_pages' ), 10, 2 );
189
  }
@@ -250,14 +258,16 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
250
  * Add yith-plugin-fw-panel in body classes in Panel pages
251
  *
252
  * @param $admin_body_classes
 
253
  * @return string
254
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
255
  * @since 3.0.0
256
  */
257
  public static function add_body_class( $admin_body_classes ) {
258
  global $pagenow;
259
- if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) )
260
  $admin_body_classes = substr_count( $admin_body_classes, ' yith-plugin-fw-panel ' ) == 0 ? $admin_body_classes . ' yith-plugin-fw-panel ' : $admin_body_classes;
 
261
 
262
  return $admin_body_classes;
263
  }
@@ -355,6 +365,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
355
  * a callback function called by Register Settings function
356
  *
357
  * @param $input
 
358
  * @return array validate input fields
359
  * @since 1.0
360
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
@@ -463,6 +474,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
463
  * Print the tabs navigation
464
  *
465
  * @param array $args
 
466
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
467
  * @since 3.4.0
468
  */
@@ -524,6 +536,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
524
  * @param string $tab
525
  * @param string $sub_tab
526
  * @param string $parent_page
 
527
  * @return string
528
  */
529
  public function get_nav_url( $page, $tab, $sub_tab = '', $parent_page = '' ) {
@@ -548,6 +561,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
548
  * Print the Sub-tabs navigation if the current tab has sub-tabs
549
  *
550
  * @param array $args
 
551
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
552
  * @since 3.4.0
553
  */
@@ -597,6 +611,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
597
 
598
  if ( $custom_tab_action ) {
599
  $this->print_custom_tab( $custom_tab_action );
 
600
  return;
601
  }
602
 
@@ -612,17 +627,17 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
612
  <p>&nbsp;</p>
613
  <?php settings_fields( 'yit_' . $this->settings['parent'] . '_options' ); ?>
614
  <input type="hidden" name="<?php echo $this->get_name_field( 'option_key' ) ?>"
615
- value="<?php echo esc_attr( $option_key ) ?>"/>
616
  <input type="submit" class="button-primary"
617
- value="<?php _e( 'Save Changes', 'yith-plugin-fw' ) ?>"
618
- style="float:left;margin-right:10px;"/>
619
  </form>
620
  <form method="post">
621
  <?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
622
  <input type="hidden" name="yit-action" value="reset"/>
623
  <input type="submit" name="yit-reset" class="button-secondary"
624
- value="<?php _e( 'Reset to default', 'yith-plugin-fw' ) ?>"
625
- onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');"/>
626
  </form>
627
  <p>&nbsp;</p>
628
  <?php endif ?>
@@ -637,6 +652,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
637
  *
638
  * @param array $options
639
  * @param string $option_key
 
640
  * @return bool
641
  */
642
  public function is_custom_tab( $options, $option_key ) {
@@ -655,6 +671,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
655
  $first = ! ! $tab_options && is_array( $tab_options ) ? current( $tab_options ) : array();
656
  $type = isset( $first['type'] ) ? $first['type'] : 'options';
657
  $special_types = array( 'post_type', 'taxonomy', 'custom_tab', 'multi_tab' );
 
658
  return in_array( $type, $special_types ) ? $type : 'options';
659
  }
660
 
@@ -675,6 +692,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
675
  * Fire the action to print the custom tab
676
  *
677
  * @param string $action Action to fire
 
678
  * @return void
679
  * @since 1.0
680
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
@@ -730,11 +748,11 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
730
  foreach ( $this->settings['admin-tabs'] as $item => $title ) {
731
 
732
  $wp_admin_bar->add_menu( array(
733
- 'parent' => $this->settings['parent'],
734
- 'title' => $title,
735
- 'id' => $this->settings['parent'] . '-' . $item,
736
- 'href' => admin_url( 'themes.php' ) . '?page=' . $this->settings['parent_page'] . '&tab=' . $item,
737
- ) );
738
  }
739
  }
740
  }
@@ -848,6 +866,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
848
  * @param $message
849
  * @param string $type can be 'error' or 'updated'
850
  * @param bool $echo
 
851
  * @return string
852
  * @since 1.0
853
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
@@ -876,7 +895,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
876
 
877
  $tabs = array();
878
 
879
- foreach ( ( array )glob( $option_files_path . '*.php' ) as $filename ) {
880
  preg_match( '/(.*)-options\.(.*)/', basename( $filename ), $filename_parts );
881
 
882
  if ( ! isset( $filename_parts[1] ) ) {
@@ -915,6 +934,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
915
  * Return the sub-tabs array of a specific tab
916
  *
917
  * @param array|bool $_tab the tab; if not set it'll be the current tab
 
918
  * @since 3.4.0
919
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
920
  * @return array sub-tabs array
@@ -937,6 +957,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
937
  if ( $_first && is_array( $_first ) && isset( $_first['type'] ) && 'multi_tab' === $_first['type'] && ! empty( $_first['sub-tabs'] ) ) {
938
  return $_first['sub-tabs'];
939
  }
 
940
  return array();
941
  }
942
 
@@ -1005,6 +1026,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1005
  }
1006
  }
1007
  }
 
1008
  return '';
1009
  }
1010
 
@@ -1013,6 +1035,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1013
  * return the title of section
1014
  *
1015
  * @param $section
 
1016
  * @return string
1017
  * @since 1.0
1018
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
@@ -1026,6 +1049,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1026
  return $option['name'];
1027
  }
1028
  }
 
1029
  return '';
1030
  }
1031
 
@@ -1034,6 +1058,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1034
  * return the description of section if is set
1035
  *
1036
  * @param $section
 
1037
  * @return string
1038
  * @since 1.0
1039
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
@@ -1047,6 +1072,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1047
  return '<p>' . $option['desc'] . '</p>';
1048
  }
1049
  }
 
1050
  return '';
1051
  }
1052
 
@@ -1082,6 +1108,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1082
  * return a string with the name of the input field
1083
  *
1084
  * @param string $name
 
1085
  * @return string
1086
  * @since 1.0
1087
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
@@ -1095,6 +1122,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1095
  * return a string with the id of the input field
1096
  *
1097
  * @param string $id
 
1098
  * @return string
1099
  * @since 1.0
1100
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
@@ -1110,6 +1138,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1110
  * return a text area
1111
  *
1112
  * @param array $param
 
1113
  * @return void
1114
  * @since 1.0
1115
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
@@ -1132,11 +1161,13 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1132
  $std = isset( $option['std'] ) ? $option['std'] : '';
1133
  $db_value = ( isset( $db_options[ $option['id'] ] ) ) ? $db_options[ $option['id'] ] : $std;
1134
 
1135
- if ( isset( $option['deps'] ) )
1136
  $deps = $option['deps'];
 
1137
 
1138
- if ( 'on-off' === $option['type'] )
1139
  $option['type'] = 'onoff';
 
1140
 
1141
  if ( $field_template_path = yith_plugin_fw_get_field_template_path( $option ) ) {
1142
  $field_container_path = apply_filters( 'yith_plugin_fw_panel_field_container_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/panel-field-container.php', $option );
@@ -1169,6 +1200,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1169
  * Show a box panel with specific content in two columns as a new woocommerce type
1170
  *
1171
  * @param array $args
 
1172
  * @return void
1173
  * @since 1.0
1174
  * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
@@ -1184,6 +1216,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1184
  * Show a box panel with specific content in two columns as a new woocommerce type
1185
  *
1186
  * @param array $args
 
1187
  * @return void
1188
  * @deprecated 3.0.12 Do nothing! Method left to prevent Fatal Error if called directly
1189
  */
@@ -1278,11 +1311,11 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1278
  </div>
1279
  <div class="yith-plugin-fw-rate">
1280
  <?php printf( '<strong>%s</strong> %s <a href="%s" target="_blank"><u>%s</u> <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> %s',
1281
- __( 'We need your support', 'yith-plugin-fw' ),
1282
- __( 'to keep updating and improving the plugin. Please,', 'yith-plugin-fw' ),
1283
- $rate_link,
1284
- __( 'help us by leaving a five-star rating', 'yith-plugin-fw' ),
1285
- __( ':) Thanks!', 'yith-plugin-fw' ) ) ?>
1286
  </div>
1287
  <?php else: ?>
1288
  <h1 class="notice-container"></h1>
@@ -1368,72 +1401,73 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1368
  public function maybe_redirect_to_proper_wp_page() {
1369
  global $pagenow;
1370
  if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && $this->settings['page'] === $_GET['page'] &&
1371
- ! $this->is_custom_taxonomy_page() && ! $this->is_custom_post_type_page() && ! isset( $_REQUEST['yith-plugin-fw-panel-skip-redirect'] ) ) {
1372
  $url = $this->get_nav_url( $this->settings['page'], $this->get_current_tab(), $this->get_current_sub_tab() );
1373
  if ( strpos( $url, 'edit.php' ) !== false || strpos( $url, 'edit-tags.php' ) !== false ) {
1374
  wp_safe_redirect( add_query_arg( array( 'yith-plugin-fw-panel-skip-redirect' => 1 ), $url ) );
1375
  exit;
1376
  }
1377
  }
1378
- }
1379
-
1380
- /**
1381
- * Print the Panel tabs and sub-tabs navigation in WP pages
1382
- * Important: this opens a wrapper <div> that will be closed through YIT_Plugin_Panel::print_panel_tabs_in_post_edit_page_end()
1383
- *
1384
- * @since 3.4.0
1385
- * @author Leanza Francesco <leanzafrancesco@gmail.com>
1386
- */
1387
- public function print_panel_tabs_in_wp_pages() {
1388
- if ( self::$_panel_tabs_in_wp_pages ) {
1389
- wp_enqueue_style( 'yit-plugin-style' );
1390
- wp_enqueue_script( 'yit-plugin-panel' );
1391
-
1392
- $wrap_class = isset( $this->settings[ 'class' ] ) ? $this->settings[ 'class' ] : '';
1393
-
1394
- ?>
1395
- <div class="yith-plugin-fw-wp-page-wrapper">
1396
- <?php
1397
- echo "<div class='{$wrap_class}'>";
1398
- $this->add_plugin_banner( $this->settings[ 'page' ] );
1399
- $this->print_tabs_nav( self::$_panel_tabs_in_wp_pages );
1400
- echo "</div>";
1401
- }
1402
- }
1403
-
1404
-
1405
- /**
1406
- * Close the wrapper opened in YIT_Plugin_Panel::print_panel_tabs_in_wp_pages()
1407
- *
1408
- * @since 3.4.0
1409
- * @author Leanza Francesco <leanzafrancesco@gmail.com>
1410
- */
1411
- public function print_panel_tabs_in_wp_pages_end() {
1412
- if ( self::$_panel_tabs_in_wp_pages ) {
1413
- echo "</div><!-- /yith-plugin-fw-wp-page-wrapper -->";
1414
- }
1415
- }
1416
-
1417
- public function set_parent_file_to_handle_menu_for_wp_pages( $parent_file ) {
1418
- if ( self::$_panel_tabs_in_wp_pages ) {
1419
- return 'yith_plugin_panel';
1420
- }
1421
-
1422
- return $parent_file;
1423
- }
1424
-
1425
- public function set_submenu_file_to_handle_menu_for_wp_pages( $submenu_file, $parent_file ) {
1426
- if ( self::$_panel_tabs_in_wp_pages ) {
1427
- return $this->settings[ 'page' ];
1428
- }
1429
- return $submenu_file;
1430
- }
1431
-
1432
- /**
1433
- *
1434
- */
1435
- public function save_toggle_element_options() {
1436
- return true;
1437
- }
1438
- }
 
1439
  }
67
  * Constructor
68
  *
69
  * @param array $args
70
+ *
71
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
72
  * @since 1.0
73
  */
85
  );
86
 
87
  $args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
88
+ if ( isset( $args['parent_page'] ) && 'yit_plugin_panel' === $args['parent_page'] ) {
89
  $args['parent_page'] = 'yith_plugin_panel';
90
+ }
91
 
92
  $this->settings = $args;
93
  $this->_tabs_path_files = $this->get_tabs_path_files();
115
 
116
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
117
 
118
+ //yith-plugin-ui
119
+ add_action( 'yith_plugin_fw_before_yith_panel', array( $this, 'add_plugin_banner' ), 10, 1 );
120
+ add_action( 'wp_ajax_yith_plugin_fw_save_toggle_element', array( $this, 'save_toggle_element_options' ) );
121
+ }
122
 
123
  /**
124
  * Is this a custom post type page?
132
  $excluded_post_types = array( 'product', 'page', 'post' );
133
 
134
  return in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true ) &&
135
+ ! in_array( $post_type, $excluded_post_types, true );
136
  }
137
 
138
  /**
147
  $excluded_taxonomies = array( 'category', 'post_tag', 'product_cat', 'product_tag' );
148
 
149
  return in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) &&
150
+ ! in_array( $taxonomy, $excluded_taxonomies, true );
151
  }
152
 
153
  /**
170
  $tabs = $this->get_taxonomy_tabs( $taxonomy );
171
  }
172
 
173
+ $is_block_editor = function_exists( 'get_current_screen' ) && get_current_screen() && get_current_screen()->is_block_editor();
174
+
175
  if ( $tabs ) {
176
  // tabs_in_edit
177
  $current_tab_args = array(
180
  'current_sub_tab' => isset( $tabs['sub_tab'] ) ? $tabs['sub_tab'] : '',
181
  );
182
 
183
+ if ( ! $is_block_editor ) {
184
+ wp_enqueue_style( 'yit-plugin-style' );
185
+ wp_enqueue_style( 'yith-plugin-fw-fields' );
186
+ wp_enqueue_script( 'yith-plugin-fw-wp-pages' );
187
+ }
188
 
189
  if ( ! self::$_panel_tabs_in_wp_pages ) {
190
  self::$_panel_tabs_in_wp_pages = $current_tab_args;
191
+ if ( ! $is_block_editor ) {
192
+ add_action( 'all_admin_notices', array( $this, 'print_panel_tabs_in_wp_pages' ) );
193
+ add_action( 'admin_footer', array( $this, 'print_panel_tabs_in_wp_pages_end' ) );
194
+ }
195
  add_filter( 'parent_file', array( $this, 'set_parent_file_to_handle_menu_for_wp_pages' ) );
196
  add_filter( 'submenu_file', array( $this, 'set_submenu_file_to_handle_menu_for_wp_pages' ), 10, 2 );
197
  }
258
  * Add yith-plugin-fw-panel in body classes in Panel pages
259
  *
260
  * @param $admin_body_classes
261
+ *
262
  * @return string
263
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
264
  * @since 3.0.0
265
  */
266
  public static function add_body_class( $admin_body_classes ) {
267
  global $pagenow;
268
+ if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) ) {
269
  $admin_body_classes = substr_count( $admin_body_classes, ' yith-plugin-fw-panel ' ) == 0 ? $admin_body_classes . ' yith-plugin-fw-panel ' : $admin_body_classes;
270
+ }
271
 
272
  return $admin_body_classes;
273
  }
365
  * a callback function called by Register Settings function
366
  *
367
  * @param $input
368
+ *
369
  * @return array validate input fields
370
  * @since 1.0
371
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
474
  * Print the tabs navigation
475
  *
476
  * @param array $args
477
+ *
478
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
479
  * @since 3.4.0
480
  */
536
  * @param string $tab
537
  * @param string $sub_tab
538
  * @param string $parent_page
539
+ *
540
  * @return string
541
  */
542
  public function get_nav_url( $page, $tab, $sub_tab = '', $parent_page = '' ) {
561
  * Print the Sub-tabs navigation if the current tab has sub-tabs
562
  *
563
  * @param array $args
564
+ *
565
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
566
  * @since 3.4.0
567
  */
611
 
612
  if ( $custom_tab_action ) {
613
  $this->print_custom_tab( $custom_tab_action );
614
+
615
  return;
616
  }
617
 
627
  <p>&nbsp;</p>
628
  <?php settings_fields( 'yit_' . $this->settings['parent'] . '_options' ); ?>
629
  <input type="hidden" name="<?php echo $this->get_name_field( 'option_key' ) ?>"
630
+ value="<?php echo esc_attr( $option_key ) ?>"/>
631
  <input type="submit" class="button-primary"
632
+ value="<?php _e( 'Save Changes', 'yith-plugin-fw' ) ?>"
633
+ style="float:left;margin-right:10px;"/>
634
  </form>
635
  <form method="post">
636
  <?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
637
  <input type="hidden" name="yit-action" value="reset"/>
638
  <input type="submit" name="yit-reset" class="button-secondary"
639
+ value="<?php _e( 'Reset to default', 'yith-plugin-fw' ) ?>"
640
+ onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');"/>
641
  </form>
642
  <p>&nbsp;</p>
643
  <?php endif ?>
652
  *
653
  * @param array $options
654
  * @param string $option_key
655
+ *
656
  * @return bool
657
  */
658
  public function is_custom_tab( $options, $option_key ) {
671
  $first = ! ! $tab_options && is_array( $tab_options ) ? current( $tab_options ) : array();
672
  $type = isset( $first['type'] ) ? $first['type'] : 'options';
673
  $special_types = array( 'post_type', 'taxonomy', 'custom_tab', 'multi_tab' );
674
+
675
  return in_array( $type, $special_types ) ? $type : 'options';
676
  }
677
 
692
  * Fire the action to print the custom tab
693
  *
694
  * @param string $action Action to fire
695
+ *
696
  * @return void
697
  * @since 1.0
698
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
748
  foreach ( $this->settings['admin-tabs'] as $item => $title ) {
749
 
750
  $wp_admin_bar->add_menu( array(
751
+ 'parent' => $this->settings['parent'],
752
+ 'title' => $title,
753
+ 'id' => $this->settings['parent'] . '-' . $item,
754
+ 'href' => admin_url( 'themes.php' ) . '?page=' . $this->settings['parent_page'] . '&tab=' . $item,
755
+ ) );
756
  }
757
  }
758
  }
866
  * @param $message
867
  * @param string $type can be 'error' or 'updated'
868
  * @param bool $echo
869
+ *
870
  * @return string
871
  * @since 1.0
872
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
895
 
896
  $tabs = array();
897
 
898
+ foreach ( ( array ) glob( $option_files_path . '*.php' ) as $filename ) {
899
  preg_match( '/(.*)-options\.(.*)/', basename( $filename ), $filename_parts );
900
 
901
  if ( ! isset( $filename_parts[1] ) ) {
934
  * Return the sub-tabs array of a specific tab
935
  *
936
  * @param array|bool $_tab the tab; if not set it'll be the current tab
937
+ *
938
  * @since 3.4.0
939
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
940
  * @return array sub-tabs array
957
  if ( $_first && is_array( $_first ) && isset( $_first['type'] ) && 'multi_tab' === $_first['type'] && ! empty( $_first['sub-tabs'] ) ) {
958
  return $_first['sub-tabs'];
959
  }
960
+
961
  return array();
962
  }
963
 
1026
  }
1027
  }
1028
  }
1029
+
1030
  return '';
1031
  }
1032
 
1035
  * return the title of section
1036
  *
1037
  * @param $section
1038
+ *
1039
  * @return string
1040
  * @since 1.0
1041
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
1049
  return $option['name'];
1050
  }
1051
  }
1052
+
1053
  return '';
1054
  }
1055
 
1058
  * return the description of section if is set
1059
  *
1060
  * @param $section
1061
+ *
1062
  * @return string
1063
  * @since 1.0
1064
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
1072
  return '<p>' . $option['desc'] . '</p>';
1073
  }
1074
  }
1075
+
1076
  return '';
1077
  }
1078
 
1108
  * return a string with the name of the input field
1109
  *
1110
  * @param string $name
1111
+ *
1112
  * @return string
1113
  * @since 1.0
1114
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
1122
  * return a string with the id of the input field
1123
  *
1124
  * @param string $id
1125
+ *
1126
  * @return string
1127
  * @since 1.0
1128
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
1138
  * return a text area
1139
  *
1140
  * @param array $param
1141
+ *
1142
  * @return void
1143
  * @since 1.0
1144
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
1161
  $std = isset( $option['std'] ) ? $option['std'] : '';
1162
  $db_value = ( isset( $db_options[ $option['id'] ] ) ) ? $db_options[ $option['id'] ] : $std;
1163
 
1164
+ if ( isset( $option['deps'] ) ) {
1165
  $deps = $option['deps'];
1166
+ }
1167
 
1168
+ if ( 'on-off' === $option['type'] ) {
1169
  $option['type'] = 'onoff';
1170
+ }
1171
 
1172
  if ( $field_template_path = yith_plugin_fw_get_field_template_path( $option ) ) {
1173
  $field_container_path = apply_filters( 'yith_plugin_fw_panel_field_container_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/panel-field-container.php', $option );
1200
  * Show a box panel with specific content in two columns as a new woocommerce type
1201
  *
1202
  * @param array $args
1203
+ *
1204
  * @return void
1205
  * @since 1.0
1206
  * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
1216
  * Show a box panel with specific content in two columns as a new woocommerce type
1217
  *
1218
  * @param array $args
1219
+ *
1220
  * @return void
1221
  * @deprecated 3.0.12 Do nothing! Method left to prevent Fatal Error if called directly
1222
  */
1311
  </div>
1312
  <div class="yith-plugin-fw-rate">
1313
  <?php printf( '<strong>%s</strong> %s <a href="%s" target="_blank"><u>%s</u> <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> %s',
1314
+ __( 'We need your support', 'yith-plugin-fw' ),
1315
+ __( 'to keep updating and improving the plugin. Please,', 'yith-plugin-fw' ),
1316
+ $rate_link,
1317
+ __( 'help us by leaving a five-star rating', 'yith-plugin-fw' ),
1318
+ __( ':) Thanks!', 'yith-plugin-fw' ) ) ?>
1319
  </div>
1320
  <?php else: ?>
1321
  <h1 class="notice-container"></h1>
1401
  public function maybe_redirect_to_proper_wp_page() {
1402
  global $pagenow;
1403
  if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && $this->settings['page'] === $_GET['page'] &&
1404
+ ! $this->is_custom_taxonomy_page() && ! $this->is_custom_post_type_page() && ! isset( $_REQUEST['yith-plugin-fw-panel-skip-redirect'] ) ) {
1405
  $url = $this->get_nav_url( $this->settings['page'], $this->get_current_tab(), $this->get_current_sub_tab() );
1406
  if ( strpos( $url, 'edit.php' ) !== false || strpos( $url, 'edit-tags.php' ) !== false ) {
1407
  wp_safe_redirect( add_query_arg( array( 'yith-plugin-fw-panel-skip-redirect' => 1 ), $url ) );
1408
  exit;
1409
  }
1410
  }
1411
+ }
1412
+
1413
+ /**
1414
+ * Print the Panel tabs and sub-tabs navigation in WP pages
1415
+ * Important: this opens a wrapper <div> that will be closed through YIT_Plugin_Panel::print_panel_tabs_in_post_edit_page_end()
1416
+ *
1417
+ * @since 3.4.0
1418
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
1419
+ */
1420
+ public function print_panel_tabs_in_wp_pages() {
1421
+ if ( self::$_panel_tabs_in_wp_pages ) {
1422
+ wp_enqueue_style( 'yit-plugin-style' );
1423
+ wp_enqueue_script( 'yit-plugin-panel' );
1424
+
1425
+ $wrap_class = isset( $this->settings['class'] ) ? $this->settings['class'] : '';
1426
+
1427
+ ?>
1428
+ <div class="yith-plugin-fw-wp-page-wrapper">
1429
+ <?php
1430
+ echo "<div class='{$wrap_class}'>";
1431
+ $this->add_plugin_banner( $this->settings['page'] );
1432
+ $this->print_tabs_nav( self::$_panel_tabs_in_wp_pages );
1433
+ echo "</div>";
1434
+ }
1435
+ }
1436
+
1437
+
1438
+ /**
1439
+ * Close the wrapper opened in YIT_Plugin_Panel::print_panel_tabs_in_wp_pages()
1440
+ *
1441
+ * @since 3.4.0
1442
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
1443
+ */
1444
+ public function print_panel_tabs_in_wp_pages_end() {
1445
+ if ( self::$_panel_tabs_in_wp_pages ) {
1446
+ echo "</div><!-- /yith-plugin-fw-wp-page-wrapper -->";
1447
+ }
1448
+ }
1449
+
1450
+ public function set_parent_file_to_handle_menu_for_wp_pages( $parent_file ) {
1451
+ if ( self::$_panel_tabs_in_wp_pages ) {
1452
+ return 'yith_plugin_panel';
1453
+ }
1454
+
1455
+ return $parent_file;
1456
+ }
1457
+
1458
+ public function set_submenu_file_to_handle_menu_for_wp_pages( $submenu_file, $parent_file ) {
1459
+ if ( self::$_panel_tabs_in_wp_pages ) {
1460
+ return $this->settings['page'];
1461
+ }
1462
+
1463
+ return $submenu_file;
1464
+ }
1465
+
1466
+ /**
1467
+ *
1468
+ */
1469
+ public function save_toggle_element_options() {
1470
+ return true;
1471
+ }
1472
+ }
1473
  }
plugin-fw/package.json CHANGED
@@ -6,12 +6,18 @@
6
  "scripts": {
7
  "build": "npm run js && npm run i18n",
8
  "js": "grunt js",
9
- "i18n": "grunt i18n"
 
 
 
 
 
10
  },
11
  "author": "YITH",
12
  "license": "GPL-3.0+",
13
  "keywords": [],
14
  "devDependencies": {
 
15
  "grunt": "^1.0.3",
16
  "grunt-cli": "^1.3.2",
17
  "grunt-contrib-jshint": "^2.0.0",
6
  "scripts": {
7
  "build": "npm run js && npm run i18n",
8
  "js": "grunt js",
9
+ "i18n": "npm run -s i18n:build && npm run -s i18n:translations",
10
+ "i18n:build": "grunt makepot",
11
+ "i18n:translations": "npm run -s i18n:download-translations && npm run -s i18n:update-po && npm run -s i18n:clean",
12
+ "i18n:download-translations": "node ./bin/download-translations.js",
13
+ "i18n:update-po": "grunt update_po",
14
+ "i18n:clean": "node ./bin/clean-language-files.js"
15
  },
16
  "author": "YITH",
17
  "license": "GPL-3.0+",
18
  "keywords": [],
19
  "devDependencies": {
20
+ "axios": "^0.19.2",
21
  "grunt": "^1.0.3",
22
  "grunt-cli": "^1.3.2",
23
  "grunt-contrib-jshint": "^2.0.0",