Skip to content

Commit

Permalink
v1.4.12
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbot committed Mar 18, 2024
1 parent 691e42e commit 8e655c5
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 157 deletions.
57 changes: 38 additions & 19 deletions includes/Admin/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use const HOUR_IN_SECONDS;
use const WCPOS\WooCommercePOS\PLUGIN_NAME;
use const WCPOS\WooCommercePOS\VERSION as PLUGIN_VERSION;

/**
*
Expand Down Expand Up @@ -39,6 +40,7 @@ public function __construct() {
$this->register_pos_admin();
add_filter( 'custom_menu_order', '__return_true' );
add_filter( 'menu_order', array( $this, 'menu_order' ), 9, 1 );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_landing_scripts_and_styles' ) );
}

// add_filter( 'woocommerce_analytics_report_menu_items', array( $this, 'analytics_menu_items' ) );
Expand Down Expand Up @@ -79,25 +81,6 @@ public function menu_order( array $menu_order ): array {
* Render the upgrade page.
*/
public function display_upgrade_page(): void {
$upgrade = get_transient( 'remote_pro_page' );

// Check for transient, if none, grab remote HTML file
if ( false === $upgrade ) {
// Get remote HTML file
$response = wp_remote_get( 'http://wcpos.com/pro/?wp-admin=woocommerce-pos' );
// Check for error
if ( is_wp_error( $response ) ) {
return;
}
// Parse remote HTML file
$upgrade = wp_remote_retrieve_body( $response );
// Check for error
if ( is_wp_error( $upgrade ) ) {
return;
}
// Store remote HTML file in transient, expire after 24 hours
set_transient( 'remote_pro_page', $upgrade, 24 * HOUR_IN_SECONDS );
}
include_once 'templates/upgrade.php';
}

Expand Down Expand Up @@ -192,4 +175,40 @@ private function register_pos_admin(): void {
)
);
}

/**
* Enqueue landing page scripts and styles.
*/
public function enqueue_landing_scripts_and_styles( $hook_suffix ): void {
if ( $hook_suffix === $this->toplevel_screen_id ) {
$is_development = isset( $_ENV['DEVELOPMENT'] ) && $_ENV['DEVELOPMENT'];
$url = $is_development ? 'http://localhost:9000/' : 'https://cdn.jsdelivr.net/gh/wcpos/wp-admin-landing/assets/';

// Enqueue the landing page CSS from CDN
wp_enqueue_style(
'wcpos-landing',
$url . 'css/landing.css',
array(),
PLUGIN_VERSION
);

// Ensure WordPress bundled React and lodash are loaded as dependencies
wp_enqueue_script( 'react' );
wp_enqueue_script( 'lodash' );

// Enqueue the landing page JS from CDN, with React and lodash as dependencies
wp_enqueue_script(
'wcpos-landing',
$url . 'js/landing.js',
array(
'react',
'react-dom',
'wp-element',
'lodash',
),
PLUGIN_VERSION,
true
);
}
}
}
136 changes: 5 additions & 131 deletions includes/Admin/templates/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,145 +4,19 @@
*
* @author Paul Kilmurray <[email protected]>
*
* @see http://www.kilbot.com.au
* @see http://www.kilbot.com
*/
?>

<!-- temporary inline css, todo: remove this -->
<style type="text/css">
.web-title {
display: none;
}
<div class="wrap clear">

.blurb {
font-size: 14px;
line-height: 1.6em;
}

.widget-area {
float: right;
width: 33%;
margin-left: 20px;
text-align: center;
margin-bottom: 20px;
}

.widget-area .btn {
display: inline-block;
margin-bottom: 0;
font-weight: 400;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
text-decoration: none;
margin: 20px 0;
}

.widget-area .btn-primary {
color: #fff;
background-color: #cd2f19;
border-color: #b62a16;
}

.widget-area .btn-lg {
padding: 10px 16px;
font-size: 18px;
line-height: 1.33;
border-radius: 6px;
}

.comparison-table {
width: 100%;
border-spacing: 0;
border-collapse: collapse;
border: 1px solid #e5e5e5;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
background-color: #f5f5f5;
}

