Fixed: CodeFactor issues

This commit is contained in:
Bogdan Rapaić 2020-04-22 18:37:14 +02:00 committed by GitHub
parent a38267555d
commit 351f3e00f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View file

@ -1303,7 +1303,7 @@ class MainWP_Child_Server_Information {
} else {
$response_body = wp_remote_retrieve_body( $response );
if ( false === strstr( $response_body, 'MainWP Test' ) ) {
$test_result .= sprintf( __( 'Not expected HTTP response body: %s', 'mainwp-child' ), esc_attr( strip_tags( $response_body ) ) );
$test_result .= sprintf( __( 'Not expected HTTP response body: %s', 'mainwp-child' ), esc_attr( wp_strip_tags( $response_body ) ) );
}
}
if ( empty( $test_result ) ) {

View file

@ -2616,9 +2616,9 @@ class MainWP_Child_Updraft_Plus_Backups {
if ( UpdraftPlus_Manipulation_Functions::normalise_url( $old_siteurl ) == UpdraftPlus_Manipulation_Functions::normalise_url( site_url() ) ) {
// Same site migration with only http/https difference.
$info['same_url'] = false;
$old_siteurl_parsed = parse_url( $old_siteurl );
$actual_siteurl_parsed = parse_url( site_url() );
if ( ( stripos( $old_siteurl_parsed['host'], 'www.' ) === 0 && stripos( $actual_siteurl_parsed['host'], 'www.' ) !== 0 ) || ( stripos( $old_siteurl_parsed['host'], 'www.' ) !== 0 && stripos( $actual_siteurl_parsed['host'], 'www.' ) === 0 ) ) {
$old_siteurl_parsed = wp_parse_url( $old_siteurl );
$actual_siteurl_parsed = wp_parse_url( site_url() );
if ( ( 0 === stripos( $old_siteurl_parsed['host'], 'www.' ) && 0 !== stripos( $actual_siteurl_parsed['host'], 'www.' ) ) || ( stripos( $old_siteurl_parsed['host'], 'www.' ) !== 0 && stripos( $actual_siteurl_parsed['host'], 'www.' ) === 0 ) ) {
$powarn = sprintf( __( 'The website address in the backup set (%1$s) is slightly different from that of the site now (%2$s). This is not expected to be a problem for restoring the site, as long as visits to the former address still reach the site.', 'updraftplus' ), $old_siteurl, site_url() ) . ' ';
} else {
$powarn = '';

View file

@ -1038,7 +1038,7 @@ class MainWP_Child {
public function mod_rewrite_rules( $pRules ) {
$home_root = parse_url( home_url() );
$home_root = wp_parse_url( home_url() );
if ( isset( $home_root['path'] ) ) {
$home_root = trailingslashit( $home_root['path'] );
} else {
@ -1381,7 +1381,7 @@ class MainWP_Child {
if ( ! empty( $open_location ) ) {
$open_location = base64_decode( $open_location ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons.
$_vars = MainWP_Helper::parse_query( $open_location );
$_path = parse_url( $open_location, PHP_URL_PATH );
$_path = wp_parse_url( $open_location, PHP_URL_PATH );
if ( isset( $_vars['_mwpNoneName'] ) && isset( $_vars['_mwpNoneValue'] ) ) {
$_vars[ $_vars['_mwpNoneName'] ] = wp_create_nonce( $_vars['_mwpNoneValue'] );
unset( $_vars['_mwpNoneName'] );
@ -2806,7 +2806,7 @@ class MainWP_Child {
$error_str = '';
foreach ( $errors->get_error_messages() as $message ) {
if ( is_string( $message ) ) {
$error_str .= ' ' . esc_html( strip_tags( $message ) );
$error_str .= ' ' . esc_html( wp_strip_tags( $message ) );
}
}
return array( 'error' => $error_str );

View file

@ -105,10 +105,10 @@ class MainWP_Custom_Post_Type {
$linkToReplaceWith = dirname( $localUrl );
if ( '' !== $hrefLink ) {
$server = get_option( 'mainwp_child_server' );
$serverHost = parse_url( $server, PHP_URL_HOST );
$serverHost = wp_parse_url( $server, PHP_URL_HOST );
if ( ! empty( $serverHost ) && strpos( $hrefLink, $serverHost ) !== false ) {
$serverHref = 'href="' . $serverHost;
$replaceServerHref = 'href="' . parse_url( $localUrl, PHP_URL_SCHEME ) . '://' . parse_url( $localUrl, PHP_URL_HOST );
$replaceServerHref = 'href="' . wp_parse_url( $localUrl, PHP_URL_SCHEME ) . '://' . wp_parse_url( $localUrl, PHP_URL_HOST );
$post_content = str_replace( $serverHref, $replaceServerHref, $post_content );
} elseif ( strpos( $hrefLink, 'http' ) !== false ) {
$lnkToReplace = dirname( $hrefLink );

View file

@ -506,10 +506,10 @@ class MainWP_Helper {
$linkToReplaceWith = dirname( $localUrl );
if ( '' !== $hrefLink ) {
$server = get_option( 'mainwp_child_server' );
$serverHost = parse_url( $server, PHP_URL_HOST );
$serverHost = wp_parse_url( $server, PHP_URL_HOST );
if ( ! empty( $serverHost ) && strpos( $hrefLink, $serverHost ) !== false ) {
$serverHref = 'href="' . $serverHost;
$replaceServerHref = 'href="' . parse_url( $localUrl, PHP_URL_SCHEME ) . '://' . parse_url( $localUrl, PHP_URL_HOST );
$replaceServerHref = 'href="' . wp_parse_url( $localUrl, PHP_URL_SCHEME ) . '://' . wp_parse_url( $localUrl, PHP_URL_HOST );
$new_post['post_content'] = str_replace( $serverHref, $replaceServerHref, $new_post['post_content'] );
}
}
@ -592,7 +592,7 @@ class MainWP_Helper {
$random_date_to = $tmp;
}
$random_timestamp = rand( $random_date_from, $random_date_to );
$random_timestamp = wp_rand( $random_date_from, $random_date_to );
$new_post['post_date'] = date( 'Y-m-d H:i:s', $random_timestamp );
}
}
@ -1124,7 +1124,7 @@ class MainWP_Helper {
$str = '';
$count = strlen( $charset );
while ( $length -- ) {
$str .= $charset[ mt_rand( 0, $count - 1 ) ];
$str .= $charset[ wp_rand( 0, $count - 1 ) ];
}
return $str;
@ -1426,7 +1426,7 @@ class MainWP_Helper {
public static function parse_query( $var ) {
$var = parse_url( $var, PHP_URL_QUERY );
$var = wp_parse_url( $var, PHP_URL_QUERY );
$var = html_entity_decode( $var );
$var = explode( '&', $var );
$arr = array();