equal
deleted
inserted
replaced
|
1 <?php |
|
2 /** |
|
3 * Diff API: WP_Text_Diff_Renderer_inline class |
|
4 * |
|
5 * @package WordPress |
|
6 * @subpackage Diff |
|
7 * @since 4.7.0 |
|
8 */ |
|
9 |
|
10 /** |
|
11 * Better word splitting than the PEAR package provides. |
|
12 * |
|
13 * @since 2.6.0 |
|
14 * @uses Text_Diff_Renderer_inline Extends |
|
15 */ |
|
16 class WP_Text_Diff_Renderer_inline extends Text_Diff_Renderer_inline { |
|
17 |
|
18 /** |
|
19 * @ignore |
|
20 * @since 2.6.0 |
|
21 * |
|
22 * @param string $string |
|
23 * @param string $newlineEscape |
|
24 * @return string |
|
25 */ |
|
26 public function _splitOnWords($string, $newlineEscape = "\n") { |
|
27 $string = str_replace("\0", '', $string); |
|
28 $words = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE ); |
|
29 $words = str_replace( "\n", $newlineEscape, $words ); |
|
30 return $words; |
|
31 } |
|
32 |
|
33 } |