Perfect Brands for WooCommerce - Version 1.8.3

Version Description

  • Enhancement: Update suggestions
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 Perfect Brands for WooCommerce
Version 1.8.3
Comparing to
See all releases

Code changes from version 1.8.2 to 1.8.3

assets/img/quadlayers.jpg ADDED
Binary file
classes/admin/class-pwb-admin-tab.php CHANGED
@@ -52,6 +52,7 @@ function pwb_admin_tab() {
52
  }
53
 
54
  echo ' | <li><a target="_blank" href="' . admin_url('edit-tags.php?taxonomy=pwb-brand&post_type=product') . '">' . __('Brands', 'perfect-woocommerce-brands') . '</a></li>';
 
55
  echo ' | <li><a target="_blank" href="' . PWB_DOCUMENTATION_URL . '">' . __('Documentation', 'perfect-woocommerce-brands') . '</a></li>';
56
 
57
  echo '</ul><br class="clear" />';
52
  }
53
 
54
  echo ' | <li><a target="_blank" href="' . admin_url('edit-tags.php?taxonomy=pwb-brand&post_type=product') . '">' . __('Brands', 'perfect-woocommerce-brands') . '</a></li>';
55
+ echo ' | <li><a target="_blank" href="' . admin_url('admin.php?page=pwb_suggestions') . '">' . __('Suggestions', 'perfect-woocommerce-brands') . '</a></li>';
56
  echo ' | <li><a target="_blank" href="' . PWB_DOCUMENTATION_URL . '">' . __('Documentation', 'perfect-woocommerce-brands') . '</a></li>';
57
 
58
  echo '</ul><br class="clear" />';
