PluginProbe
Redirection / 3.6
Redirection v3.6
5.10.0 5.9.0 5.8.1 5.8.0 3.7.2 3.7.3 4.0 4.0.1 4.1 4.1.1 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6.2 4.7.1 All 130 releases
← All changes | modules/apache.php +3 -19 4.33.6 View file →
@@ -48,30 +48,14 @@
48 48
49 49 return $htaccess->save( $this->location );
50 50 }
51 51
52 - public function can_save( $location ) {
53 - $location = $this->sanitize_location( $location );
54 -
55 - if ( @fopen( $location, 'a' ) === false ) {
56 - $error = error_get_last();
57 - return new WP_Error( 'redirect', isset( $error['message'] ) ? $error['message'] : 'Unknown error' );
58 - }
59 -
60 - return true;
61 - }
62 -
63 - private function sanitize_location( $location ) {
64 - $location = rtrim( $location, '/' ) . '/.htaccess';
65 - return rtrim( dirname( $location ), '/' ) . '/.htaccess';
66 - }
67 -
68 52 public function update( array $data ) {
69 53 include_once dirname( dirname( __FILE__ ) ) . '/models/htaccess.php';
70 54
71 - $save = [
72 - 'location' => isset( $data['location'] ) ? $this->sanitize_location( trim( $data['location'] ) ) : '',
73 - ];
55 + $save = array(
56 + 'location' => isset( $data['location'] ) ? trim( $data['location'] ) : '',
57 + );
74 58
75 59 if ( ! empty( $this->location ) && $save['location'] !== $this->location ) {
76 60 // Location has moved. Remove from old location
77 61 $htaccess = new Red_Htaccess();