mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 09:20:28 +08:00
Merge pull request #154 from mainwp/bogdan01-cf-autofix
Apply fixes from CodeFactor
This commit is contained in:
commit
b4ddb00a69
7 changed files with 40 additions and 40 deletions
|
@ -666,7 +666,7 @@ class MainWP_Child_Branding {
|
|||
echo '<style>' . self::parse_css( $extra_setting['login_css'] ) . '</style>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PARSE
|
||||
* Parses some CSS into an array
|
||||
|
@ -760,7 +760,7 @@ class MainWP_Child_Branding {
|
|||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
public function custom_the_generator( $generator, $type = '' ) {
|
||||
$extra_setting = $this->get_extra_options();
|
||||
if ( isset( $extra_setting['site_generator'] ) ) {
|
||||
|
|
|
@ -524,7 +524,7 @@ class MainWP_Child_Server_Information_Render {
|
|||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
protected static function render_file_system_method_check() {
|
||||
$fsmethod = MainWP_Child_Server_Information::get_file_system_method();
|
||||
if ( 'direct' === $fsmethod ) {
|
||||
|
@ -533,7 +533,7 @@ class MainWP_Child_Server_Information_Render {
|
|||
echo '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function render_php_settings_rows() {
|
||||
?>
|
||||
<tr>
|
||||
|
@ -844,13 +844,13 @@ class MainWP_Child_Server_Information_Render {
|
|||
$branding_title = 'MainWP';
|
||||
}
|
||||
$branding_title .= ' Upload Directory';
|
||||
|
||||
$path = '';
|
||||
|
||||
$path = '';
|
||||
$message = 'Writable';
|
||||
|
||||
|
||||
MainWP_Child_Server_Information::check_mainwp_directory( $message, $path );
|
||||
|
||||
self::render_directory_row( $branding_title, $path, 'Writable', $message, true );
|
||||
|
||||
self::render_directory_row( $branding_title, $path, 'Writable', $message, true );
|
||||
}
|
||||
|
||||
protected static function render_directory_row( $pName, $pDirectory, $pCheck, $pResult, $pPassed ) {
|
||||
|
@ -906,7 +906,7 @@ class MainWP_Child_Server_Information_Render {
|
|||
}
|
||||
return '<span class="mainwp-fail"><i class="fa fa-exclamation-circle"></i> Fail</span>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*Plugin-Name: Error Log Dashboard Widget
|
||||
*Plugin URI: http://wordpress.org/extend/plugins/error-log-dashboard-widget/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace MainWP\Child;
|
||||
|
||||
class MainWP_Child_Server_Information {
|
||||
|
||||
|
||||
/**
|
||||
* Method get_class_name()
|
||||
*
|
||||
|
@ -72,8 +72,8 @@ class MainWP_Child_Server_Information {
|
|||
return $i;
|
||||
}
|
||||
|
||||
public function check_mainwp_directory( &$message = '', &$path = '' ) {
|
||||
$path = '';
|
||||
public function check_mainwp_directory( &$message = '', &$path = '' ) {
|
||||
$path = '';
|
||||
try {
|
||||
$dirs = MainWP_Helper::get_mainwp_dir( null, false );
|
||||
$path = $dirs[0];
|
||||
|
@ -82,9 +82,9 @@ class MainWP_Child_Server_Information {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( ! is_dir( dirname( $path ) ) ) {
|
||||
if ( ! is_dir( dirname( $path ) ) ) {
|
||||
$message = 'Directory not found';
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
$hasWPFileSystem = MainWP_Helper::get_wp_filesystem();
|
||||
|
@ -92,20 +92,20 @@ class MainWP_Child_Server_Information {
|
|||
global $wp_filesystem;
|
||||
|
||||
if ( $hasWPFileSystem && ! empty( $wp_filesystem ) ) {
|
||||
if ( ! $wp_filesystem->is_writable( $path ) ) {
|
||||
if ( ! $wp_filesystem->is_writable( $path ) ) {
|
||||
$message = 'Directory not writable';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ( ! is_writable( $path ) ) {
|
||||
$message = 'Directory not writable';
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$message = 'Writable';
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function check( $pCompare, $pVersion, $pGetter, $pExtraCompare = null, $pExtraVersion = null, $sizeCompare = false ) {
|
||||
$currentVersion = call_user_func( array( self::get_class_name(), $pGetter ) );
|
||||
|
||||
|
@ -115,7 +115,7 @@ class MainWP_Child_Server_Information {
|
|||
return ( version_compare( $currentVersion, $pVersion, $pCompare ) || ( ( null !== $pExtraCompare ) && version_compare( $currentVersion, $pExtraVersion, $pExtraCompare ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function filesize_compare( $value1, $value2, $operator = null ) {
|
||||
if ( false !== strpos( $value1, 'G' ) ) {
|
||||
$value1 = preg_replace( '/[A-Za-z]/', '', $value1 );
|
||||
|
@ -132,8 +132,8 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
return version_compare( $value1, $value2, $operator );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function get_curl_support() {
|
||||
return function_exists( 'curl_version' );
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ class MainWP_Child_Server_Information {
|
|||
sort( $extensions );
|
||||
echo esc_html( implode( ', ', $extensions ) );
|
||||
}
|
||||
|
||||
|
||||
public static function get_file_system_method() {
|
||||
if ( defined( 'MAINWP_SAVE_FS_METHOD' ) ) {
|
||||
return MAINWP_SAVE_FS_METHOD;
|
||||
|
@ -189,8 +189,8 @@ class MainWP_Child_Server_Information {
|
|||
$fs = get_filesystem_method();
|
||||
|
||||
return $fs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function get_current_version() {
|
||||
$currentVersion = get_option( 'mainwp_child_plugin_version' );
|
||||
|
||||
|
|
|
@ -82,13 +82,13 @@ class MainWP_Child_Staging {
|
|||
MainWP_Helper::write( array( 'error' => __( 'Please install WP Staging plugin on child website', 'mainwp-child' ) ) );
|
||||
}
|
||||
|
||||
if (!class_exists( 'WPStaging\WPStaging' )){
|
||||
if ( ! class_exists( 'WPStaging\WPStaging' ) ) {
|
||||
if ( file_exists( WPSTG_PLUGIN_DIR . 'app/Core/WPStaging.php' ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . 'app/Core/WPStaging.php';
|
||||
} else if ( file_exists( WPSTG_PLUGIN_DIR . "Core/WPStaging.php" ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . "Core/WPStaging.php";
|
||||
}
|
||||
}
|
||||
} elseif ( file_exists( WPSTG_PLUGIN_DIR . 'Core/WPStaging.php' ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . 'Core/WPStaging.php';
|
||||
}
|
||||
}
|
||||
|
||||
\WPStaging\WPStaging::getInstance();
|
||||
$information = array();
|
||||
|
@ -243,8 +243,8 @@ class MainWP_Child_Staging {
|
|||
ob_start();
|
||||
if ( file_exists( WPSTG_PLUGIN_DIR . 'app/Backend/views/clone/ajax/start.php' ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . 'app/Backend/views/clone/ajax/start.php';
|
||||
} else if ( file_exists( WPSTG_PLUGIN_DIR . "Backend/views/clone/ajax/start.php" ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . "Backend/views/clone/ajax/start.php";
|
||||
} elseif ( file_exists( WPSTG_PLUGIN_DIR . 'Backend/views/clone/ajax/start.php' ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . 'Backend/views/clone/ajax/start.php';
|
||||
}
|
||||
$result = ob_get_clean();
|
||||
return $result;
|
||||
|
@ -343,8 +343,8 @@ class MainWP_Child_Staging {
|
|||
ob_start();
|
||||
if ( file_exists( WPSTG_PLUGIN_DIR . 'app/Backend/views/clone/ajax/update.php' ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . 'app/Backend/views/clone/ajax/update.php';
|
||||
} else if ( file_exists( WPSTG_PLUGIN_DIR . "Backend/views/clone/ajax/update.php" ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . "Backend/views/clone/ajax/update.php";
|
||||
} elseif ( file_exists( WPSTG_PLUGIN_DIR . 'Backend/views/clone/ajax/update.php' ) ) {
|
||||
require_once WPSTG_PLUGIN_DIR . 'Backend/views/clone/ajax/update.php';
|
||||
}
|
||||
$result = ob_get_clean();
|
||||
return $result;
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace MainWP\Child;
|
|||
class MainWP_Client_Report {
|
||||
|
||||
public static $instance = null;
|
||||
|
||||
|
||||
/**
|
||||
* Get Class Name.
|
||||
*
|
||||
|
@ -14,7 +14,7 @@ class MainWP_Client_Report {
|
|||
public static function get_class_name() {
|
||||
return __CLASS__;
|
||||
}
|
||||
|
||||
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
|
|
|
@ -251,7 +251,7 @@ class MainWP_Pages {
|
|||
|
||||
<?php if ( ! $hide_connection_detail ) { ?>
|
||||
<div class="mainwp-child-setting-tab connection-detail" <?php echo ( 'connection-detail' !== $shownPage ) ? $hide_style : ''; ?>>
|
||||
<?php MainWP_Child_Server_Information_Render::render_connection_details(); ?>
|
||||
<?php MainWP_Child_Server_Information_Render::render_connection_details(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
|
|
|
@ -506,7 +506,7 @@ class MainWP_Utility {
|
|||
}
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
|
||||
public static function validate_mainwp_dir() {
|
||||
$done = false;
|
||||
$dir = MainWP_Helper::get_mainwp_dir();
|
||||
|
@ -561,7 +561,7 @@ class MainWP_Utility {
|
|||
}
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
public static function create_nonce_without_session( $action = - 1 ) {
|
||||
$user = wp_get_current_user();
|
||||
$uid = (int) $user->ID;
|
||||
|
@ -600,7 +600,7 @@ class MainWP_Utility {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function update_lasttime_backup( $by, $time ) {
|
||||
$backup_by = array( 'backupbuddy', 'backupwordpress', 'backwpup', 'updraftplus', 'wptimecapsule' );
|
||||
if ( ! in_array( $by, $backup_by ) ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue