Skip to content

Commit

Permalink
pushing ready to switch to danielchatfield fork
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchatfield committed Jul 29, 2012
1 parent 7221c79 commit 7d10b7a
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 59 deletions.
5 changes: 5 additions & 0 deletions admin_pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ settings:
skins:
type: skins
title: Login Page Skin
extensions:
type: extensions
support:
type: support
support_forum_url: https://groups.google.com/forum/embed/?place=forum/privacy-plugin&showpopout=true&showsearch=true
6 changes: 0 additions & 6 deletions classes/lavaPrivateBlogAccessLogsPage.php

This file was deleted.

30 changes: 0 additions & 30 deletions classes/lavaVolcanicPixelsLicensingAjax.php

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions extensions/vendor/settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
enabled:
title: Enable Extension
type: checkbox
2 changes: 1 addition & 1 deletion lava
Submodule lava updated 58 files
+3 −1 assets/coffee/lava/_general/animations.coffee
+3 −0 assets/coffee/lava/_general/html5-history.coffee
+5 −1 assets/coffee/lava/_general/navigation.coffee
+63 −0 assets/coffee/lava/_general/pages.skins.coffee
+5 −2 assets/coffee/lava/_general/scenes.coffee
+67 −0 assets/coffee/lava/_general/scenes.height-adjust.coffee
+31 −0 assets/coffee/lava/_general/scenes.no-actionbar.coffee
+2 −2 assets/coffee/lava/_general/scenes.settings.coffee
+179 −7 assets/js/lava.js
+31 −0 assets/js/lava/_general/animations.js
+31 −0 assets/js/lava/_general/html5-history.js
+35 −0 assets/js/lava/_general/navigation.js
+61 −0 assets/js/lava/_general/scenes.height-adjust.js
+45 −0 assets/js/lava/_general/scenes.js
+31 −0 assets/js/lava/_general/scenes.no-actionbar.js
+24 −0 assets/js/lava/_general/scenes.settings.js
+16 −0 assets/js/lava/_general/test.js
+84 −0 assets/js/lava/_polyfills/formattribute.js
+20 −0 assets/js/lava/_polyfills/image-label-fix.js
+46 −1 assets/lava.css
+12 −0 assets/less/design.less
+37 −1 assets/less/structure.css
+51 −1 assets/less/structure.less
+39 −0 classes/ajax/lava-ajax-handler.php
+36 −0 classes/ajax/lava-ajax-handlers.php
+26 −0 classes/ajax/lava-get-skin-settings-ajax-handler.php
+27 −11 classes/extensions/lava-extension.php
+108 −0 classes/extensions/lava-extensions.php
+1 −3 classes/extensions/lava-vendor.php
+211 −7 classes/lava-base.php
+27 −3 classes/lava-functions.php
+15 −5 classes/lava-plugin.php
+25 −0 classes/pages/lava-extensions-page.php
+32 −8 classes/pages/lava-page.php
+1 −1 classes/pages/lava-settings-page.php
+8 −0 classes/pages/lava-skins-page.php
+42 −0 classes/pages/lava-support-page.php
+1 −1 classes/scenes/lava-choose-skin-scene.php
+52 −0 classes/scenes/lava-configure-skin-scene.php
+21 −0 classes/scenes/lava-enable-extensions-scene.php
+46 −0 classes/scenes/lava-iframe-scene.php
+12 −9 classes/scenes/lava-scene.php
+12 −1 classes/scenes/lava-settings-scene.php
+21 −0 classes/scenes/lava-support-forum-scene.php
+13 −0 classes/settings/lava-extension-setting.php
+23 −18 classes/settings/lava-setting.php
+11 −0 classes/settings/lava-settings.php
+1 −0 classes/settings/lava-text-setting.php
+17 −25 classes/skins/lava-skin.php
+27 −67 classes/skins/lava-skins.php
+0 −0 data/buttons/choose-skin.yaml
+0 −1 data/buttons/settings.yaml
+28 −1 spec.txt
+1 −1 templates/default/actionbar.twig
+1 −1 templates/default/scenes/default.twig
+17 −0 templates/default/scenes/iframe.twig
+1 −1 templates/default/scenes/settings.twig
+7 −0 templates/default/scenes/support-forum.twig
81 changes: 70 additions & 11 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ class Volcanic_Pixels_Private_Blog extends Lava_Plugin {
public $_plugin_version = 4.05;

public $_plugin_actions = array(
'do_authentication',
'do_logout',
'do_login',
'do_login_display'
);

public $_plugin_filters = array(
'is_authorised'
'get_query_args',
'is_authorised',
'is_logout_request',
'is_login_request'
);

###########################################
Expand All @@ -32,29 +36,84 @@ class Volcanic_Pixels_Private_Blog extends Lava_Plugin {

function _init() {
parent::_init();
$this->_set_fingerprint_cookie();
$this->_do_action_if( 'logout', 'logout_request' );
$this->_do_action_if( 'login', 'login_request' );
}

function _get_header() {
$this->_do_plugin_action( 'do_authentication' );
// [action], [condition], [default], [should_terminate] - make sure the page is terminated after printing the login template
$this->_do_action_unless( 'login_display', 'authorised', false, true );
}

###########################################
## lava hooks
## Plugin hooks
###########################################

function get_query_args( $args ) {
$new = array(
'logged_in',
'logged_out',
'incorrect_credentials'
);
return array_merge( $args, $new );
}

/*
Plugin hooks
Checks whether user is logging out
*/
function do_authentication() {
$is_authorised = $this->_apply_plugin_filters( 'is_authorised', false );
if( ! $is_authorised ) {
$this->_do_plugin_action( 'do_login_display' );
exit; //better to be safe
function is_logout_request( $current ) {
//die('gary');
if( $this->_request_var( 'logout', false ) or $this->_request_var( 'action', '' ) == 'logout' ) {
$current = true;
}
return $current;
}

function do_logout() {
die('test');
}

function is_login_request( $current ) {
if( $this->_request_var( 'login', false ) or $this->_request_var( 'action', '' ) == 'login' ) {
$current = true;
}
return $current;
}

function do_login() {
// check password against setting
$password = $this->_settings()->_get_value_for( 'password' );
if( $this->_request_var( 'password' ) == $password ) {
$fingerprint = array(
'password' => $password,
'_expiration' => $this->_settings()->_get_value_for( 'login_duration', 60*60*24 )
);
$this->_merge_fingerprint( $fingerprint );
$args = $this->_apply_plugin_filters( 'get_query_args', array() );
$url = remove_query_arg( $args );
$url = add_query_arg( 'logged_in', '', $url );
wp_redirect( $url );
exit;
} else {
//details incorrect
$args = $this->_apply_plugin_filters( 'get_query_args', array() );
$url = remove_query_arg( $args );
$url = add_query_arg( 'incorrect_credentials', '', $url );
wp_redirect( $url );
exit;
}
}


function is_authorised( $current ) {
return false;
$fingerprint = $this->_get_fingerprint();
if( array_key_exists( 'password', $fingerprint ) ) {
if( $fingerprint['password'] == $this->_settings()->_get_value_for('password') ) {
$current = true;
}
}
return $current;
}


Expand Down
46 changes: 45 additions & 1 deletion skins/default/styles.css
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
.no-select{-webkit-user-select:none}body{background:#fbfbfb;color:#666;font-family:sans-serif}#logo{background-repeat:no-repeat;background-position:bottom center;min-height:200px;max-height:500px}#logo img{margin-left:-1000px;opacity:0;z-index:-1}#login_form_cntr{margin-left:auto;margin-right:auto;background:#fff;border:1px solid #BEBEBE;width:300px;padding:20px;-moz-box-shadow:0 1px 3px rgba(0,0,0,.2);-ms-box-shadow:0 1px 3px rgba(0,0,0,.2);-o-box-shadow:0 1px 3px rgba(0,0,0,.2);box-shadow:0 1px 3px rgba(0,0,0,.2);-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px}input:not([type="submit"]){width:100%;line-height:30px;height:30px;font-size:24px;font-weight:200}label{font-size:14px}
.no-select {
-webkit-user-select: none;
}
body {
background: #fbfbfb;
color: #666;
font-family: sans-serif;
}
#logo {
background-repeat: no-repeat;
background-position: bottom center;
min-height: 200px;
max-height: 500px;
}
#logo img {
margin-left: -1000px;
opacity: 0;
z-index: -1;
}
#login_form_cntr {
margin-left: auto;
margin-right: auto;
background: white;
border: 1px solid #BEBEBE;
width: 300px;
padding: 20px;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
-ms-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
-o-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
}
input:not([type="submit"]) {
width: 100%;
line-height: 30px;
height: 30px;
font-size: 24px;
font-weight: 200;
}
label {
font-size: 14px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@
</div>
<div id="login_form_cntr">
{% if widget_exists( 'form' ) %}
{{ widget( 'form' ) }}
{{ widget( 'form' ) }}{# This allows an extension to override the form #}
{% else %}
<form id="login_form" method="post">
<label>
{{ translate( 'Password' ) }}
<br />
<input type="password" />
</label>
<input type="submit" value="{{ translate( 'login' ) }}" />
<input type="hidden" name="{{ namespace( 'action' ) }}" value="login" />
<p>
<label>
{{ translate( 'Password' ) }}
<br />
<input type="password" name="{{ namespace( 'password' ) }}" />
</label>
</p>
<input type="submit" value="{{ translate( 'Login' ) }}" />
</form>
{% endif %}
</div>
Expand Down
68 changes: 65 additions & 3 deletions todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ Add browser popup



Add hook to flush defaults to database on activation, upgrade, rand etc.
Hidden pages


Hidden pages:
Welcome
Change log (update)




Expand All @@ -18,4 +20,64 @@ settings:
What to protect
RSS feeds
Login Duration
Multiple passwords
Multiple passwords

extensions:
make case insensitive
protocol

pages:
skins page:
If there is no skin settings hide the configure skin scene

plugins:
editor
translator **
WP Debugger
Intelligent warnings
- Custom scripts loaded on non-plugin pages
- register_page called before init


support:
Get help:
Chrome browser
Chrome remote
Click new tab
Click Remote
Get debug info

update:
Make sure extensions are copied accross


Flags:
No extensions
Reset

CLI interface for forms

Protocols:
web+lava-plugin://
Used to send instructions to a wordpress installation
If protocol is handled by something else then display popup explaining with option to disable extension

e.g.
protocol://[plugin]/[verb]/[vars]
web+lava-plugin://private-blog/activate_extension/debug

- safe patterns
- an array of regexs that match urls that do not need to be prompted

- You have followed a link from groups.google.com which is trying to:
- Activate the 'debug' extension

web+lava-support://



blog posts:
Making a skin
Making an extension
Why we have dropped IE7 support
< 0.2 % users using IE7

0 comments on commit 7d10b7a

Please sign in to comment.