[CodeFactor] Apply fixes

[ci skip] [skip ci]
This commit is contained in:
codefactor-io 2020-05-22 04:40:40 +00:00
parent e758ee489e
commit 635f617694
5 changed files with 330 additions and 324 deletions

View file

@ -26,36 +26,38 @@ require_once ABSPATH . '/wp-admin/includes/plugin.php';
/**
* Class MainWP_Child
*
* @package MainWP\Child
*/
class MainWP_Child {
/**
* @static
* @var string MainWP Child Plugin Version.
*/
public static $version = '4.0.7.1';
/**
* @static
* @var string MainWP Child Plugin Version.
*/
public static $version = '4.0.7.1';
/**
* @var string Update Version.
*/
private $update_version = '1.5';
/**
* @var string Update Version.
*/
private $update_version = '1.5';
/**
* @var string MainWP Child Plugin slug.
*/
public $plugin_slug;
/**
* @var string MainWP Child Plugin slug.
*/
public $plugin_slug;
/**
* @var string MainWP Child Plugin directory.
*/
private $plugin_dir;
/**
* @var string MainWP Child Plugin directory.
*/
private $plugin_dir;
/**
* MainWP_Child constructor.
* @param $plugin_file MainWP Child Plugin file.
*/
public function __construct($plugin_file ) {
/**
* MainWP_Child constructor.
*
* @param $plugin_file MainWP Child Plugin file.
*/
public function __construct( $plugin_file ) {
$this->update();
$this->load_all_options();
@ -97,14 +99,14 @@ class MainWP_Child {
}
}
/**
* Load all MainWP Child Plugin options.
*
* @return array|bool Return array of options $alloptions[] or FALSE on failure.
*/
public function load_all_options() {
/**
* Load all MainWP Child Plugin options.
*
* @return array|bool Return array of options $alloptions[] or FALSE on failure.
*/
public function load_all_options() {
/** @var global $wbdb wpdb. */
/** @var global $wbdb wpdb. */
global $wpdb;
if ( ! defined( 'WP_INSTALLING' ) || ! is_multisite() ) {
@ -178,12 +180,12 @@ class MainWP_Child {
}
/**
* Update MainWP Child Plugin.
*
* @return string Update verison.
*/
public function update() {
/**
* Update MainWP Child Plugin.
*
* @return string Update verison.
*/
public function update() {
$update_version = get_option( 'mainwp_child_update_version' );
if ( $update_version === $this->update_version ) {
@ -193,24 +195,24 @@ class MainWP_Child {
MainWP_Helper::update_option( 'mainwp_child_update_version', $this->update_version, 'yes' );
}
/**
* Load MainWP Child Plugin textdomains.
*/
public function localization() {
/**
* Load MainWP Child Plugin textdomains.
*/
public function localization() {
load_plugin_textdomain( 'mainwp-child', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' );
}
/**
* Template redirect.
*/
public function template_redirect() {
/**
* Template redirect.
*/
public function template_redirect() {
MainWP_Utility::instance()->maintenance_alert();
}
/**
*
*/
public function parse_init() {
/**
*
*/
public function parse_init() {
if ( isset( $_REQUEST['cloneFunc'] ) ) {
@ -222,7 +224,7 @@ class MainWP_Child {
}
}
/** @var global $wp_rewrite Core class used to implement a rewrite component API. */
/** @var global $wp_rewrite Core class used to implement a rewrite component API. */
global $wp_rewrite;
$snPluginDir = basename( $this->plugin_dir );
@ -284,26 +286,26 @@ class MainWP_Child {
MainWP_Keyword_Links::instance()->parse_init_keyword_links();
}
/**
* Check login.
*/
public function init_check_login() {
/**
* Check login.
*/
public function init_check_login() {
MainWP_Connect::instance()->check_login();
}
/**
* If user is administrator initiate the admin ajax.
*/
public function admin_init() {
/**
* If user is administrator initiate the admin ajax.
*/
public function admin_init() {
if ( MainWP_Helper::is_admin() && is_admin() ) {
MainWP_Clone::get()->init_ajax();
}
}
/**
* Parse MainWP Extension initiations.
*/
private function parse_init_extensions() {
/**
* Parse MainWP Extension initiations.
*/
private function parse_init_extensions() {
// Handle fatal errors for those init if needed.
MainWP_Child_Branding::instance()->branding_init();
MainWP_Client_Report::instance()->creport_init();
@ -321,11 +323,12 @@ class MainWP_Child {
\MainWP_Child_WPvivid_BackupRestore::instance()->init();
}
/**
* Hook to deactivate MainWP Child Plugin.
* @param bool $deact Whether or not to deactivate pugin. Default: true.
*/
public function deactivation($deact = true ) {
/**
* Hook to deactivate MainWP Child Plugin.
*
* @param bool $deact Whether or not to deactivate pugin. Default: true.
*/
public function deactivation( $deact = true ) {
$mu_plugin_enabled = apply_filters( 'mainwp_child_mu_plugin_enabled', false );
if ( $mu_plugin_enabled ) {
@ -355,10 +358,10 @@ class MainWP_Child {
}
}
/**
* Hook to deactivate Child Plugin.
*/
public function activation() {
/**
* Hook to deactivate Child Plugin.
*/
public function activation() {
$mu_plugin_enabled = apply_filters( 'mainwp_child_mu_plugin_enabled', false );
if ( $mu_plugin_enabled ) {
return;