Make WordPress Core

Ticket #35899: 35899.diff

File 35899.diff, 10.7 KB (added by chris_dev, 10 years ago)
  • src/wp-admin/includes/class-wp-filesystem-base.php

     
    566566         * @access public
    567567         * @since 2.5.0
    568568         * @abstract
    569          * 
     569         *
    570570         * @param string $file Path to the file.
    571571         * @return string|bool Username of the user or false on error.
    572572         */
  • src/wp-admin/includes/class-wp-filesystem-ftpext.php

     
    120120                        unlink( $tempfile );
    121121                        return false;
    122122                }
    123                
     123
    124124                if ( ! @ftp_fget( $this->link, $temp, $file, FTP_BINARY ) ) {
    125125                        fclose( $temp );
    126126                        unlink( $tempfile );
    127127                        return false;
    128128                }
    129                
     129
    130130                fseek( $temp, 0 ); // Skip back to the start of the file being written to
    131131                $contents = '';
    132132
  • src/wp-admin/includes/class-wp-filesystem-ssh2.php

     
    183183
    184184        /**
    185185         * @access public
    186          * 
     186         *
    187187         * @param string $command
    188188         * @param bool $returnbool
    189189         * @return bool|string
  • src/wp-admin/includes/network.php

     
    159159                $subdomain_install = true;
    160160        } else {
    161161                $subdomain_install = false;
    162                 if ( $got_mod_rewrite = got_mod_rewrite() ) { // dangerous assumptions 
     162                if ( $got_mod_rewrite = got_mod_rewrite() ) { // dangerous assumptions
    163163                        echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
    164164                        /* translators: %s: mod_rewrite */
    165165                        printf( __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
  • src/wp-admin/nav-menus.php

     
    5151
    5252/*
    5353 * If a JSON blob of navigation menu data is found, expand it and inject it
    54  * into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134. 
     54 * into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134.
    5555 */
    5656if ( isset( $_POST['nav-menu-data'] ) ) {
    5757        $data = json_decode( stripslashes( $_POST['nav-menu-data'] ) );
  • src/wp-admin/theme-editor.php

     
    229229
    230230                        echo "\t<ul>\n";
    231231                }
    232                
     232
    233233                $file_description = get_file_description( $filename );
    234234                if ( $filename !== basename( $absolute_filename ) || $file_description !== $filename ) {
    235235                        $file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
  • src/wp-includes/class-feed.php

     
    2727
    2828        /**
    2929         * Class instantiator.
    30          * 
     30         *
    3131         * @param string $location  URL location (scheme is used to determine handler).
    3232         * @param string $filename  Unique identifier for cache object.
    3333         * @param string $extension 'spi' or 'spc'.
  • src/wp-includes/class-json.php

     
    135135    *                                   bubble up with an error, so all return values
    136136    *                                   from encode() should be checked with isError()
    137137    *                           - SERVICES_JSON_USE_TO_JSON:  call toJSON when serializing objects
    138     *                                   It serializes the return value from the toJSON call rather 
    139     *                                   than the object itself, toJSON can return associative arrays, 
     138    *                                   It serializes the return value from the toJSON call rather
     139    *                                   than the object itself, toJSON can return associative arrays,
    140140    *                                   strings or numbers, if you return an object, make sure it does
    141141    *                                   not have a toJSON method, otherwise an error will occur.
    142142    */
     
    158158    var $_mb_strlen = false;
    159159    var $_mb_substr = false;
    160160    var $_mb_convert_encoding = false;
    161    
     161
    162162   /**
    163163    * convert a string from one UTF-16 char to one UTF-8 char
    164164    *
     
    282282        $ret = $this->_encode($var);
    283283        setlocale(LC_NUMERIC, $lc);
    284284        return $ret;
    285        
    286285    }
    287286    /**
    288     * PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format 
     287    * PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format
    289288    *
    290289    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
    291290    *                           see argument 1 to Services_JSON() above for array-parsing behavior.
     
    295294    * @return   mixed   JSON string representation of input var or an error if a problem occurs
    296295    * @access   public
    297296    */
    298     function _encode($var) 
     297    function _encode($var)
    299298    {
    300          
    301299        switch (gettype($var)) {
    302300            case 'boolean':
    303301                return $var ? 'true' : 'false';
     
    362360                                $ascii .= '?';
    363361                                break;
    364362                            }
    365                            
     363
    366364                            $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
    367365                            $c += 1;
    368366                            $utf16 = $this->utf82utf16($char);
     
    488486                return '[' . join(',', $elements) . ']';
    489487
    490488            case 'object':
    491            
     489
    492490                // support toJSON methods.
    493491                if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) {
    494492                    // this may end up allowing unlimited recursion
    495493                    // so we check the return value to make sure it's not got the same method.
    496494                    $recode = $var->toJSON();
    497                    
     495
    498496                    if (method_exists($recode, 'toJSON')) {
    499                        
     497
    500498                        return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
    501499                        ? 'null'
    502500                        : new Services_JSON_Error(get_class($var).
    503501                            " toJSON returned an object with a toJSON method.");
    504                            
     502
    505503                    }
    506                    
     504
    507505                    return $this->_encode( $recode );
    508                 } 
    509                
     506                }
     507
    510508                $vars = get_object_vars($var);
    511                
     509
    512510                $properties = array_map(array($this, 'name_value'),
    513511                                        array_keys($vars),
    514512                                        array_values($vars));
     
    772770                                // element in an associative array,
    773771                                // for now
    774772                                $parts = array();
    775                                
    776                                if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) {
     773
     774                                if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) {
    777775                                      // "name":value pair
    778776                                    $key = $this->decode($parts[1]);
    779777                                    $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
     
    879877
    880878        return false;
    881879    }
    882    
     880
    883881    /**
    884882    * Calculates length of string in bytes
    885     * @param string 
     883    * @param string
    886884    * @return integer length
    887885    */
    888     function strlen8( $str ) 
     886    function strlen8( $str )
    889887    {
    890888        if ( $this->_mb_strlen ) {
    891889            return mb_strlen( $str, "8bit" );
     
    892890        }
    893891        return strlen( $str );
    894892    }
    895    
     893
    896894    /**
    897895    * Returns part of a string, interpreting $start and $length as number of bytes.
    898     * @param string 
    899     * @param integer start 
    900     * @param integer length 
     896    * @param string
     897    * @param integer start
     898    * @param integer length
    901899    * @return integer length
    902900    */
    903     function substr8( $string, $start, $length=false ) 
     901    function substr8( $string, $start, $length=false )
    904902    {
    905903        if ( $length === false ) {
    906904            $length = $this->strlen8( $string ) - $start;
     
    954952                        self::__construct( $message, $code, $mode, $options, $userinfo );
    955953                }
    956954    }
    957    
     955
    958956}
    959957
    960958endif;
  • src/wp-includes/class-wp-walker.php

     
    386386         *
    387387         * @since 2.7.0
    388388         * @access public
    389          * 
     389         *
    390390         * @param array $elements Elements to list.
    391391         * @return int Number of root elements.
    392392         */
  • src/wp-includes/kses.php

     
    550550        $allowed_protocols = wp_allowed_protocols();
    551551        $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
    552552        $string = wp_kses_js_entities( $string );
    553        
     553
    554554        // Preserve leading and trailing whitespace.
    555555        $matches = array();
    556556        preg_match('/^\s*/', $string, $matches);
     
    562562        } else {
    563563                $string = substr( $string, strlen( $lead ), -strlen( $trail ) );
    564564        }
    565        
     565
    566566        // Parse attribute name and value from input.
    567567        $split = preg_split( '/\s*=\s*/', $string, 2 );
    568568        $name = $split[0];
     
    599599                $value = '';
    600600                $vless = 'y';
    601601        }
    602        
     602
    603603        // Sanitize attribute by name.
    604604        wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html );
    605605
     
    10621062        } else {
    10631063                $xhtml_slash = '';
    10641064        }
    1065        
     1065
    10661066        // Split it
    10671067        $attrarr = wp_kses_hair_parse( $attr );
    10681068        if ( false === $attrarr ) {
     
    10721072        // Make sure all input is returned by adding front and back matter.
    10731073        array_unshift( $attrarr, $begin . $slash . $elname );
    10741074        array_push( $attrarr, $xhtml_slash . $end );
    1075        
     1075
    10761076        return $attrarr;
    10771077}
    10781078