YITH WooCommerce Compare - Version 2.3.4

Version Description

Released on Oct 01, 2018

  • New: Support to WooCommerce 3.5.0 RC1.
  • Update: Plugin Core.
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Compare
Version 2.3.4
Comparing to
See all releases

Code changes from version 2.3.3 to 2.3.4

README.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
4
  Tags: woocommerce compare, compare products, product compare, product comparison, compare table
5
  Requires at least: 3.5.1
6
  Tested up to: 4.9
7
- Stable tag: 2.3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -66,6 +66,11 @@ yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
69
  = 2.3.3 = Released on Sep 20, 2018
70
 
71
  * Fix: Compatibility issue with WPML and RTL languages.
@@ -296,6 +301,7 @@ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woo
296
 
297
  == Upgrade notice ==
298
 
299
- = 2.3.3 = Released on Sep 20, 2018
300
 
301
- * Fix: Compatibility issue with WPML and RTL languages.
 
4
  Tags: woocommerce compare, compare products, product compare, product comparison, compare table
5
  Requires at least: 3.5.1
6
  Tested up to: 4.9
7
+ Stable tag: 2.3.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.3.4 = Released on Oct 01, 2018
70
+
71
+ * New: Support to WooCommerce 3.5.0 RC1.
72
+ * Update: Plugin Core.
73
+
74
  = 2.3.3 = Released on Sep 20, 2018
75
 
76
  * Fix: Compatibility issue with WPML and RTL languages.
301
 
302
  == Upgrade notice ==
303
 
304
+ = 2.3.4 = Released on Oct 01, 2018
305
 
306
+ * New: Support to WooCommerce 3.5.0 RC1.
307
+ * Update: Plugin Core.
includes/class.yith-woocompare-admin.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Admin class
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Compare
7
  * @version 2.0.0
8
  */
@@ -117,8 +117,8 @@ if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
117
  public function action_links( $links ) {
118
 
119
  $links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-compare' ) . '</a>';
120
- if ( ! ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) ) {
121
- $links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-compare' ) . '</a>';
122
  }
123
 
124
  return $links;