classes/admin/class-pwb-suggestions.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Perfect_Woocommerce_Brands\Admin;
4
+
5
+ defined('ABSPATH') or die('No script kiddies please!');
6
+
7
+ class PWB_Suggestions {
8
+
9
+ public function __construct() {
10
+ add_action('admin_menu', array($this, 'add_menu'));
11
+ add_action('admin_init', array($this, 'add_redirect'));
12
+ add_action('admin_head', array($this, 'remove_menu'));
13
+ add_filter('network_admin_url', array($this, 'network_admin_url'), 10, 2);
14
+ }
15
+
16
+ // Admin
17
+ // -------------------------------------------------------------------------
18
+
19
+ public function add_page() {
20
+ include_once( PWB_PLUGIN_DIR . 'classes/class-pwb-suggestions-list.php' );
21
+ ?>
22
+ <div class="wrap about-wrap full-width-layout">
23
+
24
+ <h1><?php esc_html_e('Suggestions', 'perfect-woocommerce-brands'); ?></h1>
25
+
26
+ <p class="about-text"><?php printf(esc_html__('Thanks for using our product! We recommend these extensions that will add new features to stand out your business and improve your sales.', 'perfect-woocommerce-brands'), PWB_PLUGIN_NAME); ?></p>
27
+
28
+ <p class="about-text">
29
+ <?php printf('<a href="%s" target="_blank">%s</a>', PWB_PURCHASE_URL, esc_html__('Purchase', 'perfect-woocommerce-brands')); ?></a> |
30
+ <?php printf('<a href="%s" target="_blank">%s</a>', PWB_DOCUMENTATION_URL, esc_html__('Documentation', 'perfect-woocommerce-brands')); ?></a>
31
+ </p>
32
+
33
+ <?php printf('<a href="%s" target="_blank"><div style="
34
+ background: #006bff url(%s) no-repeat;
35
+ background-position: top center;
36
+ background-size: 130px 130px;
37
+ color: #fff;
38
+ font-size: 14px;
39
+ text-align: center;
40
+ font-weight: 600;
41
+ margin: 5px 0 0;
42
+ padding-top: 120px;
43
+ height: 40px;
44
+ display: inline-block;
45
+ width: 140px;
46
+ " class="wp-badge">%s</div></a>', 'https://quadlayers.com/?utm_source=pwb_admin', plugins_url('/assets/img/quadlayers.jpg', PWB_PLUGIN_FILE), esc_html__('QuadLayers', 'perfect-woocommerce-brands')); ?>
47
+
48
+ </div>
49
+ <div class="wrap" style="
50
+ position: relative;
51
+ margin: 25px 40px 0 20px;
52
+ max-width: 1200px;">
53
+ <?php
54
+ $wp_list_table = new \Perfect_Woocommerce_Brands\PWB_Suggestions_List_Table();
55
+ $wp_list_table->prepare_items();
56
+ ?>
57
+ <form id="plugin-filter" method="post" class="importer-item">
58
+ <?php $wp_list_table->display(); ?>
59
+ </form>
60
+ </div>
61
+ <?php
62
+ }
63
+
64
+ public function add_menu() {
65
+ add_menu_page(PWB_PLUGIN_NAME, PWB_PLUGIN_NAME, 'manage_woocommerce', PWB_PREFIX, array($this, 'add_page'));
66
+ add_submenu_page(PWB_PREFIX, __('Suggestions', 'perfect-woocommerce-brands'), __('Suggestions', 'perfect-woocommerce-brands'), 'manage_woocommerce', PWB_PREFIX . '_suggestions', array($this, 'add_page'));
67
+ }
68
+
69
+ // fix for activateUrl on install now button
70
+ public function network_admin_url($url, $path) {
71
+
72
+ if (wp_doing_ajax() && !is_network_admin()) {
73
+ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'install-plugin') {
74
+ if (strpos($url, 'plugins.php') !== false) {
75
+ $url = self_admin_url($path);
76
+ }
77
+ }
78
+ }
79
+
80
+ return $url;
81
+ }
82
+
83
+ public function add_redirect() {
84
+
85
+ if (isset($_REQUEST['activate']) && $_REQUEST['activate'] == 'true') {
86
+ if (wp_get_referer() == admin_url('admin.php?page=' . PWB_PREFIX . '_suggestions')) {
87
+ wp_redirect(admin_url('admin.php?page=' . PWB_PREFIX . '_suggestions'));
88
+ }
89
+ }
90
+ }
91
+
92
+ public function remove_menu() {
93
+ ?>
94
+ <style>
95
+
96
+ li.toplevel_page_<?php echo PWB_PREFIX; ?> {
97
+ display:none;
98
+ }
99
+
100
+ </style>
101
+ <?php
102
+ }
103
+
104
+ }
classes/class-pwb-suggestions-list.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Perfect_Woocommerce_Brands;
4
+
5
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-plugin-install-list-table.php' );
6
+
7
+ class PWB_Suggestions_List_Table extends \WP_Plugin_Install_List_Table {
8
+
9
+ public $promote = array(
10
+ 'woocommerce-checkout-manager',
11
+ 'woocommerce-direct-checkout',
12
+ 'wp-whatsapp-chat',
13
+ 'wp-tiktok-feed',
14
+ 'insta-gallery',
15
+ 'quadmenu',
16
+ );
17
+
18
+ private function remove_plugins($plugins) {
19
+
20
+ $promote = array();
21
+
22
+ foreach ($this->promote as $order => $slug) {
23
+
24
+ if ($id = @max(array_keys(array_column($plugins, 'slug'), $slug))) {
25
+
26
+ $promote[] = $plugins[$id];
27
+ }
28
+ }
29
+
30
+ return $promote;
31
+ }
32
+
33
+ public function self_admin_url($url, $path) {
34
+
35
+ if (strpos($url, 'tab=plugin-information') !== false) {
36
+ $url = network_admin_url($path);
37
+ }
38
+
39
+ return $url;
40
+ }
41
+
42
+ public function network_admin_url($url, $path) {
43
+
44
+ if (strpos($url, 'plugins.php') !== false) {
45
+ $url = self_admin_url($path);
46
+ }
47
+
48
+ return $url;
49
+ }
50
+
51
+ public function display_rows() {
52
+ add_filter('self_admin_url', array($this, 'self_admin_url'), 10, 2);
53
+ add_filter('network_admin_url', array($this, 'network_admin_url'), 10, 2);
54
+ parent::display_rows();
55
+ }
56
+
57
+ public function is_connected() {
58
+
59
+ global $wp_version;
60
+
61
+ $http_args = array(
62
+ 'timeout' => 15,
63
+ 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'),
64
+ );
65
+
66
+ return is_wp_error(wp_remote_get('http://api.wordpress.org/plugins/info/1.2/', $http_args));
67
+ }
68
+
69
+ public function get_plugins() {
70
+
71
+ $tk = PWB_PREFIX . '_suggestions_plugins';
72
+
73
+ $plugins = get_transient($tk);
74
+
75
+ if ($plugins === false) {
76
+
77
+ $args = array(
78
+ 'per_page' => 36,
79
+ 'author' => 'quadlayers',
80
+ 'locale' => get_user_locale(),
81
+ );
82
+
83
+ $api = plugins_api('query_plugins', $args);
84
+
85
+ if (!is_wp_error($api)) {
86
+
87
+ $plugins = $this->remove_plugins($api->plugins);
88
+
89
+ set_transient($tk, $plugins, 24 * HOUR_IN_SECONDS);
90
+ }
91
+ }
92
+
93
+ return $plugins;
94
+ }
95
+
96
+ public function prepare_items() {
97
+
98
+ include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
99
+
100
+ global $tabs, $tab;
101
+
102
+ wp_enqueue_style('thickbox');
103
+ wp_enqueue_script('plugin-install');
104
+ wp_enqueue_script('thickbox');
105
+ wp_enqueue_script('updates');
106
+ wp_localize_script('updates', 'pagenow', 'plugin-install-network');
107
+
108
+ wp_reset_vars(array('tab'));
109
+
110
+ $tabs = array();
111
+
112
+ if ('search' === $tab) {
113
+ $tabs['search'] = __('Search Results');
114
+ }
115
+ if ($tab === 'beta' || false !== strpos(get_bloginfo('version'), '-')) {
116
+ $tabs['beta'] = _x('Beta Testing', 'Plugin Installer');
117
+ }
118
+ $tabs['featured'] = _x('Featured', 'Plugin Installer');
119
+ $tabs['popular'] = _x('Popular', 'Plugin Installer');
120
+ $tabs['recommended'] = _x('Recommended', 'Plugin Installer');
121
+ $tabs['favorites'] = _x('Favorites', 'Plugin Installer');
122
+
123
+ $nonmenu_tabs = array('plugin-information'); // Valid actions to perform which do not have a Menu item.
124
+
125
+ $tabs = apply_filters('install_plugins_tabs', $tabs);
126
+
127
+ $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
128
+
129
+ // If a non-valid menu tab has been selected, And it's not a non-menu action.
130
+ if (empty($tab) || (!isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs) )) {
131
+ $tab = key($tabs);
132
+ }
133
+
134
+ $this->items = $this->get_plugins();
135
+
136
+
137
+ wp_localize_script('updates', '_wpUpdatesItemCounts', array(
138
+ 'totals' => wp_get_update_data())
139
+ );
140
+ }
141
+
142
+ }
perfect-woocommerce-brands.php CHANGED
@@ -1,16 +1,16 @@
1
  <?php
