RC2 cleanup

git-svn-id: http://plugins.svn.wordpress.org/wp-ffpc/trunk@684358 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
cadeyrn 2013-03-19 18:08:34 +00:00
parent 3581f845a6
commit 2598ed919d
6 changed files with 36 additions and 41 deletions

View file

@ -81,6 +81,7 @@ and **at least one** of the following for storage backend:
= 1.0 =
*in RC state*
* plugin development using [GitHub repository](https://github.com/petermolnar/wp-ffpc "GitHub repository") from this version; WordPress SVN only for releases
* Software licence change from GPLv2 to GPLv3
* backend code completely replaced ( object-based backend, improved readability & better structure, lot less global vars, etc. )
* added proper uninstall ( uninstall hook was not removing options from DB, uninstall.php will )

View file

@ -44,6 +44,11 @@ if (!class_exists('WP_Plugins_Abstract')) {
*/
abstract class WP_Plugins_Abstract {
const slug_save = '&saved=true';
const slug_delete = '&deleted=true';
const broadcast_url = 'http://petermolnar.eu/broadcast/';
const donation_business_id = 'FA3NT7XDVHPWU';
protected $plugin_constant;
protected $options = array();
protected $defaults = array();
@ -60,11 +65,7 @@ if (!class_exists('WP_Plugins_Abstract')) {
protected $donation_link;
protected $button_save;
protected $button_delete;
public $capability = 10;
const slug_save = '&saved=true';
const slug_delete = '&deleted=true';
const broadcast_url = 'http://petermolnar.eu/broadcast/';
const donation_business_id = 'FA3NT7XDVHPWU';
protected $capability = 10;
protected $donation_business_name;
protected $donation_item_name;
protected $broadcast_message;
@ -181,14 +182,13 @@ if (!class_exists('WP_Plugins_Abstract')) {
*/
abstract function plugin_setup();
/**
* admin panel, the HTML usually
*/
abstract function plugin_admin_panel();
/**
* admin init: save/delete setting, add admin panel call hook
* admin init called by WordPress add_action, needs to be public
*/
public function plugin_admin_init() {
@ -283,15 +283,15 @@ if (!class_exists('WP_Plugins_Abstract')) {
}
/**
* hook to add functionality into plugin_options_read
*/
abstract function plugin_hook_options_read ( &$options );
/**
* hook for parameter migration
* hook for parameter migration, runs right after options read from DB
*/
abstract function plugin_hook_options_migrate( &$options );
/**
* hook to add functionality into plugin_options_read, runs after defaults check
*/
abstract function plugin_hook_options_read ( &$options );
/**
* used on update and to save current options to database
*
@ -482,8 +482,10 @@ if (!class_exists('WP_Plugins_Abstract')) {
return $opt;
}
/**
* creates PayPal donation form based on plugin details & hardcoded business ID
*
*/
protected function plugin_donation_form () {
?>
@ -504,7 +506,6 @@ if (!class_exists('WP_Plugins_Abstract')) {
slider.slider( "value", this.selectedIndex + 1 );
});
});
});
</script>

View file

@ -76,13 +76,11 @@ $wp_ffpc_values = array();
foreach ( $wp_ffpc_keys as $key ) {
$value = $wp_ffpc_backend->get ( $wp_ffpc_backend->key ( $key ) );
if ( ! $value )
{
if ( ! $value ) {
wp_ffpc_start();
return;
}
else
{
else {
$wp_ffpc_values[ $key ] = $value;
}
}
@ -230,14 +228,12 @@ function wp_ffpc_callback( $buffer ) {
if made with archieve, last listed post can make this go bad
*/
global $post;
if ( !empty($post) && ( $meta['type'] == 'single' || $meta['type'] == 'page' ) && !empty ( $post->post_modified_gmt ) )
{
if ( !empty($post) && ( $meta['type'] == 'single' || $meta['type'] == 'page' ) && !empty ( $post->post_modified_gmt ) ) {
/* get last modification data */
$meta['lastmodified'] = strtotime ( $post->post_modified_gmt );
/* get shortlink, if possible */
if (function_exists('wp_get_shortlink'))
{
if (function_exists('wp_get_shortlink')) {
$shortlink = wp_get_shortlink( );
if (!empty ( $shortlink ) )
$meta['shortlink'] = $shortlink;
@ -254,13 +250,11 @@ function wp_ffpc_callback( $buffer ) {
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
$_SERVER['HTTPS'] = 'on';
if ( isset($_SERVER['HTTPS']) && ( ( strtolower($_SERVER['HTTPS']) == 'on' ) || ( $_SERVER['HTTPS'] == '1' ) ) )
{
if ( isset($_SERVER['HTTPS']) && ( ( strtolower($_SERVER['HTTPS']) == 'on' ) || ( $_SERVER['HTTPS'] == '1' ) ) ) {
$sync_from = 'http://' . $_SERVER['SERVER_NAME'];
$sync_to = 'https://' . $_SERVER['SERVER_NAME'];
}
else
{
else {
$sync_from = 'https://' . $_SERVER['SERVER_NAME'];
$sync_to = 'http://' . $_SERVER['SERVER_NAME'];
}

View file

@ -120,7 +120,7 @@
background: #f1f1f1;
}
.ui-slider .ui-slider-handle {
.wp-ffpc-donation .ui-slider .ui-slider-handle {
position: absolute;
z-index: 2;
width: 1.2em;
@ -137,5 +137,4 @@
background-image: -o-linear-gradient(bottom,#ececec,#f9f9f9);
background-image: linear-gradient(to top,#ececec,#f9f9f9);
outline: none;
}

View file

@ -36,12 +36,12 @@ if (!class_exists('WP_FFPC_Backend')) {
const prefix = 'prefix-';
const host_separator = ',';
const port_separator = ':';
private $key_prefixes = array ( 'meta', 'data' );
private $key_prefixes = array ( 'meta', 'data' );
private $connection = NULL;
private $options;
private $alive = false;
public $status;
private $status;
/**
* constructor
@ -192,11 +192,13 @@ if (!class_exists('WP_FFPC_Backend')) {
else
$protocol = 'http://';
/* elements to clear */
$to_clear = array (
$this->options['prefix-meta'] . $protocol . $path,
$this->options['prefix-data'] . $protocol . $path,
);
/* delete entries */
$internal = $this->proxy ( 'clear' );
$this->$internal ( $to_clear );
}
@ -299,7 +301,7 @@ if (!class_exists('WP_FFPC_Backend')) {
if ( function_exists( 'syslog' ) )
syslog( $log_level , self::plugin_constant . " with " . $this->options['cache_type'] . ' ' . $message );
/* error level is real problem, needs to be displayed on the admin panel */
throw new Exception ( $message );
//throw new Exception ( $message );
break;
default:
if ( function_exists( 'syslog' ) && $this->options['debug'] )
@ -423,7 +425,7 @@ if (!class_exists('WP_FFPC_Backend')) {
/* use binary and not compressed format, good for nginx and still fast */
$this->connection->setOption( Memcached::OPT_COMPRESSION , false );
//$this->connection->setOption( Memcached::OPT_BINARY_PROTOCOL , true );
$this->connection->setOption( Memcached::OPT_BINARY_PROTOCOL , true );
}
/* check if initialization was success or not */
@ -652,12 +654,10 @@ if (!class_exists('WP_FFPC_Backend')) {
foreach ( $keys as $key ) {
$kresult = $this->connection->delete( $key );
if ( $kresult === false )
{
if ( $kresult === false ) {
$this->log ( __translate__('unable to delete entry ', self::plugin_constant ) . $key );
}
else
{
else {
$this->log ( __translate__( 'entry deleted: ', self::plugin_constant ) . $key );
}
}

View file

@ -511,7 +511,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
/* create advanced cache file, needed only once or on activation, because there could be lefover advanced-cache.php from different plugins */
if ( !$activating )
$this->deploy_acache();
$this->deploy_advanced_cache();
}
@ -574,7 +574,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
* advanced-cache.php creator function
*
*/
private function deploy_acache( ) {
private function deploy_advanced_cache( ) {
/* in case advanced-cache.php was already there, remove it */
if ( @file_exists( $this->acache ))
@ -651,7 +651,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
}
/* deploy advanced-cache.php */
$this->deploy_acache ();
$this->deploy_advanced_cache ();
/* save options to database */
update_site_option( $this->global_option , $this->global_config );