PluginProbe
PatternsWP – Gutenberg Block Patterns & Page Templates Library / 1.0.6
PatternsWP – Gutenberg Block Patterns & Page Templates Library v1.0.6
1.1.0 trunk 1.0.0 1.0.1 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
← All changes | includes/lib/class-patterns-license.php +11 -21 1.0.91.0.6 View file →
@@ -1,9 +1,5 @@
1 1 <?php
2 -// Exit if accessed directly
3 -if (!defined('ABSPATH')) {
4 - exit;
5 -}
6 2
7 3 class PatternsWP_LicenseSection {
8 4 private $patternswp_license_key_option;
9 5
@@ -105,19 +101,17 @@
105 101 }
106 102 $patterns_tkey = 'patterns_data';
107 103 delete_transient( $patterns_tkey );
108 104 }else{
109 - $redirect_url = add_query_arg( array(
105 + wp_redirect( add_query_arg( array(
110 106 'page' => 'patternswp-license_section',
111 107 'pt_msg' => urlencode( 'License activation failed: License Key cannot be empty. Please enter a valid license key.' ),
112 108 'status' => 'error'
113 - ), admin_url( 'admin.php' ) );
114 - wp_safe_redirect( $redirect_url );
109 + ), admin_url( 'admin.php' ) ) );
115 110 exit;
116 111 }
117 112
118 - $redirect_url = add_query_arg( 'updated', 'true', wp_get_referer() );
119 - wp_safe_redirect( $redirect_url );
113 + wp_redirect( add_query_arg( 'updated', 'true', wp_get_referer() ) );
120 114 exit;
121 115 }
122 116 }
123 117
@@ -129,25 +123,23 @@
129 123 */
130 124 public function handle_license_activation( $old_value, $new_value ) {
131 125 if ( isset( $new_value['patternswp_pro_license_key'] ) && ! empty( $new_value['patternswp_pro_license_key'] ) ) {
132 126 if ( $old_value['patternswp_pro_license_key'] === $new_value['patternswp_pro_license_key'] ) {
133 - $redirect_url = add_query_arg( array(
127 + wp_redirect( add_query_arg( array(
134 128 'page' => 'patternswp-license_section',
135 129 'pt_msg' => urlencode( 'License Key is already activated.' ),
136 130 'status' => 'info'
137 - ), admin_url( 'admin.php' ) );
138 - wp_safe_redirect( $redirect_url );
131 + ), admin_url( 'admin.php' ) ) );
139 132 exit;
140 133 } else {
141 134 $this->activate_license( $new_value['patternswp_pro_license_key'] );
142 135 }
143 136 } else {
144 - $redirect_url = add_query_arg( array(
137 + wp_redirect( add_query_arg( array(
145 138 'page' => 'patternswp-license_section',
146 139 'pt_msg' => urlencode( 'License activation failed: License Key cannot be empty. Please enter a valid license key.' ),
147 140 'status' => 'error'
148 - ), admin_url( 'admin.php' ) );
149 - wp_safe_redirect( $redirect_url );
141 + ), admin_url( 'admin.php' ) ) );
150 142 exit;
151 143 }
152 144 }
153 145
@@ -168,14 +160,13 @@
168 160 if( $response->error == 'license_key not found.' ){
169 161 $response->error = 'License activation failed: Please enter a valid license key.';
170 162 }
171 163
172 - $redirect_url = add_query_arg( array(
164 + wp_redirect( add_query_arg( array(
173 165 'page' => 'patternswp-license_section',
174 166 'pt_msg' => urlencode( $response->error ),
175 167 'status' => 'error'
176 - ), admin_url( 'admin.php' ) );
177 - wp_safe_redirect( $redirect_url );
168 + ), admin_url( 'admin.php' ) ) );
178 169 exit;
179 170 }
180 171
181 172 if( isset( $response->activated ) && $response->activated == true ) {
@@ -188,14 +179,13 @@
188 179 $license_key = update_option( 'patternswp_license_key', $license_key_data );
189 180
190 181 do_action( 'patternswp_load_patterns_by_ra' );
191 182
192 - $redirect_url = add_query_arg( array(
183 + wp_redirect( add_query_arg( array(
193 184 'page' => 'patternswp-license_section',
194 185 'pt_msg' => urlencode( 'License activated successfully.' ),
195 186 'status' => 'success'
196 - ), admin_url( 'admin.php' ) );
197 - wp_safe_redirect( $redirect_url );
187 + ), admin_url( 'admin.php' ) ) );
198 188 exit;
199 189
200 190 }
201 191 }