2
 
3
  /**
4
- * Plugin Name: Perfect WooCommerce Brands
5
- * Plugin URI: https://wordpress.org/plugins/perfect-woocommerce-brands/
6
  * Description: Perfect WooCommerce Brands allows you to show product brands in your WooCommerce based store.
7
- * Version: 1.8.2
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * Text Domain: perfect-woocommerce-brands
11
  * Domain Path: /lang
12
- * License: GPL3
13
- * Perfect WooCommerce Brands version 1.8.2, Copyright (C) 2019 QuadLayers
14
  * Perfect WooCommerce Brands is free software: you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License as published by
16
  * the Free Software Foundation, either version 3 of the License, or
@@ -24,7 +24,7 @@
24
  * along with Perfect WooCommerce Brands. If not, see <http://www.gnu.org/licenses/>.
25
  *
26
  * WC requires at least: 3.1.0
27
- * WC tested up to: 4.0
28
  */
29
 
30
  namespace Perfect_Woocommerce_Brands;
@@ -32,11 +32,13 @@ namespace Perfect_Woocommerce_Brands;
32
  defined('ABSPATH') or die('No script kiddies please!');
33
 
34
  //plugin constants
 
35
  define('PWB_PLUGIN_URL', plugins_url('', __FILE__));
36
  define('PWB_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR);
37
  define('PWB_PLUGIN_BASENAME', plugin_basename(__FILE__));
38
- define('PWB_PLUGIN_VERSION', '1.8.2');
39
  define('PWB_PLUGIN_NAME', 'Perfect WooCommerce Brands');
 
40
  define('PWB_REVIEW_URL', 'https://wordpress.org/support/plugin/perfect-woocommerce-brands/reviews/?filter=5#new-post');
41
  define('PWB_DEMO_URL', 'https://quadlayers.com/portfolio/perfect-woocommerce-brands/?utm_source=pwb_admin');
42
  define('PWB_PURCHASE_URL', PWB_DEMO_URL);
@@ -78,6 +80,8 @@ if (is_plugin_active('woocommerce/woocommerce.php')) {
78
  new Admin\PWB_Coupon();
79
 
80
  if (is_admin()) {
 
 
81
  require 'classes/admin/class-pwb-notices.php';
82
  new Admin\PWB_Notices();
83
  require 'classes/admin/class-pwb-system-status.php';
1
  <?php
2
 
3
  /**
4
+ * Plugin Name: Perfect Brands for WooCommerce
5
+ * Plugin URI: https://quadlayers.com/portfolio/perfect-woocommerce-brands/
6
  * Description: Perfect WooCommerce Brands allows you to show product brands in your WooCommerce based store.
7
+ * Version: 1.8.3
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * Text Domain: perfect-woocommerce-brands
11
  * Domain Path: /lang
12
+ * License: GPLv3
13
+ * Perfect WooCommerce Brands version 1.8.3, Copyright (C) 2019 QuadLayers
14
  * Perfect WooCommerce Brands is free software: you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License as published by
16
  * the Free Software Foundation, either version 3 of the License, or
24
  * along with Perfect WooCommerce Brands. If not, see <http://www.gnu.org/licenses/>.
25
  *
26
  * WC requires at least: 3.1.0
27
+ * WC tested up to: 4.2.0
28
  */
29
 
30
  namespace Perfect_Woocommerce_Brands;
32
  defined('ABSPATH') or die('No script kiddies please!');
33
 
34
  //plugin constants
35
+ define('PWB_PLUGIN_FILE', __FILE__);
36
  define('PWB_PLUGIN_URL', plugins_url('', __FILE__));
37
  define('PWB_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR);
38
  define('PWB_PLUGIN_BASENAME', plugin_basename(__FILE__));
39
+ define('PWB_PLUGIN_VERSION', '1.8.3');
40
  define('PWB_PLUGIN_NAME', 'Perfect WooCommerce Brands');
41
+ define('PWB_PREFIX', 'pwb');
42
  define('PWB_REVIEW_URL', 'https://wordpress.org/support/plugin/perfect-woocommerce-brands/reviews/?filter=5#new-post');
43
  define('PWB_DEMO_URL', 'https://quadlayers.com/portfolio/perfect-woocommerce-brands/?utm_source=pwb_admin');
44
  define('PWB_PURCHASE_URL', PWB_DEMO_URL);
80
  new Admin\PWB_Coupon();
81
 
82
  if (is_admin()) {
83
+ require 'classes/admin/class-pwb-suggestions.php';
84
+ new Admin\PWB_Suggestions();
85
  require 'classes/admin/class-pwb-notices.php';
86
  new Admin\PWB_Notices();
87
  require 'classes/admin/class-pwb-system-status.php';
readme.txt CHANGED
@@ -1,17 +1,17 @@
1
- === Perfect WooCommerce Brands ===
2
  Contributors: quadlayers, titodevera
3
  Donate link: https://quadlayers.com
4
  Tags: woocommerce, woocommerce brands, woocommerce product, woocommerce manufacturer, woocommerce supplier, e-commerce
5
  Requires at least: 4.7
6
- Tested up to: 5.4.0
7
  Requires PHP: 5.6
8
- Stable tag: 1.8.2
9
  WC requires at least: 3.0
10
- WC tested up to: 4.0
11
- License: GPL3
12
- License URI: http://www.gnu.org/licenses/gpl-3.0.en.html
13
 
14
- Perfect WooCommerce Brands allows you to show product brands in your WooCommerce based store
15
 
16
  == Description ==
17
 
@@ -90,6 +90,8 @@ You can also contribute [translating the plugin](https://translate.wordpress.org
90
 
91
 
92
  == Changelog ==
 
 
93
  = 1.8.2 =
94
  * Enhancement: Update documentation
95
  = 1.8.1 =
1
+ === Perfect Brands for WooCommerce ===
2
  Contributors: quadlayers, titodevera
3
  Donate link: https://quadlayers.com
4
  Tags: woocommerce, woocommerce brands, woocommerce product, woocommerce manufacturer, woocommerce supplier, e-commerce
5
  Requires at least: 4.7
6
+ Tested up to: 5.4.2
7
  Requires PHP: 5.6
8
+ Stable tag: 1.8.3
9
  WC requires at least: 3.0
10
+ WC tested up to: 4.1.1
11
+ License: GPLv3
12
+ License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
 
14
+ Perfect Brands for WooCommerce allows you to show product brands in your WooCommerce based store
15
 
16
  == Description ==
17
 
90
 
91
 
92
  == Changelog ==
93
+ = 1.8.3 =
94
+ * Enhancement: Update suggestions
95
  = 1.8.2 =
96
  * Enhancement: Update documentation
97
  = 1.8.1 =