Merge pull request #153 from mainwp/bogdan01-cf-autofix

Apply fixes from CodeFactor
This commit is contained in:
Thang Hoang Van 2020-05-20 20:19:06 +07:00 committed by GitHub
commit fa9f53cea4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 23 deletions

View file

@ -222,7 +222,7 @@ class MainWP_Child_Install {
if ( ! isset( $_POST['type'] ) || ! isset( $_POST['url'] ) || ( 'plugin' !== $_POST['type'] && 'theme' !== $_POST['type'] ) || '' === $_POST['url'] ) {
MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
}
$this->require_files();
$urlgot = json_decode( stripslashes( $_POST['url'] ) );
@ -266,14 +266,14 @@ class MainWP_Child_Install {
if ( false == $ssl_verify ) {
remove_filter( 'http_request_args', array( MainWP_Helper::get_class_name(), 'no_ssl_filter_function' ), 99 );
}
$this->after_installed( $result );
$this->after_installed( $result );
}
$information['installation'] = 'SUCCESS';
$information['destination_name'] = $result['destination_name'];
MainWP_Helper::write( $information );
}
private function require_files() {
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
include_once ABSPATH . '/wp-admin/includes/screen.php';
@ -320,15 +320,15 @@ class MainWP_Child_Install {
activate_plugin( $path . $fileName, '' );
}
}
}
}
} else {
$args['type'] = 'theme';
$args['slug'] = $result['destination_name'];
do_action_deprecated( 'mainwp_child_installPluginTheme', array( $args ), '4.0.7.1', 'mainwp_child_install_plugin_theme' );
do_action( 'mainwp_child_install_plugin_theme', $args );
}
}
}
private function try_second_install( $url, $installer ) {
add_filter( 'http_request_args', array( MainWP_Helper::get_class_name(), 'no_ssl_filter_function' ), 99, 2 );
$result = $installer->run(

View file

@ -206,8 +206,8 @@ class MainWP_Connect {
}
$signature = rawurldecode( isset( $_REQUEST['mainwpsignature'] ) ? $_REQUEST['mainwpsignature'] : '' );
$file = $this->get_request_files();
$file = $this->get_request_files();
$auth = self::instance()->auth( $signature, rawurldecode( ( isset( $_REQUEST['where'] ) ? $_REQUEST['where'] : $file ) ), isset( $_REQUEST['nonce'] ) ? $_REQUEST['nonce'] : '', isset( $_REQUEST['nossl'] ) ? $_REQUEST['nossl'] : 0 );
@ -231,12 +231,12 @@ class MainWP_Connect {
return;
}
}
}
$this->check_redirects();
}
$this->check_redirects();
}
private function get_request_files() {
$file = '';
$file = '';
if ( isset( $_REQUEST['f'] ) ) {
$file = $_REQUEST['f'];
} elseif ( isset( $_REQUEST['file'] ) ) {
@ -246,8 +246,8 @@ class MainWP_Connect {
}
return $file;
}
private function check_redirects() {
private function check_redirects() {
if ( isset( $_REQUEST['fdl'] ) ) {
if ( stristr( $_REQUEST['fdl'], '..' ) ) {
return;
@ -262,7 +262,7 @@ class MainWP_Connect {
}
$this->where_redirect();
}
private function open_location_redirect( $open_location ) {
$_vars = self::parse_query( $open_location );
$_path = wp_parse_url( $open_location, PHP_URL_PATH );
@ -284,8 +284,8 @@ class MainWP_Connect {
wp_safe_redirect( site_url() . $open_location );
exit();
}
public static function parse_query( $var ) {
$var = wp_parse_url( $var, PHP_URL_QUERY );

View file

@ -64,7 +64,7 @@ class MainWP_Helper {
if ( null !== $code ) {
$information['error_code'] = $code;
}
MainWP_Helper::write( $information );
self::write( $information );
}
/**

View file

@ -166,8 +166,8 @@ class MainWP_Utility {
'content-type: text/html',
)
);
}
}
public static function clean( $string ) {
$string = trim( $string );
$string = htmlentities( $string, ENT_QUOTES );
@ -175,7 +175,7 @@ class MainWP_Utility {
$string = stripslashes( $string );
return $string;
}
public static function format_email( $to_email, $body ) {
return '<br>
<div>
@ -236,7 +236,7 @@ class MainWP_Utility {
<br>';
}
/**
* Handle fatal error for requests from the dashboard
* mwp_action requests
@ -452,7 +452,7 @@ class MainWP_Utility {
}
return $wpdb->get_results( $wpdb->prepare( "SELECT ID,guid FROM $wpdb->posts WHERE post_type = 'attachment' AND guid LIKE %s", '%/' . $wpdb->esc_like( $filename ) ) );
}
public static function fetch_url( $url, $postdata ) {
try {
$tmpUrl = $url;