@@ -817,27 +817,27 @@ public function register_api_hooks() {
817817 'method ' => 'GET ' ,
818818 'callback ' => 'plugin_install ' ,
819819 ),
820- 'license ' => array (
820+ 'license ' => array (
821821 'method ' => 'GET ' ,
822822 'callback ' => 'license ' ,
823823 ),
824- 'license-validate ' => array (
824+ 'license-validate ' => array (
825825 'method ' => 'GET ' ,
826826 'callback ' => 'validate_license ' ,
827827 ),
828- 'license-activate ' => array (
828+ 'license-activate ' => array (
829829 'method ' => 'GET ' ,
830830 'callback ' => 'activate_license ' ,
831831 ),
832- 'license-deactivate ' => array (
832+ 'license-deactivate ' => array (
833833 'method ' => 'GET ' ,
834834 'callback ' => 'deactivate_license ' ,
835835 ),
836- 'get-pro-url ' => array (
836+ 'get-pro-url ' => array (
837837 'method ' => 'GET ' ,
838838 'callback ' => 'get_pro_url ' ,
839839 ),
840- 'opt_out ' => array (
840+ 'opt_out ' => array (
841841 'method ' => 'GET ' ,
842842 'callback ' => 'opt_out_account ' ,
843843 ),
@@ -919,8 +919,8 @@ public function plugin_install( \WP_REST_Request $request ) {
919919 'error ' => __ ( 'Redux Pro license not active, please activate. ' , 'redux-framework ' ),
920920 );
921921 } else {
922- $ array = array (
923- 'edd_action ' => 'get_version '
922+ $ array = array (
923+ 'edd_action ' => 'get_version ' ,
924924 );
925925 $ request = $ this ->do_license_request ( $ array );
926926
@@ -1016,9 +1016,9 @@ public function license( \WP_REST_Request $request ) {
10161016 )
10171017 );
10181018 }
1019- $ array = array (
1019+ $ array = array (
10201020 'edd_action ' => 'check_license ' ,
1021- 'license ' => $ data ['key ' ]
1021+ 'license ' => $ data ['key ' ],
10221022 );
10231023 $ response = $ this ->do_license_request ( $ array );
10241024
@@ -1028,13 +1028,15 @@ public function license( \WP_REST_Request $request ) {
10281028 wp_send_json_success ( array ( 'status ' => 'success ' ) );
10291029 } elseif ( 'site_inactive ' === $ response ['license ' ] ) {
10301030 if ( 0 === $ response ['activations_left ' ] ) {
1031- wp_send_json_error ( array (
1032- 'status ' => 'error ' ,
1033- 'message ' => __ ( 'You have reached your activation limits for Redux Pro ' , 'redux-framework ' )
1034- ) );
1031+ wp_send_json_error (
1032+ array (
1033+ 'status ' => 'error ' ,
1034+ 'message ' => __ ( 'You have reached your activation limits for Redux Pro ' , 'redux-framework ' ),
1035+ )
1036+ );
10351037 }
1036- $ array = array (
1037- 'edd_action ' => 'activate_license '
1038+ $ array = array (
1039+ 'edd_action ' => 'activate_license ' ,
10381040 );
10391041 $ request = $ this ->do_license_request ( $ array );
10401042
@@ -1045,9 +1047,9 @@ public function license( \WP_REST_Request $request ) {
10451047 }
10461048 wp_send_json_error (
10471049 array (
1048- 'status ' => 'error ' ,
1049- 'msg ' => __ ( 'Invalid license key. ' , 'redux-framework ' ),
1050- 'response ' => $ response
1050+ 'status ' => 'error ' ,
1051+ 'msg ' => __ ( 'Invalid license key. ' , 'redux-framework ' ),
1052+ 'response ' => $ response,
10511053 )
10521054 );
10531055 }
@@ -1066,14 +1068,14 @@ public function validate_license( \WP_REST_Request $request ) {
10661068 );
10671069 }
10681070
1069- $ array = array (
1071+ $ array = array (
10701072 'edd_action ' => 'check_license ' ,
1071- 'license ' => $ data ['license ' ]
1073+ 'license ' => $ data ['license ' ],
10721074 );
10731075 $ response = $ this ->do_license_request ( $ array );
10741076
10751077 if ( isset ( $ response ['license ' ] ) && in_array ( $ response ['license ' ], array ( 'valid ' , 'site_inactive ' ) ) ) {
1076- update_option ( 'redux_pro_license_key ' , $ data ['license ' ] );
1078+ update_option ( 'redux_pro_license_status ' , $ data ['license ' ] );
10771079 wp_send_json_success ( $ response );
10781080 } else {
10791081 wp_send_json_error (
@@ -1099,8 +1101,8 @@ public function activate_license( \WP_REST_Request $request ) {
10991101 );
11001102 }
11011103
1102- $ array = array (
1103- 'edd_action ' => 'activate_license '
1104+ $ array = array (
1105+ 'edd_action ' => 'activate_license ' ,
11041106 );
11051107 $ request = $ this ->do_license_request ( $ array );
11061108
@@ -1123,7 +1125,7 @@ public function deactivate_license() {
11231125 }
11241126 $ lic = get_option ( 'redux_pro_license_key ' );
11251127 if ( empty ( $ lic ) ) {
1126- //delete_option( 'redux_pro_license_status' );
1128+ // delete_option( 'redux_pro_license_status' );
11271129 wp_send_json_error (
11281130 array (
11291131 'success ' => 'false ' ,
@@ -1133,8 +1135,8 @@ public function deactivate_license() {
11331135 );
11341136 }
11351137
1136- $ array = array (
1137- 'edd_action ' => 'deactivate_license '
1138+ $ array = array (
1139+ 'edd_action ' => 'deactivate_license ' ,
11381140 );
11391141 $ request = $ this ->do_license_request ( $ array );
11401142 if ( isset ( $ request ['license ' ] ) && 'deactivated ' === $ request ['license ' ] ) {
@@ -1163,8 +1165,8 @@ public function get_pro_url() {
11631165 );
11641166 }
11651167
1166- $ array = array (
1167- 'edd_action ' => 'get_version '
1168+ $ array = array (
1169+ 'edd_action ' => 'get_version ' ,
11681170 );
11691171 $ request = $ this ->do_license_request ( $ array );
11701172
@@ -1180,18 +1182,17 @@ public function get_pro_url() {
11801182 )
11811183 );
11821184
1183-
11841185 }
11851186
11861187
11871188 private function do_license_request ( $ args ) {
11881189
11891190 $ defaults = array (
1190- 'item_name ' => 'Redux Pro ' ,
1191- 'url ' => network_site_url (),
1192- 'license ' => get_option ( 'redux_pro_license_key ' )
1191+ 'item_name ' => 'Redux Pro ' ,
1192+ 'url ' => network_site_url (),
1193+ 'license ' => get_option ( 'redux_pro_license_key ' ),
11931194 );
1194- $ args = wp_parse_args ( $ args , $ defaults );
1195+ $ args = wp_parse_args ( $ args , $ defaults );
11951196
11961197 if ( ! isset ( $ args ['edd_action ' ] ) || ( isset ( $ args ['edd_action ' ] ) && empty ( $ args ['edd_action ' ] ) ) ) {
11971198 wp_send_json_error (
@@ -1210,7 +1211,7 @@ private function do_license_request( $args ) {
12101211 }
12111212 }
12121213
1213- $ url = add_query_arg ( $ args , $ this ->license_base_url );
1214+ $ url = add_query_arg ( $ args , $ this ->license_base_url );
12141215
12151216 $ request = wp_remote_get ( $ url , array ( 'timeout ' => $ this ->timeout ) );
12161217 if ( is_wp_error ( $ request ) ) {
@@ -1233,7 +1234,7 @@ private function do_license_request( $args ) {
12331234 }
12341235 $ data = json_decode ( $ request ['body ' ], true );
12351236 if ( isset ( $ data ['license ' ] ) ) {
1236- update_option ( 'redux_pro_license_status ' , $ data ['license ' ] );
1237+ update_option ( 'redux_pro_license_status ' , $ data ['license ' ] );
12371238 }
12381239 return $ data ;
12391240 }
0 commit comments