.comparison-table thead {
font-size: 18px;
}

.comparison-table thead tr {
border-bottom: 1px solid #e5e5e5;
}

.comparison-table thead th {
width: 33%;
font-weight: normal;
}

.comparison-table thead th:first-of-type {
background-color: #B0B0B0;
color: #f5f5f5;
}

.comparison-table thead th:last-of-type {
background-color: #d54e21;
color: #f5f5f5;
}

.comparison-table th, td {
padding: 1% 2%;
}

.comparison-table tbody th {
font-weight: normal;
text-align: right;
}

.comparison-table tbody tr {
border-bottom: 1px solid #e5e5e5;
}

.comparison-table tbody tr td:first-of-type {
background-color: #fafafa;
}

.comparison-table tbody tr td:last-of-type {
background-color: #fef7f1;
}

.comparison-table .fa {
font-family: Dashicons !important;;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

.comparison-table .fa-check:before {
content: "\f147";
color: #3c763d;
font-size: 24px;
}

.comparison-table .fa-times:before {
content: "\f335";
color: #a94442;
font-size: 24px;
}
</style>

<div class="wrap clear woocommerce-pos-upgrade">

<!--
<!--
Little trick to get around WP js injection of admin notices
WP js looks for first h2 in .wrap and appends notices, so we'll make the first one hidden
https://github.com/WordPress/WordPress/blob/master/wp-admin/js/common.js
-->
<h2 style="display:none"></h2>

<h2 style="margin:20px 0;">Thank you for using WooCommerce POS!</h2>
<h2 style="display:none"></h2>

<?php echo $upgrade; ?>
<div id="woocommerce-pos-upgrade"></div>

</div>

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wcpos/woocommerce-pos",
"version": "1.4.11",
"version": "1.4.12",
"description": "A simple front-end for taking WooCommerce orders at the Point of Sale.",
"main": "index.js",
"workspaces": {
Expand Down
6 changes: 3 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: kilbot
Tags: cart, e-commerce, ecommerce, inventory, point-of-sale, pos, sales, sell, shop, shopify, store, vend, woocommerce, wordpress-ecommerce
Requires at least: 5.6
Tested up to: 6.4
Stable tag: 1.4.11
Tested up to: 6.5
Stable tag: 1.4.12
License: GPL-3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -63,7 +63,7 @@ There is more information on our website at [https://wcpos.com](https://wcpos.co

== Changelog ==

= 1.4.12 - 2024/03/XX =
= 1.4.12 - 2024/03/18 =
* Security: Fix Insufficient Verification of Data Authenticity to Authenticated (Customer+) Information Disclosure (reported by Lucio Sá)
* Fix: Pro plugin not showing updates for some users

Expand Down
10 changes: 7 additions & 3 deletions woocommerce-pos.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
* Plugin Name: WooCommerce POS
* Plugin URI: https://wordpress.org/plugins/woocommerce-pos/
* Description: A simple front-end for taking WooCommerce orders at the Point of Sale. Requires <a href="http://wordpress.org/plugins/woocommerce/">WooCommerce</a>.
* Version: 1.4.11
* Version: 1.4.12
* Author: kilbot
* Author URI: http://wcpos.com
* Text Domain: woocommerce-pos
* License: GPL-3.0+
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
* Domain Path: /languages
* Requires at least: 5.6
* Requires PHP: 7.4
* Requires Plugins: woocommerce
* Tested up to: 6.5
* WC tested up to: 8.6
* WC requires at least: 5.3.
* WC requires at least: 5.3
*
* @author Paul Kilmurray <[email protected]>
*
Expand All @@ -22,7 +26,7 @@
namespace WCPOS\WooCommercePOS;

// Define plugin constants.
const VERSION = '1.4.11';
const VERSION = '1.4.12';
const PLUGIN_NAME = 'woocommerce-pos';
const SHORT_NAME = 'wcpos';
\define( __NAMESPACE__ . '\PLUGIN_FILE', plugin_basename( __FILE__ ) ); // 'woocommerce-pos/woocommerce-pos.php'
Expand Down

0 comments on commit 8e655c5

Please sign in to comment.