Make WordPress Core

Ticket #39473: 39473-2.patch

File 39473-2.patch, 2.0 KB (added by ruud@…, 9 years ago)

Patch against version 4.7.1, extra level of indentation removed, made getter/setter functions protected

  • wp-includes/rest-api/class-wp-rest-server.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    7272         */
    7373        protected $endpoints = array();
    7474
     75        /**
     76         * The route map is an associative array with path regexes as the keys. The
     77         * value is an indexed array with the callback function/method as the first
     78         * item, and a bitmask of HTTP methods as the second item (see the class
     79         * constants).
     80         *
     81         * @access protected
     82         * @var array Route map of the routes
     83         */
     84        protected $route_map = array();
     85
    7586        /**
    7687         * Options defined for the routes.
    7788         *
     
    673684                }
    674685        }
    675686
     687        /**
     688         * Retrieves the internally stored route map.
     689         *
     690         * @access protected
     691         *
     692         * @return array Route map of the routes.
     693         */
     694        protected function get_route_map() {
     695                return $this->route_map;
     696        }
     697
     698        /**
     699         * Sets the internally stored route map.
     700         *
     701         * @access protected
     702         *
     703         * @param array $route_map Route map of the routes.
     704         */
     705        protected function set_route_map( $route_map ) {
     706                $this->route_map = $route_map;
     707        }
     708
    676709        /**
    677710         * Retrieves the route map.
    678711         *
     712         * Caches the results internally.
     713         *
    679714         * The route map is an associative array with path regexes as the keys. The
    680715         * value is an indexed array with the callback function/method as the first
    681716         * item, and a bitmask of HTTP methods as the second item (see the class
     
    695730         *               `'/path/regex' => array( array( $callback, $bitmask ), ...)`.
    696731         */
    697732        public function get_routes() {
     733                $endpoints = $this->get_route_map();
     734
     735                if ( ! empty( $endpoints ) ) {
     736                        return $endpoints;
     737                }
    698738
    699739                /**
    700740                 * Filters the array of available endpoints.
     
    756796                                }
    757797                        }
    758798                }
     799                $this->set_route_map( $endpoints );
    759800
    760801                return $endpoints;
    761802        }