Completed
Push — develop ( 79f047...6e9c49 )
by Zack
04:28
created

GV_License_Handler::refresh_license_status()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 23
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 12
c 1
b 0
f 0
nc 3
nop 0
dl 0
loc 23
rs 9.0856
1
<?php
2
3
class GV_License_Handler {
0 ignored issues
show
Coding Style introduced by
Since you have declared the constructor as private, maybe you should also declare the class as final.
Loading history...
4
5
	/**
6
	 * @var GravityView_Settings
7
	 */
8
	private $Addon;
9
10
	const name = 'GravityView';
11
12
	const author = 'Katz Web Services, Inc.';
13
	
14
	const url = 'https://gravityview.co';
15
	
16
	const version = GravityView_Plugin::version;
17
18
	/**
19
	 * Post ID on gravityview.co
20
	 * @since 1.15
21
	 */
22
	const item_id = 17;
23
24
	/**
25
	 * Name of the transient used to store license status for GV
26
	 * @since 1.17
27
	 */
28
	const status_transient_key = 'gravityview_edd-activate_valid';
29
30
	private $EDD_SL_Plugin_Updater;
31
32
	/**
33
	 * @var GV_License_Handler
34
	 */
35
	public static $instance;
36
37
	/**
38
	 * @param GravityView_Settings $GFAddOn
39
	 *
40
	 * @return GV_License_Handler
41
	 */
42
	public static function get_instance( GravityView_Settings $GFAddOn ) {
43
		if( empty( self::$instance ) ) {
44
			self::$instance = new self( $GFAddOn );
45
		}
46
		return self::$instance;
47
	}
48
	
49
	private function __construct( GravityView_Settings $GFAddOn ) {
50
51
		$this->Addon = $GFAddOn;
52
53
		$this->setup_edd();
54
		
55
		$this->add_hooks();
56
	}
57
58
	private function add_hooks() {
59
		add_action( 'wp_ajax_gravityview_license', array( $this, 'license_call' ) );
60
		add_action( 'admin_init', array( $this, 'refresh_license_status' ) );
61
	}
62
63
	/**
64
	 * When the status transient expires (or is deleted on activation), re-check the status
65
	 *
66
	 * @since 1.17
67
	 *
68
	 * @return void
69
	 */
70
	public function refresh_license_status() {
71
72
		// Only perform on GravityView pages
73
		if( ! gravityview_is_admin_page() ) {
74
			return;
75
		}
76
77
		// The transient is fresh; don't fetch.
78
		if( $status = get_transient( self::status_transient_key ) ) {
79
			return;
80
		}
81
82
		$data = array(
83
			'edd_action' => 'check_license',
84
			'license' => trim( $this->Addon->get_app_setting( 'license_key' ) ),
85
			'update' => true,
86
			'format' => 'object',
87
		);
88
89
		$license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data );
90
91
		do_action( 'gravityview_log_debug', __METHOD__ . ': Refreshed the license.', $license_call );
92
	}
93
94
	function settings_edd_license_activation( $field, $echo ) {
0 ignored issues
show
Unused Code introduced by
The parameter $field is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
95
96
		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
97
98
		wp_enqueue_script( 'gv-admin-edd-license', GRAVITYVIEW_URL . 'assets/js/admin-edd-license' . $script_debug . '.js', array( 'jquery' ) );
99
100
		$status = trim( $this->Addon->get_app_setting( 'license_key_status' ) );
101
		$key = trim( $this->Addon->get_app_setting( 'license_key' ) );
102
103
		if( !empty( $key ) ) {
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
104
			$response = $this->Addon->get_app_setting( 'license_key_response' );
105
			$response = is_array( $response ) ? (object) $response : json_decode( $response );
106
		} else {
107
			$response = array();
108
		}
109
110
		wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array(
111
			'license_box' => $this->get_license_message( $response )
112
		));
