PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.0.0
ShopBuilder – WooCommerce Builder For Elementor v1.0.0
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Controllers/Admin/Notice/Upgrade.php +108 -126 2.0.21.0.0 View file →
@@ -1,126 +1,108 @@
1 -<?php
2 -/**
3 - * Main Upgrade class.
4 - *
5 - * @package RadiusTheme\SB
6 - */
7 -
8 -namespace RadiusTheme\SB\Controllers\Admin\Notice;
9 -
10 -use RadiusTheme\SB\Traits\SingletonTrait;
11 -
12 -// Do not allow directly accessing this file.
13 -if ( ! defined( 'ABSPATH' ) ) {
14 - exit( 'This script cannot be accessed directly.' );
15 -}
16 -
17 -/**
18 - * Main Upgrade class.
19 - */
20 -class Upgrade {
21 - /**
22 - * Singleton Trait.
23 - */
24 - use SingletonTrait;
25 -
26 - /**
27 - * Class Constructor.
28 - */
29 - private function __construct() {
30 - add_action( 'admin_head', [ $this, 'upgrade_styles' ] );
31 - add_action(
32 - 'in_plugin_update_message-' . RTSB_ACTIVE_FILE_NAME,
33 - function ( $plugin_data ) {
34 - $this->version_update_warning( RTSB_VERSION, $plugin_data['new_version'] );
35 - }
36 - );
37 - }
38 -
39 - /**
40 - * Update message
41 - *
42 - * @param int $current_version Current Version.
43 - * @param int $new_version New Version.
44 - *
45 - * @return void
46 - */
47 - public function version_update_warning( $current_version, $new_version ) {
48 - $current_version_crit = explode( '.', $current_version )[0];
49 - $new_version_crit = explode( '.', $new_version )[0];
50 - $current_version_major = explode( '.', $current_version )[1];
51 - $new_version_major = explode( '.', $new_version )[1];
52 -
53 - if ( $current_version_crit === $new_version_crit ) {
54 - if ( $current_version_major === $new_version_major ) {
55 - return;
56 - }
57 - }
58 - ?>
59 - <div class="rtsb-major-update-warning">
60 - <div class="rtsb-major-update-icon">
61 - <i class="dashicons dashicons-info"></i>
62 - </div>
63 - <div>
64 - <div class="rtsb-major-update-title">
65 - <?php
66 - printf(
67 - '%s%s.',
68 - esc_html__( 'Heads up, Please backup before upgrade to version ', 'shopbuilder' ),
69 - esc_html( $new_version )
70 - );
71 - ?>
72 - </div>
73 - <div class="rtsb-major-update-message">
74 - The latest update includes some substantial changes across different areas of the plugin. <br/>We
75 - highly recommend you to <b>backup your site before upgrading</b>, and make sure you first update in a staging environment.
76 - </div>
77 - </div>
78 - </div>
79 - <?php
80 - }
81 -
82 - /**
83 - * Admin styles.
84 - *
85 - * @return void
86 - */
87 - public function upgrade_styles() {
88 - global $pagenow;
89 -
90 - if ( 'plugins.php' !== $pagenow ) {
91 - return;
92 - }
93 -
94 - echo '<style>
95 - .rtsb-major-update-warning {
96 - border-top: 2px solid #d63638;
97 - padding-top: 15px;
98 - margin-top: 15px;
99 - margin-bottom: 15px;
100 - display: flex;
101 - }
102 -
103 - .rtsb-major-update-icon i {
104 - color: #d63638;
105 - margin-right: 8px;
106 - }
107 -
108 - .rtsb-major-update-warning + p {
109 - display: none;
110 - }
111 -
112 - .rtsb-major-update-title {
113 - font-weight: 600;
114 - margin-bottom: 10px;
115 - }
116 -
117 - .notice-success .rtsb-major-update-warning {
118 - border-color: #46b450;
119 - }
120 -
121 - .notice-success .rtsb-major-update-icon i {
122 - color: #79ba49;
123 - }
124 - </style>';
125 - }
126 -}
1 +<?php
2 +/**
3 + * Main Upgrade class.
4 + *
5 + * @package RadiusTheme\SB
6 + */
7 +
8 +namespace RadiusTheme\SB\Controllers\Admin\Notice;
9 +
10 +use RadiusTheme\SB\Traits\SingletonTrait;
11 +
12 +// Do not allow directly accessing this file.
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit( 'This script cannot be accessed directly.' );
15 +}
16 +
17 +/**
18 + * Main Upgrade class.
19 + */
20 +class Upgrade {
21 + /**
22 + * Singleton Trait.
23 + */
24 + use SingletonTrait;
25 +
26 + /**
27 + * Class Constructor.
28 + */
29 + private function __construct() {
30 + add_action(
31 + 'in_plugin_update_message-' . RTSB_ACTIVE_FILE_NAME,
32 + function ( $plugin_data ) {
33 + $this->version_update_warning( RTSB_VERSION, $plugin_data['new_version'] );
34 + }
35 + );
36 + }
37 +
38 + /**
39 + * Update message
40 + *
41 + * @param int $current_version Current Version.
42 + * @param int $new_version New Version.
43 + *
44 + * @return void
45 + */
46 + public function version_update_warning( $current_version, $new_version ) {
47 + $current_version_major = explode( '.', $current_version )[1];
48 + $new_version_major = explode( '.', $new_version )[1];
49 +
50 + if ( $current_version_major === $new_version_major ) {
51 + return;
52 + }
53 + ?>
54 + <style>
55 + .rtsb-major-update-warning {
56 + border-top: 2px solid #d63638;
57 + padding-top: 15px;
58 + margin-top: 15px;
59 + margin-bottom: 15px;
60 + display: flex;
61 + }
62 +
63 + .rtsb-major-update-icon i {
64 + color: #d63638;
65 + margin-right: 8px;
66 + }
67 +
68 + .rtsb-major-update-warning + p {
69 + display: none;
70 + }
71 +
72 + .rtsb-major-update-title {
73 + font-weight: 600;
74 + margin-bottom: 10px;
75 + }
76 +
77 + .notice-success .rtsb-major-update-warning {
78 + border-color: #46b450;
79 + }
80 +
81 + .notice-success .rtsb-major-update-icon i {
82 + color: #79ba49;
83 + }
84 + </style>
85 + <div class="rtsb-major-update-warning">
86 + <div class="rtsb-major-update-icon">
87 + <i class="dashicons dashicons-info"></i>
88 + </div>
89 + <div>
90 + <div class="rtsb-major-update-title">
91 + <?php
92 + printf(
93 + '%s%s.',
94 + esc_html__( 'Heads up, Please backup before upgrade to version ', 'shopbuilder' ),
95 + esc_html( $new_version )
96 + );
97 + ?>
98 + </div>
99 + <div class="rtsb-major-update-message">
100 + The latest update includes some substantial changes across different areas of the plugin. <br/>We
101 + highly recommend you to <b>backup your site before upgrading</b>, and make sure you first update in
102 + a staging environment.
103 + </div>
104 + </div>
105 + </div>
106 + <?php
107 + }
108 +}