Gentoo Archives: gentoo-commits

From: Theo Chatzimichos <tampakrap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/blogs-gentoo:master commit in: plugins/wordpress-importer/, plugins/wordpress-importer/languages/, ...
Date: Mon, 01 Aug 2011 11:18:17
Message-Id: 70011eb7f2f5c26a3b9bfee28863c3aa8dcdc2f7.tampakrap@gentoo
1 commit: 70011eb7f2f5c26a3b9bfee28863c3aa8dcdc2f7
2 Author: Theo Chatzimichos <tampakrap <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 1 11:17:42 2011 +0000
4 Commit: Theo Chatzimichos <tampakrap <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 1 11:17:42 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/blogs-gentoo.git;a=commit;h=70011eb7
7
8 Update wp-importer and wp-syntax
9
10 ---
11 .../languages/wordpress-importer.pot | 90 ++++++++++----------
12 plugins/wordpress-importer/parsers.php | 31 +++++++-
13 plugins/wordpress-importer/readme.txt | 11 ++-
14 plugins/wordpress-importer/wordpress-importer.php | 23 ++++--
15 plugins/wp-syntax/README.txt | 11 ++-
16 plugins/wp-syntax/wp-syntax.php | 48 ++++++++---
17 6 files changed, 144 insertions(+), 70 deletions(-)
18
19 diff --git a/plugins/wordpress-importer/languages/wordpress-importer.pot b/plugins/wordpress-importer/languages/wordpress-importer.pot
20 index 8dae6cf..0ca72e2 100644
21 --- a/plugins/wordpress-importer/languages/wordpress-importer.pot
22 +++ b/plugins/wordpress-importer/languages/wordpress-importer.pot
23 @@ -2,9 +2,9 @@
24 # This file is distributed under the same license as the WordPress Importer package.
25 msgid ""
26 msgstr ""
27 -"Project-Id-Version: WordPress Importer 0.3\n"
28 +"Project-Id-Version: WordPress Importer 0.5\n"
29 "Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-importer\n"
30 -"POT-Creation-Date: 2011-02-21 21:07:12+00:00\n"
31 +"POT-Creation-Date: 2011-07-16 15:45:12+00:00\n"
32 "MIME-Version: 1.0\n"
33 "Content-Type: text/plain; charset=UTF-8\n"
34 "Content-Transfer-Encoding: 8bit\n"
35 @@ -22,49 +22,49 @@ msgid ""
36 "parser..."
37 msgstr ""
38
39 -#: parsers.php:67 parsers.php:72 parsers.php:248 parsers.php:430
40 +#: parsers.php:67 parsers.php:72 parsers.php:262 parsers.php:451
41 msgid ""
42 "This does not appear to be a WXR file, missing/invalid WXR version number"
43 msgstr ""
44
45 -#: wordpress-importer.php:133 wordpress-importer.php:142
46 -#: wordpress-importer.php:193 wordpress-importer.php:201
47 +#: wordpress-importer.php:134 wordpress-importer.php:143
48 +#: wordpress-importer.php:194 wordpress-importer.php:202
49 msgid "Sorry, there has been an error."
50 msgstr ""
51
52 -#: wordpress-importer.php:134
53 +#: wordpress-importer.php:135
54 msgid "The file does not exist, please try again."
55 msgstr ""
56
57 -#: wordpress-importer.php:177
58 +#: wordpress-importer.php:178
59 msgid "All done."
60 msgstr ""
61
62 -#: wordpress-importer.php:177
63 +#: wordpress-importer.php:178
64 msgid "Have fun!"
65 msgstr ""
66
67 -#: wordpress-importer.php:178
68 +#: wordpress-importer.php:179
69 msgid "Remember to update the passwords and roles of imported users."
70 msgstr ""
71
72 -#: wordpress-importer.php:209
73 +#: wordpress-importer.php:210
74 msgid ""
75 "This WXR file (version %s) may not be supported by this version of the "
76 "importer. Please consider updating."
77 msgstr ""
78
79 -#: wordpress-importer.php:234
80 +#: wordpress-importer.php:235
81 msgid ""
82 "Failed to import author %s. Their posts will be attributed to the current "
83 "user."
84 msgstr ""
85
86 -#: wordpress-importer.php:260
87 +#: wordpress-importer.php:261
88 msgid "Assign Authors"
89 msgstr ""
90
91 -#: wordpress-importer.php:261
92 +#: wordpress-importer.php:262
93 msgid ""
94 "To make it easier for you to edit and save the imported content, you may "
95 "want to reassign the author of the imported item to an existing user of this "
96 @@ -72,137 +72,137 @@ msgid ""
97 "code>s entries."
98 msgstr ""
99
100 -#: wordpress-importer.php:263
101 +#: wordpress-importer.php:264
102 msgid ""
103 "If a new user is created by WordPress, a new password will be randomly "
104 "generated and the new user&#8217;s role will be set as %s. Manually changing "
105 "the new user&#8217;s details will be necessary."
106 msgstr ""
107
108 -#: wordpress-importer.php:273
109 +#: wordpress-importer.php:274
110 msgid "Import Attachments"
111 msgstr ""
112
113 -#: wordpress-importer.php:276
114 +#: wordpress-importer.php:277
115 msgid "Download and import file attachments"
116 msgstr ""
117
118 -#: wordpress-importer.php:280
119 +#: wordpress-importer.php:281
120 msgid "Submit"
121 msgstr ""
122
123 -#: wordpress-importer.php:293
124 +#: wordpress-importer.php:294
125 msgid "Import author:"
126 msgstr ""
127
128 -#: wordpress-importer.php:304
129 +#: wordpress-importer.php:305
130 msgid "or create new user with login name:"
131 msgstr ""
132
133 -#: wordpress-importer.php:307
134 +#: wordpress-importer.php:308
135 msgid "as a new user:"
136 msgstr ""
137
138 -#: wordpress-importer.php:315
139 +#: wordpress-importer.php:316
140 msgid "assign posts to an existing user:"
141 msgstr ""
142
143 -#: wordpress-importer.php:317
144 +#: wordpress-importer.php:318
145 msgid "or assign posts to an existing user:"
146 msgstr ""
147
148 -#: wordpress-importer.php:318
149 +#: wordpress-importer.php:319
150 msgid "- Select -"
151 msgstr ""
152
153 -#: wordpress-importer.php:366
154 +#: wordpress-importer.php:369
155 msgid ""
156 "Failed to create new user for %s. Their posts will be attributed to the "
157 "current user."
158 msgstr ""
159
160 -#: wordpress-importer.php:413
161 +#: wordpress-importer.php:418
162 msgid "Failed to import category %s"
163 msgstr ""
164
165 -#: wordpress-importer.php:449
166 +#: wordpress-importer.php:456
167 msgid "Failed to import post tag %s"
168 msgstr ""
169
170 -#: wordpress-importer.php:491 wordpress-importer.php:603
171 +#: wordpress-importer.php:500 wordpress-importer.php:626
172 msgid "Failed to import %s %s"
173 msgstr ""
174
175 -#: wordpress-importer.php:513
176 +#: wordpress-importer.php:522
177 msgid "Failed to import &#8220;%s&#8221;: Invalid post type %s"
178 msgstr ""
179
180 -#: wordpress-importer.php:534
181 +#: wordpress-importer.php:543
182 msgid "%s &#8220;%s&#8221; already exists."
183 msgstr ""
184
185 -#: wordpress-importer.php:575
186 +#: wordpress-importer.php:598
187 msgid "Failed to import %s &#8220;%s&#8221;"
188 msgstr ""
189
190 -#: wordpress-importer.php:712
191 +#: wordpress-importer.php:744
192 msgid "Menu item skipped due to missing menu slug"
193 msgstr ""
194
195 -#: wordpress-importer.php:719
196 +#: wordpress-importer.php:751
197 msgid "Menu item skipped due to invalid menu slug: %s"
198 msgstr ""
199
200 -#: wordpress-importer.php:782
201 +#: wordpress-importer.php:814
202 msgid "Fetching attachments is not enabled"
203 msgstr ""
204
205 -#: wordpress-importer.php:795
206 +#: wordpress-importer.php:827
207 msgid "Invalid file type"
208 msgstr ""
209
210 -#: wordpress-importer.php:838
211 +#: wordpress-importer.php:871
212 msgid "Remote server did not respond"
213 msgstr ""
214
215 -#: wordpress-importer.php:844
216 +#: wordpress-importer.php:877
217 msgid "Remote server returned error response %1$d %2$s"
218 msgstr ""
219
220 -#: wordpress-importer.php:851
221 +#: wordpress-importer.php:884
222 msgid "Remote file is incorrect size"
223 msgstr ""
224
225 -#: wordpress-importer.php:856
226 +#: wordpress-importer.php:889
227 msgid "Zero size file downloaded"
228 msgstr ""
229
230 -#: wordpress-importer.php:862
231 +#: wordpress-importer.php:895
232 msgid "Remote file is too large, limit is %s"
233 msgstr ""
234
235 -#: wordpress-importer.php:961
236 +#: wordpress-importer.php:994
237 msgid "Import WordPress"
238 msgstr ""
239
240 -#: wordpress-importer.php:968
241 +#: wordpress-importer.php:1001
242 msgid ""
243 "A new version of this importer is available. Please update to version %s to "
244 "ensure compatibility with newer export files."
245 msgstr ""
246
247 -#: wordpress-importer.php:983
248 +#: wordpress-importer.php:1016
249 msgid ""
250 "Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import "
251 "the posts, pages, comments, custom fields, categories, and tags into this "
252 "site."
253 msgstr ""
254
255 -#: wordpress-importer.php:984
256 -msgid "Choose a WXR file to upload, then click Upload file and import."
257 +#: wordpress-importer.php:1017
258 +msgid "Choose a WXR (.xml) file to upload, then click Upload file and import."
259 msgstr ""
260
261 -#: wordpress-importer.php:1058
262 +#: wordpress-importer.php:1091
263 msgid ""
264 "Import <strong>posts, pages, comments, custom fields, categories, and tags</"
265 "strong> from a WordPress export file."
266
267 diff --git a/plugins/wordpress-importer/parsers.php b/plugins/wordpress-importer/parsers.php
268 index 87c3b9d..ab4be51 100644
269 --- a/plugins/wordpress-importer/parsers.php
270 +++ b/plugins/wordpress-importer/parsers.php
271 @@ -173,11 +173,21 @@ class WXR_Parser_SimpleXML {
272 foreach ( $wp->postmeta as $meta ) {
273 $post['postmeta'][] = array(
274 'key' => (string) $meta->meta_key,
275 - 'value' => (string) $meta->meta_value,
276 + 'value' => (string) $meta->meta_value
277 );
278 }
279
280 foreach ( $wp->comment as $comment ) {
281 + $meta = array();
282 + if ( isset( $comment->commentmeta ) ) {
283 + foreach ( $comment->commentmeta as $m ) {
284 + $meta[] = array(
285 + 'key' => (string) $m->meta_key,
286 + 'value' => (string) $m->meta_value
287 + );
288 + }
289 + }
290 +
291 $post['comments'][] = array(
292 'comment_id' => (int) $comment->comment_id,
293 'comment_author' => (string) $comment->comment_author,
294 @@ -191,6 +201,7 @@ class WXR_Parser_SimpleXML {
295 'comment_type' => (string) $comment->comment_type,
296 'comment_parent' => (string) $comment->comment_parent,
297 'comment_user_id' => (int) $comment->comment_user_id,
298 + 'commentmeta' => $meta,
299 );
300 }
301
302 @@ -302,10 +313,17 @@ class WXR_Parser_XML {
303 function tag_close( $parser, $tag ) {
304 switch ( $tag ) {
305 case 'wp:comment':
306 + unset( $this->sub_data['key'], $this->sub_data['value'] ); // remove meta sub_data
307 if ( ! empty( $this->sub_data ) )
308 $this->data['comments'][] = $this->sub_data;
309 $this->sub_data = false;
310 break;
311 + case 'wp:commentmeta':
312 + $this->sub_data['commentmeta'][] = array(
313 + 'key' => $this->sub_data['key'],
314 + 'value' => $this->sub_data['value']
315 + );
316 + break;
317 case 'category':
318 if ( ! empty( $this->sub_data ) ) {
319 $this->sub_data['name'] = $this->cdata;
320 @@ -546,6 +564,16 @@ class WXR_Parser_Regex {
321 $comments = $comments[1];
322 if ( $comments ) {
323 foreach ( $comments as $comment ) {
324 + preg_match_all( '|<wp:commentmeta>(.+?)</wp:commentmeta>|is', $comment, $commentmeta );
325 + $commentmeta = $commentmeta[1];
326 + $c_meta = array();
327 + foreach ( $commentmeta as $m ) {
328 + $c_meta[] = array(
329 + 'key' => $this->get_tag( $m, 'wp:meta_key' ),
330 + 'value' => $this->get_tag( $m, 'wp:meta_value' ),
331 + );
332 + }
333 +
334 $post_comments[] = array(
335 'comment_id' => $this->get_tag( $comment, 'wp:comment_id' ),
336 'comment_author' => $this->get_tag( $comment, 'wp:comment_author' ),
337 @@ -559,6 +587,7 @@ class WXR_Parser_Regex {
338 'comment_type' => $this->get_tag( $comment, 'wp:comment_type' ),
339 'comment_parent' => $this->get_tag( $comment, 'wp:comment_parent' ),
340 'comment_user_id' => $this->get_tag( $comment, 'wp:comment_user_id' ),
341 + 'commentmeta' => $c_meta,
342 );
343 }
344 }
345
346 diff --git a/plugins/wordpress-importer/readme.txt b/plugins/wordpress-importer/readme.txt
347 index 554232f..e296814 100644
348 --- a/plugins/wordpress-importer/readme.txt
349 +++ b/plugins/wordpress-importer/readme.txt
350 @@ -3,8 +3,8 @@ Contributors: wordpressdotorg
351 Donate link:
352 Tags: importer, wordpress
353 Requires at least: 3.0
354 -Tested up to: 3.1
355 -Stable tag: 0.4
356 +Tested up to: 3.2.1
357 +Stable tag: 0.5
358
359 Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
360
361 @@ -37,6 +37,10 @@ If you would prefer to do things manually then follow these instructions:
362
363 == Changelog ==
364
365 += 0.5 =
366 +* Import comment meta (requires export from WordPress 3.2)
367 +* Minor bugfixes and enhancements
368 +
369 = 0.4 =
370 * Map comment user_id where possible
371 * Import attachments from `wp:attachment_url`
372 @@ -53,6 +57,9 @@ If you would prefer to do things manually then follow these instructions:
373
374 == Upgrade Notice ==
375
376 += 0.5 =
377 +Import comment meta and other minor bugfixes and enhancements.
378 +
379 = 0.4 =
380 Bug fixes for attachment importing and other small enhancements.
381
382
383 diff --git a/plugins/wordpress-importer/wordpress-importer.php b/plugins/wordpress-importer/wordpress-importer.php
384 index 966182a..5e38484 100644
385 --- a/plugins/wordpress-importer/wordpress-importer.php
386 +++ b/plugins/wordpress-importer/wordpress-importer.php
387 @@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/extend/plugins/wordpress-importer/
388 Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
389 Author: wordpressdotorg
390 Author URI: http://wordpress.org/
391 -Version: 0.4
392 +Version: 0.5
393 Text Domain: wordpress-importer
394 License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
395 */
396 @@ -335,6 +335,8 @@ class WP_Import extends WP_Importer {
397 $create_users = $this->allow_create_users();
398
399 foreach ( (array) $_POST['imported_authors'] as $i => $old_login ) {
400 + // Multsite adds strtolower to sanitize_user. Need to sanitize here to stop breakage in process_posts.
401 + $santized_old_login = sanitize_user( $old_login, true );
402 $old_id = isset( $this->authors[$old_login]['author_id'] ) ? intval($this->authors[$old_login]['author_id']) : false;
403
404 if ( ! empty( $_POST['user_map'][$i] ) ) {
405 @@ -342,7 +344,7 @@ class WP_Import extends WP_Importer {
406 if ( isset( $user->ID ) ) {
407 if ( $old_id )
408 $this->processed_authors[$old_id] = $user->ID;
409 - $this->author_mapping[$old_login] = $user->ID;
410 + $this->author_mapping[$santized_old_login] = $user->ID;
411 }
412 } else if ( $create_users ) {
413 if ( ! empty($_POST['user_new'][$i]) ) {
414 @@ -362,7 +364,7 @@ class WP_Import extends WP_Importer {
415 if ( ! is_wp_error( $user_id ) ) {
416 if ( $old_id )
417 $this->processed_authors[$old_id] = $user_id;
418 - $this->author_mapping[$old_login] = $user_id;
419 + $this->author_mapping[$santized_old_login] = $user_id;
420 } else {
421 printf( __( 'Failed to create new user for %s. Their posts will be attributed to the current user.', 'wordpress-importer' ), esc_html($this->authors[$old_login]['author_display_name']) );
422 if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
423 @@ -372,10 +374,10 @@ class WP_Import extends WP_Importer {
424 }
425
426 // failsafe: if the user_id was invalid, default to the current user
427 - if ( ! isset( $this->author_mapping[$old_login] ) ) {
428 + if ( ! isset( $this->author_mapping[$santized_old_login] ) ) {
429 if ( $old_id )
430 $this->processed_authors[$old_id] = (int) get_current_user_id();
431 - $this->author_mapping[$old_login] = (int) get_current_user_id();
432 + $this->author_mapping[$santized_old_login] = (int) get_current_user_id();
433 }
434 }
435 }
436 @@ -523,7 +525,7 @@ class WP_Import extends WP_Importer {
437 continue;
438 }
439
440 - if ( isset( $this->processed_posts[$post['post_id']] ) )
441 + if ( isset( $this->processed_posts[$post['post_id']] ) && ! empty( $post['post_id'] ) )
442 continue;
443
444 if ( $post['status'] == 'auto-draft' )
445 @@ -654,6 +656,7 @@ class WP_Import extends WP_Importer {
446 $newcomments[$comment_id]['comment_approved'] = $comment['comment_approved'];
447 $newcomments[$comment_id]['comment_type'] = $comment['comment_type'];
448 $newcomments[$comment_id]['comment_parent'] = $comment['comment_parent'];
449 + $newcomments[$comment_id]['commentmeta'] = isset( $comment['commentmeta'] ) ? $comment['commentmeta'] : array();
450 if ( isset( $this->processed_authors[$comment['comment_user_id']] ) )
451 $newcomments[$comment_id]['user_id'] = $this->processed_authors[$comment['comment_user_id']];
452 }
453 @@ -666,6 +669,12 @@ class WP_Import extends WP_Importer {
454 $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
455 $comment = wp_filter_comment( $comment );
456 $inserted_comments[$key] = wp_insert_comment( $comment );
457 +
458 + foreach( $comment['commentmeta'] as $meta ) {
459 + $value = maybe_unserialize( $meta['value'] );
460 + add_comment_meta( $inserted_comments[$key], $meta['key'], $value );
461 + }
462 +
463 $num_comments++;
464 }
465 }
466 @@ -1005,7 +1014,7 @@ class WP_Import extends WP_Importer {
467 function greet() {
468 echo '<div class="narrow">';
469 echo '<p>'.__( 'Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, pages, comments, custom fields, categories, and tags into this site.', 'wordpress-importer' ).'</p>';
470 - echo '<p>'.__( 'Choose a WXR file to upload, then click Upload file and import.', 'wordpress-importer' ).'</p>';
471 + echo '<p>'.__( 'Choose a WXR (.xml) file to upload, then click Upload file and import.', 'wordpress-importer' ).'</p>';
472 wp_import_upload_form( 'admin.php?import=wordpress&amp;step=1' );
473 echo '</div>';
474 }
475
476 diff --git a/plugins/wp-syntax/README.txt b/plugins/wp-syntax/README.txt
477 index 3a32264..174ac43 100644
478 --- a/plugins/wp-syntax/README.txt
479 +++ b/plugins/wp-syntax/README.txt
480 @@ -3,8 +3,8 @@ Contributors: shazahm1@×××××××.com, rmm5t
481 Donate link: http://connections-pro.com
482 Tags: syntax highlighting, syntax, highlight, code, formatting
483 Requires at least: 3.0
484 -Tested up to: 3.1.3
485 -Stable tag: 0.9.10
486 +Tested up to: 3.2.1
487 +Stable tag: 0.9.12
488
489 WP-Syntax provides clean syntax highlighting for embedding source code within pages or posts.
490
491 @@ -167,8 +167,11 @@ review the [GeSHi Documentation](http://qbnz.com/highlighter/geshi-doc.html).
492
493 == Changelog ==
494
495 -**0.9.10** : Fix for security vulnerability when register_globals in php is
496 - enabled;
497 +**0.9.12** : Fixed a range bug in the new highlight feature.
498 +
499 +**0.9.11** : Added line highlighting support. User submitted patch. [Thanks Flynsarmy && Chimo](http://www.flynsarmy.com/2011/06/how-to-add-line-highlight-support-to-wp-syntax/)
500 +
501 +**0.9.10** : Fix for security vulnerability when register_globals in php is enabled.
502
503 **0.9.9** : Fix to support child theme's. WP-Syntax now requires WP >= 3.0.
504 Credit to [OddOneOut](http://wordpress.org/support/topic/wp-syntax-css-with-twenty-ten-child-theme)
505
506 diff --git a/plugins/wp-syntax/wp-syntax.php b/plugins/wp-syntax/wp-syntax.php
507 index db9ea98..3d195ea 100644
508 --- a/plugins/wp-syntax/wp-syntax.php
509 +++ b/plugins/wp-syntax/wp-syntax.php
510 @@ -3,11 +3,13 @@
511 Plugin Name: WP-Syntax
512 Plugin URI: http://wordpress.org/extend/plugins/wp-syntax/
513 Description: Syntax highlighting using <a href="http://qbnz.com/highlighter/">GeSHi</a> supporting a wide range of popular languages. Wrap code blocks with <code>&lt;pre lang="LANGUAGE" line="1"&gt;</code> and <code>&lt;/pre&gt;</code> where <code>LANGUAGE</code> is a geshi supported language syntax. The <code>line</code> attribute is optional.
514 -Author: Ryan McGeary, Steven A. Zahm
515 -Version: 0.9.10
516 +Author: Steven A. Zahm
517 +Version: 0.9.12
518 Author URI: http://connections-pro.com
519 */
520
521 +# Original Author: Ryan McGeary
522 +
523 #
524 # Copyright (c) 2007-2009 Ryan McGeary 2010 Steven A. Zahm
525 #
526 @@ -37,12 +39,14 @@ if (!CUSTOM_TAGS) {
527 'escaped' => array(),
528 'style' => array(),
529 'width' => array(),
530 + 'highlight' => array()
531 );
532 //Allow plugin use in comments
533 $allowedtags['pre'] = array(
534 'lang' => array(),
535 'line' => array(),
536 'escaped' => array(),
537 + 'highlight' => array()
538 );
539 }
540
541 @@ -101,22 +105,44 @@ function wp_syntax_line_numbers($code, $start)
542 function wp_syntax_highlight($match)
543 {
544 global $wp_syntax_matches;
545 -
546 +
547 $i = intval($match[1]);
548 $match = $wp_syntax_matches[$i];
549 -
550 +
551 $language = strtolower(trim($match[1]));
552 $line = trim($match[2]);
553 $escaped = trim($match[3]);
554 - $code = wp_syntax_code_trim($match[4]);
555 +
556 + $code = wp_syntax_code_trim($match[5]);
557 if ($escaped == "true") $code = htmlspecialchars_decode($code);
558 -
559 +
560 $geshi = new GeSHi($code, $language);
561 $geshi->enable_keyword_links(false);
562 do_action_ref_array('wp_syntax_init_geshi', array(&$geshi));
563 -
564 +
565 + //START LINE HIGHLIGHT SUPPORT
566 + $highlight = array();
567 + if ( !empty($match[4]) )
568 + {
569 + $highlight = strpos($match[4],',') == false ? array($match[4]) : explode(',', $match[4]);
570 +
571 + $h_lines = array();
572 + for( $i=0; $i<sizeof($highlight); $i++ )
573 + {
574 + $h_range = explode('-', $highlight[$i]);
575 +
576 + if( sizeof($h_range) == 2 )
577 + $h_lines = array_merge( $h_lines, range($h_range[0], $h_range[1]) );
578 + else
579 + array_push($h_lines, $highlight[$i]);
580 + }
581 +
582 + $geshi->highlight_lines_extra( $h_lines );
583 + }
584 + //END LINE HIGHLIGHT SUPPORT
585 +
586 $output = "\n<div class=\"wp_syntax\">";
587 -
588 +
589 if ($line)
590 {
591 $output .= "<table><tr><td class=\"line_numbers\">";
592 @@ -132,16 +158,16 @@ function wp_syntax_highlight($match)
593 $output .= "</div>";
594 }
595 return
596 -
597 +
598 $output .= "</div>\n";
599 -
600 +
601 return $output;
602 }
603
604 function wp_syntax_before_filter($content)
605 {
606 return preg_replace_callback(
607 - "/\s*<pre(?:lang=[\"']([\w-]+)[\"']|line=[\"'](\d*)[\"']|escaped=[\"'](true|false)?[\"']|\s)+>(.*)<\/pre>\s*/siU",
608 + "/\s*<pre(?:lang=[\"']([\w-]+)[\"']|line=[\"'](\d*)[\"']|escaped=[\"'](true|false)?[\"']|highlight=[\"']((?:\d+[,-])*\d+)[\"']|\s)+>(.*)<\/pre>\s*/siU",
609 "wp_syntax_substitute",
610 $content
611 );