Make WordPress Core

Ticket #22325: 22325.diff

File 22325.diff, 2.0 KB (added by rmccue, 12 years ago)

Initial pass at GPCS abstraction

  • wp-includes/class-wp.php

    diff --git wp-includes/class-wp.php wp-includes/class-wp.php
    index 36faf66..11957de 100644
    class WP { 
    8484        var $did_permalink = false;
    8585
    8686        /**
     87         * Unslashed GET superglobal
     88         *
     89         * @since 3.6.0
     90         * @var array
     91         */
     92        var $GET = array();
     93
     94        /**
     95         * Unslashed POST superglobal
     96         *
     97         * @since 3.6.0
     98         * @var array
     99         */
     100        var $POST = array();
     101
     102        /**
     103         * Unslashed REQUEST superglobal
     104         *
     105         * @since 3.6.0
     106         * @var array
     107         */
     108        var $REQUEST = array();
     109
     110        /**
    87111         * Add name to list of public query variables.
    88112         *
    89113         * @since 2.1.0
  • wp-includes/load.php

    diff --git wp-includes/load.php wp-includes/load.php
    index 8a94962..9d79197 100644
    function wp_set_internal_encoding() { 
    530530 * @since 3.0.0
    531531 */
    532532function wp_magic_quotes() {
     533        global $wp;
     534
    533535        // If already slashed, strip.
    534536        if ( get_magic_quotes_gpc() ) {
    535537                $_GET    = stripslashes_deep( $_GET    );
    function wp_magic_quotes() { 
    537539                $_COOKIE = stripslashes_deep( $_COOKIE );
    538540        }
    539541
     542        // During setup, we don't have a global request object
     543        if ( isset( $wp ) ) {
     544                // Store the unslashed superglobals
     545                $wp->GET     = $_GET;
     546                $wp->POST    = $_POST;
     547                $wp->REQUEST = array_merge( $_GET, $_POST );
     548        }
     549
    540550        // Escape with wpdb.
    541551        $_GET    = add_magic_quotes( $_GET    );
    542552        $_POST   = add_magic_quotes( $_POST   );
  • wp-settings.php

    diff --git wp-settings.php wp-settings.php
    index 1094749..026d858 100644
    do_action( 'plugins_loaded' ); 
    213213// Define constants which affect functionality if not already defined.
    214214wp_functionality_constants();
    215215
    216 // Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
    217 wp_magic_quotes();
    218 
    219216do_action( 'sanitize_comment_cookies' );
    220217
    221218/**
    $GLOBALS['wp_rewrite'] = new WP_Rewrite(); 
    247244 */
    248245$wp = new WP();
    249246
     247// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
     248wp_magic_quotes();
     249
    250250/**
    251251 * WordPress Widget Factory Object
    252252 * @global object $wp_widget_factory