Merge pull request #1 from haroldkyle/master

squelched various php and wp notices and warnings, enqueuing admin css and js better
This commit is contained in:
Peter Molnar 2013-03-28 02:29:46 -07:00
commit 97dca3d3fc
4 changed files with 29 additions and 24 deletions

View file

@ -123,26 +123,12 @@ if (!class_exists('WP_Plugins_Abstract')) {
/* setup plugin, plugin specific setup functions that need options */
$this->plugin_setup();
/* add admin styling */
if( is_admin() ) {
/* jquery ui tabs is provided by WordPress */
wp_enqueue_script ( "jquery-ui-tabs" );
wp_enqueue_script ( "jquery-ui-slider" );
/* additional admin styling */
$css_handle = $this->plugin_constant . '-admin-css';
$css_file = $this->plugin_constant . '-admin.css';
if ( @file_exists ( $this->plugin_dir . $css_file ) )
{
$css_src = $this->plugin_url . $css_file;
wp_register_style( $css_handle, $css_src, false, false, 'all' );
wp_enqueue_style( $css_handle );
}
}
add_action( 'admin_enqueue_scripts', array(&$this,'enqueue_admin_css_js'));
register_activation_hook( $this->plugin_file , array( $this , 'plugin_activate') );
register_deactivation_hook( $this->plugin_file , array( $this , 'plugin_deactivate') );
register_uninstall_hook( $this->plugin_file , array( $this , 'plugin_uninstall') );
register_activation_hook( $this->plugin_file , 'plugin_activate' );
register_deactivation_hook( $this->plugin_file , 'plugin_deactivate' );
register_uninstall_hook( $this->plugin_file , 'plugin_uninstall' );
/* register settings pages */
if ( $this->network )
@ -234,6 +220,23 @@ if (!class_exists('WP_Plugins_Abstract')) {
return $links;
}
/* add admin styling */
public function enqueue_admin_css_js(){
/* jquery ui tabs is provided by WordPress */
wp_enqueue_script ( "jquery-ui-tabs" );
wp_enqueue_script ( "jquery-ui-slider" );
/* additional admin styling */
$css_handle = $this->plugin_constant . '-admin-css';
$css_file = $this->plugin_constant . '-admin.css';
if ( @file_exists ( $this->plugin_dir . $css_file ) )
{
$css_src = $this->plugin_url . $css_file;
wp_register_style( $css_handle, $css_src, false, false, 'all' );
wp_enqueue_style( $css_handle );
}
}
/**
* deletes saved options from database
*/
@ -462,6 +465,7 @@ if (!class_exists('WP_Plugins_Abstract')) {
else
$check_disabled = false;
$opt = '';
foreach ($elements as $value => $name ) {
//$disabled .= ( @array_key_exists( $valid[ $value ] ) && $valid[ $value ] == false ) ? ' disabled="disabled"' : '';
$opt .= '<option value="' . $value . '" ';

View file

@ -250,7 +250,7 @@ function wp_ffpc_callback( $buffer ) {
$meta['pingback'] = get_bloginfo('pingback_url');
/* sync all http and https requests if enabled */
if ( $config['sync_protocols'] == '1' ) {
if ( isset( $config['sync_protocols'] ) && $config['sync_protocols'] == '1' ) {
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
$_SERVER['HTTPS'] = 'on';

View file

@ -305,7 +305,7 @@ if (!class_exists('WP_FFPC_Backend')) {
//throw new Exception ( $message );
break;
default:
if ( function_exists( 'syslog' ) && $this->options['debug'] )
if ( function_exists( 'syslog' ) && isset($this->options['debug']) && $this->options['debug'] )
syslog( $log_level , self::plugin_constant . " with " . $this->options['cache_type'] . ' ' . $message );
break;
}

View file

@ -242,28 +242,28 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
/**
* if options were saved, display saved message
*/
if ($_GET[ self::key_save ]=='true' || $this->status == 1) : ?>
if (isset($_GET[ self::key_save ]) && $_GET[ self::key_save ]=='true' || $this->status == 1) : ?>
<div class='updated settings-error'><p><strong><?php _e( 'Settings saved.' , $this->plugin_constant ) ?></strong></p></div>
<?php endif;
/**
* if options were delete, display delete message
*/
if ($_GET[ self::key_delete ]=='true' || $this->status == 2) : ?>
if (isset($_GET[ self::key_delete ]) && $_GET[ self::key_delete ]=='true' || $this->status == 2) : ?>
<div class='error'><p><strong><?php _e( 'Plugin options deleted.' , $this->plugin_constant ) ?></strong></p></div>
<?php endif;
/**
* if options were saved
*/
if ($_GET[ self::key_flush ]=='true' || $this->status == 3) : ?>
if (isset($_GET[ self::key_flush ]) && $_GET[ self::key_flush ]=='true' || $this->status == 3) : ?>
<div class='updated settings-error'><p><strong><?php _e( "Cache flushed." , $this->plugin_constant ); ?></strong></p></div>
<?php endif;
/**
* if options were saved, display saved message
*/
if ($_GET[ self::key_precache ]=='true' || $this->status == 4) : ?>
if (isset($_GET[ self::key_precache ]) && $_GET[ self::key_precache ]=='true' || $this->status == 4) : ?>
<div class='updated settings-error'><p><strong><?php _e( 'Precache process was started, it is now running in the background, please be patient, it may take a very long time to finish.' , $this->plugin_constant ) ?></strong></p></div>
<?php endif;
@ -769,6 +769,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
/* set upstream servers from configured servers, best to get from the actual backend */
$servers = $this->backend->get_servers();
$nginx_servers = '';
foreach ( array_keys( $servers ) as $server ) {
$nginx_servers .= " server ". $server .";\n";
}