]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-importer.php
WordPress 4.1.2-scripts
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-importer.php
index 5a7f0e47a7e8d858768ef5db5c7bbe17d261660d..b54573f67508b72e693196ed4fff57204329fe5a 100644 (file)
@@ -8,11 +8,7 @@ class WP_Importer {
         *
         * @return void
         */
-       function __construct() {}
-
-       function WP_Importer() {
-               $this->__construct();
-       }
+       public function __construct() {}
 
        /**
         * Returns array with imported permalinks from WordPress database
@@ -20,7 +16,7 @@ class WP_Importer {
         * @param string $bid
         * @return array
         */
-       function get_imported_posts( $importer_name, $bid ) {
+       public function get_imported_posts( $importer_name, $bid ) {
                global $wpdb;
 
                $hashtable = array();
@@ -45,7 +41,7 @@ class WP_Importer {
                        }
                } while ( count( $results ) == $limit );
 
-               // unset to save memory
+               // Unset to save memory.
                unset( $results, $r );
 
                return $hashtable;
@@ -57,7 +53,7 @@ class WP_Importer {
         * @param string $bid
         * @return int
         */
-       function count_imported_posts( $importer_name, $bid ) {
+       public function count_imported_posts( $importer_name, $bid ) {
                global $wpdb;
 
                $count = 0;
@@ -71,7 +67,7 @@ class WP_Importer {
                if ( !empty( $result ) )
                        $count = intval( $result[0]->cnt );
 
-               // unset to save memory
+               // Unset to save memory.
                unset( $results );
 
                return $count;
@@ -83,7 +79,7 @@ class WP_Importer {
         * @param string $bid
         * @return array
         */
-       function get_imported_comments( $bid ) {
+       public function get_imported_comments( $bid ) {
                global $wpdb;
 
                $hashtable = array();
@@ -113,13 +109,13 @@ class WP_Importer {
                        }
                } while ( count( $results ) == $limit );
 
-               // unset to save memory
+               // Unset to save memory.
                unset( $results, $r );
 
                return $hashtable;
        }
 
-       function set_blog( $blog_id ) {
+       public function set_blog( $blog_id ) {
                if ( is_numeric( $blog_id ) ) {
                        $blog_id = (int) $blog_id;
                } else {
@@ -130,14 +126,12 @@ class WP_Importer {
                        }
                        if ( empty( $parsed['path'] ) )
                                $parsed['path'] = '/';
-                       if ( !$blog = get_blog_info( $parsed['host'], $parsed['path'] ) ) {
+                       $blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) );
+                       if ( !$blog ) {
                                fwrite( STDERR, "Error: Could not find blog\n" );
                                exit();
                        }
                        $blog_id = (int) $blog->blog_id;
-                       // Restore global $current_blog
-                       global $current_blog;
-                       $current_blog = $blog;
                }
 
                if ( function_exists( 'is_multisite' ) ) {
@@ -148,7 +142,7 @@ class WP_Importer {
                return $blog_id;
        }
 
-       function set_user( $user_id ) {
+       public function set_user( $user_id ) {
                if ( is_numeric( $user_id ) ) {
                        $user_id = (int) $user_id;
                } else {
@@ -170,7 +164,7 @@ class WP_Importer {
         * @param string $b
         * @return int
         */
-       function cmpr_strlen( $a, $b ) {
+       public function cmpr_strlen( $a, $b ) {
                return strlen( $b ) - strlen( $a );
        }
 
@@ -183,9 +177,9 @@ class WP_Importer {
         * @param bool $head
         * @return array
         */
-       function get_page( $url, $username = '', $password = '', $head = false ) {
+       public function get_page( $url, $username = '', $password = '', $head = false ) {
                // Increase the timeout
-               add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
+               add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );
 
                $headers = array();
                $args = array();
@@ -196,7 +190,7 @@ class WP_Importer {
 
                $args['headers'] = $headers;
 
-               return wp_remote_request( $url, $args );
+               return wp_safe_remote_request( $url, $args );
        }
 
        /**
@@ -205,7 +199,7 @@ class WP_Importer {
         * @param int $val
         * @return int
         */
-       function bump_request_timeout( $val ) {
+       public function bump_request_timeout( $val ) {
                return 60;
        }
 
@@ -214,9 +208,7 @@ class WP_Importer {
         *
         * @return bool
         */
-       function is_user_over_quota() {
-               global $current_user, $current_blog;
-
+       public function is_user_over_quota() {
                if ( function_exists( 'upload_is_user_over_quota' ) ) {
                        if ( upload_is_user_over_quota( 1 ) ) {
                                echo "Sorry, you have used your upload quota.\n";
@@ -233,7 +225,7 @@ class WP_Importer {
         * @param string $string
         * @return string
         */
-       function min_whitespace( $string ) {
+       public function min_whitespace( $string ) {
                return preg_replace( '|[\r\n\t ]+|', ' ', $string );
        }
 
@@ -242,7 +234,7 @@ class WP_Importer {
         *
         * @return void
         */
-       function stop_the_insanity() {
+       public function stop_the_insanity() {
                global $wpdb, $wp_actions;
                // Or define( 'WP_IMPORTING', true );
                $wpdb->queries = array();