WP coding style

This commit is contained in:
2016-08-20 18:50:38 +02:00
parent bff28ce85b
commit 1e0659e649
5 changed files with 388 additions and 362 deletions

View File

@ -1,70 +1,69 @@
<?php
/* Quit */
defined('ABSPATH') OR exit;
defined( 'ABSPATH' ) OR exit;
/**
* Statify Blacklist system configuration
*
* @since 1.0.0
*/
class StatifyBlacklist_System extends StatifyBlacklist
{
/**
* Plugin install handler.
*
* @since 1.0.0
*
* @param bool $network_wide Whether the plugin was activated network-wide or not.
*/
public static function install( $network_wide = false ) {
global $wpdb;
class StatifyBlacklist_System extends StatifyBlacklist {
/**
* Plugin install handler.
*
* @since 1.0.0
*
* @param bool $network_wide Whether the plugin was activated network-wide or not.
*/
public static function install( $network_wide = false ) {
global $wpdb;
// Create tables for each site in a network.
if ( is_multisite() && $network_wide ) {
// Todo: Use get_sites() in WordPress 4.6+
$ids = $wpdb->get_col( "SELECT blog_id FROM `$wpdb->blogs`" );
// Create tables for each site in a network.
if ( is_multisite() && $network_wide ) {
// Todo: Use get_sites() in WordPress 4.6+
$ids = $wpdb->get_col( "SELECT blog_id FROM `$wpdb->blogs`" );
foreach ( $ids as $site_id ) {
switch_to_blog( $site_id );
add_option(
'statify-blacklist',
array()
);
}
foreach ( $ids as $site_id ) {
switch_to_blog( $site_id );
add_option(
'statify-blacklist',
array()
);
}
restore_current_blog();
} else {
add_option(
'statify-blacklist',
array()
);
}
}
restore_current_blog();
} else {
add_option(
'statify-blacklist',
array()
);
}
}
/**
* Plugin uninstall handler.
*
* @since 1.0.0
*/
public static function uninstall() {
global $wpdb;
/**
* Plugin uninstall handler.
*
* @since 1.0.0
*/
public static function uninstall() {
global $wpdb;
if ( is_multisite() ) {
$old = get_current_blog_id();
if ( is_multisite() ) {
$old = get_current_blog_id();
// Todo: Use get_sites() in WordPress 4.6+
$ids = $wpdb->get_col( "SELECT blog_id FROM `$wpdb->blogs`" );
// Todo: Use get_sites() in WordPress 4.6+
$ids = $wpdb->get_col( "SELECT blog_id FROM `$wpdb->blogs`" );
foreach ( $ids as $id ) {
switch_to_blog( $id );
delete_option('statify-blacklist');
}
foreach ( $ids as $id ) {
switch_to_blog( $id );
delete_option( 'statify-blacklist' );
}
switch_to_blog( $old );
}
switch_to_blog( $old );
}
delete_option('statify-blacklist');
}
delete_option( 'statify-blacklist' );
}
}