113
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
114
115
		$fields = array(
116
			array(
117
				'name'  => 'edd-activate',
118
				'value' => __('Activate License', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
119
				'data-pending_text' => __('Verifying license&hellip;', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
120
				'data-edd_action' => 'activate_license',
121
				'class' => 'button-primary',
122
			),
123
			array(
124
				'name'  => 'edd-deactivate',
125
				'value' => __('Deactivate License', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
126
				'data-pending_text' => __('Deactivating license&hellip;', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
127
				'data-edd_action' => 'deactivate_license',
128
				'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ),
129
			),
130
			array(
131
				'name'  => 'edd-check',
132
				'value' => __('Check License', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
133
				'data-pending_text' => __('Verifying license&hellip;', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
134
				'title' => 'Check the license before saving it',
135
				'data-edd_action' => 'check_license',
136
				'class' => 'button-secondary',
137
			),
138
		);
139
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
140
141
		$class = 'button gv-edd-action';
142
143
		$class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
144
145
		$disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled';
146
147
		$submit = '<div class="gv-edd-button-wrapper">';
148
		foreach ( $fields as $field ) {
149
			$field['type'] = 'button';
150
			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
151
			$field['style'] = 'margin-left: 10px;';
152
			if( $disabled_attribute ) {
153
				$field['disabled'] = $disabled_attribute;
154
			}
155
			$submit .= $this->Addon->settings_submit( $field, $echo );
156
		}
157
		$submit .= '</div>';
158
159
		return $submit;
160
	}
161
162
	/**
163
	 * Include the EDD plugin updater class, if not exists
164
	 * @since 1.7.4
165
	 * @return void
166
	 */
167
	private function setup_edd() {
168
169
		if( !class_exists('EDD_SL_Plugin_Updater') ) {
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
170
			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php');
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
171
		}
172
173
		// setup the updater
174
		$this->EDD_SL_Plugin_Updater = new EDD_SL_Plugin_Updater(
175
			self::url,
176
			GRAVITYVIEW_FILE,
177
			$this->_get_edd_settings()
178
		);
179
180
	}
181
182
	/**
183
	 * Generate the array of settings passed to the EDD license call
184
	 *
185
	 * @since 1.7.4
186
	 *
187
	 * @param string $action The action to send to edd, such as `check_license`
188
	 * @param string $license The license key to have passed to EDD
189
	 *
190
	 * @return array
191
	 */
192
	function _get_edd_settings( $action = '', $license = '' ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
193
194
		// retrieve our license key from the DB
195
		$license_key = empty( $license ) ? trim( $this->Addon->get_app_setting( 'license_key' ) ) : $license;
196
197
		$settings = array(
198
			'version'   => self::version,
199
			'license'   => $license_key,
200
			'item_name' => self::name,
201
			'item_id'   => self::item_id,
202
			'author'    => self::author,
203
			'url'       => home_url(),
204
		);
205
206
		if( !empty( $action ) ) {
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
207
			$settings['edd_action'] = esc_attr( $action );
208
		}
209
210
		$settings = array_map( 'urlencode', $settings );
211
212
		return $settings;
213
	}
214
215
	/**
216
	 * Perform the call
217
	 * @return array|WP_Error
218
	 */
219
	private function _license_get_remote_response( $data, $license = '' ) {
220
221
		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
222
223
		$url = add_query_arg( $api_params, self::url );
224
225
		$response = wp_remote_get( $url, array(
0 ignored issues
show
introduced by
wp_remote_get is highly discouraged, please use vip_safe_wp_remote_get() instead.
Loading history...
226
			'timeout'   => 15,
227
			'sslverify' => false,
228
		));
229
230
		if ( is_wp_error( $response ) ) {
231
			return array();
232
		}
233
234
		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
235
236
		// Not JSON
237
		if ( empty( $license_data ) ) {
238
239
			delete_transient( self::status_transient_key );
240
241
			// Change status
242
			return array();
243
		}
244
245
		// Store the license key inside the data array
246
		$license_data->license_key = $license;
247
248
		return $license_data;
249
	}
250
251
	/**
252
	 * Generate the status message displayed in the license field
253
	 *
254
	 * @since 1.7.4
255
	 * @param $license_data
256
	 *
257
	 * @return string
258
	 */
259
	function get_license_message( $license_data ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
260
261
		if( empty( $license_data ) ) {
262
			$message = '';
263
		} else {
264
265
			if( ! empty( $license_data->error ) ) {
266
				$class = 'error';
267
				$string_key = $license_data->error;
268
			} else {
269
				$class = $license_data->license;
270
				$string_key = $license_data->license;
271
			}
272
273
			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) );
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
274
275
			$message = $this->generate_license_box( $message, $class );
276
		}
277
278
		return $message;
279
	}
280
281
	/**
282
	 * Generate the status message box HTML based on the current status
283
	 *
284
	 * @since 1.7.4
285
	 * @param $message
286
	 * @param string $class
287
	 *
288
	 * @return string
289
	 */
290
	private function generate_license_box( $message, $class = '' ) {
291
292
		$template = '<div id="gv-edd-status" class="gv-edd-message inline %s">%s</div>';
293
294
		$output = sprintf( $template, esc_attr( $class ), $message );
295
296
		return $output;
297
	}
298
299
	/**
300
	 * Perform the call to EDD based on the AJAX call or passed data
301
	 *
302
	 * @since 1.7.4
303
	 *
304
	 * @param array $array {
305
	 * @type string $license The license key
306
	 * @type string $edd_action The EDD action to perform, like `check_license`
307
	 * @type string $field_id The ID of the field to check
308
	 * @type boolean $update Whether to update plugin settings. Prevent updating the data by setting an `update` key to false
309
	 * @type string $format If `object`, return the object of the license data. Else, return the JSON-encoded object
310
	 * }
311
	 *
312
	 * @return mixed|string|void
313
	 */
314
	public function license_call( $array = array() ) {
315
316
		$is_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
317
		$data = empty( $array ) ? $_POST['data'] : $array;
0 ignored issues
show
introduced by
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_POST
Loading history...
318
		$has_cap = GVCommon::has_cap( 'gravityview_edit_settings' );
319
320
		if ( $is_ajax && empty( $data['license'] ) ) {
321
			die( - 1 );
0 ignored issues
show
Coding Style Compatibility introduced by
The method license_call() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
322
		}
323
324
		// If the user isn't allowed to edit settings, show an error message
325
		if( ! $has_cap ) {
326
			$license_data = new stdClass();
327
			$license_data->error = 'capability';
328
			$license_data->message = $this->get_license_message( $license_data );
329
			$json = json_encode( $license_data );
330
		} else {
331
332
			$license      = esc_attr( rgget( 'license', $data ) );
333
			$license_data = $this->_license_get_remote_response( $data, $license );
334
335
			// Empty is returned when there's an error.
336
			if ( empty( $license_data ) ) {
337
				if ( $is_ajax ) {
338
					exit( json_encode( array() ) );
0 ignored issues
show
Coding Style Compatibility introduced by
The method license_call() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
339
				} else { // Non-ajax call
340
					return json_encode( array() );
341
				}
342
			}
343
344
			$license_data->message = $this->get_license_message( $license_data );
345
346
			$json = json_encode( $license_data );
347
348
			$update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) );
349
350
			$is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX );
351
352
			// Failed is the response from trying to de-activate a license and it didn't work.
353
			// This likely happened because people entered in a different key and clicked "Deactivate",
354
			// meaning to deactivate the original key. We don't want to save this response, since it is
355
			// most likely a mistake.
356
			if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) {
0 ignored issues
show
introduced by
Found "!== '". Use Yoda Condition checks, you must
Loading history...
357
358
				if ( ! empty( $data['field_id'] ) ) {
359
					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
360
				}
361
362
				$this->license_call_update_settings( $license_data, $data );
363
			}
364
		} // End $has_cap
