@@ -121,53 +121,53 @@ public function license_view() {
121121 $ license_message = apply_filters ( $ this ->product ->get_key () . '_lc_license_message ' , 'Enter your license from %s purchase history in order to get %s updates ' );
122122 $ error_message = $ this ->get_error ();
123123 ?>
124- <style type="text/css">
125- input.themeisle-sdk-text-input-valid {
126- border: 1px solid #7ad03a;
127- }
128-
129- input.themeisle-sdk-license-input {
130- width: 300px;
131- padding: 0 8px;
132- line-height: 2;
133- min-height: 30px;
134- }
135-
136- .themeisle-sdk-license-deactivate-cta {
137- color: #fff;
138- background: #7ad03a;
139- display: inline-block;
140- text-decoration: none;
141- font-size: 13px;
142- line-height: 30px;
143- height: 26px;
144- margin-left: 5px;
145- padding: 0 10px 3px;
146- -webkit-border-radius: 3px;
147- border-radius: 3px;
148- }
149-
150- .themeisle-sdk-license-activate-cta {
151- color: #fff;
152- background: #dd3d36;
153- display: inline-block;
154- text-decoration: none;
155- font-size: 13px;
156- line-height: 30px;
157- height: 26px;
158- margin-left: 5px;
159- padding: 0 10px 3px;
160- -webkit-border-radius: 3px;
161- border-radius: 3px;
162- }
163-
164- button.button.themeisle-sdk-licenser-button-cta {
165- line-height: 26px;
166- height: 29px;
167- vertical-align: top;
168- }
169-
170- </style>
124+ <style type="text/css">
125+ input.themeisle-sdk-text-input-valid {
126+ border: 1px solid #7ad03a;
127+ }
128+
129+ input.themeisle-sdk-license-input {
130+ width: 300px;
131+ padding: 0 8px;
132+ line-height: 2;
133+ min-height: 30px;
134+ }
135+
136+ .themeisle-sdk-license-deactivate-cta {
137+ color: #fff;
138+ background: #7ad03a;
139+ display: inline-block;
140+ text-decoration: none;
141+ font-size: 13px;
142+ line-height: 30px;
143+ height: 26px;
144+ margin-left: 5px;
145+ padding: 0 10px 3px;
146+ -webkit-border-radius: 3px;
147+ border-radius: 3px;
148+ }
149+
150+ .themeisle-sdk-license-activate-cta {
151+ color: #fff;
152+ background: #dd3d36;
153+ display: inline-block;
154+ text-decoration: none;
155+ font-size: 13px;
156+ line-height: 30px;
157+ height: 26px;
158+ margin-left: 5px;
159+ padding: 0 10px 3px;
160+ -webkit-border-radius: 3px;
161+ border-radius: 3px;
162+ }
163+
164+ button.button.themeisle-sdk-licenser-button-cta {
165+ line-height: 26px;
166+ height: 29px;
167+ vertical-align: top;
168+ }
169+
170+ </style>
171171 <?php
172172 echo sprintf (
173173 '<p>%s<input class="themeisle-sdk-license-input %s" type="text" id="%s_license" name="%s_license" value="%s" /><a class="%s">%s</a> <button name="%s_btn_trigger" class="button button-primary themeisle-sdk-licenser-button-cta" value="yes" type="submit" >%s</button></p><p class="description">%s</p>%s ' ,
@@ -250,8 +250,8 @@ function show_notice() {
250250 // No activations left for this license.
251251 if ( 'valid ' != $ status && $ this ->check_activation () ) {
252252 ?>
253- <div class="error">
254- <p><strong>
253+ <div class="error">
254+ <p><strong>
255255 <?php
256256 echo sprintf (
257257 $ no_activations_string ,
@@ -260,20 +260,20 @@ function show_notice() {
260260 '<a href=" ' . $ this ->get_api_url () . '" target="_blank"> ' . $ this ->get_distributor_name () . '</a> '
261261 );
262262 ?>
263- </strong>
264- </p>
265- </div>
263+ </strong>
264+ </p>
265+ </div>
266266 <?php
267267 return false ;
268268 }
269269 // Invalid license key.
270270 if ( 'valid ' != $ status ) {
271271 ?>
272- <div class="error">
273- <p>
274- <strong><?php echo sprintf ( $ no_valid_string , $ this ->product ->get_name () . ' ' . $ this ->product ->get_type (), $ this ->get_api_url (), admin_url ( 'options-general.php ' ) . '# ' . $ this ->product ->get_key () . '_license ' ); ?> </strong>
275- </p>
276- </div>
272+ <div class="error">
273+ <p>
274+ <strong><?php echo sprintf ( $ no_valid_string , $ this ->product ->get_name () . ' ' . $ this ->product ->get_type (), $ this ->get_api_url (), admin_url ( 'options-general.php ' ) . '# ' . $ this ->product ->get_key () . '_license ' ); ?> </strong>
275+ </p>
276+ </div>
277277 <?php
278278
279279 return false ;
@@ -370,7 +370,6 @@ public function check_license() {
370370 $ license_data = $ response ;
371371 }
372372
373-
374373 $ license_old = get_option ( $ this ->product ->get_key () . '_license_data ' , '' );
375374
376375 if ( 'valid ' === $ license_old ->license && ( $ license_data ->license !== $ license_old ->license ) ) {
@@ -431,17 +430,18 @@ public function get_error() {
431430 * Do license activation/deactivation.
432431 *
433432 * @param string $license License key.
433+ * @param string $action What do to.
434434 *
435435 * @return bool|\WP_Error
436436 */
437437 private function do_license_process ( $ license , $ action = 'toggle ' ) {
438438
439439 $ status = $ this ->get_license_status ();
440440
441- if ( $ status === ' valid ' && $ action === ' activate ' ) {
441+ if ( ' valid ' === $ status && ' activate ' === $ action ) {
442442 return new \WP_Error ( 'themeisle-license-already-active ' , 'License is already active. ' );
443443 }
444- if ( $ status !== ' valid ' && $ action === ' deactivate ' ) {
444+ if ( ' valid ' !== $ status && ' deactivate ' === $ action ) {
445445 return new \WP_Error ( 'themeisle-license-already-deactivate ' , 'License not active. ' );
446446 }
447447
@@ -480,7 +480,7 @@ private function do_license_process( $license, $action = 'toggle' ) {
480480 if ( ! is_object ( $ license_data ) ) {
481481 return new \WP_Error ( 'themeisle-license-404 ' , 'ERROR: Failed to validate license. Please try again in one minute. ' );
482482 }
483- if ( $ action === ' check ' ) {
483+ if ( ' check ' === $ action ) {
484484 return $ license_data ;
485485 }
486486 if ( ! isset ( $ license_data ->license ) ) {
@@ -508,7 +508,7 @@ private function do_license_process( $license, $action = 'toggle' ) {
508508 update_option ( $ this ->product ->get_key () . '_license_data ' , $ license_data );
509509 set_transient ( $ this ->product ->get_key () . '_license_data ' , $ license_data , 12 * HOUR_IN_SECONDS );
510510
511- if ( $ license_data -> license !== ' valid ' ) {
511+ if ( ' valid ' !== $ license_data -> license ) {
512512 return new \WP_Error ( 'themeisle-license-invalid ' , 'ERROR: Invalid license provided. ' );
513513 }
514514
@@ -530,7 +530,7 @@ function process_license() {
530530
531531 return ;
532532 }
533- if ( $ response === true ) {
533+ if ( true === $ response ) {
534534 $ this ->set_error ( '' );
535535 }
536536
@@ -694,7 +694,7 @@ public function pre_set_site_transient_update_plugins_filter( $_transient_data )
694694 * Calls the API and, if successfull, returns the object delivered by the API.
695695 *
696696 * @param string $_action The requested action.
697- * @param array $_data Parameters for the API action.
697+ * @param array $_data Parameters for the API action.
698698 *
699699 * @return false||object
700700 */
@@ -713,7 +713,7 @@ private function api_request( $_action = '', $_data = '' ) {
713713 /**
714714 * Updates information on the "View version x.x details" page with custom data.
715715 *
716- * @param mixed $_data Plugin data.
716+ * @param mixed $_data Plugin data.
717717 * @param string $_action Action to send.
718718 * @param object $_args Arguments to use.
719719 *
@@ -734,7 +734,7 @@ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
734734 /**
735735 * Disable SSL verification in order to prevent download update failures.
736736 *
737- * @param array $args Http args.
737+ * @param array $args Http args.
738738 * @param string $url Url to check.
739739 *
740740 * @return array $array
@@ -785,7 +785,7 @@ public function load( $product ) {
785785
786786 if ( defined ( 'WP_CLI ' ) && WP_CLI ) {
787787 $ namespace = apply_filters ( 'themesle_sdk_cli_ ' . md5 ( $ product ->get_basefile () ), false );
788- if ( $ namespace !== false ) {
788+ if ( false !== $ namespace ) {
789789 \WP_CLI ::add_command ( $ namespace . ' activate ' , [ $ this , 'cli_activate ' ] );
790790 \WP_CLI ::add_command ( $ namespace . ' deactivate ' , [ $ this , 'cli_deactivate ' ] );
791791 \WP_CLI ::add_command ( $ namespace . ' is-active ' , [ $ this , 'cli_is_active ' ] );
@@ -805,7 +805,6 @@ public function load( $product ) {
805805 add_filter ( 'plugins_api ' , array ( $ this , 'plugins_api_filter ' ), 10 , 3 );
806806 add_filter ( 'http_request_args ' , array ( $ this , 'http_request_args ' ), 10 , 2 );
807807
808-
809808 return $ this ;
810809 }
811810 if ( $ this ->product ->is_theme () ) {
@@ -875,9 +874,9 @@ public function auto_activate() {
875874 */
876875 public function autoactivate_notice () {
877876 ?>
878- <div class="notice notice-success is-dismissible">
879- <p><?php echo sprintf ( '<strong>%s</strong> has been successfully activated using <strong>%s</strong> license ! ' , $ this ->product ->get_name (), str_repeat ( '* ' , 20 ) . substr ( $ this ->license_local ->key , - 10 ) ); ?> </p>
880- </div>
877+ <div class="notice notice-success is-dismissible">
878+ <p><?php echo sprintf ( '<strong>%s</strong> has been successfully activated using <strong>%s</strong> license ! ' , $ this ->product ->get_name (), str_repeat ( '* ' , 20 ) . substr ( $ this ->license_local ->key , - 10 ) ); ?> </p>
879+ </div>
881880 <?php
882881 }
883882
@@ -886,13 +885,15 @@ public function autoactivate_notice() {
886885 *
887886 * ## OPTIONS
888887 *
888+ * @param array $args Command args.
889+ *
889890 * [<license-key>]
890- * : Product license key
891+ * : Product license key.
891892 */
892893 public function cli_activate ( $ args ) {
893894 $ license_key = isset ( $ args [0 ] ) ? trim ( $ args [0 ] ) : '' ;
894895 $ response = $ this ->do_license_process ( $ license_key , 'activate ' );
895- if ( $ response !== true ) {
896+ if ( true !== $ response ) {
896897 \WP_CLI ::error ( $ response ->get_error_message () );
897898
898899 return ;
@@ -904,15 +905,17 @@ public function cli_activate( $args ) {
904905 /**
905906 * Deactivate product license on this site.
906907 *
908+ * @param array $args Command args.
909+ *
907910 * ## OPTIONS
908911 *
909912 * [<license-key>]
910- * : Product license key
913+ * : Product license key.
911914 */
912915 public function cli_deactivate ( $ args ) {
913916 $ license_key = isset ( $ args [0 ] ) ? trim ( $ args [0 ] ) : '' ;
914917 $ response = $ this ->do_license_process ( $ license_key , 'deactivate ' );
915- if ( $ response !== true ) {
918+ if ( true !== $ response ) {
916919 \WP_CLI ::error ( $ response ->get_error_message () );
917920
918921 return ;
@@ -924,12 +927,14 @@ public function cli_deactivate( $args ) {
924927 /**
925928 * Checks if product has license activated.
926929 *
930+ * @param array $args Command args.
931+ *
927932 * @subcommand is-active
928933 */
929934 public function cli_is_active ( $ args ) {
930935
931936 $ status = $ this ->get_license_status ();
932- if ( $ status === ' valid ' ) {
937+ if ( ' valid ' === $ status ) {
933938 \WP_CLI ::halt ( 0 );
934939
935940 return ;
0 commit comments