]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-snoopy.php
WordPress 4.5
[autoinstalls/wordpress.git] / wp-includes / class-snoopy.php
index b1b32d2faa9bbd82e8da6a7c161257de6864f02f..7b3940669fbf3c0650c328b7ffdc9f44c3de696d 100644 (file)
@@ -1,5 +1,11 @@
 <?php
-if ( !in_array('Snoopy', get_declared_classes() ) ) :
+
+/**
+ * Deprecated. Use WP_HTTP (http.php) instead.
+ */
+_deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/http.php' );
+
+if ( ! class_exists( 'Snoopy', false ) ) :
 /*************************************************
 
 Snoopy - the PHP net client
@@ -713,13 +719,13 @@ class Snoopy
                                                        chr(176),
                                                        chr(39),
                                                        chr(128),
-                                                       "ä",
-                                                       "ö",
-                                                       "ü",
-                                                       "Ä",
-                                                       "Ö",
-                                                       "Ü",
-                                                       "ß",
+                                                       chr(0xE4), // ANSI &auml;
+                                                       chr(0xF6), // ANSI &ouml;
+                                                       chr(0xFC), // ANSI &uuml;
+                                                       chr(0xC4), // ANSI &Auml;
+                                                       chr(0xD6), // ANSI &Ouml;
+                                                       chr(0xDC), // ANSI &Uuml;
+                                                       chr(0xDF), // ANSI &szlig;
                                                );
 
                $text = preg_replace($search,$replace,$document);
@@ -904,7 +910,7 @@ class Snoopy
                        return false;
                }
 
-               // check if there is a redirect meta tag
+               // check if there is a redirect meta tag
 
                if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
 
@@ -993,20 +999,23 @@ class Snoopy
                if(!empty($this->user) || !empty($this->pass))
                        $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
 
-               for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
-                       $safer_header = strtr( $headers[$curr_header], "\"", " " );
-                       $cmdline_params .= " -H \"".$safer_header."\"";
+               $headerfile = tempnam( $this->temp_dir, "sno" );
+               $cmdline_params = '-k -D ' . escapeshellarg( $headerfile );
+
+               foreach ( $headers as $header ) {
+                       $cmdline_params .= ' -H ' . escapeshellarg( $header );
                }
 
-               if(!empty($body))
-                       $cmdline_params .= " -d \"$body\"";
+               if ( ! empty( $body ) ) {
+                       $cmdline_params .= ' -d ' . escapeshellarg( $body );
+               }
 
-               if($this->read_timeout > 0)
-                       $cmdline_params .= " -m ".$this->read_timeout;
+               if ( $this->read_timeout > 0 ) {
+                       $cmdline_params .= ' -m ' . escapeshellarg( $this->read_timeout );
+               }
 
-               $headerfile = tempnam($temp_dir, "sno");
 
-               exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($URI)."\"",$results,$return);
+               exec( $this->curl_path . ' ' . $cmdline_params . ' ' . escapeshellarg( $URI ), $results, $return );
 
                if($return)
                {
@@ -1051,7 +1060,7 @@ class Snoopy
                        $this->headers[] = $result_headers[$currentHeader];
                }
 
-               // check if there is a redirect meta tag
+               // check if there is a redirect meta tag
 
                if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
                {