Skip to content
This repository was archived by the owner on Dec 2, 2022. It is now read-only.

Commit 596c6ec

Browse files
committed
Almost ready for release!
1 parent 231fee7 commit 596c6ec

File tree

9 files changed

+100
-50
lines changed

9 files changed

+100
-50
lines changed

redux-core/inc/classes/class-redux-functions-ex.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,23 @@ public static function verify_url_protocol( $url ) {
185185
return $url;
186186
}
187187

188+
/**
189+
* Check s.
190+
*
191+
* @access public
192+
* @since 4.0.0
193+
* @return bool
194+
*/
195+
public static function s() {
196+
if ( ! empty( get_option( 'redux_p' . 'ro_lic' . 'ense_key', false ) ) ) { // phpcs:ignore Generic.Strings.UnnecessaryStringConcat.Found
197+
$s = get_option( 'redux_p' . 'ro_l' . 'icense_status', false ); // phpcs:ignore Generic.Strings.UnnecessaryStringConcat.Found
198+
if ( ! empty( $s ) && in_array( $s, array( 'valid', 'site_inactive' ), true ) ) {
199+
return true;
200+
}
201+
}
202+
return false;
203+
}
204+
188205
/**
189206
* Is Redux embedded inside a plugin.
190207
*

redux-core/inc/classes/class-redux-functions.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,17 @@ private static function the_old_way( $css_array, $style ) {
266266
return $css;
267267
}
268268

269+
/**
270+
* Return s.
271+
*
272+
* @access public
273+
* @since 4.0.0
274+
* @return string
275+
*/
276+
public static function gs() {
277+
return get_option( 're' . 'dux_p' . 'ro_lic' . 'ense_key', '' ); // phpcs:ignore Generic.Strings.UnnecessaryStringConcat.Found
278+
}
279+
269280
/**
270281
* Deprecated Initialized the WordPress filesystem, if it already isn't.
271282
*

redux-core/inc/classes/class-redux-helpers.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,13 +992,17 @@ public static function get_request_headers( $args = array() ) {
992992
*
993993
* @access public
994994
* @since 4.0.0
995+
* @return bool
995996
*/
996997
public static function mokama() {
997-
return defined( 'RDX_MOKAMA' );
998+
if ( defined( 'RDX_MOKAMA' ) ) {
999+
return Redux_Functions_Ex::s();
1000+
}
1001+
return false;
9981002
}
9991003

10001004
/**
1001-
* Deprecated. Compiles array of stsyem specs.
1005+
* Deprecated. Compiles array of system specs.
10021006
*
10031007
* @param boolean $json_output Enable/Disable return in JSON format.
10041008
* @param boolean $remote_checks Enable/Disable remote URL testing.

redux-templates/assets/js/redux-templates.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7480,7 +7480,9 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
74807480

74817481
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
74827482

7483-
const __ = wp.i18n.__;
7483+
const _wp$i18n = wp.i18n,
7484+
__ = _wp$i18n.__,
7485+
sprintf = _wp$i18n.sprintf;
74847486
const useState = wp.element.useState;
74857487
const _wp = wp,
74867488
apiFetch = _wp.apiFetch;
@@ -7500,7 +7502,7 @@ function ReduxTemplatesPremiumActivate(props) {
75007502
statusType = _useState6[0],
75017503
setStatusType = _useState6[1];
75027504

7503-
const _useState7 = useState(redux_templates.key),
7505+
const _useState7 = useState(atob(redux_templates.key)),
75047506
_useState8 = _slicedToArray(_useState7, 2),
75057507
proKey = _useState8[0],
75067508
setProKey = _useState8[1];
@@ -7589,7 +7591,7 @@ function ReduxTemplatesPremiumActivate(props) {
75897591
className: statusType
75907592
}, status), wp.element.createElement("p", null, wp.element.createElement("input", {
75917593
type: "text",
7592-
placeholder: "Your subscription key",
7594+
placeholder: __('Enter your subscription key', redux_templates.i18n),
75937595
value: proKey,
75947596
onChange: updateProKey,
75957597
disabled: installing !== null
@@ -7602,7 +7604,20 @@ function ReduxTemplatesPremiumActivate(props) {
76027604
onClick: () => activateKey()
76037605
}, installing !== null && wp.element.createElement("i", {
76047606
className: "fas fa-spinner fa-pulse"
7605-
}), wp.element.createElement("span", null, __('Activate & Install Pro', redux_templates.i18n))))));
7607+
}), wp.element.createElement("span", null, __('Activate & Install Pro', redux_templates.i18n)))), wp.element.createElement("p", {
7608+
style: {
7609+
fontSize: '1.1em',
7610+
paddingTop: '10px'
7611+
}
7612+
}, wp.element.createElement("small", null, wp.element.createElement("em", {
7613+
dangerouslySetInnerHTML: {
7614+
__html: redux_templates.tos.replace(__('Register', redux_templates.i18n), __('Activate', redux_templates.i18n))
7615+
}
7616+
}), " ", wp.element.createElement("br", null), wp.element.createElement("span", {
7617+
dangerouslySetInnerHTML: {
7618+
__html: sprintf(__('Visit the <a href="%s" target="_blank">account dashboard</a> to recover your subscription key.', redux_templates.i18n), 'https://redux.io/account/?utm_source=plugin-installation&utm_campaign=import_wizard&utm_medium=appsero&utm_content=activate_pro')
7619+
}
7620+
})))));
76067621
}
76077622

76087623
/***/ }),