@@ -154,7 +154,7 @@ if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
154
  'menu_title' => _x( 'Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
155
  'capability' => 'manage_options',
156
  'parent' => '',
157
- 'parent_page' => 'yit_plugin_panel',
158
  'page' => $this->_panel_page,
159
  'admin-tabs' => apply_filters( 'yith_woocompare_admin_tabs', $admin_tabs ),
160
  'options-path' => YITH_WOOCOMPARE_DIR . '/plugin-options'
2
  /**
3
  * Admin class
4
  *
5
+ * @author YITH
6
  * @package YITH WooCommerce Compare
7
  * @version 2.0.0
8
  */
117
  public function action_links( $links ) {
118
 
119
  $links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-compare' ) . '</a>';
120
+ if ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) {
121
+ $links[] = '<a href="' . YIT_Plugin_Licence()->get_license_activation_url() . '" target="_blank">' . __( 'License', 'yith-woocommerce-compare' ) . '</a>';
122
  }
123
 
124
  return $links;
154
  'menu_title' => _x( 'Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
155
  'capability' => 'manage_options',
156
  'parent' => '',
157
+ 'parent_page' => 'yith_plugin_panel',
158
  'page' => $this->_panel_page,
159
  'admin-tabs' => apply_filters( 'yith_woocompare_admin_tabs', $admin_tabs ),
160
  'options-path' => YITH_WOOCOMPARE_DIR . '/plugin-options'
includes/class.yith-woocompare-frontend.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Main class
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH Woocommerce Compare
7
  * @version 1.1.4
8
  */
2
  /**
3
  * Main class
4
  *
5
+ * @author YITH
6
  * @package YITH Woocommerce Compare
7
  * @version 1.1.4
8
  */
includes/class.yith-woocompare-helper.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Main class
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Compare
7
  * @version 1.1.4
8
  */
2
  /**
3
  * Main class
4
  *
5
+ * @author YITH
6
  * @package YITH WooCommerce Compare
7
  * @version 1.1.4
8
  */
includes/class.yith-woocompare.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Main class
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH Woocommerce Compare
7
  * @version 1.1.4
8
  */
2
  /**
3
  * Main class
4
  *
5
+ * @author YITH
6
  * @package YITH Woocommerce Compare
7
  * @version 1.1.4
8
  */
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 allows you to compare in a simple and efficient way products on sale in your shop and compare their main features in a single table. <a href="https://yithemes.com/" target="_blank">Find new awesome plugins on <strong>YITH</strong></a>.
6
- * Version: 2.3.3
7
- * Author: YITHEMES
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-compare
10
  * Domain Path: /languages/
11
  * WC requires at least: 2.5.0
12
  * WC tested up to: 3.4.5
13
  *
14
- * @author Yithemes
15
  * @package YITH WooCommerce Compare
16
- * @version 2.3.3
17
  */
18
  /* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
19
 
@@ -58,7 +58,7 @@ if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
58
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
59
 
60
  if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
61
- define( 'YITH_WOOCOMPARE_VERSION', '2.3.3' );
62
  }
63
  if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
64
  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 allows you to compare in a simple and efficient way products on sale in your shop and compare their main features in a single table. <a href="https://yithemes.com/" target="_blank">Find new awesome plugins on <strong>YITH</strong></a>.
6
+ * Version: 2.3.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: 2.5.0
12
  * WC tested up to: 3.4.5
13
  *
14
+ * @author YITH
15
  * @package YITH WooCommerce Compare
16
+ * @version 2.3.4
17
  */
18
  /* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
19
 
58
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
59
 
60
  if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
61
+ define( 'YITH_WOOCOMPARE_VERSION', '2.3.4' );
62
  }
63
  if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
64
  define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.0.22
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.0.22
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.0.23
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.0.23
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -156,8 +156,11 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
156
  $capability = apply_filters( 'yit_plugin_panel_menu_page_capability', 'manage_options' );
157
  $show = apply_filters( 'yit_plugin_panel_menu_page_show', true );
158
 
159
- // YITH Plugins text must not be translated
160
- !!$show && add_menu_page( 'yith_plugin_panel', 'YITH Plugins', $capability, 'yith_plugin_panel', null, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
 
 
 
161
  }
162
  }
163
 
@@ -203,7 +206,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
203
  wp_enqueue_script( 'yith-plugin-fw-fields' );
204
  }
205
 
206
- if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) || apply_filters( 'yit_plugin_panel_asset_loading', false ) ) {
207
  wp_enqueue_media();
208
  wp_enqueue_style( 'yit-plugin-style' );
209
  wp_enqueue_script( 'yit-plugin-panel' );
156
  $capability = apply_filters( 'yit_plugin_panel_menu_page_capability', 'manage_options' );
157
  $show = apply_filters( 'yit_plugin_panel_menu_page_show', true );
158
 
159
+ // YITH text must not be translated
160
+ if ( !!$show ) {
161
+ add_menu_page( 'yith_plugin_panel', 'YITH', $capability, 'yith_plugin_panel', null, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
162
+ $admin_page_hooks[ 'yith_plugin_panel' ] = 'yith-plugins'; // prevent issues for backward compatibility
163
+ }
164
  }
165
  }
166
 
206
  wp_enqueue_script( 'yith-plugin-fw-fields' );
207
  }
208
 
209
+ if ( ( 'admin.php' == $pagenow && yith_plugin_fw_is_panel() ) || apply_filters( 'yit_plugin_panel_asset_loading', false ) ) {
210
  wp_enqueue_media();
211
  wp_enqueue_style( 'yit-plugin-style' );
212
  wp_enqueue_script( 'yit-plugin-panel' );
plugin-fw/lib/yit-plugin-subpanel.php CHANGED
@@ -18,7 +18,7 @@ if ( !class_exists( 'YIT_Plugin_SubPanel' ) ) {
18
  *
19
  * Setting Page to Manage Plugins
20
  *
21
- * @class YIT_Plugin_Panel
22
  * @package Yithemes
23
  * @since 1.0
24
  * @author Your Inspiration Themes
@@ -98,7 +98,8 @@ if ( !class_exists( 'YIT_Plugin_SubPanel' ) ) {
98
 
99
  if ( !isset( $admin_page_hooks[ 'yith_plugin_panel' ] ) ) {
100
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
101
- add_menu_page( 'yith_plugin_panel', 'YITH Plugins', 'nosuchcapability', 'yith_plugin_panel', null, $logo, $position );
 
102
  }
103
 
104
  add_submenu_page( 'yith_plugin_panel', $this->settings[ 'label' ], $this->settings[ 'label' ], 'manage_options', $this->settings[ 'page' ], array( $this, 'yit_panel' ) );
18
  *
19
  * Setting Page to Manage Plugins
20
  *
21
+ * @class YIT_Plugin_Panel
22
  * @package Yithemes
23
  * @since 1.0
24
  * @author Your Inspiration Themes
98
 
99
  if ( !isset( $admin_page_hooks[ 'yith_plugin_panel' ] ) ) {
100
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
101
+ add_menu_page( 'yith_plugin_panel', 'YITH', 'nosuchcapability', 'yith_plugin_panel', null, $logo, $position );
102
+ $admin_page_hooks[ 'yith_plugin_panel' ] = 'yith-plugins'; // prevent issues for backward compatibility
103
  }
104
 
105
  add_submenu_page( 'yith_plugin_panel', $this->settings[ 'label' ], $this->settings[ 'label' ], 'manage_options', $this->settings[ 'page' ], array( $this, 'yit_panel' ) );
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -7,610 +7,657 @@
7
  * It is also available through the world-wide-web at this URL:
8
  * http://www.gnu.org/licenses/gpl-3.0.txt
9
  */
10
- if ( !defined( 'ABSPATH' ) ) {
11
- exit;
12
  } // Exit if accessed directly
13
 
14
- if ( !class_exists( 'YIT_Upgrade' ) ) {
15
- /**
16
- * YIT Upgrade
17
- *
18
- * Notify and Update plugin
19
- *
20
- * @class YIT_Upgrade
21
- * @package Yithemes
22
- * @since 1.0
23
- * @author Your Inspiration Themes
24
- * @see WP_Updater Class
25
- */
26
- class YIT_Upgrade {
27
-
28
- /**
29
- * @var string XML notifier update
30
- */
31
- protected $_xml = 'http://update.yithemes.com/plugins/%plugin_slug%.xml';
32
-
33
- /**
34
- * @var string api server url
35
- */
36
- protected $_package_url = 'https://yithemes.com';
37
-
38
- /**
39
- * @var array The registered plugins
40
- */
41
- protected $_plugins = array();
42
-
43
- /**
44
- * @var YIT_Upgrade The main instance
45
- */
46
- protected static $_instance;
47
-
48
- /**
49
- * Construct
50
- *
51
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
52
- * @since 1.0
53
- */
54
- public function __construct() {
55
- add_filter( 'upgrader_pre_download', array( $this, 'upgrader_pre_download' ), 10, 3 );
56
- add_action( 'update-custom_upgrade-plugin-multisite', array( $this, 'upgrade_plugin_multisite' ) );
57
-
58
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
-
60
- $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
61
- if ( $is_debug_enabled ) {
62
- $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
63
- add_filter( 'block_local_requests', '__return_false' );
64
- }
65
-
66
- add_action( 'install_plugins_pre_plugin-information', array( $this, 'show_changelog_for_premium_plugins' ) );
67
- add_action( 'wp_ajax_yith_plugin_fw_get_premium_changelog', array( $this, 'show_changelog_for_premium_plugins' ) );
68
- }
69
-
70
- /**
71
- * show changelog for premium plugins
72
- *
73
- * @since 3.0.14
74
- */
75
- public function show_changelog_for_premium_plugins() {
76
- if ( isset( $_GET[ 'plugin' ] ) && isset( $_GET[ 'section' ] ) && 'changelog' === $_GET[ 'section' ] ) {
77
- $plugin_init = $_GET[ 'plugin' ];
78
- if ( isset( $this->_plugins[ $plugin_init ] ) ) {
79
- // this is YITH Premium Plugin
80
- if ( !empty( $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ] ) ) {
81
- $plugin_name = $this->_plugins[ $plugin_init ][ 'info' ][ 'Name' ];
82
- $changelog = $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ];
83
- $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/changelog.php';
84
- if ( file_exists( $template ) ) {
85
- include( $template );
86
- }
87
- die();
88
- }
89
- $error = __( 'An unexpected error occurred, please try again later. Thanks!', 'yith-plugin-fw' );
90
- $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/error.php';
91
- if ( file_exists( $template ) ) {
92
- include( $template );
93
- } else {
94
- echo "<p>$error</p>";
95
- }
96
- die();
97
- }
98
- }
99
- }
100
-
101
- /**
102
- * Main plugin Instance
103
- *
104
- * @param $plugin_slug | string The plugin slug
105
- * @param $plugin_init | string The plugin init file
106
- *
107
- * @return void
108
- *
109
- * @since 1.0
110
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
111
- */
112
- public function register( $plugin_slug, $plugin_init ) {
113
-
114
- if ( !function_exists( 'get_plugins' ) ) {
115
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
116
- }
117
-
118
- $plugins = get_plugins();
119
- $plugin_info = $plugins[ $plugin_init ];
120
-
121
- $this->_plugins[ $plugin_init ] = array(
122
- 'info' => $plugin_info,
123
- 'slug' => $plugin_slug,
124
- );
125
-
126
- $transient = 'yith_register_' . md5( $plugin_slug );
127
- if ( apply_filters( 'yith_register_delete_transient', false ) ) {
128
- delete_transient( $transient );
129
- }
130
- $info = get_transient( $transient );
131
- if ( false === $info || apply_filters( 'yith_register_delete_transient', false ) ) {
132
- $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
133
- $remote_xml = wp_remote_get( $xml );
134
-
135
- $error = false;
136
- if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
137
- $plugin_remote_info = @simplexml_load_string( $remote_xml[ 'body' ] );
138
- if ( $plugin_remote_info ) {
139
- $info[ 'Latest' ] = (string) $plugin_remote_info->latest;
140
- $info[ 'changelog' ] = (string) $plugin_remote_info->changelog;
141
- if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
142
- YIT_Plugin_Licence()->check( $plugin_slug, false );
143
- }
144
- set_transient( $transient, $info, DAY_IN_SECONDS );
145
- } else {
146
- $error = true;
147
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
148
- __FILE__, __FUNCTION__, $plugin_slug ) );
149
- }
150
- } else {
151
- $error = true;
152
- }
153
-
154
- if ( $error ) {
155
- // If error, set empty value in the transient to prevent multiple requests
156
- $info = array( 'Latest' => '', 'changelog' => '' );
157
- set_transient( $transient, $info, HOUR_IN_SECONDS );
158
- }
159
- }
160
-
161
- $this->_plugins[ $plugin_init ][ 'info' ][ 'Latest' ] = $info[ 'Latest' ];
162
- $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ] = $info[ 'changelog' ];
163
-
164
- /* === HOOKS === */
165
- if ( !is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
166
- add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
167
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
168
- } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
169
- add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
170
- }
171
- }
172
-
173
- /**
174
- * Add the multisite updater scripts
175
- *
176
- * @return void
177
- *
178
- * @since 1.0
179
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
180
- */
181
- public function multisite_updater_script() {
182
- $update_url = $changelogs = $details_url = array();
183
- $strings = array(
184
- 'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
185
- 'latest' => __( 'View version %latest% details.', 'yith-plugin-fw' ),
186
- 'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
187
- 'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
188
- 'update_now' => __( 'Update now.', 'yith-plugin-fw' )
189
-
190
- );
191
-
192
- foreach ( $this->_plugins as $init => $info ) {
193
- $update_url[ $init ] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin-multisite&plugin=' ) . $init, 'upgrade-plugin-multisite_' . $init );
194
- $details_url[ $init ] = admin_url( 'admin-ajax.php?action=yith_plugin_fw_get_premium_changelog&tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
195
- }
196
-
197
- $localize_script_args = array(
198
- 'registered' => $this->_plugins,
199
- 'activated' => YIT_Plugin_Licence()->get_activated_products(),
200
- 'licence_activation_url' => YIT_Plugin_Licence()->get_licence_activation_page_url(),
201
- 'update_url' => $update_url,
202
- 'details_url' => $details_url,
203
- 'strings' => $strings,
204
- );
205
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
206
- yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
207
-
208
- wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
209
- }
210
-
211
- public function admin_enqueue_scripts() {
212
- global $pagenow;
213
- if ( 'plugins.php' === $pagenow )
214
- wp_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
215
- }
216
-
217
- /**
218
- * Retrive the zip package file
219
- *
220
- * @param bool $reply Whether to bail without returning the package. Default false.
221
- * @param string $package The package file name.
222
- * @param \WP_Upgrader $upgrader WP_Upgrader instance.
223
- *
224
- * @return string | The download file
225
- *
226
- * @since 1.0
227
- * @see wp-admin/includes/class-wp-upgrader.php
228
- * @access public
229
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
230
- */
231
- public function upgrader_pre_download( $reply, $package, $upgrader ) {
232
- $plugin = false;
233
- $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
234
-
235
- if ( !$is_bulk ) {
236
- $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
237
- } else {
238
- //Bulk action upgrade
239
- $action_url = parse_url( $upgrader->skin->options[ 'url' ] );
240
- parse_str( rawurldecode( htmlspecialchars_decode( $action_url[ 'query' ] ) ), $output );
241
- $plugins = isset( $output[ 'plugins' ] ) ? $output[ 'plugins' ] : '';
242
- $plugins = explode( ',', $plugins );
243
- foreach ( $plugins as $plugin_init ) {
244
- $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_init );
245
- if ( $to_upgrade[ 'Name' ] == $upgrader->skin->plugin_info[ 'Name' ] ) {
246
- $plugin = $plugin_init;
247
- }
248
- }
249
- }
250
-
251
- /**
252
- * It isn't YITH Premium plugins, please wordpress update it for me!
253
- */
254
- if ( !$plugin ) {
255
- return $reply;
256
- }
257
-
258
- $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
259
-
260
- /**
261
- * False ? It isn't YITH Premium plugins, please wordpress update it for me!
262
- */
263
- if ( false === $plugin_info ) {
264
- return $reply;
265
- }
266
-
267
- $licence = YIT_Plugin_Licence()->get_licence();
268
- $product_id = $plugin_info[ 'product_id' ];
269
- $args = array(
270
- 'email' => $licence[ $product_id ][ 'email' ],
271
- 'licence_key' => $licence[ $product_id ][ 'licence_key' ],
272
- 'product_id' => $plugin_info[ 'product_id' ],
273
- 'secret_key' => $plugin_info[ 'secret_key' ],
274
- 'instance' => YIT_Plugin_Licence()->get_home_url(),
275
- 'wc-api' => 'download-api',
276
- 'request' => 'download'
277
- );
278
-
279
- if ( !preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) {
280
- //Local file or remote?
281
- return $package;
282
- }
283
-
284
- if ( empty( $package ) ) {
285
- return new WP_Error( 'no_package', $upgrader->strings[ 'no_package' ] );
286
- }
287
-
288
- $upgrader->skin->feedback( 'downloading_package', __( 'YITH Repository', 'yith-plugin-fw' ) );
289
-
290
- $download_file = $this->_download_url( $package, $args );
291
-
292
- /**
293
- * Regenerate update_plugins transient
294
- */
295
- $this->force_regenerate_update_transient();
296
-
297
- if ( is_wp_error( $download_file ) ) {
298
- return new WP_Error( 'download_failed', $upgrader->strings[ 'download_failed' ], $download_file->get_error_message() );
299
- }
300
-
301
- return $download_file;
302
- }
303
-
304
- /**
305
- * Retrive the temp filename
306
- *
307
- * @param string $url The package url
308
- * @param string $body The post data fields
309
- * @param int $timeout Execution timeout (default: 300)
310
- *
311
- * @return string | The temp filename
312
- *
313
- * @since 1.0
314
- * @see wp-admin/includes/class-wp-upgrader.php
315
- * @access protected
316
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
317
- */
318
- protected function _download_url( $url, $body, $timeout = 300 ) {
319
-
320
- //WARNING: The file is not automatically deleted, The script must unlink() the file.
321
- if ( !$url ) {
322
- return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yit' ) );
323
- }
324
-
325
- $tmpfname = wp_tempnam( $url );
326
-
327
- $args = array(
328
- 'timeout' => $timeout,
329
- 'stream' => true,
330
- 'filename' => $tmpfname,
331
- 'body' => $body
332
- );
333
-
334
- if ( !$tmpfname ) {
335
- return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yit' ) );
336
- }
337
-
338
- $response = wp_safe_remote_post( $url, $args );
339
-
340
- if ( is_wp_error( $response ) ) {
341
- unlink( $tmpfname );
342
-
343
- return $response;
344
- }
345
-
346
- if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
347
- unlink( $tmpfname );
348
-
349
- return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
350
- }
351
-
352
- $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
353
-
354
- if ( $content_md5 ) {
355
- $md5_check = verify_file_md5( $tmpfname, $content_md5 );
356
- if ( is_wp_error( $md5_check ) ) {
357
- unlink( $tmpfname );
358
-
359
- return $md5_check;
360
- }
361
- }
362
-
363
- return $tmpfname;
364
- }
365
-
366
- /**
367
- * Main plugin Instance
368
- *
369
- * @static
370
- * @return object Main instance
371
- *
372
- * @since 1.0
373
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
374
- */
375
- public static function instance() {
376
- if ( is_null( self::$_instance ) ) {
377
- self::$_instance = new self();
378
- }
379
-
380
- return self::$_instance;
381
- }
382
-
383
- /**
384
- * Delete the update plugins transient
385
- *
386
- * @return void
387
- *
388
- * @since 1.0
389
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
390
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
391
- */
392
- public function force_regenerate_update_transient() {
393
- delete_site_transient( 'update_plugins' );
394
- }
395
-
396
- /**
397
- * Check for plugins update
398
- *
399
- * If a new plugin version is available set it in the pre_set_site_transient_update_plugins hooks
400
- *
401
- * @param mixed $transient | update_plugins transient value
402
- * @param bool $save | Default: false. Set true to regenerate the update_transient plugins
403
- *
404
- * @return mixed $transient | The new update_plugins transient value
405
- *
406
- * @since 1.0
407
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
408
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
409
- */
410
- public function check_update( $transient, $save = false ) {
411
-
412
- foreach ( $this->_plugins as $init => $plugin ) {
413
- $plugin_slug = $this->_plugins[ $init ][ 'slug' ];
414
- $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
415
- $remote_xml = wp_remote_get( $xml );
416
-
417
- if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
418
-
419
- $plugin_remote_info = @simplexml_load_string( $remote_xml[ 'body' ] );
420
-
421
- if ( $plugin_remote_info ) {
422
-
423
- if ( version_compare( $plugin_remote_info->latest, $plugin[ 'info' ][ 'Version' ], '>' ) && !isset( $transient->response[ $init ] ) ) {
424
-
425
- $package = YIT_Plugin_Licence()->check( $init ) ? $this->_package_url : null;
426
-
427
- $obj = new stdClass();
428
- $obj->slug = (string) $init;
429
- $obj->new_version = (string) $plugin_remote_info->latest;
430
- $obj->changelog = (string) $plugin_remote_info->changelog;
431
- $obj->package = $package;
432
- $obj->plugin = $init;
433
- $transient->response[ $init ] = $obj;
434
- }
435
-
436
- } else {
437
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
438
- __FILE__, __FUNCTION__, $plugin_slug ) );
439
-
440
- return $transient;
441
- }
442
- }
443
- }
444
-
445
- if ( $save ) {
446
- set_site_transient( 'update_plugins', $transient );
447
- }
448
-
449
- return $transient;
450
- }
451
-
452
- /**
453
- * Add the plugin update row in plugin page
454
- *
455
- * @return void
456
- * @fire "in_theme_update_message-{$init}" action
457
- *
458
- * @since 1.0
459
- * @see after_plugin_row_{$init} action
460
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
461
- */
462
- public function plugin_update_row() {
463
-
464
- $current = get_site_transient( 'update_plugins' );
465
- $init = str_replace( 'after_plugin_row_', '', current_filter() );
466
-
467
- if ( !isset( $current->response[ $init ] ) ) {
468
- return false;
469
- }
470
-
471
- /**
472
- * stdClass Object
473
- */
474
- $r = $current->response[ $init ];
475
-
476
- $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
477
- $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
478
-
479
- /**
480
- * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
481
- */
482
- $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
483
-
484
- if ( is_network_admin() || !is_multisite() || true ) {
485
- global $wp_version;
486
- $is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
487
-
488
- echo '<tr class="plugin-update-tr' . ( is_plugin_active( $init ) ? ' active' : '' ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
489
-
490
- echo '<div class="update-message' . ( $is_wp_4_6 ? ' notice inline notice-warning notice-alt' : '' ) . '">';
491
-
492
- echo( $is_wp_4_6 ? '<p>' : '' );
493
-
494
- if ( !current_user_can( 'update_plugins' ) ) {
495
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ][ 'info' ][ 'Name' ], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ][ 'info' ][ 'Name' ] ), $r->new_version );
496
- } elseif ( is_plugin_active_for_network( $init ) ) {
497
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ][ 'info' ][ 'Name' ], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ][ 'info' ][ 'Name' ] ), $r->new_version );
498
- } elseif ( empty( $r->package ) ) {
499
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ][ 'info' ][ 'Name' ], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ][ 'info' ][ 'Name' ] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ][ 'info' ][ 'Name' ] );
500
- } else {
501
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ][ 'info' ][ 'Name' ], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ][ 'info' ][ 'Name' ] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ) );
502
- }
503
-
504
- echo( $is_wp_4_6 ? '</p>' : '' );
505
-
506
- /**
507
- * Fires at the end of the update message container in each
508
- * row of the themes list table.
509
- *
510
- * The dynamic portion of the hook name, `$theme_key`, refers to
511
- * the theme slug as found in the WordPress.org themes repository.
512
- *
513
- * @since Wordpress 3.1.0
514
- * }
515
- */
516
- do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
517
-
518
- echo '</div></td></tr>';
519
- }
520
- }
521
-
522
- /**
523
- * Remove the standard plugin_update_row
524
- *
525
- * Remove the standard plugin_update_row and Add a custom plugin update row in plugin page.
526
- *
527
- * @return void
528
- * @fire "in_theme_update_message-{$init}" action
529
- *
530
- * @since 1.0
531
- * @see after_plugin_row_{$init} action
532
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
533
- */
534
- public function remove_wp_plugin_update_row() {
535
- foreach ( $this->_plugins as $init => $plugin ) {
536
- remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
537
- add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
538
- //add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
539
- }
540
- }
541
-
542
- public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ) {
543
- $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
 
 
 
 
 
 
 
544
  <div class='yit-plugin-changelog'>
545
  <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
546
  <p>{$changelog}</p>
547
  </div>
548
  </div>";
549
 
550
- if ( $echo ) {
551
- echo $res;
552
- } else {
553
- return $res;
554
- }
555
- }
556
-
557
- /**
558
- * Auto-Update Plugin in multisite
559
- *
560
- * Manage the non standard upgrade-plugin-multisite action
561
- *
562
- * @return void
563
- *
564
- * @since 1.0
565
- * @see upgrade-plugin action
566
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
567
- */
568
- public function upgrade_plugin_multisite() {
569
-
570
- $plugin = isset( $_REQUEST[ 'plugin' ] ) ? trim( $_REQUEST[ 'plugin' ] ) : '';
571
- $action = isset( $_REQUEST[ 'action' ] ) ? $_REQUEST[ 'action' ] : '';
572
-
573
- if ( 'upgrade-plugin-multisite' != $action ) {
574
- wp_die( __( 'You can\'t update the plugins for this site.', 'yith-plugin-fw' ) );
575
- }
576
-
577
- if ( !current_user_can( 'update_plugins' ) ) {
578
- wp_die( __( 'You do not have sufficient permissions to update the plugins for this site.', 'yith-plugin-fw' ) );
579
- }
580
-
581
- $this->check_update( get_site_transient( 'update_plugins' ), true );
582
-
583
- check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
584
-
585
- $title = __( 'Update Plugin', 'yith-plugin-fw' );
586
- $parent_file = 'plugins.php';
587
- $submenu_file = 'plugins.php';
588
-
589
- wp_enqueue_script( 'updates' );
590
- require_once( ABSPATH . 'wp-admin/admin-header.php' );
591
-
592
- $nonce = 'upgrade-plugin-multisite_' . $plugin;
593
- $url = 'update.php?action=upgrade-plugin-multisite&plugin=' . urlencode( $plugin );
594
-
595
- $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
596
- $upgrader->upgrade( $plugin );
597
-
598
- include( ABSPATH . 'wp-admin/admin-footer.php' );
599
- }
600
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
  }
