diff --git a/editor/editor.account.php b/editor/editor.account.php
index 23b8249b..a38a22c2 100644
--- a/editor/editor.account.php
+++ b/editor/editor.account.php
@@ -24,7 +24,7 @@ function toolbar( $toolbar ){
'icon' => 'icon-star',
'call' => array(&$this, 'pagelines_welcome'),
),
- 'account' => array(
+ 'pl_account' => array(
'name' => 'Your Account',
'icon' => 'icon-user',
'call' => array(&$this, 'pagelines_account'),
@@ -58,20 +58,48 @@ function pagelines_welcome(){
}
function pagelines_account(){
+
+ $disabled = '';
+ $email = '';
+ $key = '';
+ $activate_text = 'Activate';
+ if( pl_is_pro() ) {
+ $disabled = ' disabled';
+ $data = get_option( 'dms_activation' );
+ $email = sprintf( 'value="%s"', $data['email'] );
+ $key = sprintf( 'value="%s"', $data['key'] );
+ printf( '
', $data['message'] );
+ $activate_text = 'Deactivate';
+ }
+
+ if( ! pl_is_pro() ){
?>
- Enter your PageLines user account information
-
- This will be used to authenticate purchases and membership level. If you are a Pro member, it will unlock pro features.
+
Enter your PageLines DMS Activation key
+
+ If you are a Pro member, it will unlock pro features.
- PageLines Username
-
+
+ User email
+ />
+
+ Activation key
+ />
+
+
+ ';
+ }
- PageLines Password
-
+ ?>
- Submit
+
$uploaded_file['url'], 'success' => TRUE));
}
+ die(); // don't forget this, always returns 0 w/o
+}
+add_action( 'wp_ajax_pl_account_actions', 'pl_account_actions' );
+function pl_account_actions() {
+ $postdata = $_POST;
+ $response = array();
+
+ $response['key'] = $postdata['key'];
+ $response['email'] = $postdata['email'];
+ $response['active'] = false;
+ $response['refresh'] = false;
+
+ $activated = array( 'active' => false, 'key' => '', 'message' => '', 'email' => '' );
+
+ if( $postdata['key'] && $postdata['email'] ) {
+ $state = 'activation';
+
+ if( true == $postdata['revoke'] )
+ $state = 'deactivation';
+
+ $url = sprintf( 'http://www.pagelines.com/?wc-api=software-api&request=%s&product_id=dmspro&licence_key=%s&email=%s&instance=%s', $state, $response['key'], $response['email'], site_url() );
+
+ $response['url'] = $url;
+// $response['postdata'] = $postdata;
+ $data = wp_remote_get( $url );
+
+
+ $rsp = json_decode( $data['body'] );
+
+ if( isset( $rsp->activated ) ) {
+ $response['active'] = $rsp->activated;
+ }
+ $response['message'] = ( isset( $rsp->error ) ) ? $rsp->error : $rsp->message;
- die(); // don't forget this, always returns 0 w/o
-
+ } else {
+ $response['message'] = 'There was an error!';
+ }
+ if( true == $rsp->activated ) {
+ $activated['message'] = $rsp->message;
+ $activated['instance'] = $rsp->instance;
+ $activated['active'] = true;
+ $activated['key'] = $response['key'];
+ $activated['email'] = $response['email'];
+ $response['refresh'] = true;
+ }
+
+ if( isset( $rsp->reset ) && true == $rsp->reset ){
+ $response['message'] = 'Deactivated activation for ' . site_url();
+ $response['refresh'] = true;
+ }
+
+// $response['rsp'] = $rsp;
+ update_option( 'dms_activation', $activated );
+ echo json_encode( pl_arrays_to_objects( $response ) );
+
+ exit();
}
diff --git a/editor/editor.premium.php b/editor/editor.premium.php
index b632db69..bb8181b5 100644
--- a/editor/editor.premium.php
+++ b/editor/editor.premium.php
@@ -3,7 +3,11 @@
function pl_is_pro(){
- return false;
+ $status = get_option( 'dms_activation', array( 'active' => false, 'key' => '', 'message' => '', 'email' => '' ) );
+
+ $pro = (true === $status['active']) ? true : false;
+
+ return $pro;
}
diff --git a/editor/js/pl.editor.js b/editor/js/pl.editor.js
index 015eb448..32203c9c 100644
--- a/editor/js/pl.editor.js
+++ b/editor/js/pl.editor.js
@@ -130,6 +130,43 @@
that.tabLink(tabLink, tabSubLink)
}
+
+ $('[data-action="pagelines-account"]').on('click', function() {
+
+
+ var key = $('#pl_activation').val()
+ , email = $('#pl_email').val()
+ , revoke = $('#pl_revoke').val()
+ , theData = {
+ action: 'pl_account_actions'
+ , key: key
+ , email: email
+ , revoke: revoke
+ }
+
+ $.ajax({
+ type: 'POST'
+ , url: ajaxurl
+ , data: theData
+ , beforeSend: function(){
+
+ }
+ , success: function( response ){
+
+ var rsp = $.parseJSON( response )
+ , textRsp = sprintf('%s
', rsp.message)
+ $('.account-description').html( textRsp )
+
+ var url = sprintf( '%s?tablink=account&tabsublink=pl_account', $.pl.config.siteURL)
+ if( true == rsp.refresh )
+ pl_url_refresh(url,1000)
+
+ console.log(response)
+ }
+ })
+
+
+ })
}
, tabLink: function(tabLink, tabSubLink){
diff --git a/style.css b/style.css
index 89840d9d..96d88278 100644
--- a/style.css
+++ b/style.css
@@ -3,7 +3,7 @@ Theme Name: PageLines Framework
Description: !!!MASTER BRANCH!!! A responsive drag-and-drop platform for professional websites based on HTML5 and CSS3. PageLines will help you do amazing things faster & easier than ever before. Designed by PageLines in California. Twitter @pagelines
-Version: 2.5_alpha5
+Version: 2.5_alpha6
Author: PageLines
@@ -47,6 +47,4 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
* The license for this software can also likely be found here:
* http://www.gnu.org/licenses/gpl-2.0.html
*
-********************************************************************************************************************************/
-
-
+********************************************************************************************************************************/
\ No newline at end of file