diff --git a/_classes/lavaPrivateBlogAccessLogsPage.php b/_classes/lavaPrivateBlogAccessLogsPage.php new file mode 100644 index 0000000..9c755b7 --- /dev/null +++ b/_classes/lavaPrivateBlogAccessLogsPage.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/_classes/lavaVolcanicPixelsLicensingAjax.php b/_classes/lavaVolcanicPixelsLicensingAjax.php new file mode 100644 index 0000000..939f0d8 --- /dev/null +++ b/_classes/lavaVolcanicPixelsLicensingAjax.php @@ -0,0 +1,30 @@ +_settings()->fetchSetting('license_public', 'vendor')->updateValue( $public_key ); + $this->_settings()->fetchSetting('license_private', 'vendor')->updateValue( $private_key ); + + $return = array( + "status" => "complete" + ); + + $this->returnData( $return ); + $this->doReturn(); + } +} +?> \ No newline at end of file diff --git a/_static/images/Thumbs.db b/_static/images/Thumbs.db new file mode 100644 index 0000000..3ab3f10 Binary files /dev/null and b/_static/images/Thumbs.db differ diff --git a/_static/images/logout-icon.png b/_static/images/logout-icon.png new file mode 100644 index 0000000..a71989c Binary files /dev/null and b/_static/images/logout-icon.png differ diff --git a/_static/scripts.js b/_static/scripts.js index 0da0568..8ade74c 100644 --- a/_static/scripts.js +++ b/_static/scripts.js @@ -1,7 +1,6 @@ var passwordFieldAnimationSpeed = 0; jQuery( document ).ready( function(){ makeLabels(); - bindLogoutLink(); jQuery('#private_blog-settings-multiple_passwords').change( function(){ if( jQuery(this).hasAttr( 'checked' ) ) { @@ -120,14 +119,3 @@ function makeLabels() //jQuery(this).find( '.custom-password-label' ).css({marginLeft: -(labelWidth + 50 ),opacity:0,display: 'none'}); }); } - -function bindLogoutLink() { - jQuery('#private_blog-settings-logout_link').change(function(){ - - if( jQuery(this).hasAttr( "checked" ) ) {console.log(2); - jQuery( '#setting-cntr_private_blog-settings-logout_link_menu.tag-options-available' ).slideDown(); - } else { - jQuery( '#setting-cntr_private_blog-settings-logout_link_menu' ).slideUp(); - } - }).change(); -} \ No newline at end of file diff --git a/_static/styles.css b/_static/styles.css index a20e92e..261b125 100644 --- a/_static/styles.css +++ b/_static/styles.css @@ -1,3 +1,4 @@ +/* This beautiful CSS-File has been crafted with LESS (lesscss.org) and compiled by simpLESS (wearekiss.com/simpless) */ .setting.tag-multi-password { margin-top: -10px; } @@ -76,3 +77,26 @@ cursor: pointer; min-width: 28px; } +.lava-table-viewer[data-data-source="access_logs"] .cell-id, +.lava-table-viewer[data-data-source="access_logs"] .cell-password, +.lava-table-viewer[data-data-source="access_logs"] .cell-password_color, +.lava-table-viewer[data-data-source="access_logs"] .cell-user_agent { + display: none; +} +.lava-table-viewer[data-data-source="access_logs"] .cell-timestamp { + text-align: center; +} +.lava-table-viewer[data-data-source="access_logs"] .cell-action.value-loginAccepted, .lava-table-viewer[data-data-source="access_logs"] .cell-action.value-doLogout, .lava-table-viewer[data-data-source="access_logs"] .cell-action.value-loginRejected { + text-align: center; + color: white; + text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.5); +} +.lava-table-viewer[data-data-source="access_logs"] .cell-action.value-doLogout { + background: #69AEB4; +} +.lava-table-viewer[data-data-source="access_logs"] .cell-action.value-loginAccepted { + background-color: #7cd05b; +} +.lava-table-viewer[data-data-source="access_logs"] .cell-action.value-loginRejected { + background: red; +} diff --git a/_static/styles.less b/_static/styles.less index 9ca337f..31d17f7 100644 --- a/_static/styles.less +++ b/_static/styles.less @@ -46,11 +46,11 @@ //background: rgba(255,255,255,0.25); border-radius: 15px; background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.01) 2%, rgba(0,0,0,0.14) 49%, rgba(0,0,0,0.18) 51%, rgba(0,0,0,0.2) 52%, rgba(0,0,0,0) 100%); /* FF3.6+ */ -background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(2%,rgba(0,0,0,0.01)), color-stop(49%,rgba(0,0,0,0.14)), color-stop(51%,rgba(0,0,0,0.18)), color-stop(52%,rgba(0,0,0,0.2)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */ -background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0,0.14) 49%,rgba(0,0,0,0.18) 51%,rgba(0,0,0,0.2) 52%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */ -background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0,0.14) 49%,rgba(0,0,0,0.18) 51%,rgba(0,0,0,0.2) 52%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */ -background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0,0.14) 49%,rgba(0,0,0,0.18) 51%,rgba(0,0,0,0.2) 52%,rgba(0,0,0,0) 100%); /* IE10+ */ -background: linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0,0.14) 49%,rgba(0,0,0,0.18) 51%,rgba(0,0,0,0.2) 52%,rgba(0,0,0,0) 100%); /* W3C */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(2%,rgba(0,0,0,0.01)), color-stop(49%,rgba(0,0,0,0.14)), color-stop(51%,rgba(0,0,0,0.18)), color-stop(52%,rgba(0,0,0,0.2)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0,0.14) 49%,rgba(0,0,0,0.18) 51%,rgba(0,0,0,0.2) 52%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0,0.14) 49%,rgba(0,0,0,0.18) 51%,rgba(0,0,0,0.2) 52%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0,0.14) 49%,rgba(0,0,0,0.18) 51%,rgba(0,0,0,0.2) 52%,rgba(0,0,0,0) 100%); /* IE10+ */ + background: linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0,0.14) 49%,rgba(0,0,0,0.18) 51%,rgba(0,0,0,0.2) 52%,rgba(0,0,0,0) 100%); /* W3C */ } } } @@ -105,4 +105,34 @@ background: linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 2%,rgba(0,0,0 } } } -} \ No newline at end of file +} + +.lava-table-viewer[data-data-source="access_logs"] { + .cell-id, .cell-password, .cell-password_color, .cell-user_agent { + display: none; + } + + .cell-timestamp { + text-align: center; + } + + .cell-action { + &.value-loginAccepted, &.value-doLogout, &.value-loginRejected { + text-align: center; + color: white; + text-shadow: 0px -1px 0px rgba(0,0,0,0.5); + } + + &.value-doLogout { + background: #69AEB4; + } + + &.value-loginAccepted { + background-color: #7cd05b; + } + + &.value-loginRejected { + background: red; + } + } +} diff --git a/_static/vendor.css b/_static/vendor.css new file mode 100644 index 0000000..6e06fa5 --- /dev/null +++ b/_static/vendor.css @@ -0,0 +1,2 @@ +/* This beautiful CSS-File has been crafted with LESS (lesscss.org) and compiled by simpLESS (wearekiss.com/simpless) */ +#lava-nav .vendor-link{float:right;background-color:#b0351a;height:45px;line-height:45px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.6);padding:0 15px;text-decoration:none;margin-left:1px}#lava-nav .vendor-link:hover{background-color:#992f17}#lava-nav .licensing-box{float:right;height:45px;padding-left:10px;padding-right:10px;background-color:#c63c1e}#lava-nav .licensing-box input{display:none;background:transparent;border:0;color:#fff;font-size:14px;height:45px;line-height:45px;width:200px;padding-right:0}#lava-nav .licensing-box input::-webkit-input-placeholder{color:#fff}#lava-nav .licensing-box input:-moz-placeholder{color:#fff}.lava-underground[data-underground-context="get-premium"] .underground-context-get-premium{display:block}.lava-underground .underground-context-get-premium{text-align:center}.lava-underground .underground-context-get-premium.loading .license-options .lava-loader{display:block}.lava-underground .underground-context-get-premium.loading button{display:none}.lava-underground .underground-context-get-premium .license-options .lava-loader{height:100px;display:none}.lava-underground .underground-context-get-premium .license-options .license-option{cursor:pointer;text-align:center;float:left;width:30%;margin:1%;background-color:#959493;box-shadow:8px 8px 0 #c1beb9;-ms-box-shadow:8px 8px 0 #c1beb9;-o-box-shadow:8px 8px 0 #c1beb9;-moz-box-shadow:8px 8px 0 #c1beb9;color:#fff;padding:20px 0}.lava-underground .underground-context-get-premium .license-options .license-option.selected{background:#dc4321}.lava-underground .underground-context-get-premium .license-options .license-option h3{margin-top:0;font-family:Lobster;font-size:34px;color:#fff;text-shadow:0 -1px 0 #000}.lava-underground .underground-context-get-premium .license-options .license-option .description{color:#fff}.lava-underground .underground-context-get-premium button{margin-bottom:30px}.setting.tag-is-premium:hover .premium-notice,.setting.tag-is-premium.hover .premium-notice{opacity:1}.setting.tag-is-premium:hover .pre-setting,.setting.tag-is-premium.hover .pre-setting,.setting.tag-is-premium:hover .setting-inner,.setting.tag-is-premium.hover .setting-inner{-webkit-filter:blur(3px);opacity:.2}.setting.tag-is-premium .status-indicator{background:red}.setting.tag-is-premium .pre-setting,.setting.tag-is-premium .setting-inner{-webkit-transition:all .25s ease-in-out;transition:all .25s ease-in-out}.setting.tag-is-premium .premium-notice{opacity:0;-moz-opacity:0;filter:alpha(opacity=0);-webkit-transition:all 1s ease-in-out;-moz-transition:all 1s ease-in-out;-o-transition:all 1s ease-in-out;transition:all 1s ease-in-out;z-index:80;position:absolute;top:0;bottom:0;left:10px;right:0;color:#fff}.setting.tag-is-premium .premium-notice .premium-notice-inner{height:50%;text-align:center;position:relative}.setting.tag-is-premium .premium-notice .premium-notice-inner .premium-line{position:absolute;bottom:-30px;left:0;right:0;height:36px;text-align:center}.setting.tag-is-premium .premium-notice .premium-notice-inner .premium-line .lava-btn{padding:10px 20px;font-size:14px;background-color:rgba(255,0,0,.7);color:#fff;margin-right:20px}.setting.tag-is-premium .premium-notice .premium-notice-inner .premium-line .lava-btn:hover{background-color:red} \ No newline at end of file diff --git a/_static/vendor.js b/_static/vendor.js new file mode 100644 index 0000000..9af4c38 --- /dev/null +++ b/_static/vendor.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 + + '&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}); + } + }); + + + + 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/_static/vendor.less b/_static/vendor.less new file mode 100644 index 0000000..0520252 --- /dev/null +++ b/_static/vendor.less @@ -0,0 +1,179 @@ +@ui-foreground-color : #dc4321; + +#lava-nav { + .vendor-link { + float:right; + background-color: darken(@ui-foreground-color, 10%); + height: 45px; + line-height: 45px; + color: white; + text-shadow: 0px -1px 0px rgba(0,0,0,0.6); + padding: 0px 15px; + text-decoration: none; + margin-left: 1px; + + &:hover { + background-color: darken(@ui-foreground-color, 15%); + } + } + + .licensing-box { + float: right; + height: 45px; + padding-left: 10px; + padding-right:10px; + background-color: darken(@ui-foreground-color, 5%); + + input { + display: none; + background: transparent; + border: none; + color: white; + font-size: 14px; + height: 45px; + line-height: 45px; + width: 200px; + padding-right: 0px; + + &::-webkit-input-placeholder { + color: white; + } + + &:-moz-placeholder { + color: white; + } + } + } +} + +.lava-underground { + &[data-underground-context="get-premium"] { + .underground-context-get-premium { + display: block; + } + } + + .underground-context-get-premium { + text-align: center; + &.loading { + .license-options { + .lava-loader { + display: block; + } + } + button { + display: none; + } + } + + .license-options { + + .lava-loader { + height: 100px; + display: none; + } + + .license-option { + cursor: pointer; + text-align: center; + float: left; + width: 30%; + margin: 1%; + background-color: #959493; + box-shadow: 8px 8px 0 #c1beb9; + -ms-box-shadow: 8px 8px 0 #c1beb9; + -o-box-shadow: 8px 8px 0 #c1beb9; + -moz-box-shadow: 8px 8px 0 #c1beb9; + color: white; + padding: 20px 0px; + + &.selected { + background: @ui-foreground-color; + } + + h3 { + margin-top: 0px; + font-family: Lobster; + font-size: 34px; + color: white; + text-shadow: 0px -1px 0px black; + } + + .description { + color: white; + } + } + } + + button { + margin-bottom: 30px; + } + } +} + + +.setting.tag-is-premium { + &:hover, &.hover { + + .premium-notice { + opacity: 1; + } + .pre-setting, .setting-inner { + -webkit-filter:blur( 3px ); + opacity: 0.2; + } + } + + .status-indicator { + background: #ff0000; + } + + .pre-setting, .setting-inner { + -webkit-transition: all 0.25s ease-in-out; + transition: all 0.25s ease-in-out; + } + + .premium-notice { + opacity: 0; + -moz-opacity: 0; + filter:alpha(opacity=0); + -webkit-transition: all 1s ease-in-out; + -moz-transition: all 1s ease-in-out; + -o-transition: all 1s ease-in-out; + transition: all 1s ease-in-out; + z-index: 80; + position: absolute; + top: 0px; + bottom: 0px; + left: 10px; + right: 0px; + color: white; + + .premium-notice-inner { + height: 50%; + text-align: center; + position: relative; + + .premium-line { + position: absolute; + bottom: -30px; + left: 0px; + right: 0px; + height: 36px ; + text-align: center; + + .lava-btn { + padding: 10px 20px; + font-size: 14px; + background-color: fadeout(red, 30%); + color: white; + margin-right: 20px; + + &:hover{ + background-color: red; + } + } + } + } + } +} \ No newline at end of file diff --git a/branding.php b/branding.php deleted file mode 100644 index e69de29..0000000 diff --git a/config.php b/config.php deleted file mode 100644 index 9f2e233..0000000 --- a/config.php +++ /dev/null @@ -1,11 +0,0 @@ - 10, - "SHOW_DEBUG_SETTINGS" => false -); -?> \ No newline at end of file diff --git a/lava/_classes/lavaAjax.php b/lava/_classes/lavaAjax.php index 7692c51..d708f94 100644 --- a/lava/_classes/lavaAjax.php +++ b/lava/_classes/lavaAjax.php @@ -70,7 +70,6 @@ function nonceError() { } else { $nonce = $_GET['nonce']; } - if( !wp_verify_nonce($nonce, $this->targetAction) ) { return true; } diff --git a/lava/_classes/lavaAjaxHandlers.php b/lava/_classes/lavaAjaxHandlers.php index 372e305..0a5315b 100644 --- a/lava/_classes/lavaAjaxHandlers.php +++ b/lava/_classes/lavaAjaxHandlers.php @@ -22,7 +22,8 @@ function adminInit() { function addAdminAjaxHandlers() { $handlers = array( "FileUpload", - "ImageUpload" + "ImageUpload", + "DataSource" ); foreach( $handlers as $handler ) { @@ -30,5 +31,9 @@ function addAdminAjaxHandlers() { $this->handlers[$handler] = $this->_new( $fullHandler ); } } + + function addHandler( $handler ) { + $this->handlers[$handler] = $this->_new( $handler ); + } } ?> \ No newline at end of file diff --git a/lava/_classes/lavaBase.php b/lava/_classes/lavaBase.php index a1460ea..cc88f61 100644 --- a/lava/_classes/lavaBase.php +++ b/lava/_classes/lavaBase.php @@ -27,6 +27,8 @@ class lavaBase protected $chain = array(); protected $memory = array(); public $suffixes = array( "/pre", "", "/post" ); + public $allowMethodMiss = false; + public $autoMethods = false; /** @@ -44,15 +46,16 @@ class lavaBase function __construct( $pluginInstance, $arguments = array() ) { $this->pluginInstance = $pluginInstance; - - + if( method_exists( $this, "lavaConstruct" ) )//call the sub classes construct argument { $callback = array( $this, "lavaConstruct" ); call_user_func_array( $callback, $arguments ); } + + $this->addAutoMethods(); } - + /** * __call function. * @@ -104,9 +107,12 @@ function __call( $methodName, $arguments ) return call_user_func_array( $callback, $arguments ); } - if( 1 == 1) + if( ! $this->allowMethodMiss ) { - echo $methodName; + + echo "

LavaError thrown on line 110 of lavaBase.php


"; + echo "Could not find method '{$methodName}' on object of class '" . get_class( $this ) . "'. We also tried the current child which has class '" . get_class( $this->getContext() ) . "' and the parent which has class '" . get_class( $this->getContext() ) . "'."; + exit; } //to prevent a dummy method call from returning a child parents set an "if lost return to" property on the children - we should check to see if it exists @@ -116,6 +122,17 @@ function __call( $methodName, $arguments ) } return $this;//couldn't find anything to call so return this object so chaining doesn't break } + + function addAutoMethods() { + if( $this->autoMethods == true ) { + $this->_misc()->_addAutoMethods( $this ); + } + } + + //meant to be overridden - so a class can forward a request to something else + function getThis() { + return $this; + } /** * lavaReset function. @@ -211,7 +228,7 @@ final function withinContext( $context ) * * @since 1.0.0 */ - final function clearLavaContext( $handle = "current" ) + final function clearContext( $handle = "current" ) { $this->chain[ $handle ] = null; } @@ -366,8 +383,11 @@ function runActions( $hookTag, $debug = false ) * * @since 1.0.0 */ - function runFilters( $hookTag, $argument = "", $debug = false ) + function runFilters( $hookTag, $argument = "", $args = null, $debug = false ) { + if( is_null( $args ) ) { + $args = $this; + } $hooks = array_unique( $this->hookTags() ); $suffixes = array_unique( $this->suffixes ); @@ -384,7 +404,7 @@ function runFilters( $hookTag, $argument = "", $debug = false ) //echo( $this->_slug( "{$hookTag}{$hook}{$suffix}" ). "
" ); $theHook = $this->_slug( "{$hookTag}{$hook}{$suffix}" ); if( $debug ){ echo( "$theHook
" ); } - $argument = apply_filters( $theHook, $argument, $this ); + $argument = apply_filters( $theHook, $argument, $args ); } } diff --git a/lava/_classes/lavaDataSourceAjax.php b/lava/_classes/lavaDataSourceAjax.php new file mode 100644 index 0000000..ea707e1 --- /dev/null +++ b/lava/_classes/lavaDataSourceAjax.php @@ -0,0 +1,72 @@ +_tables()->tableExists( $dataSourceSlug ) ) { + $this->returnError( "The specified data source could not be retrieved :(" ); + $this->doReturn(); + } + + $dataSource = $this->_tables()->fetchTable( $dataSourceSlug ); + + $result = $dataSource->getResults(); + + $result = $this->runFilters( "_dataSourceAjax_result", $result ); + $result = $this->runFilters( "_dataSourceAjax_result/dataSource:{$dataSourceSlug}", $result ); + $newResult = array(); + foreach( $result as $i => $row ) { + $row = $this->runFilters( "_dataSourceAjax_row", $row ); + $row = $this->runFilters( "_dataSourceAjax_row/dataSource:{$dataSourceSlug}", $row ); + $newRow = array(); + + foreach( $row as $col => $column ) { + + + + $newColumn = $this->runFilters( "_dataSourceAjax_column", $column ); + $newColumn = $this->runFilters( "_dataSourceAjax_column/dataSource:{$dataSourceSlug}", $newColumn ); + $newColumn = $this->runFilters( "_dataSourceAjax_column/dataSource:{$dataSourceSlug}/col:$col", $newColumn ); + + $argArray = array( + "original" => $column, + "new" => $newColumn + ); + + $classes = $this->runFilters( "_dataSourceAjax_columnClasses/dataSource:{$dataSourceSlug}/col:$col", "", $argArray ); + $title = $this->runFilters( "_dataSourceAjax_columnTitle/dataSource:{$dataSourceSlug}/col:$col", $newColumn, $argArray ); + + $newRow[$col] = array( + "data" => $newColumn, + "classes" => $classes, + "title" => $title + ); + } + + $newResult[$i] = $newRow; + } + + + + $return = array( + "data" => $newResult + ); + + $this->returnData( $return ); + $this->doReturn(); + } +} +?> \ No newline at end of file diff --git a/lava/_classes/lavaExtension.php b/lava/_classes/lavaExtension.php new file mode 100644 index 0000000..0e7c8e2 --- /dev/null +++ b/lava/_classes/lavaExtension.php @@ -0,0 +1,12 @@ +_misc()->_addAutoMethods( $this ); + $this->registerActions(); + } + + function registerActions() { + //should be overloaded + } +} +?> \ No newline at end of file diff --git a/lava/_classes/lavaMiscFunctions.php b/lava/_classes/lavaMiscFunctions.php index d1229d1..d0096b7 100644 --- a/lava/_classes/lavaMiscFunctions.php +++ b/lava/_classes/lavaMiscFunctions.php @@ -1,6 +1,7 @@ addAutoMethods(); } @@ -21,26 +22,30 @@ function addAutoMethods() { $this->_ajax(), $this->_skins() ); - $autoHooks = array( - "init" => "init", - "admin_init" => "adminInit" - ); foreach( $objects as $object ) { - foreach( $autoHooks as $hookTag => $actions ) { - if( !is_array( $actions ) ) { - $actions = array( $actions ); - } - foreach( $actions as $action ) { - if( method_exists( $object, $action ) ) { - $callback = array( $object, $action ); - add_action( $hookTag, $callback ); - } - } - } + $this->_addAutoMethods( $object ); } } + function _addAutoMethods( $object ) { + $autoHooks = array( + "init" => "init", + "admin_init" => "adminInit" + ); + foreach( $autoHooks as $hookTag => $actions ) { + if( !is_array( $actions ) ) { + $actions = array( $actions ); + } + foreach( $actions as $action ) { + if( method_exists( $object, $action ) ) { + $callback = array( $object, $action ); + add_action( $hookTag, $callback ); + } + } + } + } + function _registerActions() { $hooks = array(); @@ -49,6 +54,70 @@ function _registerActions() { } } + function versionMatch( $ver1, $ver2 = null ) { + if( is_null( $ver2 ) ) { + $ver2 = $this->_version(); + } + if( strpos( $ver2, "beta" ) ) { + return false;//this is a beta plugin so we should assume run update hooks all the time + } + if( $ver1 == $ver2 ) { + return true; + } + return fasle; + } + + function userAgentInfo() { + $ua = $_SERVER['HTTP_USER_AGENT']; + $info = array( + 'device' => 'pc', + 'os' => 'unknown', + 'browser' => 'unknown' + ); + if( strpos( $ua, "ipad" ) ) { + $info['device'] = "iPad"; + $info['os'] = 'ios'; + $info['browser'] = 'Mobile Safari'; + return $info; + } else if( strpos( $ua, "iPod" ) ) { + $info['device'] = "iPod"; + $info['os'] = 'ios'; + $info['browser'] = 'Mobile Safari'; + return $info; + } else if( strpos( $ua, "iPhone" ) ) { + $info['device'] = "iPhone"; + $info['os'] = 'ios'; + $info['browser'] = 'Mobile Safari'; + return $info; + } + + //not an ios device + if( strpos( $ua, "Windows NT 6.2" ) ) { + $info['os'] = 'Windows 8'; + } else if( strpos( $ua, "Windows NT 6.1" ) ) { + $info['os'] = 'Windows 7'; + } else if( strpos( $ua, "Windows NT 6.0" ) ) { + $info['os'] = 'Windows Vista'; + } else if( strpos( $ua, "Windows NT 5.1" ) ) { + $info['os'] = 'Windows XP'; + } else if( strpos( $ua, "Macintosh" ) ) { + $info['os'] = "OSX"; + } + //do the browser + if( strpos( $ua, "Chrome" ) ) { + $info['browser'] = 'Chrome'; + } else if( strpos( $ua, "Safari" ) ) { + $info['browser'] = 'Safari'; + } else if( strpos( $ua, "MSIE" ) ) { + $info['browser'] = 'Internet Explorer'; + } else if( strpos( $ua, "Firefox" ) ) { + $info['browser'] = 'Firefox'; + } else if( strpos( $ua, "Opera" ) ) { + $info['browser'] = 'Opera'; + } + return $info; + } + } ?> \ No newline at end of file diff --git a/lava/_classes/lavaPage.php b/lava/_classes/lavaPage.php index 5497d1a..501ec54 100644 --- a/lava/_classes/lavaPage.php +++ b/lava/_classes/lavaPage.php @@ -53,6 +53,10 @@ function _registerActions() { $this->registerActions(); } + } + + function loadPage() { + } function get( $what ) @@ -158,15 +162,27 @@ function displayHeader() })(); +
+
+ + + + + +
+
-

-
+

+ + -
- -

+ runActions( "ajaxChecks" ); ?> + + + +
@@ -177,15 +193,19 @@ function displayHeader()
  • get( "slug" ) ){ echo "active"; } ?>">get( "title" ); ?>
  • + runActions( "lavaNav" ); ?>
    + runActions( "pageHiddenStuff" ); ?> +
    runActions( "displayUnderground" ); $this->displayUnderground(); ?>
    @@ -198,7 +218,7 @@ function displayHeader() function displayUnderground() { - //sub classes should overload this method or rely on js to move things around (if have to) + //sub classes should overload this method or rely on js to move things around (if they have to) } function displayFooter() @@ -265,6 +285,11 @@ function displayToolbar() _framework() ); diff --git a/lava/_classes/lavaPages.php b/lava/_classes/lavaPages.php index 0cd22ec..8765479 100644 --- a/lava/_classes/lavaPages.php +++ b/lava/_classes/lavaPages.php @@ -40,7 +40,8 @@ function lavaConstruct() $this->addStyle( $this->_slug( "dropkick" ), "lava/_static/dropkick.css" ); $this->addStyle( $this->_slug( "codemirror" ), "lava/_static/codemirror/codemirror.css" ); $this->addStyle( $this->_slug( "codemirror-theme" ), "lava/_static/codemirror/codemirror.theme.css" ); - $this->addStyle( $this->_slug( "colorpicker-theme" ), "lava/_static/colorpicker/colorpicker.css" ); + $this->addStyle( $this->_slug( "lobster" ), "http://fonts.googleapis.com/css?family=Lobster" ); + //$this->addStyle( $this->_slug( "colorpicker-theme" ), "lava/_static/colorpicker/colorpicker.css" ); $this->addScript( $this->_slug( "lavaScripts" ), "lava/_static/scripts.js", array( "jquery" ) ); $this->addScript( $this->_slug( "dropkick" ), "lava/_static/dropkick.js", array( "jquery" ) ); @@ -52,7 +53,8 @@ function lavaConstruct() $this->addScript( $this->_slug( "jquery-iframe-transport" ), "lava/_static/jquery.iframe-transport.js", array( "jquery" ) ); $this->addScript( $this->_slug( "codemirror" ), "lava/_static/codemirror/codemirror.js" ); $this->addScript( $this->_slug( "codemirror-css" ), "lava/_static/codemirror/codemirror.css.js" ); - $this->addScript( $this->_slug( "colorpicker" ), "lava/_static/colorpicker/colorpicker.js" ); + $this->addScript( $this->_slug( "colorpicker" ), "lava/_static/autoResize.js", array( "jquery" ) ); + //$this->addScript( $this->_slug( "colorpicker" ), "lava/_static/colorpicker/colorpicker.js" ); add_action( "admin_enqueue_scripts", array( $this, "registerIncludes" ) ); diff --git a/lava/_classes/lavaPlugin.php b/lava/_classes/lavaPlugin.php index b029924..1e6bf74 100644 --- a/lava/_classes/lavaPlugin.php +++ b/lava/_classes/lavaPlugin.php @@ -33,7 +33,7 @@ class lavaPlugin * * @since 1.0.0 */ - function __construct( $pluginFile, $pluginName, $pluginVersion ) + function __construct( $pluginFile, $pluginName, $pluginVersion, $loadVendor = true ) { $this->pluginFile = $pluginFile; $this->pluginName = $pluginName; @@ -51,6 +51,11 @@ function __construct( $pluginFile, $pluginName, $pluginVersion ) } $this->_misc();//initialise this class + if( $loadVendor ) { + require_once( dirname( $pluginFile ) . "/vendor.php" ); + $className = $this->_slug( "vendor" ); + $this->pluginVendor = $this->_new( $className ); + } } /** @@ -70,6 +75,11 @@ function __autoload( $className ) { include_once( dirname( __FILE__ ) . "/{$className}.php" ); } + + if( file_exists( dirname( $this->_file() ) . "/_classes/{$className}.php" ) AND !class_exists( $className ) )//don't want to include the file if it doesn't exist + { + include_once( dirname( $this->_file() ) . "/_classes/{$className}.php" ); + } } @@ -221,7 +231,7 @@ function _handle( $what, $reset ) } else { - return $this->$pointer; + return $this->$pointer->getThis(); } } diff --git a/lava/_classes/lavaSetting.php b/lava/_classes/lavaSetting.php index 22f5536..0eb62d9 100644 --- a/lava/_classes/lavaSetting.php +++ b/lava/_classes/lavaSetting.php @@ -79,9 +79,20 @@ function setType( $type ) case "colour"://that's more like it //no support for alpha channels at this time $this->setDefault( "#FFFFFF", false ); + $this->addTag( "reset-to-default" ); break; case "password": $this->setDefault( "password" ); + $this->addTag( "reset-to-default" ); + break; + case "timeperiod": + $this->addTag( "reset-to-default" ); + break; + case "image": + $this->addTag( "reset-to-default" ); + break; + case "textarea": + $this->addTag( "reset-to-default" ); break; } return $this->_settings( false ); @@ -466,16 +477,16 @@ function getClasses( $format = false ) { $classes = array(); - $classes[] = "setting"; - $classes[] = "clearfix"; + $classes["setting"] = "setting"; + $classes["clearfix"] = "clearfix"; foreach( $this->tags as $tag ) { - $classes[] = "tag-{$tag}"; + $classes["tag-{$tag}"] = "tag-{$tag}"; } $type = $this->getType(); - $classes[] = "type-{$type}"; + $classes["type-{$type}"] = "type-{$type}"; $classes = $this->runFilters( "settingClasses", $classes ); @@ -661,6 +672,8 @@ function doSetting() $settingID = "setting-cntr_{$pluginSlug}-{$settingWho}-{$settingKey}"; $settingStart = "
    "; + + $settingAbsElements = $this->runFilters( "settingAbsElements", '' ); $statusIndicator = ''; $preSettingStart = '
    '; $settingName = "$name$help"; @@ -684,8 +697,9 @@ function doSetting() $settingFull = " $settingStart + $settingAbsElements $statusIndicator - + $preSettingStart $settingName $preSettingEnd @@ -780,7 +794,7 @@ function doSettingControl( $type = "default" ) break; case "password": - $settingControl = ""; + $settingControl = ""; break; case "timeperiod": diff --git a/lava/_classes/lavaSettings.php b/lava/_classes/lavaSettings.php index 5a1c462..78f164f 100644 --- a/lava/_classes/lavaSettings.php +++ b/lava/_classes/lavaSettings.php @@ -212,6 +212,8 @@ function getCache( $who ) function putCache( $who, $cache) { $this->settingCache[ $who ] = $cache; + + return $this; } function updateCache( $who = "*" ) @@ -228,6 +230,8 @@ function updateCache( $who = "*" ) { $this->updateOption( $this->_slug( $who ), $this->settingCache[ $who ] ); } + + return $this; } function config( $key, $default = null ) @@ -255,7 +259,6 @@ function updateOption( $option, $value ) { return update_site_option( $option, $value ); } - update_option( "test", "bob" ); return update_option( $option, $value ); } } diff --git a/lava/_classes/lavaSettingsCallback.php b/lava/_classes/lavaSettingsCallback.php index c91f3ba..0a65dd3 100644 --- a/lava/_classes/lavaSettingsCallback.php +++ b/lava/_classes/lavaSettingsCallback.php @@ -37,7 +37,7 @@ function lavaConstruct() //settingActions $hookTag = "settingActions"; add_filter( $this->_slug( "{$hookTag}-type/password" ), array( $this, "addShowPassword" ) ); - add_filter( $this->_slug( "{$hookTag}" ), array( $this, "addResetToDefault" ) ); + add_filter( $this->_slug( "{$hookTag}-tag/reset-to-default" ), array( $this, "addResetToDefault" ) ); //settingControl $hookTag = "settingControl"; @@ -131,7 +131,7 @@ function addTimePeriodSelector( $settingControl, $theSetting ) } $settingControl .= '
    '. '
    '. - ''. + ''. '
    '. ''. + ''. $settingControl. '
    '; return $settingControl; @@ -183,7 +183,7 @@ function addTextWrapper( $settingControl, $theSetting ) $placeholder = 'placeholder="'. $theSetting->getProperty( "placeholder" ) .'"'; $settingControl = '
    '. '
    '. - ''. + ''. '
    '; return $settingControl; } @@ -321,7 +321,7 @@ function addTextareaUx( $settingControl, $theSetting ) { $settingVars = $theSetting->getVars(); extract( $settingVars ); - $settingControl = ''; + $settingControl = ''; return $settingControl; } diff --git a/lava/_classes/lavaSettingsPage.php b/lava/_classes/lavaSettingsPage.php index c1931db..b3565b3 100644 --- a/lava/_classes/lavaSettingsPage.php +++ b/lava/_classes/lavaSettingsPage.php @@ -8,7 +8,6 @@ function loadPage() { $this->saveSettings(); $this->resetSettings(); - add_action( $this->_slug( "toolbar" ), array($this, "toolbarButtons") ); $this->addAction( "toolbarButtons" ); //queue notifications //do redirect diff --git a/lava/_classes/lavaSkins.php b/lava/_classes/lavaSkins.php index 0830b59..ab7fb8c 100644 --- a/lava/_classes/lavaSkins.php +++ b/lava/_classes/lavaSkins.php @@ -42,7 +42,7 @@ function lavaConstruct() $this->_settings() ->addSetting( 'skin', 'skins' ) ->setType( 'skin' ) - ->setName( __( 'Current skin', $this->_framework() ) ) + ->setName( __( 'Select a skin', $this->_framework() ) ) ->setDefault( 'default' ); } diff --git a/lava/_classes/lavaSkinsCallback.php b/lava/_classes/lavaSkinsCallback.php index 657e9dd..db57bc9 100644 --- a/lava/_classes/lavaSkinsCallback.php +++ b/lava/_classes/lavaSkinsCallback.php @@ -57,10 +57,27 @@ function lavaConstruct() function addSkinsUx( $settingControl, $theSetting ) { + extract( $theSetting->getVars() ); $settingControl = '
    ' . $settingControl . '
    '; - $settingControl .= '
    Skin Thumbnail
    ' . __( "Change Skin", $this->_framework() ) . '
    '; - //add ux cntr, put in the labels, js will handle the rest + $settingControl .= '
    '; + + $skins = $this->_skins()->fetchSkins(); + + foreach( $skins as $skin ){ + $settingControl .= ' +
    + + Skin Thumbnail + Select Skin +
    +

    ' . $skin->getName() . '

    +
    +
    +
    '; + } + + $settingControl .= "
    "; return $settingControl; } diff --git a/lava/_classes/lavaSkinsPage.php b/lava/_classes/lavaSkinsPage.php index 0f791c3..b896588 100644 --- a/lava/_classes/lavaSkinsPage.php +++ b/lava/_classes/lavaSkinsPage.php @@ -4,35 +4,5 @@ class lavaSkinsPage extends lavaSettingsPage public $multisiteSupport = true; public $who = "skins"; public $toolbarClasses = "toolbar-skins"; - - function displayUnderground() - { - $skins = $this->_skins()->fetchSkins(); - ?> -
    - -
    -
    - runActions( "skinRibbons" ) ?> -
    -
    - Skin Thumbnail" /> -
    - - - -
    -
    getName() ?> by getAuthor() ?>
    -
    -
    - -
    - _framework() ); - } } ?> \ No newline at end of file diff --git a/lava/_classes/lavaTable.php b/lava/_classes/lavaTable.php new file mode 100644 index 0000000..0014094 --- /dev/null +++ b/lava/_classes/lavaTable.php @@ -0,0 +1,175 @@ +slug = $slug; + } + + function adminInit() { + $this->consistencyCheck(); + } + + function addField( $slug ) { + if( !array_key_exists( $slug, $this->fields ) ) { + $args = array( + $slug + ); + $this->fields[ $slug ] = $this->_new( "lavaTableField", $args ); + } + if( ! $this->uniqueKeyAdded ) { + $this->uniqueKey = $this->fields[ $slug ]; + $this->uniqueKeyAdded = true; + } + $this->lavaContext( $this->fields[ $slug ] ); + return $this; + } + + function getVersion() { + $tables = $this->_settings()->getCache( "tables" ); + if( array_key_exists( $this->slug, $tables ) ) { + $table = $tables[ $this->slug ]; + + if( array_key_exists( "version", $table ) ) { + return $table['version']; + } + } + + return '0'; + } + + function setVersion( $version = null ) { + if( is_null( $version ) ) { + $version = $this->_version(); + } + $tables = $this->_settings()->getCache( "tables" ); + + $tables[ $this->slug ]['version'] = $version; + + $this->_settings()->putCache( "tables", $tables )->updateCache(); + } + + function consistencyCheck() { + $version = $this->getVersion(); + if( !$this->_misc()->versionMatch( $version ) ) { + //version mismatch - run upgrade/install functions + if( $this->doInstall() ) { + $this->setVersion(); + } + } + + } + + function getTableName() { + global $wpdb; + return $wpdb->prefix . $this->_slug( $this->slug ); + } + + function setOrderBy( $key ) { + $this->orderBy = $key; + } + + function getOrderBy() { + if( isset( $this->orderBy ) ) { + return $this->orderBy; + } else { + return $this->uniqueKey->slug; + } + } + + function doInstall() { + global $wpdb; + + if( count( $this->fields ) == 0 ) { + echo count( $this->fields ); + die('NO FIELDS IN TABLE: ' . $this->slug ); + return false; + } + + $tableName = $this->getTableName(); + + $sql = "CREATE TABLE $tableName ("; + + $count = count( $this->fields ); + + foreach( $this->fields as $i => $field ) { + $sql .= "\n" . $field->sqlShit() . ","; + } + + $sql .= "\nUNIQUE KEY id ({$this->uniqueKey->slug})"; + + $sql .= "\n);"; + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + dbDelta($sql); + return true; + } + + function insertRow( $row, $nonce = null ) { + global $wpdb; + if( !is_null( $nonce ) ) { + $hookTag = "insertRow/nonce-{$nonce}"; + $row = $this->runFilters( $hookTag, $row ); + } + if( ! is_null( $nonce ) and array_key_exists($nonce, $this->previousRows) ) { + $tableName = $this->getTableName(); + $uniqueId = $this->uniqueKey->slug; + $rowToDelete = $this->previousRows[ $nonce ]; + $sql = " + DELETE FROM {$tableName} + WHERE {$uniqueId} = {$rowToDelete} + "; + //$wpdb->query( $sql ); + } + $affected_rows = $wpdb->insert( $this->getTableName(), $row ); + $row_id = $wpdb->insert_id; + + if( !is_null( $nonce ) ) { + $this->previousRows[ $nonce ] = $row_id; + } + } + + function getResults( $where = null, $orderBy = null, $startFrom = 0, $numberOfResults = 100 ) { + global $wpdb; + $tableName = $this->getTableName(); + + if( is_null( $orderBy ) ) { + $orderBy = $this->getOrderBy(); + } + + $sql = + "SELECT * + FROM {$tableName} + "; + + if( !is_null( $where ) ) { + $sql .= "WHERE {$where} + "; + } + + if( !is_null( $orderBy ) ) { + $sql .= "ORDER BY {$orderBy} + "; + } + + + $result = $wpdb->get_results( $sql, ARRAY_A ); + + return $result; + } +} +?> \ No newline at end of file diff --git a/lava/_classes/lavaTableField.php b/lava/_classes/lavaTableField.php new file mode 100644 index 0000000..4744808 --- /dev/null +++ b/lava/_classes/lavaTableField.php @@ -0,0 +1,131 @@ +slug = $slug; + } + + function setType( $type ) { + $this->type = $type; + + return $this->_tables( false ); + } + + function setMaxLength( $max ) { + $this->maxLength = $max; + + + return $this->_tables( false ); + } + + function getType( $format = true ) { + if( $format ): + switch( $this->type ){ + case 'varchar': + return " varchar({$this->getMaxLength()})"; + case 'mediumint': + return " mediumint({$this->getMaxLength()})"; + default: + return " {$this->type}"; + } + endif; + return " " . $this->type; + + } + + function getMaxLength() { + if( isset( $this->maxLength ) ) { + return $this->maxLength; + } + switch( $this->getType( false ) ){ + case "varchar": + return 255; + break; + case "text": + return 1000; + break; + + } + return 30; + } + + function getDefault() { + if( $this->noDefault ) { + return; + } + if( isset( $this->default ) ) { + return " DEFAULT $this->default"; + } else { + switch( $this->type ) { + case "int": + case "mediumint": + case "bigint": + case "tinyint": + return " DEFAULT 0"; + break; + case "varchar": + return " DEFAULT ''"; + } + } + } + + function setDefault( $default ) { + switch( $this->type ) { + case 'varchar': + $this->default = "'$default'"; + break; + case "int": + case "mediumint": + case "bigint": + case "tinyint": + default: + $this->default = $default; + break; + } + + return $this->_tables( false ); + } + + function getNotNull() { + if( $this->notNull ) { + return " NOT NULL"; + } + } + + function setAutoIncrement( $bool = true ) { + $this->autoIncrement = $bool; + + if( $bool ) { + $this->noDefault = true; + } + + return $this->_tables( false ); + } + + function getAutoIncrement() { + if( $this->autoIncrement ) { + return " AUTO_INCREMENT"; + } + } + + function sqlShit() { + return "{$this->slug}{$this->getType()}{$this->getDefault()}{$this->getNotNull()}{$this->getAutoIncrement()}"; + return "{$this->slug}{$this->getType()}{$this->getDefault()}{$this->getNotNull()}{$this->getAutoIncrement()}"; + } +} +?> \ No newline at end of file diff --git a/lava/_classes/lavaTablePage.php b/lava/_classes/lavaTablePage.php index ee298ed..80238fa 100644 --- a/lava/_classes/lavaTablePage.php +++ b/lava/_classes/lavaTablePage.php @@ -1,15 +1,93 @@ addAction( "toolbarButtons" ); + } + function setDataSource( $dataSource ) { - //$this->dataSource = $this->_tables()->fetchTable( $dataSource ); + $this->dataSource = $dataSource; return $this->_pages( false ); } function setDisplayOrder( $displayString ) { + $this->displayOrder = explode( ";", $displayString ); + $dataSourceSlug = $this->dataSource; + $hookTag = "_dataSourceAjax_row/dataSource:{$dataSourceSlug}"; + $this->addFilter( $hookTag, "doDisplayOrder" ); return $this->_pages( false ); } + + function doDisplayOrder( $row ) { + $newRow = array(); + foreach( $this->displayOrder as $field ) { + if( array_key_exists( $field, $row ) ) { + $newRow[ $field ] = $row[ $field ]; + } + } + foreach( $row as $field => $value ) { + if( !in_array( $field , $this->displayOrder) ) { + $newRow[ $field ] = $value; + } + } + + return $newRow; + } + + function displayPage() { + if( is_null( $this->dataSource ) ) { + $this->dieWith( "No data source specified for this page" ); + } + $this->displayLoader(); + $this->doTable(); + } + + function setOrderBy( $order ) { + $this->_tables()->fetchTable( $this->dataSource )->setOrderBy( $order ); + return $this->_pages( false ); + } + + function displayLoader(){ + ?> +
    +
    + + + + + +
    +
    + +
    " data-ajax-nonce="_slug( "data_source" ) ); ?>"> + + +
    +
    + +
    + + +
    + \ No newline at end of file diff --git a/lava/_classes/lavaTables.php b/lava/_classes/lavaTables.php new file mode 100644 index 0000000..f90e20e --- /dev/null +++ b/lava/_classes/lavaTables.php @@ -0,0 +1,49 @@ +getContext() ) ) { + return $this->getContext(); + } + return $this; + } + + function addTable( $slug ) { + if( !array_key_exists( $slug, $this->tables ) ) { + $args = array( + $slug + ); + $this->tables[ $slug ] = $this->_new( "lavaTable", $args ); + } + $this->lavaContext( $this->tables[ $slug ] ); + return $this->tables[ $slug ]->withinContext( $this ); //return table object but tell it to remember who its parent is and pass on any method calls not intented for it + } + + function fetchTable( $slug ) { + $this->clearContext(); + if( array_key_exists($slug, $this->tables) ) { + $this->setContext( $this->tables[ $slug ] ); + } + + return $this; + } + + function tableExists( $slug ) { + if( array_key_exists($slug, $this->tables) ) { + return true; + } + return false; + } +} +?> \ No newline at end of file diff --git a/lava/_static/autoResize.js b/lava/_static/autoResize.js new file mode 100644 index 0000000..b82f942 --- /dev/null +++ b/lava/_static/autoResize.js @@ -0,0 +1,274 @@ +/* + * jQuery.fn.autoResize 1.14 + * -- + * https://github.com/padolsey/jQuery.fn.autoResize + * -- + * This program is free software. It comes without any warranty, to + * the extent permitted by applicable law. You can redistribute it + * and/or modify it under the terms of the Do What The Fuck You Want + * To Public License, Version 2, as published by Sam Hocevar. See + * http://sam.zoy.org/wtfpl/COPYING for more details. */ + +(function($){ + + var uid = 'ar' + +new Date, + + defaults = autoResize.defaults = { + onResize: function(){}, + onBeforeResize: function(){return 123}, + onAfterResize: function(){return 555}, + animate: { + duration: 200, + complete: function(){} + }, + extraSpace: 50, + minHeight: 'original', + maxHeight: 500, + minWidth: 'original', + maxWidth: 500 + }; + + autoResize.cloneCSSProperties = [ + 'lineHeight', 'textDecoration', 'letterSpacing', + 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', + 'textTransform', 'textAlign', 'direction', 'wordSpacing', 'fontSizeAdjust', + 'paddingTop', 'paddingLeft', 'paddingBottom', 'paddingRight', 'width' + ]; + + autoResize.cloneCSSValues = { + position: 'absolute', + top: -9999, + left: -9999, + opacity: 0, + overflow: 'hidden' + }; + + autoResize.resizableFilterSelector = [ + 'textarea:not(textarea.' + uid + ')', + 'input:not(input[type])', + 'input[type=text]', + 'input[type=password]', + 'input[type=email]', + 'input[type=url]' + ].join(','); + + autoResize.AutoResizer = AutoResizer; + + $.fn.autoResize = autoResize; + + function autoResize(config) { + this.filter(autoResize.resizableFilterSelector).each(function(){ + new AutoResizer( $(this), config ); + }); + return this; + } + + function AutoResizer(el, config) { + + if (el.data('AutoResizer')) { + el.data('AutoResizer').destroy(); + } + + config = this.config = $.extend(true, {}, autoResize.defaults, config); + this.el = el; + + this.nodeName = el[0].nodeName.toLowerCase(); + + this.originalHeight = el.height(); + this.previousScrollTop = null; + + this.value = el.val(); + + if (config.maxWidth === 'original') config.maxWidth = el.width(); + if (config.minWidth === 'original') config.minWidth = el.width(); + if (config.maxHeight === 'original') config.maxHeight = el.height(); + if (config.minHeight === 'original') config.minHeight = el.height(); + + if (this.nodeName === 'textarea') { + el.css({ + resize: 'none', + overflowY: 'hidden' + }); + } + + el.data('AutoResizer', this); + + // Make sure onAfterResize is called upon animation completion + config.animate.complete = (function(f){ + return function() { + config.onAfterResize.call(el); + return f.apply(this, arguments); + }; + }(config.animate.complete)); + + this.bind(); + + } + + AutoResizer.prototype = { + + bind: function() { + + var check = $.proxy(function(){ + this.check(); + return true; + }, this); + + this.unbind(); + + this.el + .bind('keyup.autoResize', check) + //.bind('keydown.autoResize', check) + .bind('change.autoResize', check) + .bind('paste.autoResize', function() { + setTimeout(function() { check(); }, 0); + }); + + if (!this.el.is(':hidden')) { + this.check(null, true); + } + + }, + + unbind: function() { + this.el.unbind('.autoResize'); + }, + + createClone: function() { + + var el = this.el, + clone = this.nodeName === 'textarea' ? el.clone() : $(''); + + this.clone = clone; + + $.each(autoResize.cloneCSSProperties, function(i, p){ + clone[0].style[p] = el.css(p); + }); + + clone + .removeAttr('name') + .removeAttr('id') + .addClass(uid) + .attr('tabIndex', -1) + .css(autoResize.cloneCSSValues); + + if (this.nodeName === 'textarea') { + clone.height('auto'); + } else { + clone.width('auto').css({ + whiteSpace: 'nowrap' + }); + } + + }, + + check: function(e, immediate) { + + if (!this.clone) { + this.createClone(); + this.injectClone(); + } + + var config = this.config, + clone = this.clone, + el = this.el, + value = el.val(); + + // Do nothing if value hasn't changed + if (value === this.prevValue) { return true; } + this.prevValue = value; + + if (this.nodeName === 'input') { + + clone.text(value); + + // Calculate new width + whether to change + var cloneWidth = clone.width(), + newWidth = (cloneWidth + config.extraSpace) >= config.minWidth ? + cloneWidth + config.extraSpace : config.minWidth, + currentWidth = el.width(); + + newWidth = Math.min(newWidth, config.maxWidth); + + if ( + (newWidth < currentWidth && newWidth >= config.minWidth) || + (newWidth >= config.minWidth && newWidth <= config.maxWidth) + ) { + + config.onBeforeResize.call(el); + config.onResize.call(el); + + el.scrollLeft(0); + + if (config.animate && !immediate) { + el.stop(1,1).animate({ + width: newWidth + }, config.animate); + } else { + el.width(newWidth); + config.onAfterResize.call(el); + } + + } + + return; + + } + + // TEXTAREA + + clone.width(el.width()).height(0).val(value).scrollTop(10000); + + var scrollTop = clone[0].scrollTop; + + // Don't do anything if scrollTop hasen't changed: + if (this.previousScrollTop === scrollTop) { + return; + } + + this.previousScrollTop = scrollTop; + + if (scrollTop + config.extraSpace >= config.maxHeight) { + el.css('overflowY', ''); + scrollTop = config.maxHeight; + immediate = true; + } else if (scrollTop <= config.minHeight) { + scrollTop = config.minHeight; + } else { + el.css('overflowY', 'hidden'); + scrollTop += config.extraSpace; + } + + config.onBeforeResize.call(el); + config.onResize.call(el); + + // Either animate or directly apply height: + if (config.animate && !immediate) { + el.stop(1,1).animate({ + height: scrollTop + }, config.animate); + } else { + el.height(scrollTop); + config.onAfterResize.call(el); + } + + }, + + destroy: function() { + this.unbind(); + this.el.removeData('AutoResizer'); + this.clone.remove(); + delete this.el; + delete this.clone; + }, + + injectClone: function() { + ( + autoResize.cloneContainer || + (autoResize.cloneContainer = $('').appendTo('body')) + ).append(this.clone); + } + + }; + +})(jQuery); \ No newline at end of file diff --git a/lava/_static/images/Thumbs.db b/lava/_static/images/Thumbs.db index ad516a4..2957d52 100644 Binary files a/lava/_static/images/Thumbs.db and b/lava/_static/images/Thumbs.db differ diff --git a/lava/_static/scripts.js b/lava/_static/scripts.js index a922722..c3a7792 100644 --- a/lava/_static/scripts.js +++ b/lava/_static/scripts.js @@ -2,6 +2,9 @@ var lavaAnimations = true; var codeBoxes = new Array(); jQuery(document).ready(function(){ + addResetSettings(); + bindSkin(); + jQuery('.js-only').removeClass('js-only'); jQuery('.js-fallback').hide(); jQuery('select').dropkick(); @@ -13,9 +16,8 @@ jQuery(document).ready(function(){ bindImageChange(); bindFocus(); bindSettingToggle(); - - addResetSettings(); - parseSkin(); + bindAutoResize(); + bindDataSource(); prettifyCheckboxes(); prettifyPasswords(); @@ -93,14 +95,14 @@ function prettifyPasswords() jQuery(this).find( ".show-password-handle" ).click(function(){ var currentPassword = jQuery(this).parents('.setting').find('.input-cntr').attr("data-show", "text").find( '.password-show' ).val();//hack to prevent browser from selecting text in field - jQuery(this).parents('.setting').find( '.password-show' ).focus().val( currentPassword ); + jQuery(this).parents('.setting').find( '.password-show' ).change().focus().val( currentPassword ); jQuery(this).siblings(".hide-password-handle").show(); jQuery(this).hide(); }); jQuery(this).find( ".hide-password-handle" ).click(function(){ var currentPassword = jQuery(this).parents('.setting').find('.input-cntr').attr("data-show", "password").find( 'input[type="password"]' ).val(); - jQuery(this).parents('.setting').find( 'input[type="password"]' ).focus().val( currentPassword ); + jQuery(this).parents('.setting').find( 'input[type="password"]' ).change().focus().val( currentPassword ); jQuery(this).siblings(".show-password-handle").show(); jQuery(this).hide(); }); @@ -173,8 +175,6 @@ function prettifyColors() { return false; }, onChange: function (hsb, hex, rgb) { - console.log('asdss'); - console.log(this); } });;//load current colour jQuery(this).find('.lava-shadow-overlay').click(function(){ @@ -293,13 +293,6 @@ function bindButtons() { }); jQuery(".lava-btn.lava-btn-hide-underground").click(function(){ hideUnderground(); - }); - //the select skin button - jQuery(".lava-btn.lava-btn-select-skin").click(function(){ - var skinSlug = jQuery(this).attr( "data-slug" ); - jQuery('#private_blog-skins-skin').val( skinSlug ); - hideUnderground(); - parseSkin(); }); //not implemented buttons jQuery(".lava-btn.not-implemented").addClass("lava-btn-disabled").addClass("tiptip-right").attr("title", "This feature hasn't been imlemented yet :("); @@ -334,10 +327,15 @@ function bindSettingToggle() { function bindImageUpload() { jQuery('.setting.type-image .lava-file_upload-manual_select').bind('fileuploaddone', function (e, data) { - alert('bob'); }); } +function bindAutoResize() { + jQuery('.lava-auto-resize').autoResize({'extraSpace': 5, 'animate': false}).removeClass('lava-auto-resize').addClass('lava-auto-resize-init'); + + jQuery('.lava-auto-resize-init'); +} + function bindFocus() { jQuery('input.lava-focus-inner').focus(function(){ jQuery(this).parents('.lava-focus-outer').addClass( "focus" ); @@ -346,6 +344,54 @@ function bindFocus() { }); } +function bindDataSource() { + jQuery('.lava-table-loader-refresh-button').click(function(){ + doDataSource(); + }) + doDataSource(); +} + +function doDataSource() { + jQuery('.lava-full-page-loader').show(); + jQuery('.lava-table-viewer').each(function(){ + jQuery(this).find('table').html(""); + var dataSource = jQuery(this).attr( "data-data-source" ); + var action = jQuery(this).attr( "data-ajax-action" ); + var nonce = jQuery(this).attr( "data-ajax-nonce" ); + jQuery.getJSON( ajaxurl + '?action=' + action + '&nonce=' + nonce + '&data-source=' + dataSource, function(data) { + jQuery('.lava-full-page-loader').hide(); + parseTableData( dataSource, data["data"]["data"] ); + }); + }); + + jQuery('.lava-table-update-trigger').change(function(){ + jQuery(this).siblings('table').find('.impelements-timestamp').each(function(){ + var timestamp = jQuery(this).html(); + }); + }); +} + +function parseTableData( dataSource, data ) { + + var theTable = jQuery('.lava-table-viewer[data-data-source="' + dataSource + '"] table'); + var theTableBody = jQuery(theTable).find('tbody'); + + for( row in data ) { + var theRow = jQuery("").appendTo(theTableBody); + for( column in data[row] ) { + var theCol = jQuery("").appendTo( theRow ); + jQuery(theCol).attr('class', data[row][column]['classes']); + jQuery(theCol).addClass( "cell-" + column ); + jQuery(theCol).attr( "data-value" + data[row][column] ); + jQuery(theCol).html( data[row][column]['data'] ); + jQuery(theCol).attr( "title", data[row][column]['title'] ); + } + } + + jQuery('.lava-table-update-trigger').change(); + +} + function restartStickyTop() { var leftPosition = jQuery('#adminmenuback').outerWidth();//work out how far from the left it should be when absolutely positioned; @@ -413,8 +459,12 @@ function refreshStickyBottom() } -function showUnderground() { +function showUnderground( context ) { + if( typeof(context) == undefined ) { + context = "page"; + } var animationDuration = 500; + jQuery('.lava-underground').attr( 'data-underground-context', context ); jQuery('.lava-underground').slideDown(animationDuration).removeClass('underground-hidden').addClass('underground-visible'); jQuery('.lava-overground .underground-cancel-bar').slideDown().animate({'opacity':1},animationDuration, function(){ jQuery('.lava-overground').addClass('lava-sticky-bottom'); @@ -433,18 +483,25 @@ function hideUnderground() { jQuery('.lava-content-cntr').removeClass( "no-toolbar" ); } -function parseSkin() { - jQuery( ".skin-selector .skin" ).removeClass( "active" ); - var currentTheme = jQuery('#private_blog-skins-skin').val(); - jQuery('.skin[data-slug="' + currentTheme + '"]').addClass('active'); - var imgSrc = jQuery('.skin[data-slug="' + currentTheme + '"] img').attr('src'); - jQuery('#setting-cntr_private_blog-skins-skin .skin-thumb img').attr({'src': imgSrc}); +function bindSkin() { + jQuery( ".setting.type-skin input[data-actual='true']" ).change(function(){ + jQuery(this).parents('.setting-control').find('.skin').removeClass( "selected" ); + var currentTheme = jQuery(this).val(); + jQuery('.skin[data-slug="' + currentTheme + '"]').addClass('selected'); + + //show skin options - //show skin options + jQuery('.setting.tag-skin-setting').addClass( 'tag-setting-hidden' ); + jQuery('.setting[data-skin="' + currentTheme + '"]').removeClass( 'tag-setting-hidden' ); + codeRefresh(); + bindAutoResize(); + }).change(); - jQuery('.setting.tag-skin-setting').addClass( 'tag-setting-hidden' ); - jQuery('.setting[data-skin="' + currentTheme + '"]').removeClass( 'tag-setting-hidden' ); - codeRefresh(); + jQuery( '.skin-selector .skin .select-skin').click(function(){ + var new_skin = jQuery(this).parents('.skin').attr('data-slug'); + jQuery(this).parents('.setting-control').find('input[data-actual="true"]').val(new_skin).change(); + }) + } function prettifyCode() { diff --git a/lava/_static/styles.css b/lava/_static/styles.css index 39c7cbf..f5f66be 100644 --- a/lava/_static/styles.css +++ b/lava/_static/styles.css @@ -38,7 +38,7 @@ background: #ce4c2d; } /* Navigation */ -.lava-nav { +#lava-nav { position: relative; display: block; z-index: 100; @@ -46,13 +46,15 @@ background: #CE3D2B; margin-left: -25px !important; margin-bottom: -55px; + padding-right: 50px; } -.lava-nav.sticky { +#lava-nav.sticky { position: fixed; right: 0px; margin-left: -6px !important; + padding-right: 65px; } -.lava-nav .left-grad { +#lava-nav .left-grad { position: absolute; left: 0px; bottom: -6px; @@ -60,7 +62,7 @@ border-top-color: #76251b; border-right-color: #76251b; } -.lava-nav .sticky-toggle { +#lava-nav .sticky-toggle { display: none; cursor: pointer; position: absolute; @@ -73,13 +75,13 @@ background-image: url(images/pin.png); opacity: 0.6; } -.lava-nav .sticky-toggle:hover { +#lava-nav .sticky-toggle:hover { opacity: 1; } -.lava-nav.lava-sticky .sticky-toggle { +#lava-nav.lava-sticky .sticky-toggle { opacity: 1; } -.lava-nav.lava-sticky .sticky-toggle:hover { +#lava-nav.lava-sticky .sticky-toggle:hover { opacity: 0.6; } ul.nav { @@ -172,6 +174,161 @@ ul.nav:hover li.active:hover a { color: white; text-shadow: 0px -1px 0px #000000; } +.lava-new-message { + border-left: 4px solid; + padding: 15px; + font-size: 14px; + margin-bottom: 10px; +} +.lava-new-message.lava-message-notice { + border-left-color: #999; + background: #efefef; + color: #333; +} +/* Loader */ +.lava-full-screen-loader { + display: none; + position: fixed; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background: white; + background: rgba(255, 255, 255, 0.7); + z-index: 200; +} +body.lava-loading { + -webkit-filter: blur(3px); + overflow: hidden; +} +body.lava-loading .lava-full-screen-loader { + display: block; +} +.lava-loader { + margin-left: -4px; + height: 50%; + position: relative; +} +.lava-loader.loading span { + display: block; +} +.lava-loader span { + display: none; + width: 4px; + height: 4px; + background-color: #dc4321; + position: absolute; + bottom: 0px; + left: 50%; +} +.lava-loader .child1 { + left: 30%; + animation: lava_loader_1 5s infinite; + -moz-animation: lava_loader_1 5s infinite; + /* Firefox */ + + -webkit-animation: lava_loader_1 5s infinite; + /* Safari and Chrome */ + +} +.lava-loader .child2 { + left: 40%; + animation: lava_loader_2 5s infinite; + -moz-animation: lava_loader_2 5s infinite; + /* Firefox */ + + -webkit-animation: lava_loader_2 5s infinite; + /* Safari and Chrome */ + +} +.lava-loader .child3 { + animation: lava_loader_3 5s infinite; + -moz-animation: lava_loader_3 5s infinite; + /* Firefox */ + + -webkit-animation: lava_loader_3 5s infinite; + /* Safari and Chrome */ + +} +.lava-loader .child4 { + left: 60%; + animation: lava_loader_4 5s infinite; + -moz-animation: lava_loader_4 5s infinite; + /* Firefox */ + + -webkit-animation: lava_loader_4 5s infinite; + /* Safari and Chrome */ + +} +.lava-loader .child5 { + left: 70%; + animation: lava_loader_5 5s infinite; + -moz-animation: lava_loader_5 5s infinite; + /* Firefox */ + + -webkit-animation: lava_loader_5 5s infinite; + /* Safari and Chrome */ + +} +@-webkit-keyframes lava_loader_1 { + 0% { + left: -40%; + } + 50% { + left: 40%; + } + 90%, 100% { + left: 100%; + } +} +@-webkit-keyframes lava_loader_2 { + 0% { + left: -30%; + } + 50% { + left: 45%; + } + 90%, 100% { + left: 110%; + } +} +@-webkit-keyframes lava_loader_3 { + 0% { + left: -20%; + } + 50% { + left: 50%; + } + 90%, 100% { + left: 120%; + } +} +@-webkit-keyframes lava_loader_4 { + 0% { + left: -10%; + } + 50% { + left: 55%; + } + 90%, 100% { + left: 130%; + } +} +@-webkit-keyframes lava_loader_5 { + 0% { + left: 0%; + } + 50% { + left: 60%; + } + 90%, 100% { + left: 140%; + } +} +.lava-full-page-loader { + height: 400px; + overflow: hidden; +} /* Page Construction */ .lava-content-cntr { overflow: hidden; @@ -190,9 +347,16 @@ ul.nav:hover li.active:hover a { padding-top: 20px; overflow: hidden; } -.lava-content-cntr .lava-underground.underground-hidden { +.lava-content-cntr .lava-underground.underground-hidden, .lava-content-cntr .lava-underground .underground-hidden { display: none; } +.lava-content-cntr .lava-underground .underground-section h2 { + text-align: center; + font-family: Lobster; + font-size: 45px; + text-shadow: 0px -1px #ffffff; + margin-bottom: 30px; +} .lava-content-cntr .lava-overground { background: #fafafa; position: relative; @@ -234,6 +398,7 @@ ul.nav:hover li.active:hover a { padding: 5px 0px; background: url(images/toolbar-repeat.png); box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); + z-index: 100; } .lava-toolbar.sticky { position: fixed; @@ -573,6 +738,8 @@ ul.nav:hover li.active:hover a { padding: 20px 0px; background: #FAFAFA; font-size: 23px; + padding-left: 20px; + padding-right: 20px; } .lava-btn.lava-btn-block:hover { background-color: whiteSmoke; @@ -591,10 +758,132 @@ ul.nav:hover li.active:hover a { -moz-box-shadow: inset 0 1px 15px rgba(0, 0, 0, 0.08); box-shadow: inset 0 1px 15px rgba(0, 0, 0, 0.08); } +/* Ajax Checks */ +.ajax-checks { + display: inline-block; + padding-left: 20px; + height: 20px; +} +.ajax-checks .ajax-check { + display: inline-block; + float: left; + margin-left: 8px; + margin-right: 8px; + width: 16px; + height: 16px; + margin-top: 5px; + border-radius: 8px; + -moz-border-radius: 8px; + -ms-border-radius: 8px; + -o-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; +} +.ajax-checks .ajax-check.loading { + background: #dcdcdc; + animation: "ajax-check-loading" 0.5s infinite; + -moz-animation: "ajax-check-loading" 0.5s infinite; + /* Firefox */ + + -webkit-animation: "ajax-check-loading" 0.5s infinite; + /* Safari and Chrome */ + +} +.ajax-checks .ajax-check.complete { + background-color: #eaf9d8; + animation: "ajax-check-complete" 2s 1; + -moz-animation: "ajax-check-complete" 2s 1; + /* Firefox */ + + -webkit-animation: "ajax-check-complete" 2s 1; + /* Safari and Chrome */ + +} +.ajax-checks .ajax-check.complete:hover { + background-color: #abea61; +} +.ajax-checks .ajax-check.error { + background-color: #ffc2c2; + animation: "ajax-check-error" 2s 1; + -moz-animation: "ajax-check-error" 2s 1; + /* Firefox */ + + -webkit-animation: "ajax-check-error" 2s 1; + /* Safari and Chrome */ + +} +.ajax-checks .ajax-check.error:hover { + background-color: #ff0000; +} +.ajax-checks .ajax-check.hidden { + display: none; +} +@-webkit-keyframes ajax-check-loading { + from { + margin-left: 11px; + margin-right: 11px; + width: 10px; + height: 10px; + border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + background-color: #c8c8c8; + margin-top: 8px; + } + to { + margin-left: 6px; + margin-right: 6px; + width: 20px; + height: 20px; + border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + -o-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + background-color: #fafafa; + margin-top: 3px; + } +} +@-webkit-keyframes ajax-check-complete { + from { + background-color: #7fc927; + } + to { + background-color: #eaf9d8; + } +} +@-webkit-keyframes ajax-check-error { + from { + background-color: #ff0000; + } + to { + background-color: #ffc2c2; + } +} /* WordPress elements */ #wpwrap { background: #fafafa; } +/* Table Page */ +.lava-table-viewer { + padding: 10px; + background: white; +} +.lava-table-viewer table tbody tr { + background: white; + cursor: default; + padding: 5px 0px; +} +.lava-table-viewer table tbody tr:nth-child(even) { + background: #fafafa; +} +.lava-table-viewer table tbody tr:hover { + background: #e8e8e8; +} /* Settings */ .settings-wrap { padding-top: 20px; @@ -617,8 +906,8 @@ ul.nav:hover li.active:hover a { .setting.lava-setting-toggle-hidden { display: none; } -.setting:hover { - background: rgba(253, 237, 168, 0.05); +.setting.tag-force-invisible { + display: none !important; } .setting:hover .status-indicator { opacity: 1; @@ -627,13 +916,13 @@ ul.nav:hover li.active:hover a { opacity: 0.3; } .setting .status-indicator { - opacity: 0.5; + opacity: 0.9; position: absolute; left: 5px; top: 0px; bottom: 0px; width: 5px; - background: #e6e6e6; + background: #fafafa; } .setting .pre-setting { line-height: 25px; @@ -674,7 +963,7 @@ ul.nav:hover li.active:hover a { line-height: 30px; } .setting .setting-inner .setting-control .input-cntr { - width: 215px; + min-width: 215px; float: left; height: 30px; background: white; @@ -708,13 +997,7 @@ ul.nav:hover li.active:hover a { background: transparent; outline: none; border: none; - position: absolute; - top: 0px; - bottom: 0px; - left: 0px; - right: 0px; - width: auto; - width: 215px; + min-width: 215px; } .setting .setting-inner .setting-actions { -webkit-user-select: none; @@ -765,7 +1048,11 @@ ul.nav:hover li.active:hover a { background-position: -52px 2px; } .setting[data-type="timeperiod"] .setting-inner .setting-control .input-cntr { - width: 80px; + min-width: 30px; +} +.setting[data-type="timeperiod"] .setting-inner .setting-control .input-cntr input { + min-width: 30px; + width: 30px; } .setting[data-type="skin"] .setting-inner .setting-control .skin-thumb { position: relative; @@ -914,6 +1201,7 @@ ul.nav:hover li.active:hover a { } .setting[data-type="textarea"] .setting-inner .setting-control textarea { min-width: 400px; + min-height: 60px; background: white; -webkit-box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.1); -moz-box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.1); @@ -1017,105 +1305,96 @@ ul.nav:hover li.active:hover a { } /* Skins page */ .skin-selector .skin { - width: 45%; - border: 1px solid #c3c3c3; - -webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); - -moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); float: left; - background: #f3f3f3; - padding: 4px; - border-radius: 4px; - -moz-border-radius: 4px; - -ms-border-radius: 4px; - -o-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - margin-right: 30px; - margin-bottom: 30px; position: relative; + overflow: hidden; + border: 1px solid rgba(220, 67, 33, 0.30000000000000004); } -.skin-selector .skin:hover { - border-color: #989898; - -webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); - box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); +.skin-selector .skin:hover, .skin-selector .skin.hover { + border: 1px solid rgba(220, 67, 33, 0.6); } -.skin-selector .skin.active .ribbon-active { +.skin-selector .skin:hover .select-skin .skin-overlay, .skin-selector .skin.hover .select-skin .skin-overlay { display: block; } -.skin-selector .skin .ribbon-active { - display: none; +.skin-selector .skin:hover .select-skin .skin-meta, .skin-selector .skin.hover .select-skin .skin-meta { + display: block; } -.skin-selector .skin .content { - background: white; - padding: 5px; - padding-right: 200px; - padding-bottom: 30px; - position: relative; +.skin-selector .skin.selected { + border: 4px solid #dc4321; } -.skin-selector .skin .content img { - width: 100%; - height: auto; +.skin-selector .skin.selected .select-skin { + margin: -4px; } -.skin-selector .skin .content .actions { - position: absolute; - top: 0px; - right: 0px; - width: 170px; - padding: 10px; - text-align: center; +.skin-selector .skin .select-skin { + position: relative; + overflow: hidden; + margin: -1px; } -.skin-selector .skin .content .actions button { - width: 170px; +.skin-selector .skin .select-skin img { + display: block; + border: 0; } -.skin-selector .skin .content .actions button.lava-btn-skin-cancel { +.skin-selector .skin .select-skin .skin-overlay { display: none; -} -.skin-selector .skin .content .name { position: absolute; + top: 0px; left: 0px; - right: 200px; + right: 0px; bottom: 0px; - height: 30px; - line-height: 30px; - text-align: center; - font-weight: bold; - font-size: 15px; - overflow: hidden; + background-color: white; + background-color: rgba(255, 255, 255, 0.9); + width: 600px; + height: 400px; + text-indent: -9999px; } -.skin-selector .skin .content .name::after { - content: ""; +.skin-selector .skin .select-skin .skin-meta { + display: none; + width: 400px; + height: 200px; position: absolute; top: 0px; - right: 0px; - bottom: 0px; - width: 20px; - background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, #ffffff 100%); - /* FF3.6+ */ - - background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(100%, #ffffff)); - /* Chrome,Safari4+ */ - - background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, #ffffff 100%); - /* Chrome10+,Safari5.1+ */ - - background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, #ffffff 100%); - /* Opera 11.10+ */ - - background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, #ffffff 100%); - /* IE10+ */ - - background: linear-gradient(left, rgba(255, 255, 255, 0) 0%, #ffffff 100%); - /* W3C */ - - filter: progid:dximagetransform.microsoft.gradient(startColorstr='#00ffffff', endColorstr='#ffffff', GradientType=1); - /* IE6-9 */ - + left: 0px; +} +.skin-selector .skin .select-skin .skin-meta h3 { + text-align: center; + margin-top: 80px; + font-size: 18px; + color: #D54E21; +} +.csstransforms.csstransitions .skin-selector .skin .select-skin:hover .skin-overlay, .csstransforms.csstransitions .skin-selector .skin .select-skin:hover .skin-meta h3 { + -webkit-transform: none; + -moz-transform: none; + -o-transform: none; + -ms-transform: none; + transform: none; +} +.csstransforms.csstransitions .skin-selector .skin .select-skin .skin-overlay { + display: block; + -moz-transition: all 0.4s ease-in-out; + -webkit-transition: all 0.4s ease-in-out; + -o-transition: all 0.4s ease-in-out; + -ms-transition: all 0.4s ease-in-out; + transition: all 0.4s ease-in-out; + -webkit-transform: translate(600px, -100px) rotate(45deg); + -moz-transform: translate(600px, -100px) rotate(45deg); + -o-transform: translate(600px, -100px) rotate(45deg); + -ms-transform: translate(600px, -100px) rotate(45deg); + transform: translate(600px, -100px) rotate(45deg); +} +.csstransforms.csstransitions .skin-selector .skin .select-skin .skin-meta { + display: block; } -.skin-selector .skin .content .name .author { - font-style: italic; - font-weight: normal; +.csstransforms.csstransitions .skin-selector .skin .select-skin .skin-meta h3 { + -moz-transition: all 0.4s ease-in-out; + -webkit-transition: all 0.4s ease-in-out; + -o-transition: all 0.4s ease-in-out; + -ms-transition: all 0.4s ease-in-out; + transition: all 0.4s ease-in-out; + -webkit-transform: translate(200px, -200px); + -moz-transform: translate(200px, -200px); + -o-transform: translate(200px, -200px); + -ms-transform: translate(200px, -200px); + transform: translate(200px, -200px); } /* Ribbons */ .ribbons { diff --git a/lava/_static/styles.less b/lava/_static/styles.less index 9d0d304..aae9fa5 100644 --- a/lava/_static/styles.less +++ b/lava/_static/styles.less @@ -50,7 +50,7 @@ /* Navigation */ -.lava-nav { +#lava-nav { position: relative; display: block; z-index: 100; @@ -58,11 +58,13 @@ background: #CE3D2B; margin-left: -25px !important; margin-bottom: -55px; + padding-right: 50px; &.sticky { position: fixed; right: 0px; margin-left: -6px !important; + padding-right: 65px; } .left-grad { @@ -197,6 +199,156 @@ ul.nav { } } +.lava-new-message { + border-left: 4px solid; + padding: 15px; + font-size: 14px; + margin-bottom: 10px; + + &.lava-message-notice { + border-left-color: #999; + background: #efefef; + color: #333; + } +} + +/* Loader */ + +.lava-full-screen-loader { + display: none; + position: fixed; + top:0px; + left: 0px; + right: 0px; + bottom: 0px; + background: white; + background: rgba(255,255,255,0.7); + z-index: 200; +} + +body.lava-loading { + -webkit-filter: blur( 3px); + overflow: hidden; + .lava-full-screen-loader { + display: block; + } +} + +@loader-block-dimension: 4px; +@loader-block-color: @ui-foreground-color; +@loader-animation-duration: 5s; +@loader-middle-spacing: 5; + +.lava-loader { + margin-left: -@loader-block-dimension; + height: 50%; + position: relative; + + &.loading { + span { + display: block; + } + } + + span { + display: none; + width: @loader-block-dimension; + height: @loader-block-dimension; + background-color: @loader-block-color; + position: absolute; + bottom: 0px; + left: 50%; + } + + .child1 { + left: 30%; + .animation( lava_loader_1, @loader-animation-duration, infinite ); + } + + .child2 { + left: 40%; + .animation( lava_loader_2, @loader-animation-duration, infinite ); + } + + .child3 { + .animation( lava_loader_3, @loader-animation-duration, infinite ); + } + + .child4 { + left: 60%; + .animation( lava_loader_4, @loader-animation-duration, infinite ); + } + + .child5 { + left: 70%; + .animation( lava_loader_5, @loader-animation-duration, infinite ); + } +} + +@-webkit-keyframes lava_loader_1 { + 0% { + left: -40%; + } + 50% { + left: 40%; + } + 90%, 100% { + left: 100%; + } +} + +@-webkit-keyframes lava_loader_2 { + 0% { + left: -30%; + } + 50% { + left: 45%; + } + 90%, 100% { + left: 110%; + } +} + +@-webkit-keyframes lava_loader_3 { + 0% { + left: -20%; + } + 50% { + left: 50%; + } + 90%, 100% { + left: 120%; + } +} + +@-webkit-keyframes lava_loader_4 { + 0% { + left: -10%; + } + 50% { + left: 55%; + } + 90%, 100% { + left: 130%; + } +} + +@-webkit-keyframes lava_loader_5 { + 0% { + left: 0%; + } + 50% { + left: 60%; + } + 90%, 100% { + left: 140%; + } +} + +.lava-full-page-loader { + height: 400px; + overflow: hidden; +} /* Page Construction */ @@ -220,9 +372,20 @@ ul.nav { padding-top:20px; overflow:hidden; - &.underground-hidden { + &.underground-hidden, .underground-hidden { display: none; } + + .underground-section { + h2 { + text-align: center; + font-family: Lobster; + font-size: 45px; + text-shadow: 0px -1px white; + margin-bottom: 30px; + } + } + } .lava-overground { @@ -274,6 +437,7 @@ ul.nav { padding: 5px 0px; background: url(images/toolbar-repeat.png); box-shadow: 0px 0px 3px rgba(0,0,0,0.5); + z-index: 100; &.sticky { position: fixed; @@ -485,6 +649,8 @@ ul.nav { padding: 20px 0px; background: #FAFAFA; font-size: 23px; + padding-left: 20px; + padding-right: 20px; &:hover { background-color: whiteSmoke; @@ -507,16 +673,133 @@ ul.nav { } } +/* Ajax Checks */ + +.ajax-checks { + display:inline-block; + padding-left: 20px; + height: 20px; + + .ajax-check { + display: inline-block; + float: left; + margin-left: 8px; + margin-right: 8px; + width: 16px; + height: 16px; + margin-top: 5px; + .border-radius(8px); + + &.loading { + background: rgb(220,220,220); + .animation( "ajax-check-loading", 0.5s, infinite ); + } + + &.complete { + background-color: #eaf9d8; + .animation( "ajax-check-complete", 2s, 1 ); + + &:hover { + background-color: #abea61; + } + } + + &.error { + background-color: #ffc2c2; + .animation( "ajax-check-error", 2s, 1 ); + + &:hover { + background-color: #ff0000; + } + } + + &.hidden { + display: none; + } + } +} + +@-webkit-keyframes ajax-check-loading { + from { + margin-left: 11px; + margin-right: 11px; + width: 10px; + height: 10px; + .border-radius(5px); + background-color: rgb(200,200,200); + margin-top: 8px; + } + + to { + margin-left: 6px; + margin-right: 6px; + width: 20px; + height: 20px; + .border-radius( 10px ); + background-color: rgb(250,250,250); + margin-top: 3px; + } +} + +@-webkit-keyframes ajax-check-complete { + from { + background-color: #7fc927; + } + + to { + background-color: #eaf9d8; + } +} + +@-webkit-keyframes ajax-check-error { + from { + background-color: #ff0000; + } + + to { + background-color: #ffc2c2; + } +} /* WordPress elements */ + #wpwrap { //background: url(images/bg.png) repeat !important; background: rgb(250,250,250); } +/* Table Page */ + +.lava-table-viewer { + padding: 10px; + background: white; + + + table { + tbody { + tr { + background: white; + cursor: default; + padding: 5px 0px; + + &:nth-child(even) { + background: rgb( 250, 250, 250 ); + } + + &:hover { + background: rgb( 232, 232, 232 ); + } + + td { + } + } + } + } +} + @@ -540,11 +823,14 @@ ul.nav { display: none; } + &.tag-force-invisible { + display: none !important; + } + &:hover { - background: rgba(253, 237, 168, 0.05); .status-indicator { - opacity:1; + opacity: 1; } .setting-inner { @@ -558,13 +844,13 @@ ul.nav { .status-indicator { - opacity: 0.5; + opacity: 0.9; position:absolute; left: 5px; top:0px; bottom:0px; width:5px; - background: rgb( 230, 230, 230); + background: #fafafa; } .pre-setting { @@ -607,7 +893,7 @@ ul.nav { line-height:30px; .input-cntr { - width: 215px; + min-width: 215px; float:left; height:30px; background: white; @@ -646,13 +932,7 @@ ul.nav { background: transparent; outline: none; border: none; - position: absolute; - top: 0px; - bottom: 0px; - left: 0px; - right: 0px; - width: auto; - width:215px; + min-width:215px; } } } @@ -725,7 +1005,11 @@ ul.nav { .setting-inner { .setting-control { .input-cntr { - width: 80px; + min-width: 30px; + input { + min-width: 30px; + width: 30px; + } } } } @@ -884,6 +1168,7 @@ ul.nav { .setting-control { textarea { min-width: 400px; + min-height: 60px; background: white; .box-shadow( inset 1px 1px 3px rgba(0, 0, 0, 0.1) ); .border-radius( 0px ); @@ -988,110 +1273,126 @@ ul.nav { /* Skins page */ .skin-selector { + .skin { + float: left; + position: relative; + overflow: hidden; + border: 1px solid fadeout(@ui-foreground-color, 70%); + + &:hover, &.hover { + border: 1px solid fadeout(@ui-foreground-color, 40%); + + .select-skin { + .skin-overlay { + display: block; + } + .skin-meta { + display: block; + } + } + } - .skin { - width: 45%; - border: 1px solid #c3c3c3; - .box-shadow( 1px 1px 2px rgba(0,0,0,0.1) ); - float: left; - background: #f3f3f3; - padding: 4px; - .border-radius( 4px ); - margin-right: 30px; - margin-bottom: 30px; - position: relative; - - - &:hover { - border-color:#989898; - .box-shadow( 1px 1px 2px rgba(0,0,0,0.2) ); - } - - &.active { - .ribbon-active { - display: block; - } - .content { - .actions { - button { - } - } - } - } - - .ribbon-active { - display: none; - } - - .content { - background: white; - padding: 5px; - padding-right: 200px; - padding-bottom: 30px; - position: relative; - - img { - width: 100%; - height: auto; - } - - .actions { - position: absolute; - top: 0px; - right: 0px; - width:170px; - padding: 10px; - text-align: center; + &.selected { + border: 4px solid @ui-foreground-color; + .select-skin { + margin: -4px; + } + } - button { - width: 170px; + .select-skin { + position: relative; + overflow: hidden; + margin: -1px; + - &.lava-btn-skin-cancel { - display: none; - } - } - } + img { + display: block; + border: 0; + } + .skin-overlay { + display: none; + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background-color: white; + background-color: rgba(255, 255, 255, 0.9); + width: 600px; + height: 400px; + text-indent: -9999px; + } + .skin-meta { + display: none; + width: 400px; + height: 200px; + position: absolute; + top: 0px; + left: 0px; + + h3 { + text-align: center; + margin-top: 80px; + font-size: 18px; + color: #D54E21; + } + } + } + } +} - .name { - position: absolute; - left: 0px; - right: 200px; - bottom: 0px; - height: 30px; - line-height: 30px; - text-align:center; - font-weight: bold; - font-size: 15px; - overflow: hidden; - - &::after { - content: ""; - position: absolute; - top: 0px; - right: 0px; - bottom: 0px; - width: 20px; - - background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,0)), color-stop(100%,rgba(255,255,255,1))); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* IE10+ */ - background: linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 */ - } +.csstransforms.csstransitions .skin-selector { + .skin { - .author { - font-style: italic; - font-weight: normal; - } - } - } - } + .select-skin { + &:hover { + .skin-overlay, .skin-meta h3 { + -webkit-transform: none; + -moz-transform: none; + -o-transform: none; + -ms-transform: none; + transform: none; + } + } + .skin-overlay { + display: block; + + -moz-transition: all .4s ease-in-out; + -webkit-transition: all .4s ease-in-out; + -o-transition: all .4s ease-in-out; + -ms-transition: all .4s ease-in-out; + transition: all .4s ease-in-out; + + -webkit-transform: translate(600px, -100px) rotate(45deg); + -moz-transform: translate(600px, -100px) rotate(45deg); + -o-transform: translate(600px, -100px) rotate(45deg); + -ms-transform: translate(600px, -100px) rotate(45deg); + transform: translate(600px, -100px) rotate(45deg); + } + .skin-meta { + display: block; + + h3 { + -moz-transition: all .4s ease-in-out; + -webkit-transition: all .4s ease-in-out; + -o-transition: all .4s ease-in-out; + -ms-transition: all .4s ease-in-out; + transition: all .4s ease-in-out; + + -webkit-transform: translate(200px, -200px); + -moz-transform: translate(200px, -200px); + -o-transform: translate(200px, -200px); + -ms-transform: translate(200px, -200px); + transform: translate(200px, -200px); + } + } + } + } } + /* Ribbons */ .ribbons { diff --git a/plugin.php b/plugin.php index 2118555..5d8f38e 100644 --- a/plugin.php +++ b/plugin.php @@ -10,7 +10,7 @@ */ ?> setType( "checkbox" ) ->setDefault( "off" ) ->setHelp( sprintf( __( "When enabled, upto %s different passwords can be set.", $pluginSlug ), 10 ) ) + ->addTag( "is-premium" ) ; @@ -97,12 +98,14 @@ ->setType( "timeperiod" ) ->setHelp( __( "The length of inactivity before the user must login again. Set to 0 to timeout when browser closes.", $pluginSlug ) ) ->setDefault( $defaultTimeout ) + ->addTag( "is-premium" ) ->addSetting( "logout_link" ) ->setName( __( "Add Logout link to navigation", $pluginSlug ) ) ->setType( "checkbox" ) ->setDefault( "off" ) ->setHelp( __( "When enabled, the plugin will attempt to put a logout link in the navigation", $pluginSlug ) ) - ->addTag( "labs" ) //display a warning that this feature is experimental + ->addTag( "is-premium" ) + ->settingToggle( "logout_link_menu" ) ->addSetting( "logout_link_menu" ) ->setType( "select" ) ->addTag( "no-margin" ) @@ -111,25 +114,35 @@ ->setType( "checkbox" ) ->setDefault( "off" ) ->setHelp( __( "When enabled, the RSS feed (which contains post content) will be publicly available", $pluginSlug ) ) + ->addTag( 'is-premium' ) + ->addSetting( "record_logs" ) + ->setName( __( "Create a log of all logins and logouts", $pluginSlug ) ) + ->setType( "checkbox" ) + ->setDefault( "off" ) + ->addTag( "is-premium" ) + ->setHelp( __( "When enabled, every attempt to login will be logged", $pluginSlug ) ) ; -/* + $thePlugin->_tables() ->addTable( "access_logs" ) + ->addField( "id" ) + ->setType( "mediumint" ) + ->setMaxLength( 9 ) + ->setAutoIncrement( true ) ->addField( "timestamp" )//timestamp of entry - ->type( "timestamp" ) + ->setType( "timestamp" ) ->addField( "password" )// the number of the password used (0 if NA) - ->type( "int" ) ->addField( "password_name" )//The name of that password at the time of entry ->addField( "password_color" )//The color of the password at time of entry - ->addField( "password_attempt" )//The password used if unsuccessful ->addField( "action" )//The action (login, logout, login attempt) ->addField( "user_agent")//The user agent - ->addField( "browser" )//The browser (as parsed at time of entry) + ->setType( "text" ) + ->addField( "device" ) + ->addField( "browser" )//The browser (as pmdarsed at time of entry) ->addField( "operating_system" )//The OS (as parsed at time of entry) - ->addField( "country_code" )//The country code (as parsed at time of entry) ->addField( "ip_address" ) -;*/ +; $thePlugin->_pages() @@ -137,11 +150,11 @@ ->addSettingsPage() ->addSkinsPage() ->setTitle( __( "Login Page skin", $pluginSlug ) ) - /* - ->addTablePage( "access_logs" ) + ->addPage( "access_logs", "PrivateBlogAccessLogs" ) ->setTitle( __( "Access Logs", $pluginSlug ) ) ->setDataSource( "access_logs" ) - ->setDisplayOrder( "action;password;password_name;password_color;password_attempt;browser;operating_system;country_code;ip_address" ) + ->setDisplayOrder( "timestamp;action;password_name;browser;operating_system;device;ip_address" ) + ->setOrderBy( "timestamp DESC" )/* ->addPageFromTemplate( "custom", "custom" ) ->setTitle( __( "Plugin Customisations", $pluginSlug ) )*/ ; @@ -150,4 +163,5 @@ ->addCustomScripts() ->addCustomStyles() ; + ?> \ No newline at end of file diff --git a/pluginCallbacks.php b/pluginCallbacks.php index bd8c030..cc30da6 100644 --- a/pluginCallbacks.php +++ b/pluginCallbacks.php @@ -19,6 +19,7 @@ function init() { $hookTag = "_templateVars_pluginVars"; $this->addAction( $hookTag, "pluginVars"); + //Adds the fields to the login form - doing it this way allows extensions to add fields without messing with custom themes $hookTag = "formInputs"; $this->addFilter( $hookTag, "addActionField"); $this->addFilter( $hookTag, "addRedirectField"); @@ -35,17 +36,56 @@ function init() { $this->addFilter( $hookTag ); $hookTag = "loginAccepted"; - $this->addFilter( $hookTag ); + $this->addAction( $hookTag ); $hookTag = "loginRejected"; - $this->addFilter( $hookTag ); + $this->addAction( $hookTag ); - $hookTag = "logout"; - $this->addFilter( $hookTag ); + $hookTag = "doLogout"; + $this->addAction( $hookTag ); $hookTag = "isLoggedIn"; $this->addFilter( $hookTag ); + $hookTag = "insertRow"; + $hookTags = array( + "{$hookTag}/nonce-loginAccepted", + "{$hookTag}/nonce-loginRejected", + "{$hookTag}/nonce-doLogout" + ); + $callbacks = array( + "addUserAgentField", + "addIpAddressField", + "addBrowserField", + "addOperatingSystemField", + "addDeviceField" + ); + $this->addFilter( $hookTags, $callbacks ); + + $dataSourceSlug = "access_logs"; + $col = "timestamp"; + $hookTag = "_dataSourceAjax_columnClasses/dataSource:{$dataSourceSlug}/col:$col"; + $this->addFilter( $hookTag, "addTimestampClass" ); + + + $hookTag = "_dataSourceAjax_columnTitle/dataSource:{$dataSourceSlug}/col:$col"; + $this->addFilter( $hookTag, "addTimestampTitle", 10, 2 ); + + $hookTag = "_dataSourceAjax_column/dataSource:{$dataSourceSlug}/col:$col"; + $this->addFilter( $hookTag, "formatTimestamp" ); + + + $hookTags = array( + "_dataSourceAjax_columnClasses/dataSource:{$dataSourceSlug}/col:action", + "_dataSourceAjax_columnClasses/dataSource:{$dataSourceSlug}/col:browser", + "_dataSourceAjax_columnClasses/dataSource:{$dataSourceSlug}/col:device", + "_dataSourceAjax_columnClasses/dataSource:{$dataSourceSlug}/col:operating_system" + ); + $this->addFilter( $hookTags, "addValueAsClass", 10, 2 ); + + $hookTag = "_dataSourceAjax_column/dataSource:{$dataSourceSlug}/col:action"; + $this->addFilter( $hookTag, "formatAction" ); + $rss_public = $this->_settings()->fetchSetting( "rss_feed_visible" )->getValue(); $hookTags = array( @@ -117,7 +157,7 @@ function doHeadActions() if( true === $isLogoutRequest ) { //the user is attempting to logout - do_action( $this->_slug( "logout" ) ); + do_action( $this->_slug( "doLogout" ) ); } $isLoggedIn = apply_filters( $this->_slug( "isLoggedIn" ), false ); @@ -151,7 +191,12 @@ function isLogoutRequest( $current ) { return $current; } - function logout() { + function doLogout() { + $row = array( + "action" => "doLogout" + ); + if( $this->recordLogs() ) + $this->_tables()->fetchTable( "access_logs" )->insertRow( $row, "doLogout" ); setcookie( $this->_slug( "loggedin" ), "LOGGEDOUT", time() - 1000, COOKIEPATH, COOKIE_DOMAIN ); $redirect = remove_query_arg( $this->_slug( "action" ) ); $redirect = add_query_arg( "loggedout", "", $redirect ); @@ -160,9 +205,9 @@ function logout() { } function isLoginAccepted( $current ) { - global $maxPasswords; + global $maxPasswords;//get the maxPasswords constant (can be changed by an extension) $password = $_POST[ $this->_slug( "password" ) ]; - $password = $this->runFilters( "passwordFilter", $password ); + $password = $this->runFilters( "passwordFilter", $password );//allows extensions to do weird stuff like hash the damn thing $multiplePasswords = $this->_settings()->fetchSetting( "multiple_passwords" )->getValue(); @@ -175,7 +220,17 @@ function isLoginAccepted( $current ) { $passToCheck = $this->_settings()->fetchSetting( "password".$i."_value" )->getValue(); if( !empty( $passToCheck ) and $passToCheck == $password ) { - $current = true; + $passwordName = $this->_settings()->fetchSetting( "password{$i}_name" )->getValue(); + $passwordColour = $this->_settings()->fetchSetting( "password{$i}_colour" )->getValue(); + $row = array( + "password" => $i, + "password_name" => $passwordName, + "password_color" => $passwordColour, + "action" => "loginAccepted" + ); + if( $this->recordLogs() ) + $this->_tables()->fetchTable( "access_logs" )->insertRow( $row, "loginAccepted" ); + return true; // we just logged in } } @@ -189,6 +244,11 @@ function loginAccepted() { } function loginRejected() { + $row = array( + "action" => "loginRejected", + ); + if( $this->recordLogs() ) + $this->_tables()->fetchTable( "access_logs" )->insertRow( $row, "loginRejected" ); $redirect = add_query_arg( "incorrect_credentials", "" ); $redirect = remove_query_arg( "loggedout", $redirect ); wp_redirect( $redirect ); @@ -312,6 +372,16 @@ function pagesFilter( $output, $r ) { return $output; } + function recordLogs() { + $shouldRecord = $this->_settings()->fetchSetting( "record_logs" )->getValue(); + + if( $shouldRecord == "on" ) { + return true; + } + + return false; + } + /* @@ -331,34 +401,130 @@ function logoutLinkBackend() { $menu = wp_get_nav_menu_object( $locationId ); $counter ++; if( $counter == 1 ) { - $defaultValue = $menu->slug;//make sure a default is set + $defaultValue = $menu->slug;//make sure a default is set if any menus exist } $valueArray[] = $menu->slug; - $this->_settings()->fetchSetting( "logout_link_menu" )->addSettingOption( $menu->slug, $menu->name ); + $this->_settings()->fetchSetting( "logout_link_menu" )->addSettingOption( $menu->slug, $menu->name );//add this WP 3 menu to the dropdown of options } } if( $counter == 0 ) { - //if there is no menu that is attached to a location then we should check to see whether there is any menus at all + //if there is no menu that is attached to a location then we should check to see whether there is any menus at all as by default WP will display an unassigned menu + $this->_settings()->fetchSetting( "logout_link_menu" )->removeTag( "options-available" )->addTag("force-invisible"); $menus = wp_get_nav_menus(); foreach ( $menus as $menu_maybe ) { if ( $menu_items = wp_get_nav_menu_items($menu_maybe->term_id) ) { $menu = $menu_maybe; - $this->_settings()->fetchSetting( "logout_link_menu" )->addSettingOption( $menu->slug, $menu->name )->removeTag( "options-available" )->addTag("hidden"); + $this->_settings()->fetchSetting( "logout_link_menu" )->addSettingOption( $menu->slug, $menu->name ); $valueArray[] = $menu->slug; $defaultValue = $menu->slug; break; } } } else if( $counter == 1 ) { - //if there is only one then no need to give option - $this->_settings()->fetchSetting( "logout_link_menu" )->removeTag( "options-available" )->addTag("hidden"); + //if there is only one then no need to display dropdown + $this->_settings()->fetchSetting( "logout_link_menu" )->removeTag( "options-available" )->addTag("force-invisible"); } $currentValue = $this->_settings()->fetchSetting( "logout_link_menu" )->setDefault( $defaultValue )->getValue(); if( !in_array( $currentValue, $valueArray ) ) { - //something has changed and the current value no longer exists as a menu so reset it to new default (probably theme change) + //something has changed and the value stored no longer exists as a menu so reset it to new default (probably theme change) $this->_settings()->fetchSetting( "logout_link_menu" )->updateValue( $defaultValue ); } } + + /* + Table array Filters + */ + function addUserAgentField( $row ) { + $row['user_agent'] = $_SERVER['HTTP_USER_AGENT']; + return $row; + } + + function addBrowserField( $row ) { + $info = $this->_misc()->userAgentInfo(); + $row['browser'] = $info['browser']; + return $row; + } + + function addOperatingSystemField( $row ) { + $info = $this->_misc()->userAgentInfo(); + $row['operating_system'] = $info['os']; + return $row; + } + + function addDeviceField( $row ) { + $info = $this->_misc()->userAgentInfo(); + $row['device'] = $info['device']; + return $row; + } + + function addIpAddressField( $row ) { + $row['ip_address'] = $_SERVER['REMOTE_ADDR']; + return $row; + } + + /* Table server side filters */ + + function addTimestampClass( $classes ) { + return $classes . "implements-timestamp "; + } + + function addValueAsClass( $classes, $args ) { + $value = $args['original']; + return $classes . "value-$value "; + } + + function formatTimestamp( $timeString ) { + $timeStamp = strtotime( $timeString ); + $now = time(); + $today = strtotime( "Today"); + $yesterday = strtotime( "Yesterday"); + + if( $now < $timeStamp ) { + return __( "The future (check config)", $this->_slug() ); + } elseif( $now - $timeStamp < 60 ) { + //less than a minute ago + return __( "Less than a minute ago", $this->_slug() ); + } elseif( $now - $timeStamp < 60 * 60 ) { + //less than an hour ago + $minutes = floor( ($now - $timeStamp) / 60 ); + return sprintf(_n('%d minute ago', '%d minutes ago', $minutes), $minutes); + } elseif( $timeStamp > $today ) { + //it was today + return date( "H:i", $timeStamp ); + } elseif( $timeStamp > $yesterday ) { + return __( "Yesterday", $this->_slug() ); + } else { + return date( "d F", $timeStamp ); + } + + + + return $now - $timeStamp; + //return $timeStamp; + return $timeStamp; + } + + function formatAction( $value ) { + switch( $value ) { + case "doLogout": + return __( "Logout", $this->_slug() ); + case "loginAccepted": + return __( "Login accepted", $this->_slug() ); + case "loginRejected": + return __( "Login rejected", $this->_slug() ); + break; + } + + return $value; + } + + function addTimestampTitle( $title, $args ) { + + $timeStamp = strtotime( $args['original'] ); + return date( "D, d F Y H:i", $timeStamp ); + + } + } ?> \ No newline at end of file diff --git a/sandbox/access_log_table.html b/sandbox/access_log_table.html deleted file mode 100644 index 16ca2af..0000000 --- a/sandbox/access_log_table.html +++ /dev/null @@ -1,5 +0,0 @@ - - -
    -
    -
    \ No newline at end of file diff --git a/skins/default/Thumbs.db b/skins/default/Thumbs.db index a734d10..d2f05cf 100644 Binary files a/skins/default/Thumbs.db and b/skins/default/Thumbs.db differ diff --git a/skins/default/static/styles.css b/skins/default/static/styles.css index f673772..c616a0d 100644 --- a/skins/default/static/styles.css +++ b/skins/default/static/styles.css @@ -86,12 +86,16 @@ input.input:hover, input.input:focus { font-size: 23px; text-align: center; padding-bottom: 4px; + margin-top: -10px; + margin-left: -10px; + margin-right: -10px; + padding-top: 10px; - -webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); - -ms-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); - -o-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); - box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); + -moz-box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); + -ms-box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); + -o-box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); + box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); color: #666; } diff --git a/skins/defaultcustom/Thumbs.db b/skins/defaultcustom/Thumbs.db index beac1df..65f8e94 100644 Binary files a/skins/defaultcustom/Thumbs.db and b/skins/defaultcustom/Thumbs.db differ diff --git a/skins/defaultcustom/skin.php b/skins/defaultcustom/skin.php index 0743ee2..cfad282 100644 --- a/skins/defaultcustom/skin.php +++ b/skins/defaultcustom/skin.php @@ -11,15 +11,20 @@ ->setName( __( "Logo", $thePlugin->_slug() ) ) ->setType( "image" ) ->setDefault( $skinUrl . 'static/images/logo.png' ) + ->addTag( "is-premium" ) ->addSkinSetting( "enable_message" ) ->setName( __( "Display a message", $thePlugin->_slug() ) ) + ->setHelp( __( "Set a message to appear above the form. Any urls and email addresses will be converted into links.", $thePlugin->_slug() ) ) ->setType( "checkbox" ) ->setDefault( "off" ) ->settingToggle( "message" ) + ->addTag( "is-premium" ) ->addSkinSetting( "message" ) ->setType( "textarea" ) ->addTag( "no-margin" ) ->addTag( "align-center" ) + ->addTag( "is-premium" ) ->addPresetSkinSetting( "custom_css" ) + ->addTag( "is-premium" ) ; ?> \ No newline at end of file diff --git a/skins/defaultcustom/static/styles.css b/skins/defaultcustom/static/styles.css index a71a595..3c3e61a 100644 --- a/skins/defaultcustom/static/styles.css +++ b/skins/defaultcustom/static/styles.css @@ -8,7 +8,7 @@ body { height: 200px; background-image: url(images/logo.png); - background-position: bottom center; + background-position: center center; background-repeat: no-repeat; } @@ -93,12 +93,16 @@ body { font-size: 23px; text-align: center; padding-bottom: 4px; + margin-top: -10px; + margin-left: -10px; + margin-right: -10px; + padding-top: 10px; - -webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); - -ms-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); - -o-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); - box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); + -moz-box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); + -ms-box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); + -o-box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); + box-shadow: inset 0px 0px 9px rgba(0,0,0,0.5); color: #666; } diff --git a/vendor.php b/vendor.php new file mode 100644 index 0000000..1eb0be2 --- /dev/null +++ b/vendor.php @@ -0,0 +1,133 @@ +registerLicensingSettings(); + } + function adminInit(){ + $this->addAction( "ajaxChecks" ); + $this->addAction( "lavaNav" ); + $this->addAction( "displayUnderground" ); + $this->addAction( 'pageHiddenStuff' ); + $this->_pages() + ->addScript( $this->_slug( "vendor_js" ), "_static/vendor.js" ) + ->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" ); + } else { + $this->addFilter( "settingClasses-tag/is-premium", "removePremiumBlock" ); + } + } + + function removePremiumBlock( $classes ) { + unset( $classes['tag-is-premium'] ); + + return $classes; + } + + function registerLicensingSettings() { + $this->_settings() + ->addSetting('license_public', 'vendor') + ->addSetting('license_private', 'vendor') + ; + $this->doLicensingHooks(); + } + + function ajaxChecks(){ + ?> + + + + publicKey() != '' ) { + $code_link_text = 'Change key'; + } + ?> + Get premium + + +
    +
    +
    Enter trial mode
    + +
    +
    +
    '; + + return $current; + } + + function displayUnderground() { + $this->getPremiumUi(); + $this->redeemPremiumUi(); + } + + function getPremiumUi() { + ?> +
    +

    Get Premium

    +
    Licenses can be transferred between websites but excesively doing this (doing it over 10 times in a week for example) may cause the license to be blacklisted
    + +
    The price will be converted into your local currency before the transaction completes
    +
    +
    + + + + + +
    +
    + + +
    + licensingFields(); + } + + function licensingFields() { + ?> + + + + "/> + _settings()->fetchSetting('license_public', 'vendor')->getValue(); + } + + function privateKey() { + return $this->_settings()->fetchSetting('license_private', 'vendor')->getValue(); + } +} +?> \ No newline at end of file