602
 
603
- if ( !function_exists( 'YIT_Upgrade' ) ) {
604
- /**
605
- * Main instance of plugin
606
- *
607
- * @return YIT_Upgrade
608
- * @since 1.0
609
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
610
- */
611
- function YIT_Upgrade() {
612
- return YIT_Upgrade::instance();
613
- }
614
  }
615
 
616
  /**
7
  * It is also available through the world-wide-web at this URL:
8
  * http://www.gnu.org/licenses/gpl-3.0.txt
9
  */
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
  } // Exit if accessed directly
13
 
14
+ if ( ! class_exists( 'YIT_Upgrade' ) ) {
15
+ /**
16
+ * YIT Upgrade
17
+ *
18
+ * Notify and Update plugin
19
+ *
20
+ * @class YIT_Upgrade
21
+ * @package Yithemes
22
+ * @since 1.0
23
+ * @author Your Inspiration Themes
24
+ * @see WP_Updater Class
25
+ */
26
+ class YIT_Upgrade {
27
+
28
+ /**
29
+ * @var string XML notifier update
30
+ */
31
+ protected $_remote_url = 'https://update.yithemes.com/plugin-xml.php';
32
+
33
+ /**
34
+ * @var string api server url
35
+ */
36
+ protected $_package_url = 'https://yithemes.com';
37
+
38
+ /**
39
+ * @var array The registered plugins
40
+ */
41
+ protected $_plugins = array();
42
+
43
+ /**
44
+ * @var YIT_Upgrade The main instance
45
+ */
46
+ protected static $_instance;
47
+
48
+ /**
49
+ * Construct
50
+ *
51
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
52
+ * @since 1.0
53
+ */
54
+ public function __construct() {
55
+ add_filter( 'upgrader_pre_download', array( $this, 'upgrader_pre_download' ), 10, 3 );
56
+ add_action( 'update-custom_upgrade-plugin-multisite', array( $this, 'upgrade_plugin_multisite' ) );
57
+
58
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
+
60
+ $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
61
+ if ( $is_debug_enabled ) {
62
+ $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
63
+ add_filter( 'block_local_requests', '__return_false' );
64
+ }
65
+
66
+ add_action( 'install_plugins_pre_plugin-information', array(
67
+ $this,
68
+ 'show_changelog_for_premium_plugins'
69
+ ) );
70
+ add_action( 'wp_ajax_yith_plugin_fw_get_premium_changelog', array(
71
+ $this,
72
+ 'show_changelog_for_premium_plugins'
73
+ ) );
74
+ }
75
+
76
+ /**
77
+ * show changelog for premium plugins
78
+ *
79
+ * @since 3.0.14
80
+ */
81
+ public function show_changelog_for_premium_plugins() {
82
+ if ( isset( $_GET['plugin'] ) && isset( $_GET['section'] ) && 'changelog' === $_GET['section'] ) {
83
+ $plugin_init = $_GET['plugin'];
84
+ if ( isset( $this->_plugins[ $plugin_init ] ) ) {
85
+ // this is YITH Premium Plugin
86
+ if ( ! empty( $this->_plugins[ $plugin_init ]['info']['changelog'] ) ) {
87
+ $plugin_name = $this->_plugins[ $plugin_init ]['info']['Name'];
88
+ $changelog = $this->_plugins[ $plugin_init ]['info']['changelog'];
89
+ $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/changelog.php';
90
+ if ( file_exists( $template ) ) {
91
+ include( $template );
92
+ }
93
+ die();
94
+ }
95
+ $error = __( 'An unexpected error occurred, please try again later. Thanks!', 'yith-plugin-fw' );
96
+ $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/error.php';
97
+ if ( file_exists( $template ) ) {
98
+ include( $template );
99
+ } else {
100
+ echo "<p>$error</p>";
101
+ }
102
+ die();
103
+ }
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Main plugin Instance
109
+ *
110
+ * @param $plugin_slug | string The plugin slug
111
+ * @param $plugin_init | string The plugin init file
112
+ *
113
+ * @return void
114
+ *
115
+ * @since 1.0
116
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
117
+ */
118
+ public function register( $plugin_slug, $plugin_init ) {
119
+
120
+ if ( ! function_exists( 'get_plugins' ) ) {
121
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
122
+ }
123
+
124
+ $plugins = get_plugins();
125
+ $plugin_info = $plugins[ $plugin_init ];
126
+
127
+ $plugin = $this->_plugins[ $plugin_init ] = array(
128
+ 'info' => $plugin_info,
129
+ 'slug' => $plugin_slug,
130
+ );
131
+
132
+ $transient = 'yith_register_' . md5( $plugin_slug );
133
+ if ( apply_filters( 'yith_register_delete_transient', false ) ) {
134
+ delete_transient( $transient );
135
+ }
136
+ $info = get_transient( $transient );
137
+ if ( false === $info || apply_filters( 'yith_register_delete_transient', false ) ) {
138
+ $xml = $this->get_remote_url( $plugin );
139
+ $remote_xml = wp_remote_get( $xml );
140
+
141
+ $error = false;
142
+ if ( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
143
+ $plugin_remote_info = @simplexml_load_string( $remote_xml['body'] );
144
+ if ( $plugin_remote_info ) {
145
+ $info['Latest'] = (string) $plugin_remote_info->latest;
146
+ $info['changelog'] = (string) $plugin_remote_info->changelog;
147
+ if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
148
+ YIT_Plugin_Licence()->check( $plugin_slug, false );
149
+ }
150
+ set_transient( $transient, $info, DAY_IN_SECONDS );
151
+ } else {
152
+ $error = true;
153
+ error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
154
+ __FILE__, __FUNCTION__, $plugin_slug ) );
155
+ }
156
+ } else {
157
+ $error = true;
158
+ }
159
+
160
+ if ( $error ) {
161
+ // If error, set empty value in the transient to prevent multiple requests
162
+ $info = array( 'Latest' => '', 'changelog' => '' );
163
+ set_transient( $transient, $info, HOUR_IN_SECONDS );
164
+ }
165
+ }
166
+
167
+ $this->_plugins[ $plugin_init ]['info']['Latest'] = $info['Latest'];
168
+ $this->_plugins[ $plugin_init ]['info']['changelog'] = $info['changelog'];
169
+
170
+ /* === HOOKS === */
171
+ if ( ! is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
172
+ add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
173
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
174
+ } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
175
+ add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Add the multisite updater scripts
181
+ *
182
+ * @return void
183
+ *
184
+ * @since 1.0
185
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
186
+ */
187
+ public function multisite_updater_script() {
188
+ $update_url = $changelogs = $details_url = array();
189
+ $strings = array(
190
+ 'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
191
+ 'latest' => __( 'View version %latest% details.', 'yith-plugin-fw' ),
192
+ 'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
193
+ 'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
194
+ 'update_now' => __( 'Update now.', 'yith-plugin-fw' )
195
+
196
+ );
197
+
198
+ foreach ( $this->_plugins as $init => $info ) {
199
+ $update_url[ $init ] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin-multisite&plugin=' ) . $init, 'upgrade-plugin-multisite_' . $init );
200
+ $details_url[ $init ] = admin_url( 'admin-ajax.php?action=yith_plugin_fw_get_premium_changelog&tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
201
+ }
202
+
203
+ $localize_script_args = array(
204
+ 'registered' => $this->_plugins,
205
+ 'activated' => YIT_Plugin_Licence()->get_activated_products(),
206
+ 'licence_activation_url' => YIT_Plugin_Licence()->get_licence_activation_page_url(),
207
+ 'update_url' => $update_url,
208
+ 'details_url' => $details_url,
209
+ 'strings' => $strings,
210
+ );
211
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
212
+ yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
213
+
214
+ wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
215
+ }
216
+
217
+ public function admin_enqueue_scripts() {
218
+ global $pagenow;
219
+ if ( 'plugins.php' === $pagenow ) {
220
+ wp_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Retrive the zip package file
226
+ *
227
+ * @param bool $reply Whether to bail without returning the package. Default false.
228
+ * @param string $package The package file name.
229
+ * @param \WP_Upgrader $upgrader WP_Upgrader instance.
230
+ *
231
+ * @return string | The download file
232
+ *
233
+ * @since 1.0
234
+ * @see wp-admin/includes/class-wp-upgrader.php
235
+ * @access public
236
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
237
+ */
238
+ public function upgrader_pre_download( $reply, $package, $upgrader ) {
239
+ $plugin = false;
240
+ $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
241
+
242
+ if ( ! $is_bulk ) {
243
+ $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
244
+ } else {
245
+ //Bulk action upgrade
246
+ $action_url = parse_url( $upgrader->skin->options['url'] );
247
+ parse_str( rawurldecode( htmlspecialchars_decode( $action_url['query'] ) ), $output );
248
+ $plugins = isset( $output['plugins'] ) ? $output['plugins'] : '';
249
+ $plugins = explode( ',', $plugins );
250
+ foreach ( $plugins as $plugin_init ) {
251
+ $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_init );
252
+ if ( $to_upgrade['Name'] == $upgrader->skin->plugin_info['Name'] ) {
253
+ $plugin = $plugin_init;
254
+ }
255
+ }
256
+ }
257
+
258
+ /**
259
+ * It isn't YITH Premium plugins, please wordpress update it for me!
260
+ */
261
+ if ( ! $plugin ) {
262
+ return $reply;
263
+ }
264
+
265
+ $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
266
+
267
+ /**
268
+ * False ? It isn't YITH Premium plugins, please wordpress update it for me!
269
+ */
270
+ if ( false === $plugin_info ) {
271
+ return $reply;
272
+ }
273
+
274
+ $licence = YIT_Plugin_Licence()->get_licence();
275
+ $product_id = $plugin_info['product_id'];
276
+ $args = array(
277
+ 'email' => $licence[ $product_id ]['email'],
278
+ 'licence_key' => $licence[ $product_id ]['licence_key'],
279
+ 'product_id' => $plugin_info['product_id'],
280
+ 'secret_key' => $plugin_info['secret_key'],
281
+ 'instance' => YIT_Plugin_Licence()->get_home_url(),
282
+ 'wc-api' => 'download-api',
283
+ 'request' => 'download'
284
+ );
285
+
286
+ if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) {
287
+ //Local file or remote?
288
+ return $package;
289
+ }
290
+
291
+ if ( empty( $package ) ) {
292
+ return new WP_Error( 'no_package', $upgrader->strings['no_package'] );
293
+ }
294
+
295
+ $upgrader->skin->feedback( 'downloading_package', __( 'YITH Repository', 'yith-plugin-fw' ) );
296
+
297
+ $download_file = $this->_download_url( $package, $args );
298
+
299
+ /**
300
+ * Regenerate update_plugins transient
301
+ */
302
+ $this->force_regenerate_update_transient();
303
+
304
+ if ( is_wp_error( $download_file ) ) {
305
+ return new WP_Error( 'download_failed', $upgrader->strings['download_failed'], $download_file->get_error_message() );
306
+ }
307
+
308
+ return $download_file;
309
+ }
310
+
311
+ /**
312
+ * Retrive the temp filename
313
+ *
314
+ * @param string $url The package url
315
+ * @param string $body The post data fields
316
+ * @param int $timeout Execution timeout (default: 300)
317
+ *
318
+ * @return string | The temp filename
319
+ *
320
+ * @since 1.0
321
+ * @see wp-admin/includes/class-wp-upgrader.php
322
+ * @access protected
323
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
324
+ */
325
+ protected function _download_url( $url, $body, $timeout = 300 ) {
326
+
327
+ //WARNING: The file is not automatically deleted, The script must unlink() the file.
328
+ if ( ! $url ) {
329
+ return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yit' ) );
330
+ }
331
+
332
+ $tmpfname = wp_tempnam( $url );
333
+
334
+ $args = array(
335
+ 'timeout' => $timeout,
336
+ 'stream' => true,
337
+ 'filename' => $tmpfname,
338
+ 'body' => $body
339
+ );
340
+
341
+ if ( ! $tmpfname ) {
342
+ return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yit' ) );
343
+ }
344
+
345
+ $response = wp_safe_remote_post( $url, $args );
346
+
347
+ if ( is_wp_error( $response ) ) {
348
+ unlink( $tmpfname );
349
+
350
+ return $response;
351
+ }
352
+
353
+ if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
354
+ unlink( $tmpfname );
355
+
356
+ return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
357
+ }
358
+
359
+ $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
360
+
361
+ if ( $content_md5 ) {
362
+ $md5_check = verify_file_md5( $tmpfname, $content_md5 );
363
+ if ( is_wp_error( $md5_check ) ) {
364
+ unlink( $tmpfname );
365
+
366
+ return $md5_check;
367
+ }
368
+ }
369
+
370
+ return $tmpfname;
371
+ }
372
+
373
+ /**
374
+ * Main plugin Instance
375
+ *
376
+ * @static
377
+ * @return object Main instance
378
+ *
379
+ * @since 1.0
380
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
381
+ */
382
+ public static function instance() {
383
+ if ( is_null( self::$_instance ) ) {
384
+ self::$_instance = new self();
385
+ }
386
+
387
+ return self::$_instance;
388
+ }
389
+
390
+ /**
391
+ * Delete the update plugins transient
392
+ *
393
+ * @return void
394
+ *
395
+ * @since 1.0
396
+ * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
397
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
398
+ */
399
+ public function force_regenerate_update_transient() {
400
+ delete_site_transient( 'update_plugins' );
401
+ }
402
+
403
+ /**
404
+ * Check for plugins update
405
+ *
406
+ * If a new plugin version is available set it in the pre_set_site_transient_update_plugins hooks
407
+ *
408
+ * @param mixed $transient | update_plugins transient value
409
+ * @param bool $save | Default: false. Set true to regenerate the update_transient plugins
410
+ *
411
+ * @return mixed $transient | The new update_plugins transient value
412
+ *
413
+ * @since 1.0
414
+ * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
415
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
416
+ */
417
+ public function check_update( $transient, $save = false ) {
418
+
419
+ foreach ( $this->_plugins as $init => $plugin ) {
420
+ $plugin_slug = $this->_plugins[ $init ]['slug'];
421
+ $xml = $this->get_remote_url( $plugin );
422
+ $remote_xml = wp_remote_get( $xml );
423
+
424
+ if ( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
425
+
426
+ $plugin_remote_info = @simplexml_load_string( $remote_xml['body'] );
427
+
428
+ if ( $plugin_remote_info ) {
429
+
430
+ if ( version_compare( $plugin_remote_info->latest, $plugin['info']['Version'], '>' ) && ! isset( $transient->response[ $init ] ) ) {
431
+
432
+ $package = YIT_Plugin_Licence()->check( $init ) ? $this->_package_url : null;
433
+
434
+ $obj = new stdClass();
435
+ $obj->slug = (string) $init;
436
+ $obj->new_version = (string) $plugin_remote_info->latest;
437
+ $obj->changelog = (string) $plugin_remote_info->changelog;
438
+ $obj->package = $package;
439
+ $obj->plugin = $init;
440
+ $transient->response[ $init ] = $obj;
441
+ }
442
+
443
+ } else {
444
+ error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
445
+ __FILE__, __FUNCTION__, $plugin_slug ) );
446
+
447
+ return $transient;
448
+ }
449
+ }
450
+ }
451
+
452
+ if ( $save ) {
453
+ set_site_transient( 'update_plugins', $transient );
454
+ }
455
+
456
+ return $transient;
457
+ }
458
+
459
+ /**
460
+ * Add the plugin update row in plugin page
461
+ *
462
+ * @return void
463
+ * @fire "in_theme_update_message-{$init}" action
464
+ *
465
+ * @since 1.0
466
+ * @see after_plugin_row_{$init} action
467
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
468
+ */
469
+ public function plugin_update_row() {
470
+
471
+ $current = get_site_transient( 'update_plugins' );
472
+ $init = str_replace( 'after_plugin_row_', '', current_filter() );
473
+
474
+ if ( ! isset( $current->response[ $init ] ) ) {
475
+ return false;
476
+ }
477
+
478
+ /**
479
+ * stdClass Object
480
+ */
481
+ $r = $current->response[ $init ];
482
+
483
+ $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
484
+ $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
485
+
486
+ /**
487
+ * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
488
+ */
489
+ $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
490
+
491
+ if ( is_network_admin() || ! is_multisite() || true ) {
492
+ global $wp_version;
493
+ $is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
494
+
495
+ echo '<tr class="plugin-update-tr' . ( is_plugin_active( $init ) ? ' active' : '' ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
496
+
497
+ echo '<div class="update-message' . ( $is_wp_4_6 ? ' notice inline notice-warning notice-alt' : '' ) . '">';
498
+
499
+ echo( $is_wp_4_6 ? '<p>' : '' );
500
+
501
+ if ( ! current_user_can( 'update_plugins' ) ) {
502
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
503
+ } elseif ( is_plugin_active_for_network( $init ) ) {
504
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
505
+ } elseif ( empty( $r->package ) ) {
506
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
507
+ } else {
508
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ) );
509
+ }
510
+
511
+ echo( $is_wp_4_6 ? '</p>' : '' );
512
+
513
+ /**
514
+ * Fires at the end of the update message container in each
515
+ * row of the themes list table.
516
+ *
517
+ * The dynamic portion of the hook name, `$theme_key`, refers to
518
+ * the theme slug as found in the WordPress.org themes repository.
519
+ *
520
+ * @since Wordpress 3.1.0
521
+ * }
522
+ */
523
+ do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
524
+
525
+ echo '</div></td></tr>';
526
+ }
527
+ }
528
+
529
+ /**
530
+ * Remove the standard plugin_update_row
531
+ *
532
+ * Remove the standard plugin_update_row and Add a custom plugin update row in plugin page.
533
+ *
534
+ * @return void
535
+ * @fire "in_theme_update_message-{$init}" action
536
+ *
537
+ * @since 1.0
538
+ * @see after_plugin_row_{$init} action
539
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
540
+ */
541
+ public function remove_wp_plugin_update_row() {
542
+ foreach ( $this->_plugins as $init => $plugin ) {
543
+ remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
544
+ add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
545
+ //add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
546
+ }
547
+ }
548
+
549
+ public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ) {
550
+ $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
551
  <div class='yit-plugin-changelog'>
552
  <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
553
  <p>{$changelog}</p>
554
  </div>
555
  </div>";
556
 
557
+ if ( $echo ) {
558
+ echo $res;
559
+ } else {
560
+ return $res;
561
+ }
562
+ }
563
+
564
+ /**
565
+ * Auto-Update Plugin in multisite
566
+ *
567
+ * Manage the non standard upgrade-plugin-multisite action
568
+ *
569
+ * @return void
570
+ *
571
+ * @since 1.0
572
+ * @see upgrade-plugin action
573
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
574
+ */
575
+ public function upgrade_plugin_multisite() {
576
+
577
+ $plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : '';
578
+ $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
579
+
580
+ if ( 'upgrade-plugin-multisite' != $action ) {
581
+ wp_die( __( 'You can\'t update the plugins for this site.', 'yith-plugin-fw' ) );
582
+ }
583
+
584
+ if ( ! current_user_can( 'update_plugins' ) ) {
585
+ wp_die( __( 'You do not have sufficient permissions to update the plugins for this site.', 'yith-plugin-fw' ) );
586
+ }
587
+
588
+ $this->check_update( get_site_transient( 'update_plugins' ), true );
589
+
590
+ check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
591
+
592
+ $title = __( 'Update Plugin', 'yith-plugin-fw' );
593
+ $parent_file = 'plugins.php';
594
+ $submenu_file = 'plugins.php';
595
+
596
+ wp_enqueue_script( 'updates' );
597
+ require_once( ABSPATH . 'wp-admin/admin-header.php' );
598
+
599
+ $nonce = 'upgrade-plugin-multisite_' . $plugin;
600
+ $url = 'update.php?action=upgrade-plugin-multisite&plugin=' . urlencode( $plugin );
601
+
602
+ $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
603
+ $upgrader->upgrade( $plugin );
604
+
605
+ include( ABSPATH . 'wp-admin/admin-footer.php' );
606
+ }
607
+
608
+ /**
609
+ * Retreive the remote url with query string args
610
+ *
611
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
612
+ * @return string the remote url
613
+ */
614
+ public function get_remote_url( $plugin_info ) {
615
+
616
+ $license = $is_membership_license = false;
617
+ $slug = isset( $plugin_info['slug'] ) ? $plugin_info['slug'] : false;
618
+
619
+ if( function_exists( 'YIT_Plugin_Licence' ) && false !== $slug ){
620
+ //Get license for YITH Plugins
621
+ $enabled_license = YIT_Plugin_Licence()->get_licence();
622
+
623
+ if( isset( $enabled_license[ $slug ]['licence_key'] ) ){
624
+ $license = $enabled_license[ $slug ]['licence_key'];
625
+ }
626
+
627
+ if( isset( $enabled_license[ $slug ]['is_membership'] ) ){
628
+ $is_membership_license = $enabled_license[ $slug ]['is_membership'];
629
+ }
630
+ }
631
+
632
+ $args = array(
633
+ 'plugin' => $slug,
634
+ 'instance' => md5( $_SERVER['SERVER_NAME'] ),
635
+ 'license' => $license,
636
+ 'is_membership_license' => $is_membership_license,
637
+ 'server_ip' => $_SERVER['SERVER_ADDR'],
638
+ 'version' => isset( $plugin_info['info']['Version'] ) ? $plugin_info['info']['Version'] : '1.0.0'
639
+ );
640
+
641
+ $args = apply_filters( 'yith_get_remove_url_args', $args );
642
+
643
+ $url = add_query_arg( $args, $this->_remote_url );
644
+
645
+ return $url;
646
+ }
647
+ }
648
  }
