squelched various php and wp notices and warnings, enqueuing admin css and js better #1

Merged
haroldkyle merged 1 commit from master into master 2013-03-28 09:29:47 +00:00
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 */ /* setup plugin, plugin specific setup functions that need options */
$this->plugin_setup(); $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 */ add_action( 'admin_enqueue_scripts', array(&$this,'enqueue_admin_css_js'));
$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 );
}
}
register_activation_hook( $this->plugin_file , array( $this , 'plugin_activate') ); register_activation_hook( $this->plugin_file , 'plugin_activate' );
register_deactivation_hook( $this->plugin_file , array( $this , 'plugin_deactivate') ); register_deactivation_hook( $this->plugin_file , 'plugin_deactivate' );
register_uninstall_hook( $this->plugin_file , array( $this , 'plugin_uninstall') ); register_uninstall_hook( $this->plugin_file , 'plugin_uninstall' );
/* register settings pages */ /* register settings pages */
if ( $this->network ) if ( $this->network )
@ -234,6 +220,23 @@ if (!class_exists('WP_Plugins_Abstract')) {
return $links; 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 * deletes saved options from database
*/ */
@ -462,6 +465,7 @@ if (!class_exists('WP_Plugins_Abstract')) {
else else
$check_disabled = false; $check_disabled = false;
$opt = '';
foreach ($elements as $value => $name ) { foreach ($elements as $value => $name ) {
//$disabled .= ( @array_key_exists( $valid[ $value ] ) && $valid[ $value ] == false ) ? ' disabled="disabled"' : ''; //$disabled .= ( @array_key_exists( $valid[ $value ] ) && $valid[ $value ] == false ) ? ' disabled="disabled"' : '';
$opt .= '<option value="' . $value . '" '; $opt .= '<option value="' . $value . '" ';

View file

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

View file

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

View file

@ -242,28 +242,28 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
/** /**
* if options were saved, display saved message * 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> <div class='updated settings-error'><p><strong><?php _e( 'Settings saved.' , $this->plugin_constant ) ?></strong></p></div>
<?php endif; <?php endif;
/** /**
* if options were delete, display delete message * 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> <div class='error'><p><strong><?php _e( 'Plugin options deleted.' , $this->plugin_constant ) ?></strong></p></div>
<?php endif; <?php endif;
/** /**
* if options were saved * 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> <div class='updated settings-error'><p><strong><?php _e( "Cache flushed." , $this->plugin_constant ); ?></strong></p></div>
<?php endif; <?php endif;
/** /**
* if options were saved, display saved message * 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> <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; <?php endif;
@ -769,6 +769,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
/* set upstream servers from configured servers, best to get from the actual backend */ /* set upstream servers from configured servers, best to get from the actual backend */
$servers = $this->backend->get_servers(); $servers = $this->backend->get_servers();
$nginx_servers = '';
foreach ( array_keys( $servers ) as $server ) { foreach ( array_keys( $servers ) as $server ) {
$nginx_servers .= " server ". $server .";\n"; $nginx_servers .= " server ". $server .";\n";
} }