]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-importer.php
WordPress 4.2
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-importer.php
index 0cfc9fe8abb766969034196d3b32546163aa0e6c..ee10547deb58d45f620f4caeffec747c395b6420 100644 (file)
@@ -6,9 +6,8 @@ class WP_Importer {
        /**
         * Class Constructor
         *
        /**
         * Class Constructor
         *
-        * @return void
         */
         */
-       function __construct() {}
+       public function __construct() {}
 
        /**
         * Returns array with imported permalinks from WordPress database
 
        /**
         * Returns array with imported permalinks from WordPress database
@@ -16,7 +15,7 @@ class WP_Importer {
         * @param string $bid
         * @return array
         */
         * @param string $bid
         * @return array
         */
-       function get_imported_posts( $importer_name, $bid ) {
+       public function get_imported_posts( $importer_name, $bid ) {
                global $wpdb;
 
                $hashtable = array();
                global $wpdb;
 
                $hashtable = array();
@@ -41,7 +40,7 @@ class WP_Importer {
                        }
                } while ( count( $results ) == $limit );
 
                        }
                } while ( count( $results ) == $limit );
 
-               // unset to save memory
+               // Unset to save memory.
                unset( $results, $r );
 
                return $hashtable;
                unset( $results, $r );
 
                return $hashtable;
@@ -53,7 +52,7 @@ class WP_Importer {
         * @param string $bid
         * @return int
         */
         * @param string $bid
         * @return int
         */
-       function count_imported_posts( $importer_name, $bid ) {
+       public function count_imported_posts( $importer_name, $bid ) {
                global $wpdb;
 
                $count = 0;
                global $wpdb;
 
                $count = 0;
@@ -67,7 +66,7 @@ class WP_Importer {
                if ( !empty( $result ) )
                        $count = intval( $result[0]->cnt );
 
                if ( !empty( $result ) )
                        $count = intval( $result[0]->cnt );
 
-               // unset to save memory
+               // Unset to save memory.
                unset( $results );
 
                return $count;
                unset( $results );
 
                return $count;
@@ -79,7 +78,7 @@ class WP_Importer {
         * @param string $bid
         * @return array
         */
         * @param string $bid
         * @return array
         */
-       function get_imported_comments( $bid ) {
+       public function get_imported_comments( $bid ) {
                global $wpdb;
 
                $hashtable = array();
                global $wpdb;
 
                $hashtable = array();
@@ -109,13 +108,13 @@ class WP_Importer {
                        }
                } while ( count( $results ) == $limit );
 
                        }
                } while ( count( $results ) == $limit );
 
-               // unset to save memory
+               // Unset to save memory.
                unset( $results, $r );
 
                return $hashtable;
        }
 
                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 {
                if ( is_numeric( $blog_id ) ) {
                        $blog_id = (int) $blog_id;
                } else {
@@ -142,7 +141,7 @@ class WP_Importer {
                return $blog_id;
        }
 
                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 {
                if ( is_numeric( $user_id ) ) {
                        $user_id = (int) $user_id;
                } else {
@@ -164,7 +163,7 @@ class WP_Importer {
         * @param string $b
         * @return int
         */
         * @param string $b
         * @return int
         */
-       function cmpr_strlen( $a, $b ) {
+       public function cmpr_strlen( $a, $b ) {
                return strlen( $b ) - strlen( $a );
        }
 
                return strlen( $b ) - strlen( $a );
        }
 
@@ -177,9 +176,9 @@ class WP_Importer {
         * @param bool $head
         * @return array
         */
         * @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
                // 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();
 
                $headers = array();
                $args = array();
@@ -190,7 +189,7 @@ class WP_Importer {
 
                $args['headers'] = $headers;
 
 
                $args['headers'] = $headers;
 
-               return wp_remote_request( $url, $args );
+               return wp_safe_remote_request( $url, $args );
        }
 
        /**
        }
 
        /**
@@ -199,7 +198,7 @@ class WP_Importer {
         * @param int $val
         * @return int
         */
         * @param int $val
         * @return int
         */
-       function bump_request_timeout( $val ) {
+       public function bump_request_timeout( $val ) {
                return 60;
        }
 
                return 60;
        }
 
@@ -208,9 +207,9 @@ class WP_Importer {
         *
         * @return bool
         */
         *
         * @return bool
         */
-       function is_user_over_quota() {
+       public function is_user_over_quota() {
                if ( function_exists( 'upload_is_user_over_quota' ) ) {
                if ( function_exists( 'upload_is_user_over_quota' ) ) {
-                       if ( upload_is_user_over_quota( 1 ) ) {
+                       if ( upload_is_user_over_quota() ) {
                                echo "Sorry, you have used your upload quota.\n";
                                return true;
                        }
                                echo "Sorry, you have used your upload quota.\n";
                                return true;
                        }
@@ -225,7 +224,7 @@ class WP_Importer {
         * @param string $string
         * @return string
         */
         * @param string $string
         * @return string
         */
-       function min_whitespace( $string ) {
+       public function min_whitespace( $string ) {
                return preg_replace( '|[\r\n\t ]+|', ' ', $string );
        }
 
                return preg_replace( '|[\r\n\t ]+|', ' ', $string );
        }
 
@@ -234,7 +233,7 @@ class WP_Importer {
         *
         * @return void
         */
         *
         * @return void
         */
-       function stop_the_insanity() {
+       public function stop_the_insanity() {
                global $wpdb, $wp_actions;
                // Or define( 'WP_IMPORTING', true );
                $wpdb->queries = array();
                global $wpdb, $wp_actions;
                // Or define( 'WP_IMPORTING', true );
                $wpdb->queries = array();
@@ -273,14 +272,14 @@ function get_cli_args( $param, $required = false ) {
                        }
 
                        $last_arg = $key;
                        }
 
                        $last_arg = $key;
-               } else if ( (bool) preg_match( "/^-([a-zA-Z0-9]+)/", $args[$i], $match ) ) {
+               } elseif ( (bool) preg_match( "/^-([a-zA-Z0-9]+)/", $args[$i], $match ) ) {
                        for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) {
                                $key = $match[1]{$j};
                                $out[$key] = true;
                        }
 
                        $last_arg = $key;
                        for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) {
                                $key = $match[1]{$j};
                                $out[$key] = true;
                        }
 
                        $last_arg = $key;
-               } else if ( $last_arg !== null ) {
+               } elseif ( $last_arg !== null ) {
                        $out[$last_arg] = $args[$i];
                }
        }
                        $out[$last_arg] = $args[$i];
                }
        }