649
 
650
+ if ( ! function_exists( 'YIT_Upgrade' ) ) {
651
+ /**
652
+ * Main instance of plugin
653
+ *
654
+ * @return YIT_Upgrade
655
+ * @since 1.0
656
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
657
+ */
658
+ function YIT_Upgrade() {
659
+ return YIT_Upgrade::instance();
660
+ }
661
  }
662
 
663
  /**
plugin-fw/yit-functions.php CHANGED
@@ -282,7 +282,7 @@ if ( !function_exists( 'yit_plugin_get_attachment_id' ) ) {
282
  continue;
283
  }
284
 
285
- foreach ( (array)$meta[ 'sizes' ] as $size => $values ) {
286
  if ( $values[ 'file' ] == $file && $url == str_replace( 'https://', 'http://', array_shift( wp_get_attachment_image_src( $id, $size ) ) ) ) {
287
 
288
  return $id;
@@ -484,7 +484,7 @@ if ( !function_exists( 'yit_registered_sidebars' ) ) {
484
  $return = array( '' => '' );
485
  }
486
 
487
- foreach ( ( array )$wp_registered_sidebars as $the_ ) {
488
  $return[ $the_[ 'name' ] ] = $the_[ 'name' ];
489
  }
490
 
@@ -1140,15 +1140,24 @@ if ( !function_exists( 'yith_plugin_fw_get_version' ) ) {
1140
  }
1141
  }
1142
 
1143
- if ( ! function_exists( 'yith_get_premium_support_url' ) ) {
1144
- //@TODO: To Remove
1145
- /**
1146
- * Return the url for My Account > Support dashboard
1147
- *
1148
- * @return string The complete string, if the main string is not empty or null
1149
- * @since 2.0.0
1150
- */
1151
- function yith_get_premium_support_url() {
1152
- return 'https://yithemes.com/my-account/support/dashboard/';
1153
- }
1154
  }
 
 
 
 
 
 
 
 
 
