Replaced superfluous instantiation of Object with static init() method

This commit is contained in:
Stefan Kalscheuer 2017-08-20 11:22:29 +02:00
parent 12a7959982
commit aa40945ebd
4 changed files with 16 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "stklcode/statify-blacklist", "name": "stklcode/statify-blacklist",
"version": "1.4.1", "version": "1.4.2-alpha",
"description": "A blacklist extension for the famous Statify WordPress plugin", "description": "A blacklist extension for the famous Statify WordPress plugin",
"keywords": [ "keywords": [
"wordpress", "wordpress",

View File

@ -46,17 +46,28 @@ class StatifyBlacklist {
* Class self initialize. * Class self initialize.
* *
* @since 1.0.0 * @since 1.0.0
* @deprecated 1.4.2 Replaced by init().
*/ */
public static function instance() { public static function instance() {
new self(); self::init();
} }
/** /**
* Class constructor. * Class constructor.
* *
* @since 1.0.0 * @since 1.0.0
* @deprecated 1.4.2 Replaced by init().
*/ */
public function __construct() { public function __construct() {
self::init();
}
/**
* Plugin initialization.
*
* @since 1.4.2
*/
public static function init() {
// Skip on autosave or AJAX. // Skip on autosave or AJAX.
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
return; return;

View File

@ -1,6 +1,6 @@
{ {
"name": "statify-blacklist", "name": "statify-blacklist",
"version": "1.4.1", "version": "1.4.2-alpha",
"description": "A blacklist extension for the famous Statify WordPress plugin", "description": "A blacklist extension for the famous Statify WordPress plugin",
"author": "Stefan Kalscheuer", "author": "Stefan Kalscheuer",
"license": "GPLv2 or later", "license": "GPLv2 or later",

View File

@ -10,7 +10,7 @@
* Plugin Name: Statify Blacklist * Plugin Name: Statify Blacklist
* Plugin URI: https://wordpress.org/plugins/statify-blacklist/ * Plugin URI: https://wordpress.org/plugins/statify-blacklist/
* Description: Extension for the Statify plugin to add a customizable blacklists. * Description: Extension for the Statify plugin to add a customizable blacklists.
* Version: 1.4.1 * Version: 1.4.2-alpha
* Author: Stefan Kalscheuer (@stklcode) * Author: Stefan Kalscheuer (@stklcode)
* Author URI: https://www.stklcode.de * Author URI: https://www.stklcode.de
* Text Domain: statify-blacklist * Text Domain: statify-blacklist
@ -40,7 +40,7 @@ define( 'STATIFYBLACKLIST_DIR', dirname( __FILE__ ) );
define( 'STATIFYBLACKLIST_BASE', plugin_basename( __FILE__ ) ); define( 'STATIFYBLACKLIST_BASE', plugin_basename( __FILE__ ) );
// System Hooks. // System Hooks.
add_action( 'plugins_loaded', array( 'StatifyBlacklist', 'instance' ) ); add_action( 'plugins_loaded', array( 'StatifyBlacklist', 'init' ) );
register_activation_hook( STATIFYBLACKLIST_FILE, array( 'StatifyBlacklist_System', 'install' ) ); register_activation_hook( STATIFYBLACKLIST_FILE, array( 'StatifyBlacklist_System', 'install' ) );