equal
deleted
inserted
replaced
36 /** |
36 /** |
37 * regexp pattern to match $matches[] references |
37 * regexp pattern to match $matches[] references |
38 * |
38 * |
39 * @var string |
39 * @var string |
40 */ |
40 */ |
41 public $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number |
41 public $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // Magic number. |
42 |
42 |
43 /** |
43 /** |
44 * constructor |
44 * constructor |
45 * |
45 * |
46 * @param string $subject subject if regex |
46 * @param string $subject subject if regex |
77 } |
77 } |
78 |
78 |
79 /** |
79 /** |
80 * preg_replace_callback hook |
80 * preg_replace_callback hook |
81 * |
81 * |
82 * @param array $matches preg_replace regexp matches |
82 * @param array $matches preg_replace regexp matches |
83 * @return string |
83 * @return string |
84 */ |
84 */ |
85 public function callback( $matches ) { |
85 public function callback( $matches ) { |
86 $index = intval( substr( $matches[0], 9, -1 ) ); |
86 $index = intval( substr( $matches[0], 9, -1 ) ); |
87 return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' ); |
87 return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' ); |