282
  continue;
283
  }
284
 
285
+ foreach ( (array) $meta[ 'sizes' ] as $size => $values ) {
286
  if ( $values[ 'file' ] == $file && $url == str_replace( 'https://', 'http://', array_shift( wp_get_attachment_image_src( $id, $size ) ) ) ) {
287
 
288
  return $id;
484
  $return = array( '' => '' );
485
  }
486
 
487
+ foreach ( ( array ) $wp_registered_sidebars as $the_ ) {
488
  $return[ $the_[ 'name' ] ] = $the_[ 'name' ];
489
  }
490
 
1140
  }
1141
  }
1142
 
1143
+ if ( !function_exists( 'yith_get_premium_support_url' ) ) {
1144
+ //@TODO: To Remove
1145
+ /**
1146
+ * Return the url for My Account > Support dashboard
1147
+ *
1148
+ * @return string The complete string, if the main string is not empty or null
1149
+ * @since 2.0.0
1150
+ */
1151
+ function yith_get_premium_support_url() {
1152
+ return 'https://yithemes.com/my-account/support/dashboard/';
1153
+ }
1154
  }
1155
+
1156
+ if ( !function_exists( 'yith_plugin_fw_is_panel' ) ) {
1157
+ function yith_plugin_fw_is_panel() {
1158
+ $panel_screen_id = 'yith-plugins_page';
1159
+ $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
1160
+
1161
+ return $screen instanceof WP_Screen && strpos( $screen->id, $panel_screen_id ) !== false;
1162
+ }
1163
+ }
plugin-options/general-options.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Main admin class
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH Woocommerce Compare
7
  * @version 1.1.1
8
  */
2
  /**
3
  * Main admin class
4
  *
5
+ * @author YITH
6
  * @package YITH Woocommerce Compare
7
  * @version 1.1.1
8
  */
plugin-options/premium-options.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Main admin class
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH Woocommerce Compare
7
  * @version 1.1.1
8
  */
2
  /**
3
  * Main admin class
4
  *
5
+ * @author YITH
6
  * @package YITH Woocommerce Compare
7
  * @version 1.1.1
8
  */
templates/compare.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Woocommerce Compare page
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH Woocommerce Compare
7
  * @version 2.3.2
8
  */
2
  /**
3
  * Woocommerce Compare page
4
  *
5
+ * @author YITH
6
  * @package YITH Woocommerce Compare
7
  * @version 2.3.2
8
  */
widgets/class.yith-woocompare-widget.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Main class
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
  * @version 1.1.4
8
  */
2
  /**
3
  * Main class
4
  *
5
+ * @author YITH
6
  * @package YITH WooCommerce Ajax Navigation
7
  * @version 1.1.4
8
  */