PluginProbe
Tiered Pricing Table for WooCommerce / 6.1.0
Tiered Pricing Table for WooCommerce v6.1.0
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / src / Addons / GlobalTieredPricing / CPT / Form / UpgradeTip.php

UpgradeTip.php in Tiered Pricing Table for WooCommerce 6.1.0, at src/Addons/GlobalTieredPricing/CPT/Form/UpgradeTip.php

137 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TierPricingTable\Addons\GlobalTieredPricing\CPT\Form;
4
5 use TierPricingTable\Addons\GlobalTieredPricing\CPT\GlobalTieredPricingCPT;
6 use TierPricingTable\Admin\Tips\Tip;
7 use TierPricingTable\TierPricingTablePlugin;
8 use WP_Post;
9 class UpgradeTip extends Tip {
10 public function __construct() {
11 parent::__construct();
12 add_filter(
13 'tiered_pricing_table/admin/tips/get_tip_by_slug',
14 function ( $tip, $slug ) {
15 if ( $slug === $this->getSlug() ) {
16 return $this;
17 }
18 return $tip;
19 },
20 10,
21 2
22 );
23 add_action( 'submitpost_box', function ( WP_Post $post ) {
24 if ( GlobalTieredPricingCPT::SLUG !== $post->post_type ) {
25 return;
26 }
27 $this->render();
28 } );
29 }
30
31 protected function isValid() : bool {
32 if ( $this->isSeen() ) {
33 return false;
34 }
35 $activationDate = TierPricingTablePlugin::getPluginActivationDate();
36 if ( !$activationDate ) {
37 return false;
38 }
39 // If activation date is more than 2 months ago
40 return time() - $activationDate > MONTH_IN_SECONDS * 2;
41 }
42
43 public function render() {
44 if ( !$this->isValid() ) {
45 return;
46 }
47 ?>
48 <style>
49 @keyframes pulse-animation {
50 0% {
51 box-shadow: 0 0 0 0 rgb(189, 217, 255);
52 }
53 100% {
54 box-shadow: 0 0 0 20px rgba(0, 0, 0, 0);
55 }
56 }
57
58 .tiered-pricing-upgrade-tip {
59 border-radius: 5px;
60 animation: pulse-animation 2s infinite;
61 }
62 </style>
63
64 <div>
65 <div class="tiered-pricing-tip tiered-pricing-upgrade-tip"
66 style="margin-bottom: 20px; position: relative; padding: 20px 10px; background: #fff; border: 1px solid #c3c4c7;">
67
68 <div style="text-align: center" >
69
70 <div style="white-space: nowrap;position: absolute;right: 10px;top: 5px;">
71 <a role="button" title="Close the tip"
72 href="<?php
73 echo esc_attr( $this->getMarkAsSeenURL() );
74 ?>"
75 style="text-decoration: none;color: #000;font-size: 1.2em;"
76 class="tiered-pricing-tip-close-button">
77 &times;
78 </a>
79 </div>
80
81 <h3 style="margin-top: 5px;">
82 🎉 <?php
83 esc_html_e( 'You have got a discount!', 'tier-pricing-table' );
84 ?>
85 </h3>
86
87 <div style="margin-top: 10px;">
88 <?php
89 esc_html_e( 'You\'ve been using the free version for a while now, and we\'d like to offer you an exclusive discount on the premium version!', 'tier-pricing-table' );
90 ?>
91 </div>
92
93 <div style="margin-top: 10px;">
94 <?php
95 echo wp_kses_post( __( 'Use the coupon code below for a <b>20%</b> discount on upgrading your plan.', 'tier-pricing-table' ) );
96 ?>
97 </div>
98
99 <div style="margin-top: 25px; text-align: center; ">
100 <code style="font-size: 1.5em;">GRD20OFF</code>
101 </div>
102
103 <div style="margin-top: 20px;text-align:center">
104 <a target="_blank"
105 href="<?php
106 echo esc_attr( tpt_fs_activation_url() );
107 ?>">
108 <?php
109 esc_html_e( 'Upgrade your plan', 'tier-pricing-table' );
110 ?>
111 <svg style="
112 width: 0.8rem;
113 height: 0.8rem;
114 stroke: currentColor;
115 fill: none;"
116 xmlns='http://www.w3.org/2000/svg'
117 stroke-width='10' stroke-dashoffset='0'
118 stroke-dasharray='0' stroke-linecap='round'
119 stroke-linejoin='round' viewBox='0 0 100 100'>
120 <polyline fill="none" points="40 20 20 20 20 90 80 90 80 60"/>
121 <polyline fill="none" points="60 10 90 10 90 40"/>
122 <line fill="none" x1="89" y1="11" x2="50" y2="50"/>
123 </svg>
124 </a>
125 </div>
126 </div>
127 </div>
128 </div>
129 <?php
130 }
131
132 public function getSlug() : string {
133 return 'global-rule-2-months-discount';
134 }
135
136 }
137