]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-upgrader-skins.php
WordPress 4.1
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-upgrader-skins.php
index 8fcee68f3cd96533f20fac5a6347d7fba1fb83a2..7d4037395250b5818a989f17bc40253c8a532a46 100644 (file)
@@ -20,12 +20,16 @@ class WP_Upgrader_Skin {
        public $done_header = false;
        public $done_footer = false;
        public $result = false;
+       public $options = array();
 
        public function __construct($args = array()) {
                $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
                $this->options = wp_parse_args($args, $defaults);
        }
 
+       /**
+        * @param WP_Upgrader $upgrader
+        */
        public function set_upgrader(&$upgrader) {
                if ( is_object($upgrader) )
                        $this->upgrader =& $upgrader;
@@ -39,12 +43,18 @@ class WP_Upgrader_Skin {
                $this->result = $result;
        }
 
-       public function request_filesystem_credentials($error = false) {
+       public function request_filesystem_credentials( $error = false, $context = false, $allow_relaxed_file_ownership = false ) {
                $url = $this->options['url'];
-               $context = $this->options['context'];
-               if ( !empty($this->options['nonce']) )
+               if ( ! $context ) {
+                       $context = $this->options['context'];
+               }
+               if ( !empty($this->options['nonce']) ) {
                        $url = wp_nonce_url($url, $this->options['nonce']);
-               return request_filesystem_credentials($url, '', $error, $context); //Possible to bring inline, Leaving as is for now.
+               }
+
+               $extra_fields = array();
+
+               return request_filesystem_credentials( $url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership );
        }
 
        public function header() {
@@ -209,6 +219,9 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
                $this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
        }
 
+       /**
+        * @param string $string
+        */
        public function feedback($string) {
                if ( isset( $this->upgrader->strings[$string] ) )
                        $string = $this->upgrader->strings[$string];
@@ -698,13 +711,14 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
 class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
        protected $messages = array();
 
-       public function request_filesystem_credentials( $error = false, $context = '' ) {
-               if ( $context )
+       public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
+               if ( $context ) {
                        $this->options['context'] = $context;
+               }
                // TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version
                // This will output a credentials form in event of failure, We don't want that, so just hide with a buffer
                ob_start();
-               $result = parent::request_filesystem_credentials( $error );
+               $result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership );
                ob_end_clean();
                return $result;
        }
@@ -713,6 +727,9 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
                return $this->messages;
        }
 
+       /**
+        * @param string|array|WP_Error $data
+        */
        public function feedback( $data ) {
                if ( is_wp_error( $data ) )
                        $string = $data->get_error_message();