diff --git a/mu-plugin/plausible-proxy-speed-module.php b/mu-plugin/plausible-proxy-speed-module.php index 32c6bd11..be6ffb61 100644 --- a/mu-plugin/plausible-proxy-speed-module.php +++ b/mu-plugin/plausible-proxy-speed-module.php @@ -62,7 +62,7 @@ private function is_proxy_request() { return false; } - $path = parse_url( $this->request_uri, PHP_URL_PATH ); + $path = wp_parse_url( $this->request_uri, PHP_URL_PATH ); if ( ! is_string( $path ) || $path === '' ) { return false; diff --git a/src/Admin/Module.php b/src/Admin/Module.php index bb6850fd..83f43dec 100644 --- a/src/Admin/Module.php +++ b/src/Admin/Module.php @@ -128,7 +128,7 @@ public function uninstall() { $file_path = WP_CONTENT_DIR . '/mu-plugins/plausible-proxy-speed-module.php'; if ( file_exists( $file_path ) ) { - unlink( $file_path ); + wp_delete_file( $file_path ); } if ( get_option( 'plausible_analytics_created_mu_plugins_dir' ) && $this->dir_is_empty( WPMU_PLUGIN_DIR ) ) { @@ -142,7 +142,7 @@ public function uninstall() { $js_file = $this->get_filename(); if ( file_exists( $cache_dir . $js_file . '.js' ) ) { - unlink( $cache_dir . $js_file . '.js' ); // @codeCoverageIgnore + wp_delete_file( $cache_dir . $js_file . '.js' ); // @codeCoverageIgnore } if ( $this->dir_is_empty( $cache_dir ) ) { diff --git a/src/Cron.php b/src/Cron.php index f1742c44..5869fdf3 100644 --- a/src/Cron.php +++ b/src/Cron.php @@ -90,7 +90,7 @@ private function download_file( $remote_file, $local_file ) { * Some servers don't do a full overwrite if file already exists, so we delete it first. */ if ( file_exists( $local_file ) ) { - unlink( $local_file ); + wp_delete_file( $local_file ); } $write = file_put_contents( $local_file, wp_remote_retrieve_body( $file_contents ) ); diff --git a/src/Proxy.php b/src/Proxy.php index 1012cbde..a7a6b4b5 100644 --- a/src/Proxy.php +++ b/src/Proxy.php @@ -136,8 +136,8 @@ public function do_request( $name = 'pageview', $domain = '', $url = '', $props */ public function generate_event_url() { $url = ''; - $parts = parse_url( $_SERVER[ 'REQUEST_URI' ] ); - $home_url_parts = parse_url( get_home_url() ); + $parts = wp_parse_url( $_SERVER[ 'REQUEST_URI' ] ); + $home_url_parts = wp_parse_url( get_home_url() ); if ( isset( $home_url_parts[ 'scheme' ] ) && isset( $home_url_parts[ 'host' ] ) && isset( $parts[ 'path' ] ) ) { $url = $home_url_parts[ 'scheme' ] . '://' . $home_url_parts [ 'host' ] . $parts[ 'path' ]; diff --git a/src/Uninstall.php b/src/Uninstall.php index 7c3c1c81..30b0c17c 100644 --- a/src/Uninstall.php +++ b/src/Uninstall.php @@ -62,7 +62,7 @@ private function delete_proxy_speed_module() { $file_path = WP_CONTENT_DIR . '/mu-plugins/plausible-proxy-speed-module.php'; if ( file_exists( $file_path ) ) { - unlink( $file_path ); + wp_delete_file( $file_path ); } } }