diff --git a/Thumbs.db b/Thumbs.db
new file mode 100644
index 0000000..249571d
Binary files /dev/null and b/Thumbs.db differ
diff --git a/_static/vendor.js b/_static/vendor.js
index 9af4c38..d6667aa 100644
--- a/_static/vendor.js
+++ b/_static/vendor.js
@@ -1,172 +1,242 @@
-var lava_api_version = 1;
-var lava_vendor_uri = "http://www.volcanicpixels.com/api/" + lava_api_version;
+jQuery(document).ready(function(){
+ bindChangeKey();
+ bindGetKey();
+ bindPurchaseKey();
+
+ doRegister();
+ doLicenseCheck();
+
+})
+
+/* accessor methods (get) */
-if( location.href.indexOf('localhost') != -1 ){
- lava_vendor_uri = "http://localhost:8082/api/" + lava_api_version;
+function getLavaVariable( variableName ) {
+ return jQuery('input.vendor-input[data-variable-name="' + variableName + '"]').val();
}
-var install_id = "DEVELOPMENTINSTALL2";
-var install_url = encodeURIComponent('http://localhost:31786/');
-var install_name = "WordPress Beta";
-var install_version = "4.0 beta";
-var package_slug = "private_blog";
-//lava_vendor_uri = 'http://localhost:8082/api/' + lava_api_version;
-jQuery(document).ready(function(){
- //do register
-
+function getPublicKey() {
+ return getLavaVariable( 'public_key' );
+}
- var the_url = lava_vendor_uri + '/register/'
- + '?install_id=' + install_id
- + '&installed_version=' + install_version
- + '&package_slug=' + package_slug
- + '&install_name='+ install_name
- + '&install_url=' + install_url
- ;
- jQuery.getJSON( the_url, function(data){
- if( data.status == "complete" ) {
- jQuery('.ajax-check.type-register').removeClass( "loading" ).addClass( "complete" ).attr("title", "Registered").tipTip({'delay':0});
- } else {
- jQuery('.ajax-check.type-register').removeClass( "loading" ).addClass( "error" ).attr("title", "An error occured").tipTip({'delay':0});
- }
- });
+function getPrivateKey() {
+ return getLavaVariable( 'private_key' );
+}
+function getVendorUrl() {
+ return getLavaVariable( 'vendor_url' );
+}
+function getInstallId() {
+ return getLavaVariable( 'install_id' );
+}
- showPremiumUI()
-})
+function getInstallVersion() {
+ return getLavaVariable( 'package_version' );
+}
-function showPremiumUI() {
- jQuery('.setting.tag-is-premium .premium-notice').attr("title", "This is a premium feature, either enter trial mode or purchase a license to use.").tipTip({'delay':0});
+function getInstallUrl() {
+ return getLavaVariable( 'install_url' );
+}
- jQuery('.start-trial').click(function(){
- enterTrialMode();
- })
+function getInstallName() {
+ return getLavaVariable( 'install_name' );
+}
+function getPackageSlug() {
+ return getLavaVariable( 'package_slug' );
+}
- jQuery('.get-premium-link').attr("href", "#unlock").click(function(){
- showUnderground( "get-premium" );
- var the_url = lava_vendor_uri + '/get_license_options/'
- + '?package_slug=' + package_slug
- ;
- jQuery.getJSON( the_url, function(data){
- jQuery('.underground-context-get-premium').removeClass('loading');
- var license_types = data.licenses;
- jQuery('.underground-context-get-premium .license-options').html('');
- for( license_type in license_types) {
- the_license = license_types[license_type];
- var the_license = '
' + the_license.name + '
' + the_license.description + '
';
- jQuery('.underground-context-get-premium .license-options').append(the_license)
- }
- jQuery('.underground-context-get-premium .license-options .license-option:first-child').addClass('selected');
- jQuery('.license-option').click(function(){
- jQuery('.license-option').removeClass('selected');
- jQuery(this).addClass( 'selected');
- });
- });
+/* accessor methods (set) */
- });
-
- jQuery('.redeem-code-link').attr("href", "#verify").click(function(){
- current_key = jQuery('.vendor-input.license-public').val();
- userInput = prompt('Enter License key', current_key );
+function setLavaVariable( variableName, variableValue ) {
+ return jQuery('input.vendor-input[data-variable-name="' + variableName + '"]').val( variableValue );
+}
+
+function setPublicKey( public_key ) {
+ return setLavaVariable( 'public_key', public_key );
+}
+
+function setLavaVariable( variableName, variableValue ) {
+ return jQuery('input.vendor-input[data-variable-name="' + variableName + '"]').val( variableValue );
+}
+function setPrivateKey( private_key ) {
+ return setLavaVariable( 'private_key', private_key );
+}
+
+
+/* Dom manipulation */
+
+function createAjaxBlinker( method, title ) {
+ //remove any existing blinkers
+ jQuery('.lava-ajax-checks .ajax-blinker[data-method="' + method + '"]').remove();
+
+ jQuery('').addClass('ajax-blinker').attr( 'title', title ).attr( 'data-method', method ).attr( 'data-status', 'loading' ).appendTo( '.lava-ajax-checks' ).tipTip({'delay':0});
+}
+
+function setAjaxBlinkerStatus( method, status, title ) {
+ var blinker = jQuery('.lava-ajax-checks .ajax-blinker[data-method="' + method + '"]').attr( 'data-status', status );
+
+ if( typeof(title) != "undefined" ) {
+ jQuery( blinker ).attr( "title", title ).tipTip( {'delay': 0} );
+ }
+}
+
+function showLavaLoader() {
+ jQuery('body').addClass('lava-loading');
+}
+
+function hideLavaLoader() {
+ jQuery('body').removeClass('lava-loading');
+}
+
+/* Event binders */
+
+function bindChangeKey() {
+ jQuery('.vendor-link.redeem-code-link').attr('href', '#redeem').click(function(){
+ var current_key = getPublicKey();
+
+ var userInput = prompt( 'Enter license key:', current_key );
+
if (userInput != null) {
- jQuery('.vendor-input.license-public').val(userInput);
- checkLicense(false);
+ setPublicKey(userInput);
+ doLicensePush();
}
- })
-
+ });
+}
- checkLicense(true);
-
+function bindGetKey() {
+ jQuery('.vendor-link.get-premium-link').attr('href', '#purchase').click(function(){
+ showUnderground( 'get-premium' );
+ var method = 'get_license_options';
+ var request = doApiRequest( method ).success(function(data){
+ var license_types = data.licenses;
+ jQuery('.underground-context-get-premium .license-options').html('');
+ for( license_type in license_types) {
+ var the_license = license_types[license_type];
+ the_license = '' + the_license.name + '
' + the_license.description + '
';
+ jQuery('.underground-context-get-premium .license-options').append(the_license);
+ jQuery('.underground-context-get-premium .license-options .license-option:first-child').addClass('selected');
+ jQuery('.license-option').click(function(){
+ jQuery('.license-option').removeClass('selected');
+ jQuery(this).addClass( 'selected');
+ });
+ }
+ })
+ });
+}
+function bindPurchaseKey() {
jQuery('.lava-btn.purchase-premium-button').click(function(){
jQuery(this).html(jQuery(this).attr("data-clicked-text") );
- the_url = lava_vendor_uri + '/setup_payment/'
- + '?package_slug=' + package_slug
- + '&purchase_id=' + jQuery('.license-option.selected').attr('data-product');
- jQuery.getJSON( the_url, function(data){
+ var method = "setup_payment";
+ var args = {
+ 'purchase_id' : jQuery('.license-option.selected').attr('data-product')
+ };
+ var request = doApiRequest( method, args ).success(function(data){
location.href = data.checkout_url;
- });
+ })
});
}
-function enterTrialMode() {
- jQuery('.remove-for-trial').remove()
- jQuery('.setting.tag-is-premium').removeClass( 'tag-is-premium' );
- jQuery('.started-trial').removeClass('hidden');
- jQuery('.lava-form-purpose').val('trial');
-}
-function checkLicense( routine ) {
- var license_pub = jQuery('.vendor-input.license-public').val();
- jQuery('.ajax-check.type-licensing').show().removeClass( "complete" ).removeClass( "error" ).addClass('loading').attr("title", "Checking License...").tipTip({'delay':0});
- if( license_pub.length == 0 ) {
- jQuery('.ajax-check.type-licensing').hide();
- if( routine ) {
- console.log('just routine')
- return;//no license
+
+
+/* Api Request functions */
+
+function addDefaultArgs( args ) {
+ if( typeof( args ) == "undefined" ) {
+ args = {};
+ }
+
+ var default_args = {
+ 'install_version': getInstallVersion(),
+ 'package_slug': getPackageSlug()
+ }
+ for( arg_name in default_args ) {
+ if( ! args.hasOwnProperty( arg_name ) ) {
+ args[arg_name] = default_args[arg_name];
}
}
- var installation_to_unlicense = jQuery(this).attr('data-installation_to_unlicense');
- the_url = lava_vendor_uri + '/is_licensed/'
- + '?install_id=' + install_id
- + '&license_public=' + license_pub
- + '&installation_to_unlicense=' + installation_to_unlicense
- ;
-
- if(routine){
- //this is a routine license check (no changes were made) - if the license is alive then that is fine
- jQuery.getJSON( the_url, function(data){
- if( data.license_status == "alive" ) {
- jQuery('.ajax-check.type-licensing').removeClass( "loading" ).addClass( "complete" ).attr("title", "License approved").tipTip({'delay':0});
- } else if(data.license_status == "dead") {
- jQuery('.ajax-check.type-licensing').removeClass( "loading" ).addClass( "error" ).attr("title", "License rejected").tipTip({'delay':0});
- var action = jQuery('.vendor-input.ajax-action').val();
- var nonce = jQuery('.vendor-input.ajax-nonce').val();
- var the_url = ajaxurl + '?action=' + action + '&nonce=' + nonce
- + '?private_key=' + ''
- + '&public_key=' + jQuery('.vendor-input.license-public').val();
- ;
- alert( data.license_error_message );
- var private_key = jQuery('.vendor-input.license-private').val();
-
- if( private_key.length != 0 ) {//don't need to remove it if it isn't there
- jQuery.getJSON( the_url, function(data){
- location.reload();
- });
+
+ return args;
+}
+
+function doRegister() {
+ var method = 'register';
+ var title = 'Registering ...'
+ //show status indicator
+ createAjaxBlinker( method, title );
+
+ var args = {
+ 'install_url': getInstallUrl(),
+ 'install_name': getInstallName()
+ };
+
+ var request = doApiRequest( method, args ).success(function(data){
+ setAjaxBlinkerStatus( method, "success", "Registered" );
+ })
+}
+
+function doLicenseCheck() {
+ var method = 'is_licensed';
+ var title = 'Checking license status ...'
+ //show status indicator
+ createAjaxBlinker( method, title );
+
+ var args = {
+ 'public_key': getPublicKey(),
+ 'private_key': getPrivateKey()
+ };
+
+ var request = doApiRequest( method, args ).success(function(data){
+ if( data.license_status == 'alive' || data.license_status == 'dead' ) {
+ if( data.public_key != getPublicKey() || data.private_key != getPrivateKey() ) {
+ setPublicKey( data.public_key );
+ setPrivateKey( data.private_key );
+ if( data.license_message.length > 0) {
+ alert( data.license_message );
}
+ doLicensePush();
}
- });
- } else {
- jQuery('body').addClass( 'lava-loading' );
- jQuery.getJSON( the_url, function(data){
- if( data.license_status == "alive" ) {
- jQuery('.ajax-check.type-licensing').removeClass( "loading" ).addClass( "complete" ).attr("title", "License approved").tipTip({'delay':0});
- action = jQuery('.vendor-input.ajax-action').val();
- nonce = jQuery('.vendor-input.ajax-nonce').val();
- the_url = ajaxurl + '?action=' + action + '&nonce=' + nonce
- + '&private_key=' + data.license_private
- + '&public_key=' + data.license_public
- ;
-
- jQuery.getJSON( the_url, function(data){
- location.reload();
- });
- } else if(data.license_status == "dead") {
- jQuery('.ajax-check.type-licensing').removeClass( "loading" ).addClass( "error" ).attr("title", "License rejected").tipTip({'delay':0});
- action = jQuery('.vendor-input.ajax-action').val();
- nonce = jQuery('.vendor-input.ajax-nonce').val();
- the_url = ajaxurl + '?action=' + action + '&nonce=' + nonce
- + '&private_key=' + ''
- + '&public_key=' + jQuery('.vendor-input.license-public').val();
- ;
- alert( data.license_error_message );
- jQuery.getJSON( the_url, function(data){
- location.reload();
- });
+
+ if( data.license_status == 'alive' ) {
+ setAjaxBlinkerStatus( method, 'success', 'License accepted' );
+ } else if( data.license_status == 'dead' ) {
+ setAjaxBlinkerStatus( method, 'error', 'This installation is not licensed for premium features' )
}
- });
+ }
+ })
+}
+
+function doLicensePush() {
+ showLavaLoader();
+ var request_url = ajaxurl + '?action='+ getLavaVariable( 'ajax_action' )
+ + '&nonce=' + getLavaVariable( 'licensing_nonce' )
+ + '&public_key=' + getPublicKey()
+ + '&private_key=' + getPrivateKey();
+
+ jQuery.getJSON( request_url ).success(function(){
+ location.reload();
+ }).error(function(){
+ alert('An error occured whilst pushing license to database');
+ location.reload();
+ });
+}
+
+
+function doApiRequest( method, args ) {
+ args = addDefaultArgs( args );
+ var request_url = getVendorUrl() + method + '/?install_id=' + getInstallId();
+
+ if( typeof(args) != "undefined" ) {
+ for( arg_name in args ) {
+ request_url += '&' + arg_name + '=' + args[arg_name];
+ }
}
-}
\ No newline at end of file
+
+ return jQuery.getJSON( request_url );
+}
+
+
diff --git a/_static/vendor_bkp.js b/_static/vendor_bkp.js
new file mode 100644
index 0000000..66a2737
--- /dev/null
+++ b/_static/vendor_bkp.js
@@ -0,0 +1,172 @@
+var lava_api_version = 1;
+var lava_vendor_uri = "http://www.volcanicpixels.com/api/" + lava_api_version;
+
+if( location.href.indexOf('localhost') != -1 ){
+ lava_vendor_uri = "http://localhost:8082/api/" + lava_api_version;
+}
+var install_id = "DEVELOPMENTINSTALL2";
+var install_url = encodeURIComponent('http://localhost:31786/');
+var install_name = "WordPress Beta";
+var install_version = "4.0 beta";
+var package_slug = "private_blog";
+//lava_vendor_uri = 'http://localhost:8082/api/' + lava_api_version;
+
+jQuery(document).ready(function(){
+ //do register
+
+
+ var the_url = lava_vendor_uri + '/register/'
+ + '?install_id=' + install_id
+ + '&install_version=' + install_version
+ + '&package_slug=' + package_slug
+ + '&install_name='+ install_name
+ + '&install_url=' + install_url
+ ;
+ jQuery.getJSON( the_url, function(data){
+ if( data.status == "complete" ) {
+ jQuery('.ajax-check.type-register').removeClass( "loading" ).addClass( "complete" ).attr("title", "Registered").tipTip({'delay':0});
+ } else {
+ jQuery('.ajax-check.type-register').removeClass( "loading" ).addClass( "error" ).attr("title", "An error occured").tipTip({'delay':0});
+ }
+ });
+
+
+
+ showPremiumUI()
+})
+
+function showPremiumUI() {
+ jQuery('.setting.tag-is-premium .premium-notice').attr("title", "This is a premium feature, either enter trial mode or purchase a license to use.").tipTip({'delay':0});
+
+ jQuery('.start-trial').click(function(){
+ enterTrialMode();
+ })
+
+
+ jQuery('.get-premium-link').attr("href", "#unlock").click(function(){
+ showUnderground( "get-premium" );
+ var the_url = lava_vendor_uri + '/get_license_options/'
+ + '?package_slug=' + package_slug
+ ;
+ jQuery.getJSON( the_url, function(data){
+ jQuery('.underground-context-get-premium').removeClass('loading');
+ var license_types = data.licenses;
+ jQuery('.underground-context-get-premium .license-options').html('');
+ for( license_type in license_types) {
+ the_license = license_types[license_type];
+ var the_license = '' + the_license.name + '
' + the_license.description + '
';
+ jQuery('.underground-context-get-premium .license-options').append(the_license)
+ }
+ jQuery('.underground-context-get-premium .license-options .license-option:first-child').addClass('selected');
+ jQuery('.license-option').click(function(){
+ jQuery('.license-option').removeClass('selected');
+ jQuery(this).addClass( 'selected');
+ });
+ });
+
+ });
+
+
+ jQuery('.redeem-code-link').attr("href", "#verify").click(function(){
+ current_key = jQuery('.vendor-input.license-public').val();
+ userInput = prompt('Enter License key', current_key );
+ if (userInput != null) {
+ jQuery('.vendor-input.license-public').val(userInput);
+ checkLicense(false);
+ }
+ })
+
+
+ checkLicense(true);
+
+
+ jQuery('.lava-btn.purchase-premium-button').click(function(){
+ jQuery(this).html(jQuery(this).attr("data-clicked-text") );
+
+ the_url = lava_vendor_uri + '/setup_payment/'
+ + '?package_slug=' + package_slug
+ + '&purchase_id=' + jQuery('.license-option.selected').attr('data-product');
+ jQuery.getJSON( the_url, function(data){
+ location.href = data.checkout_url;
+ });
+ });
+}
+
+function enterTrialMode() {
+ jQuery('.remove-for-trial').remove()
+ jQuery('.setting.tag-is-premium').removeClass( 'tag-is-premium' );
+ jQuery('.started-trial').removeClass('hidden');
+ jQuery('.lava-form-purpose').val('trial');
+}
+
+function checkLicense( routine ) {
+ var license_pub = jQuery('.vendor-input.license-public').val();
+ jQuery('.ajax-check.type-licensing').show().removeClass( "complete" ).removeClass( "error" ).addClass('loading').attr("title", "Checking License...").tipTip({'delay':0});
+ if( license_pub.length == 0 ) {
+ jQuery('.ajax-check.type-licensing').hide();
+ if( routine ) {
+ console.log('just routine')
+ return;//no license
+ }
+ }
+ var installation_to_unlicense = jQuery(this).attr('data-installation_to_unlicense');
+ the_url = lava_vendor_uri + '/is_licensed/'
+ + '?install_id=' + install_id
+ + '&license_public=' + license_pub
+ + '&installation_to_unlicense=' + installation_to_unlicense
+ ;
+
+ if(routine){
+ //this is a routine license check (no changes were made) - if the license is alive then that is fine
+ jQuery.getJSON( the_url, function(data){
+ if( data.license_status == "alive" ) {
+ jQuery('.ajax-check.type-licensing').removeClass( "loading" ).addClass( "complete" ).attr("title", "License approved").tipTip({'delay':0});
+ } else if(data.license_status == "dead") {
+ jQuery('.ajax-check.type-licensing').removeClass( "loading" ).addClass( "error" ).attr("title", "License rejected").tipTip({'delay':0});
+ var action = jQuery('.vendor-input.ajax-action').val();
+ var nonce = jQuery('.vendor-input.ajax-nonce').val();
+ var the_url = ajaxurl + '?action=' + action + '&nonce=' + nonce
+ + '?private_key=' + ''
+ + '&public_key=' + jQuery('.vendor-input.license-public').val();
+ ;
+ alert( data.license_error_message );
+ var private_key = jQuery('.vendor-input.license-private').val();
+
+ if( private_key.length != 0 ) {//don't need to remove it if it isn't there
+ jQuery.getJSON( the_url, function(data){
+ location.reload();
+ });
+ }
+ }
+ });
+ } else {
+ jQuery('body').addClass( 'lava-loading' );
+ jQuery.getJSON( the_url, function(data){
+ if( data.license_status == "alive" ) {
+ jQuery('.ajax-check.type-licensing').removeClass( "loading" ).addClass( "complete" ).attr("title", "License approved").tipTip({'delay':0});
+ action = jQuery('.vendor-input.ajax-action').val();
+ nonce = jQuery('.vendor-input.ajax-nonce').val();
+ the_url = ajaxurl + '?action=' + action + '&nonce=' + nonce
+ + '&private_key=' + data.license_private
+ + '&public_key=' + data.license_public
+ ;
+
+ jQuery.getJSON( the_url, function(data){
+ location.reload();
+ });
+ } else if(data.license_status == "dead") {
+ jQuery('.ajax-check.type-licensing').removeClass( "loading" ).addClass( "error" ).attr("title", "License rejected").tipTip({'delay':0});
+ action = jQuery('.vendor-input.ajax-action').val();
+ nonce = jQuery('.vendor-input.ajax-nonce').val();
+ the_url = ajaxurl + '?action=' + action + '&nonce=' + nonce
+ + '&private_key=' + ''
+ + '&public_key=' + jQuery('.vendor-input.license-public').val();
+ ;
+ alert( data.license_error_message );
+ jQuery.getJSON( the_url, function(data){
+ location.reload();
+ });
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/lava/_classes/lavaPage.php b/lava/_classes/lavaPage.php
index 501ec54..f206254 100644
--- a/lava/_classes/lavaPage.php
+++ b/lava/_classes/lavaPage.php
@@ -176,10 +176,8 @@ function displayHeader()
-
-
+
runActions( "ajaxChecks" ); ?>
-
diff --git a/lava/_static/images/Thumbs.db b/lava/_static/images/Thumbs.db
index 2957d52..ffebde7 100644
Binary files a/lava/_static/images/Thumbs.db and b/lava/_static/images/Thumbs.db differ
diff --git a/lava/_static/styles.css b/lava/_static/styles.css
index f5f66be..13b88f2 100644
--- a/lava/_static/styles.css
+++ b/lava/_static/styles.css
@@ -759,12 +759,12 @@ body.lava-loading .lava-full-screen-loader {
box-shadow: inset 0 1px 15px rgba(0, 0, 0, 0.08);
}
/* Ajax Checks */
-.ajax-checks {
+.lava-ajax-checks {
display: inline-block;
padding-left: 20px;
height: 20px;
}
-.ajax-checks .ajax-check {
+.lava-ajax-checks .ajax-blinker {
display: inline-block;
float: left;
margin-left: 8px;
@@ -779,7 +779,7 @@ body.lava-loading .lava-full-screen-loader {
-moz-border-radius: 8px;
border-radius: 8px;
}
-.ajax-checks .ajax-check.loading {
+.lava-ajax-checks .ajax-blinker[data-status="loading"] {
background: #dcdcdc;
animation: "ajax-check-loading" 0.5s infinite;
-moz-animation: "ajax-check-loading" 0.5s infinite;
@@ -789,7 +789,7 @@ body.lava-loading .lava-full-screen-loader {
/* Safari and Chrome */
}
-.ajax-checks .ajax-check.complete {
+.lava-ajax-checks .ajax-blinker[data-status="success"] {
background-color: #eaf9d8;
animation: "ajax-check-complete" 2s 1;
-moz-animation: "ajax-check-complete" 2s 1;
@@ -799,10 +799,10 @@ body.lava-loading .lava-full-screen-loader {
/* Safari and Chrome */
}
-.ajax-checks .ajax-check.complete:hover {
+.lava-ajax-checks .ajax-blinker[data-status="success"]:hover {
background-color: #abea61;
}
-.ajax-checks .ajax-check.error {
+.lava-ajax-checks .ajax-blinker[data-status="error"] {
background-color: #ffc2c2;
animation: "ajax-check-error" 2s 1;
-moz-animation: "ajax-check-error" 2s 1;
@@ -812,10 +812,10 @@ body.lava-loading .lava-full-screen-loader {
/* Safari and Chrome */
}
-.ajax-checks .ajax-check.error:hover {
+.lava-ajax-checks .ajax-blinker[data-status="error"]:hover {
background-color: #ff0000;
}
-.ajax-checks .ajax-check.hidden {
+.lava-ajax-checks .ajax-blinker.hidden {
display: none;
}
@-webkit-keyframes ajax-check-loading {
diff --git a/lava/_static/styles.less b/lava/_static/styles.less
index aae9fa5..ee2dfa5 100644
--- a/lava/_static/styles.less
+++ b/lava/_static/styles.less
@@ -675,12 +675,12 @@ body.lava-loading {
/* Ajax Checks */
-.ajax-checks {
+.lava-ajax-checks {
display:inline-block;
padding-left: 20px;
height: 20px;
- .ajax-check {
+ .ajax-blinker {
display: inline-block;
float: left;
margin-left: 8px;
@@ -690,12 +690,12 @@ body.lava-loading {
margin-top: 5px;
.border-radius(8px);
- &.loading {
+ &[data-status="loading"] {
background: rgb(220,220,220);
.animation( "ajax-check-loading", 0.5s, infinite );
}
- &.complete {
+ &[data-status="success"] {
background-color: #eaf9d8;
.animation( "ajax-check-complete", 2s, 1 );
@@ -704,7 +704,7 @@ body.lava-loading {
}
}
- &.error {
+ &[data-status="error"] {
background-color: #ffc2c2;
.animation( "ajax-check-error", 2s, 1 );
diff --git a/plugin.php b/plugin.php
index 5d8f38e..6bea8dc 100644
--- a/plugin.php
+++ b/plugin.php
@@ -1,20 +1,20 @@
_slug();
diff --git a/pluginCallbacks.php b/pluginCallbacks.php
index cc30da6..0f91445 100644
--- a/pluginCallbacks.php
+++ b/pluginCallbacks.php
@@ -110,6 +110,33 @@ function init() {
function adminInit() {
$this->logoutLinkBackend();
+ $this->copyLegacySettings();
+ }
+
+ function copyLegacySettings() {
+ $hasBeenCopied = get_option( $this->_slug( 'legacy' ) );
+
+ if( $hasBeenCopied == "done" ) {
+ return;
+ }
+
+ update_option( $this->_slug( 'legacy' ), 'done' );
+
+ $legacySettings = get_option( "password_protect_options", array() );
+
+ if( array_key_exists('password', $legacySettings) ) {
+ $this->_settings()->fetchSetting( 'password1_value' )->updateValue( $legacySettings['password'] );
+ }
+
+ for( $i = 1; $i <= 10; $i++ ) {
+ if( array_key_exists('password'.$i, $legacySettings) ) {
+ if( strlen( $legacySettings['password1'] ) > 0 ){
+ $this->_settings()->fetchSetting( 'password' . $i . '_value' )->updateValue( $legacySettings['password'.$i] );
+ }
+ }
+ }
+
+
}
function translation() {
diff --git a/readme.txt b/readme.txt
new file mode 100644
index 0000000..1ac32c8
--- /dev/null
+++ b/readme.txt
@@ -0,0 +1,125 @@
+=== Password Protect Wordpress ===
+Contributors: volcanicpixels
+Donate link: http://www.spiders-design.co.uk/donate/
+Tags: password,protect,password protect,wordpress,blog, security
+Requires at least: 3.3.1
+Tested up to: 3.3.1
+Stable tag: 3.9
+
+This plugin password protects your wordpress blog with a single password.
+
+== Description ==
+
+Want to make your blog private from prying eyes? Well my password protection plugin is perfect for that job; with its sexy looks (well sort of), intelligent UI and endless features it will make the chore of keeping your data secure and private easy.
+
+Features:
+
+No user accounts - just a single password.
+Easy to use admin panel.
+Internationalized to make translations easy.
+
+Custom Logo [premium only]
+Custom Message [premium only]
+Multiple Passwords [premium only]
+Logging [premium only]
+
+
+Please review and vote that it works.
+Follow @danielchatfield and tweet for support
+
+== Installation ==
+
+This section describes how to install the plugin and get it working.
+
+
+1. Unzip archive
+
+2. Upload \`password-protect-wordpress\` to the \`/wp-content/plugins/\` directory
+
+3. Activate the plugin through the 'Plugins' menu in WordPress
+
+1. Edit the configuration by clicking on 'password protect' under settings
+== Frequently Asked Questions ==
+
+Q. I have made a contribution - how do I unlock the premium features.
+
+A. The features are unlocked automatically after I process the payment. Please allow 48 hrs for this before contacting me.
+
+== Screenshots ==
+
+1. Wordpress style login form with a customizable logo.
+
+2. Easy to use admin panel can be accessed by clicking on 'Password Protect' under settings on the wordpress admin dashboard.
+
+== Changelog ==
+= 1.0 =
+
+* First Version
+
+* Search engine access
+
+= 2.0 =
+
+* Better documentation
+
+* Revised Search engine access list
+
+= 2.1 =
+
+* Emergency Bug Fix
+
+= 2.3 =
+
+* Default logo file path fix
+
+= 2.5 =
+
+* Firefox options page fix
+
+= 2.7 =
+
+* Password check on return key press
+
+* Password box automatically has focus
+
+* Preliminary support for Aruba Systems RMP (remote managment protocol)
+
+* Fixed conflict with wordpress admin page
+
+= 2.8 =
+
+* Licensing improvements
+
+* Added support for directories other than the default
+
+= 3.0 =
+
+* Extension support
+
+* Multi site support
+
+* New support page
+
+* Fixed opera and ipad browser issues
+
+* Internationalised
+
+* logo upload button rather than just a textbox
+
+* Helpful instructions
+
+= 3.3 =
+
+* Multi password support
+
+* Logs supports
+
+= 3.7 =
+
+* Fixed compatibility issue where setting headings were getting removed
+
+* removed PHP short tags
+
+= 3.9 =
+
+* Links can now be in the message (by typing in the html)
\ No newline at end of file
diff --git a/screenshot-1.png b/screenshot-1.png
new file mode 100644
index 0000000..97353d6
Binary files /dev/null and b/screenshot-1.png differ
diff --git a/screenshot-2.png b/screenshot-2.png
new file mode 100644
index 0000000..804ba28
Binary files /dev/null and b/screenshot-2.png differ
diff --git a/vendor.php b/vendor.php
index 1eb0be2..dd004ca 100644
--- a/vendor.php
+++ b/vendor.php
@@ -7,9 +7,14 @@
*/
class private_blog_vendor extends lavaExtension {
+
+ public $isLocal = false;
+ public $apiVersion = 1;
+
function init() {
$this->registerLicensingSettings();
}
+
function adminInit(){
$this->addAction( "ajaxChecks" );
$this->addAction( "lavaNav" );
@@ -20,8 +25,10 @@ function adminInit(){
->addStyle( $this->_slug( "vendor_css" ), "_static/vendor.css" )
;
$this->_ajax()->addHandler( 'lavaVolcanicPixelsLicensingAjax' );
+
}
+
function doLicensingHooks() {
if( md5( $this->privateKey() ) != $this->publicKey() ) {
$this->addFilter( "settingAbsElements-tag/is-premium", "settingAbsElements" );
@@ -45,11 +52,7 @@ function registerLicensingSettings() {
}
function ajaxChecks(){
- ?>
-
-
-
-
-
Enter trial mode
-
Get premium
+
Get premium
';
@@ -114,12 +116,36 @@ function pageHiddenStuff() {
}
function licensingFields() {
- ?>
-
-
-
- "/>
- privateKey() ) == $this->publicKey() ) {
+ $license_status = "premium";
+ }
+ $lava_variables = array(
+ 'package_slug' => $this->_slug(),
+ 'package_version' => $this->_version(),
+ 'install_id' => $this->getInstallId(),
+ 'install_url' => get_home_url(),
+ 'install_name' => get_bloginfo( 'name' ),
+ 'private_key' => $this->getPrivateKey(),
+ 'public_key' => $this->getPublicKey(),
+ 'license_status' => $license_status,
+ 'licensing_nonce' => wp_create_nonce( $this->_slug( "licensing" ) ),
+ 'ajax_action' => $this->_slug('licensing'),
+ 'vendor_url' => $this->getVendorUrl( 'api/' . $this->apiVersion . '/' )
+ );
+ foreach( $lava_variables as $variable_name => $variable_key ):
+ ?>
+
+ _settings()->fetchSetting('license_public', 'vendor')->getValue();
+ }
+
+ function getPrivateKey() {
+ return $this->_settings()->fetchSetting('license_private', 'vendor')->getValue();
}
function publickey() {
@@ -129,5 +155,17 @@ function publickey() {
function privateKey() {
return $this->_settings()->fetchSetting('license_private', 'vendor')->getValue();
}
+
+ function getInstallId() {
+ return md5( AUTH_SALT . get_home_url() );
+ }
+
+ function getVendorUrl( $append = "" ) {
+ if( $this->isLocal ) {
+ return "http://localhost:8082/" . $append;
+ } else {
+ return 'http://www.volcanicpixels.com/' . $append;
+ }
+ }
}
?>
\ No newline at end of file