Changeset 42343 for trunk/src/wp-includes/class-wp-matchesmapregex.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-matchesmapregex.php
r42201 r42343 47 47 * @param array $matches data to use in map 48 48 */ 49 public function __construct( $subject, $matches) {49 public function __construct( $subject, $matches ) { 50 50 $this->_subject = $subject; 51 51 $this->_matches = $matches; 52 $this->output = $this->_map();52 $this->output = $this->_map(); 53 53 } 54 54 … … 64 64 * @return string 65 65 */ 66 public static function apply( $subject, $matches) {67 $oSelf = new WP_MatchesMapRegex( $subject, $matches);66 public static function apply( $subject, $matches ) { 67 $oSelf = new WP_MatchesMapRegex( $subject, $matches ); 68 68 return $oSelf->output; 69 69 } … … 75 75 */ 76 76 private function _map() { 77 $callback = array( $this, 'callback');78 return preg_replace_callback( $this->_pattern, $callback, $this->_subject);77 $callback = array( $this, 'callback' ); 78 return preg_replace_callback( $this->_pattern, $callback, $this->_subject ); 79 79 } 80 80 … … 85 85 * @return string 86 86 */ 87 public function callback( $matches) {88 $index = intval( substr($matches[0], 9, -1));89 return ( isset( $this->_matches[ $index] ) ? urlencode($this->_matches[$index]) : '' );87 public function callback( $matches ) { 88 $index = intval( substr( $matches[0], 9, -1 ) ); 89 return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' ); 90 90 } 91 91 }
Note: See TracChangeset
for help on using the changeset viewer.