365
366
		if ( $is_ajax ) {
367
			exit( $json );
0 ignored issues
show
Coding Style Compatibility introduced by
The method license_call() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
368
		} else { // Non-ajax call
369
			return ( rgget('format', $data ) === 'object' ) ? $license_data : $json;
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
370
		}
371
	}
372
373
	/**
374
	 * Update the license after fetching it
375
	 * @param object $license_data
376
	 * @return void
377
	 */
378
	private function license_call_update_settings( $license_data, $data ) {
379
380
		// Update option with passed data license
381
		$settings = $this->Addon->get_app_settings();
382
383
        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
384
		$settings['license_key_status'] = $license_data->license;
385
		$settings['license_key_response'] = (array)$license_data;
0 ignored issues
show
introduced by
No space after closing casting parenthesis is prohibited
Loading history...
386
387
		$this->Addon->update_app_settings( $settings );
388
	}
389
390
	/**
391
	 * URL to direct license renewal, or if license key is not set, then just the account page
392
	 * @since 1.13.1
393
	 * @param  object|null $license_data Object with license data
394
	 * @return string Renewal or account URL
395
	 */
396
	private function get_license_renewal_url( $license_data ) {
397
		$license_data = is_array( $license_data ) ? (object)$license_data : $license_data;
0 ignored issues
show
introduced by
No space after closing casting parenthesis is prohibited
Loading history...
398
		$renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/';
0 ignored issues
show
introduced by
Expected 1 space after "!"; 0 found
Loading history...
399
		return $renew_license_url;
400
	}
401
402
	/**
403
	 * Override the text used in the Redux Framework EDD field extension
404
	 * @param  array|null $status Status to get. If empty, get all strings.
405
	 * @param  object|null $license_data Object with license data
406
	 * @return array          Modified array of content
407
	 */
408
	public function strings( $status = NULL, $license_data = null ) {
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
409
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
410
411
		$strings = array(
412
			'status' => esc_html__('Status', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
413
			'error' => esc_html__('There was an error processing the request.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
414
			'failed'  => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
415
			'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
416
			'inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
417
			'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
418
			'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
419
			'valid' => esc_html__('The license key is valid and active.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
420
			'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
421
			'missing' => esc_html__('Invalid license key.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
422
			'revoked' => esc_html__('This license key has been revoked.', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
423
			'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
424
			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
425
426
			'verifying_license' => esc_html__('Verifying license&hellip;', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
427
			'activate_license' => esc_html__('Activate License', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
428
			'deactivate_license' => esc_html__('Deactivate License', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
429
			'check_license' => esc_html__('Verify License', 'gravityview'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
430
		);
431
432
		if( empty( $status ) ) {
433
			return $strings;
434
		}
435
436
		if( isset( $strings[ $status ] ) ) {
437
			return $strings[ $status ];
438
		}
439
440
		return NULL;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected null, but found NULL.
Loading history...
441
	}
442
443
}