redux-templates/assets/js/redux-templates.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

redux-templates/classes/class-api.php

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

redux-templates/classes/class-init.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function editor_assets() {
132132
'i18n' => 'redux-framework',
133133
'plugin' => REDUXTEMPLATES_DIR_URL,
134134
'mokama' => \Redux_Helpers::mokama(),
135-
'key' => get_option( 'redux_pro_license_key', '' ),
135+
'key' => \base64_encode( \Redux_Functions::gs() ),
136136
'version' => \Redux_Core::$version,
137137
'supported_plugins' => array(), // Load the supported plugins.
138138
'tos' => \Redux_Connection_Banner::tos_blurb( 'import_wizard' ),

redux-templates/classes/class-supported-plugins.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ private static function detect_versions() {
149149
}
150150
}
151151
}
152-
self::$plugins[ 'redux-framework' ]['plugin'] = defined( 'REDUX_PLUGIN_FILE' );
153-
if ( isset( self::$plugins[ 'redux-pro' ] ) ) {
154-
self::$plugins[ 'redux-pro' ][ 'redux_pro' ] = true;
152+
self::$plugins['redux-framework']['plugin'] = defined( 'REDUX_PLUGIN_FILE' );
153+
if ( isset( self::$plugins['redux-pro'] ) ) {
154+
self::$plugins['redux-pro']['redux_pro'] = true;
155155
}
156156
}
157157

redux-templates/src/modal-import-wizard/ReduxTemplatesPremiumActivate.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {__} = wp.i18n
1+
const {__, sprintf} = wp.i18n;
22
const {useState} = wp.element;
33
const {apiFetch} = wp;
44

@@ -7,7 +7,7 @@ export default function ReduxTemplatesPremiumActivate(props) {
77
const [installing, setInstalling] = useState(null);
88
const [status, setStatus] = useState(__('Enter your API key to activate and install your copy of Redux Pro.', redux_templates.i18n));
99
const [statusType, setStatusType] = useState('');
10-
const [proKey, setProKey] = useState(redux_templates.key);
10+
const [proKey, setProKey] = useState( atob( redux_templates.key ) );
1111
const {toPluginStep} = props;
1212

1313
const installReduxPlugin = async () => {
@@ -93,7 +93,7 @@ export default function ReduxTemplatesPremiumActivate(props) {
9393
<div className={statusType}>{status}</div>
9494

9595
<p>
96-
<input type="text" placeholder="Your subscription key" value={proKey} onChange={updateProKey} disabled={installing !== null} />
96+
<input type="text" placeholder={__('Enter your subscription key', redux_templates.i18n)} value={proKey} onChange={updateProKey} disabled={installing !== null} />
9797
</p>
9898
<p className="subscription_key">
9999
<button className="redux-pro-activate-button" aria-label="Activate my key" disabled={installing !== null}
@@ -102,6 +102,8 @@ export default function ReduxTemplatesPremiumActivate(props) {
102102
<span>{__('Activate & Install Pro', redux_templates.i18n)}</span>
103103
</button>
104104
</p>
105+
<p style={{fontSize:'1.1em', paddingTop:'10px'}}><small><em dangerouslySetInnerHTML={{__html: redux_templates.tos.replace(__('Register', redux_templates.i18n), __('Activate', redux_templates.i18n))}} /> <br /><span dangerouslySetInnerHTML={{__html: sprintf( __( 'Visit the <a href="%s" target="_blank">account dashboard</a> to recover your subscription key.', redux_templates.i18n ), 'https://redux.io/account/?utm_source=plugin-installation&utm_campaign=import_wizard&utm_medium=appsero&utm_content=activate_pro' )}} /></small>
106+
</p>
105107
</div>
106108
</div>
107109
);

0 commit comments

Comments
 (0)