Version Description
Download this release
Release Info
| Developer | quadlayers |
| Plugin | |
| Version | 2.1.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.1.1 to 2.1.2
- includes/quadlayers/widget.php +63 -66
- perfect-woocommerce-brands.php +3 -5
- readme.txt +3 -1
includes/quadlayers/widget.php
CHANGED
|
@@ -22,97 +22,94 @@ if ( ! class_exists( 'QL_Widget' ) ) {
|
|
| 22 |
}
|
| 23 |
|
| 24 |
public function display_dashboard_widget() {
|
| 25 |
-
$
|
| 26 |
|
| 27 |
?>
|
|
|
|
| 28 |
<div>
|
| 29 |
-
<div>
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
<div style="margin-top: 11px; float: left; width: 70%;"><a href="<?php echo esc_url( admin_url( 'admin.php?page=' . PWB_PREFIX . '_suggestions' ) ); ?>" target="_blank" class="button button-secondary"><?php esc_html_e( 'More products', 'perfect-woocommerce-brands' ); ?></a></div>
|
| 33 |
-
</div>
|
| 34 |
-
<img style="width: 30%;margin-top: 11px;float: right; max-width: 95px;" src="<?php echo esc_url( plugins_url( '/assets/img/quadlayers.jpg', PWB_PLUGIN_FILE ) ); ?>" />
|
| 35 |
</div>
|
| 36 |
-
<
|
| 37 |
</div>
|
| 38 |
-
<div style="
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
$link = esc_url( wp_strip_all_tags( $link . '?utm_source=ql_dashboard' ) );
|
| 50 |
-
$title = esc_html( trim( wp_strip_all_tags( $item['title'] ) ) );
|
| 51 |
-
|
| 52 |
-
if ( empty( $title ) ) {
|
| 53 |
-
$title = __( 'Untitled', 'perfect-woocommerce-brands' );
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
$desc = html_entity_decode( $item['desc'], ENT_QUOTES, get_option( 'blog_charset' ) );
|
| 57 |
-
$desc = esc_attr( wp_trim_words( $desc, 15, '...' ) );
|
| 58 |
-
$summary = $desc;
|
| 59 |
-
$summary = '<div class="rssSummary">' . $summary . '</div>';
|
| 60 |
-
$date = $item['date'];
|
| 61 |
-
if ( $date ) {
|
| 62 |
-
$date = '<span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date ) . '</span>';
|
| 63 |
-
}
|
| 64 |
-
$author = $item['author'];
|
| 65 |
-
$author = ucfirst( $author );
|
| 66 |
-
$author = ' <cite>' . esc_html( wp_strip_all_tags( $author ) ) . '</cite>';
|
| 67 |
-
printf( '<li><a href="%1$s" target="_blank">%2$s </a>%3$s%4$s%5$s</li>', esc_url( $link ), esc_html( $title ), esc_html( $date ), esc_html( $summary ), esc_html( $author ) );
|
| 68 |
}
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
?>
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
<?php
|
| 82 |
}
|
| 83 |
|
| 84 |
public function get_feed() {
|
| 85 |
-
$rss_items = get_transient( 'quadlayers_news_feed' );
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
if ( is_wp_error( $
|
| 91 |
return 'An error has occurred, which probably means the feed is down. Try again later';
|
| 92 |
}
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
return 'An error has occurred, which probably means the feed is down. Try again later';
|
| 98 |
}
|
| 99 |
|
| 100 |
-
$
|
| 101 |
|
| 102 |
-
foreach ( $
|
| 103 |
-
$
|
| 104 |
-
'link'
|
| 105 |
-
'
|
| 106 |
-
'
|
| 107 |
-
'
|
| 108 |
-
'date' => $item->get_date( 'U' ),
|
| 109 |
);
|
| 110 |
}
|
| 111 |
|
| 112 |
-
set_transient( 'quadlayers_news_feed', $
|
| 113 |
}
|
| 114 |
|
| 115 |
-
return $
|
| 116 |
}
|
| 117 |
|
| 118 |
public static function instance() {
|
|
@@ -123,6 +120,6 @@ if ( ! class_exists( 'QL_Widget' ) ) {
|
|
| 123 |
}
|
| 124 |
}
|
| 125 |
|
| 126 |
-
|
| 127 |
QL_Widget::instance();
|
|
|
|
| 128 |
}
|
| 22 |
}
|
| 23 |
|
| 24 |
public function display_dashboard_widget() {
|
| 25 |
+
$posts = $this->get_feed();
|
| 26 |
|
| 27 |
?>
|
| 28 |
+
<div>
|
| 29 |
<div>
|
| 30 |
+
<div style="margin-top: 11px;float: left;width: 70%;">
|
| 31 |
+
<?php esc_html_e( 'Hi! We are Quadlayers! Welcome to QuadLayers! We’re a team of international people who have been working in the WordPress sphere for the last ten years.', 'perfect-woocommerce-brands' ); ?>
|
| 32 |
+
<div style="margin-top: 11px; float: left; width: 70%;"><a href="<?php echo admin_url( 'admin.php?page=' . PWB_PREFIX . '_suggestions' ); ?>" target="_blank" class="button button-secondary"><?php esc_html_e( 'More products', 'perfect-woocommerce-brands' ); ?></a></div>
|
|
|
|
|
|
|
|
|
|
| 33 |
</div>
|
| 34 |
+
<img style="width: 30%;margin-top: 11px;float: right; max-width: 95px;" src="<?php echo plugins_url( '/assets/backend/img/quadlayers.jpg', PWB_PLUGIN_FILE ); ?>" />
|
| 35 |
</div>
|
| 36 |
+
<div style="clear: both;"></div>
|
| 37 |
+
</div>
|
| 38 |
+
<div style="margin: 16px -12px 0; padding: 12px 12px 0;border-top: 1px solid #eee;">
|
| 39 |
+
<ul>
|
| 40 |
+
<?php if ( is_array( $posts ) ) { ?>
|
| 41 |
+
<?php
|
| 42 |
+
foreach ( $posts as $post ) {
|
| 43 |
+
|
| 44 |
+
$link = $post['link'];
|
| 45 |
+
while ( stristr( $link, 'http' ) !== $link ) {
|
| 46 |
+
$link = substr( $link, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
}
|
| 48 |
+
|
| 49 |
+
$link = esc_url( strip_tags( $link . '?utm_source=ql_dashboard' ) );
|
| 50 |
+
$title = esc_html( trim( strip_tags( $post['title'] ) ) );
|
| 51 |
+
|
| 52 |
+
if ( empty( $title ) ) {
|
| 53 |
+
$title = __( 'Untitled', 'perfect-woocommerce-brands' );
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
$excerpt = esc_attr( wp_trim_words( $post['excerpt'], 15, '...' ) );
|
| 57 |
+
$summary = '<p class="rssSummary">' . $excerpt . '</p>';
|
| 58 |
+
$date = $post['date'];
|
| 59 |
+
if ( $date ) {
|
| 60 |
+
$date = ' - <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date ) . '</span>';
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
printf( __( '<li><strong><a href="%1$s" target="_blank">%2$s</a></strong>%3$s%4$s</li>', 'perfect-woocommerce-brands' ), $link, $title, $date, $summary );
|
| 64 |
}
|
| 65 |
?>
|
| 66 |
+
<?php
|
| 67 |
+
} else {
|
| 68 |
+
printf( __( '<li>%s</li>', 'perfect-woocommerce-brands' ), $posts );
|
| 69 |
+
}
|
| 70 |
+
?>
|
| 71 |
+
</ul>
|
| 72 |
+
</div>
|
| 73 |
+
<div style="display: flex; justify-content: space-between;align-items: center;margin: 16px -12px 0;padding: 12px 12px 0; border-top: 1px solid #eee;">
|
| 74 |
+
<a href="<?php printf( 'https://quadlayers.com/blog/?utm_source=%s&utm_medium=software&utm_campaign=wordpress&utm_content=dashboard', PWB_PREFIX ); ?>" target="_blank"><?php esc_html_e( 'Read more like this on our blog', 'perfect-woocommerce-brands' ); ?></a>
|
| 75 |
+
<a class="button-primary" href="<?php printf( 'https://quadlayers.com/?utm_source=%s&utm_medium=software&utm_campaign=wordpress&utm_content=dashboard', PWB_PREFIX ); ?>" target="_blank"><?php esc_html_e( 'QuadLayers', 'perfect-woocommerce-brands' ); ?></a>
|
| 76 |
+
</div>
|
| 77 |
<?php
|
| 78 |
}
|
| 79 |
|
| 80 |
public function get_feed() {
|
|
|
|
| 81 |
|
| 82 |
+
$posts = get_transient( 'quadlayers_news_feed' );
|
| 83 |
+
|
| 84 |
+
if ( false === $posts ) {
|
| 85 |
+
|
| 86 |
+
$response = wp_remote_get( 'https://quadlayers.com/wp-json/wp/v2/posts?categories=1&per_page=3' );
|
| 87 |
|
| 88 |
+
if ( is_wp_error( $response ) || ! isset( $response['body'] ) ) {
|
| 89 |
return 'An error has occurred, which probably means the feed is down. Try again later';
|
| 90 |
}
|
| 91 |
|
| 92 |
+
$posts_array = json_decode( wp_remote_retrieve_body( $response ), true );
|
| 93 |
+
|
| 94 |
+
if ( ! is_array( $posts_array ) ) {
|
| 95 |
return 'An error has occurred, which probably means the feed is down. Try again later';
|
| 96 |
}
|
| 97 |
|
| 98 |
+
$posts = array();
|
| 99 |
|
| 100 |
+
foreach ( $posts_array as $post ) {
|
| 101 |
+
$posts[] = array(
|
| 102 |
+
'link' => $post['link'],
|
| 103 |
+
'title' => $post['title']['rendered'],
|
| 104 |
+
'excerpt' => $post['excerpt']['rendered'],
|
| 105 |
+
'date' => strtotime( $post['date'], time() ),
|
|
|
|
| 106 |
);
|
| 107 |
}
|
| 108 |
|
| 109 |
+
set_transient( 'quadlayers_news_feed', $posts, DAY_IN_SECONDS );
|
| 110 |
}
|
| 111 |
|
| 112 |
+
return $posts;
|
| 113 |
}
|
| 114 |
|
| 115 |
public static function instance() {
|
| 120 |
}
|
| 121 |
}
|
| 122 |
|
|
|
|
| 123 |
QL_Widget::instance();
|
| 124 |
+
|
| 125 |
}
|
perfect-woocommerce-brands.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 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: 2.1.
|
| 8 |
* Author: QuadLayers
|
| 9 |
* Author URI: https://quadlayers.com
|
| 10 |
* Text Domain: perfect-woocommerce-brands
|
|
@@ -36,7 +36,7 @@ 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', '2.1.
|
| 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' );
|
|
@@ -71,9 +71,7 @@ add_action(
|
|
| 71 |
);
|
| 72 |
|
| 73 |
|
| 74 |
-
|
| 75 |
-
include_once PWB_PLUGIN_DIR . 'includes/quadlayers/widget.php';
|
| 76 |
-
}
|
| 77 |
|
| 78 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
| 79 |
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
| 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: 2.1.2
|
| 8 |
* Author: QuadLayers
|
| 9 |
* Author URI: https://quadlayers.com
|
| 10 |
* Text Domain: perfect-woocommerce-brands
|
| 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', '2.1.2' );
|
| 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' );
|
| 71 |
);
|
| 72 |
|
| 73 |
|
| 74 |
+
require_once PWB_PLUGIN_DIR . 'includes/quadlayers/widget.php';
|
|
|
|
|
|
|
| 75 |
|
| 76 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
| 77 |
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
readme.txt
CHANGED
|
@@ -5,7 +5,7 @@ Tags: woocommerce, woocommerce brands, woocommerce product, woocommerce manufact
|
|
| 5 |
Requires at least: 4.7
|
| 6 |
Tested up to: 6.0
|
| 7 |
Requires PHP: 5.6
|
| 8 |
-
Stable tag: 2.1.
|
| 9 |
WC requires at least: 3.0
|
| 10 |
WC tested up to: 6.6.1
|
| 11 |
License: GPLv3
|
|
@@ -90,6 +90,8 @@ You can also contribute [translating the plugin](https://translate.wordpress.org
|
|
| 90 |
|
| 91 |
|
| 92 |
== Changelog ==
|
|
|
|
|
|
|
| 93 |
= 2.1.1 =
|
| 94 |
* Fix: WooCommerce Brands carousel
|
| 95 |
= 2.1.0 =
|
| 5 |
Requires at least: 4.7
|
| 6 |
Tested up to: 6.0
|
| 7 |
Requires PHP: 5.6
|
| 8 |
+
Stable tag: 2.1.2
|
| 9 |
WC requires at least: 3.0
|
| 10 |
WC tested up to: 6.6.1
|
| 11 |
License: GPLv3
|
| 90 |
|
| 91 |
|
| 92 |
== Changelog ==
|
| 93 |
+
= 2.1.2=
|
| 94 |
+
* Fix: QuadLayers widget cache
|
| 95 |
= 2.1.1 =
|
| 96 |
* Fix: WooCommerce Brands carousel
|
| 97 |
= 2.1.0 =
|
