* [gentoo-commits] proj/blogs-gentoo:master commit in: plugins/wordpress-importer/, plugins/wordpress-importer/languages/, ...
@ 2011-08-01 11:18 Theo Chatzimichos
0 siblings, 0 replies; only message in thread
From: Theo Chatzimichos @ 2011-08-01 11:18 UTC (permalink / raw
To: gentoo-commits
commit: 70011eb7f2f5c26a3b9bfee28863c3aa8dcdc2f7
Author: Theo Chatzimichos <tampakrap <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 1 11:17:42 2011 +0000
Commit: Theo Chatzimichos <tampakrap <AT> gentoo <DOT> org>
CommitDate: Mon Aug 1 11:17:42 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/blogs-gentoo.git;a=commit;h=70011eb7
Update wp-importer and wp-syntax
---
.../languages/wordpress-importer.pot | 90 ++++++++++----------
plugins/wordpress-importer/parsers.php | 31 +++++++-
plugins/wordpress-importer/readme.txt | 11 ++-
plugins/wordpress-importer/wordpress-importer.php | 23 ++++--
plugins/wp-syntax/README.txt | 11 ++-
plugins/wp-syntax/wp-syntax.php | 48 ++++++++---
6 files changed, 144 insertions(+), 70 deletions(-)
diff --git a/plugins/wordpress-importer/languages/wordpress-importer.pot b/plugins/wordpress-importer/languages/wordpress-importer.pot
index 8dae6cf..0ca72e2 100644
--- a/plugins/wordpress-importer/languages/wordpress-importer.pot
+++ b/plugins/wordpress-importer/languages/wordpress-importer.pot
@@ -2,9 +2,9 @@
# This file is distributed under the same license as the WordPress Importer package.
msgid ""
msgstr ""
-"Project-Id-Version: WordPress Importer 0.3\n"
+"Project-Id-Version: WordPress Importer 0.5\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-importer\n"
-"POT-Creation-Date: 2011-02-21 21:07:12+00:00\n"
+"POT-Creation-Date: 2011-07-16 15:45:12+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -22,49 +22,49 @@ msgid ""
"parser..."
msgstr ""
-#: parsers.php:67 parsers.php:72 parsers.php:248 parsers.php:430
+#: parsers.php:67 parsers.php:72 parsers.php:262 parsers.php:451
msgid ""
"This does not appear to be a WXR file, missing/invalid WXR version number"
msgstr ""
-#: wordpress-importer.php:133 wordpress-importer.php:142
-#: wordpress-importer.php:193 wordpress-importer.php:201
+#: wordpress-importer.php:134 wordpress-importer.php:143
+#: wordpress-importer.php:194 wordpress-importer.php:202
msgid "Sorry, there has been an error."
msgstr ""
-#: wordpress-importer.php:134
+#: wordpress-importer.php:135
msgid "The file does not exist, please try again."
msgstr ""
-#: wordpress-importer.php:177
+#: wordpress-importer.php:178
msgid "All done."
msgstr ""
-#: wordpress-importer.php:177
+#: wordpress-importer.php:178
msgid "Have fun!"
msgstr ""
-#: wordpress-importer.php:178
+#: wordpress-importer.php:179
msgid "Remember to update the passwords and roles of imported users."
msgstr ""
-#: wordpress-importer.php:209
+#: wordpress-importer.php:210
msgid ""
"This WXR file (version %s) may not be supported by this version of the "
"importer. Please consider updating."
msgstr ""
-#: wordpress-importer.php:234
+#: wordpress-importer.php:235
msgid ""
"Failed to import author %s. Their posts will be attributed to the current "
"user."
msgstr ""
-#: wordpress-importer.php:260
+#: wordpress-importer.php:261
msgid "Assign Authors"
msgstr ""
-#: wordpress-importer.php:261
+#: wordpress-importer.php:262
msgid ""
"To make it easier for you to edit and save the imported content, you may "
"want to reassign the author of the imported item to an existing user of this "
@@ -72,137 +72,137 @@ msgid ""
"code>s entries."
msgstr ""
-#: wordpress-importer.php:263
+#: wordpress-importer.php:264
msgid ""
"If a new user is created by WordPress, a new password will be randomly "
"generated and the new user’s role will be set as %s. Manually changing "
"the new user’s details will be necessary."
msgstr ""
-#: wordpress-importer.php:273
+#: wordpress-importer.php:274
msgid "Import Attachments"
msgstr ""
-#: wordpress-importer.php:276
+#: wordpress-importer.php:277
msgid "Download and import file attachments"
msgstr ""
-#: wordpress-importer.php:280
+#: wordpress-importer.php:281
msgid "Submit"
msgstr ""
-#: wordpress-importer.php:293
+#: wordpress-importer.php:294
msgid "Import author:"
msgstr ""
-#: wordpress-importer.php:304
+#: wordpress-importer.php:305
msgid "or create new user with login name:"
msgstr ""
-#: wordpress-importer.php:307
+#: wordpress-importer.php:308
msgid "as a new user:"
msgstr ""
-#: wordpress-importer.php:315
+#: wordpress-importer.php:316
msgid "assign posts to an existing user:"
msgstr ""
-#: wordpress-importer.php:317
+#: wordpress-importer.php:318
msgid "or assign posts to an existing user:"
msgstr ""
-#: wordpress-importer.php:318
+#: wordpress-importer.php:319
msgid "- Select -"
msgstr ""
-#: wordpress-importer.php:366
+#: wordpress-importer.php:369
msgid ""
"Failed to create new user for %s. Their posts will be attributed to the "
"current user."
msgstr ""
-#: wordpress-importer.php:413
+#: wordpress-importer.php:418
msgid "Failed to import category %s"
msgstr ""
-#: wordpress-importer.php:449
+#: wordpress-importer.php:456
msgid "Failed to import post tag %s"
msgstr ""
-#: wordpress-importer.php:491 wordpress-importer.php:603
+#: wordpress-importer.php:500 wordpress-importer.php:626
msgid "Failed to import %s %s"
msgstr ""
-#: wordpress-importer.php:513
+#: wordpress-importer.php:522
msgid "Failed to import “%s”: Invalid post type %s"
msgstr ""
-#: wordpress-importer.php:534
+#: wordpress-importer.php:543
msgid "%s “%s” already exists."
msgstr ""
-#: wordpress-importer.php:575
+#: wordpress-importer.php:598
msgid "Failed to import %s “%s”"
msgstr ""
-#: wordpress-importer.php:712
+#: wordpress-importer.php:744
msgid "Menu item skipped due to missing menu slug"
msgstr ""
-#: wordpress-importer.php:719
+#: wordpress-importer.php:751
msgid "Menu item skipped due to invalid menu slug: %s"
msgstr ""
-#: wordpress-importer.php:782
+#: wordpress-importer.php:814
msgid "Fetching attachments is not enabled"
msgstr ""
-#: wordpress-importer.php:795
+#: wordpress-importer.php:827
msgid "Invalid file type"
msgstr ""
-#: wordpress-importer.php:838
+#: wordpress-importer.php:871
msgid "Remote server did not respond"
msgstr ""
-#: wordpress-importer.php:844
+#: wordpress-importer.php:877
msgid "Remote server returned error response %1$d %2$s"
msgstr ""
-#: wordpress-importer.php:851
+#: wordpress-importer.php:884
msgid "Remote file is incorrect size"
msgstr ""
-#: wordpress-importer.php:856
+#: wordpress-importer.php:889
msgid "Zero size file downloaded"
msgstr ""
-#: wordpress-importer.php:862
+#: wordpress-importer.php:895
msgid "Remote file is too large, limit is %s"
msgstr ""
-#: wordpress-importer.php:961
+#: wordpress-importer.php:994
msgid "Import WordPress"
msgstr ""
-#: wordpress-importer.php:968
+#: wordpress-importer.php:1001
msgid ""
"A new version of this importer is available. Please update to version %s to "
"ensure compatibility with newer export files."
msgstr ""
-#: wordpress-importer.php:983
+#: wordpress-importer.php:1016
msgid ""
"Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import "
"the posts, pages, comments, custom fields, categories, and tags into this "
"site."
msgstr ""
-#: wordpress-importer.php:984
-msgid "Choose a WXR file to upload, then click Upload file and import."
+#: wordpress-importer.php:1017
+msgid "Choose a WXR (.xml) file to upload, then click Upload file and import."
msgstr ""
-#: wordpress-importer.php:1058
+#: wordpress-importer.php:1091
msgid ""
"Import <strong>posts, pages, comments, custom fields, categories, and tags</"
"strong> from a WordPress export file."
diff --git a/plugins/wordpress-importer/parsers.php b/plugins/wordpress-importer/parsers.php
index 87c3b9d..ab4be51 100644
--- a/plugins/wordpress-importer/parsers.php
+++ b/plugins/wordpress-importer/parsers.php
@@ -173,11 +173,21 @@ class WXR_Parser_SimpleXML {
foreach ( $wp->postmeta as $meta ) {
$post['postmeta'][] = array(
'key' => (string) $meta->meta_key,
- 'value' => (string) $meta->meta_value,
+ 'value' => (string) $meta->meta_value
);
}
foreach ( $wp->comment as $comment ) {
+ $meta = array();
+ if ( isset( $comment->commentmeta ) ) {
+ foreach ( $comment->commentmeta as $m ) {
+ $meta[] = array(
+ 'key' => (string) $m->meta_key,
+ 'value' => (string) $m->meta_value
+ );
+ }
+ }
+
$post['comments'][] = array(
'comment_id' => (int) $comment->comment_id,
'comment_author' => (string) $comment->comment_author,
@@ -191,6 +201,7 @@ class WXR_Parser_SimpleXML {
'comment_type' => (string) $comment->comment_type,
'comment_parent' => (string) $comment->comment_parent,
'comment_user_id' => (int) $comment->comment_user_id,
+ 'commentmeta' => $meta,
);
}
@@ -302,10 +313,17 @@ class WXR_Parser_XML {
function tag_close( $parser, $tag ) {
switch ( $tag ) {
case 'wp:comment':
+ unset( $this->sub_data['key'], $this->sub_data['value'] ); // remove meta sub_data
if ( ! empty( $this->sub_data ) )
$this->data['comments'][] = $this->sub_data;
$this->sub_data = false;
break;
+ case 'wp:commentmeta':
+ $this->sub_data['commentmeta'][] = array(
+ 'key' => $this->sub_data['key'],
+ 'value' => $this->sub_data['value']
+ );
+ break;
case 'category':
if ( ! empty( $this->sub_data ) ) {
$this->sub_data['name'] = $this->cdata;
@@ -546,6 +564,16 @@ class WXR_Parser_Regex {
$comments = $comments[1];
if ( $comments ) {
foreach ( $comments as $comment ) {
+ preg_match_all( '|<wp:commentmeta>(.+?)</wp:commentmeta>|is', $comment, $commentmeta );
+ $commentmeta = $commentmeta[1];
+ $c_meta = array();
+ foreach ( $commentmeta as $m ) {
+ $c_meta[] = array(
+ 'key' => $this->get_tag( $m, 'wp:meta_key' ),
+ 'value' => $this->get_tag( $m, 'wp:meta_value' ),
+ );
+ }
+
$post_comments[] = array(
'comment_id' => $this->get_tag( $comment, 'wp:comment_id' ),
'comment_author' => $this->get_tag( $comment, 'wp:comment_author' ),
@@ -559,6 +587,7 @@ class WXR_Parser_Regex {
'comment_type' => $this->get_tag( $comment, 'wp:comment_type' ),
'comment_parent' => $this->get_tag( $comment, 'wp:comment_parent' ),
'comment_user_id' => $this->get_tag( $comment, 'wp:comment_user_id' ),
+ 'commentmeta' => $c_meta,
);
}
}
diff --git a/plugins/wordpress-importer/readme.txt b/plugins/wordpress-importer/readme.txt
index 554232f..e296814 100644
--- a/plugins/wordpress-importer/readme.txt
+++ b/plugins/wordpress-importer/readme.txt
@@ -3,8 +3,8 @@ Contributors: wordpressdotorg
Donate link:
Tags: importer, wordpress
Requires at least: 3.0
-Tested up to: 3.1
-Stable tag: 0.4
+Tested up to: 3.2.1
+Stable tag: 0.5
Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
@@ -37,6 +37,10 @@ If you would prefer to do things manually then follow these instructions:
== Changelog ==
+= 0.5 =
+* Import comment meta (requires export from WordPress 3.2)
+* Minor bugfixes and enhancements
+
= 0.4 =
* Map comment user_id where possible
* Import attachments from `wp:attachment_url`
@@ -53,6 +57,9 @@ If you would prefer to do things manually then follow these instructions:
== Upgrade Notice ==
+= 0.5 =
+Import comment meta and other minor bugfixes and enhancements.
+
= 0.4 =
Bug fixes for attachment importing and other small enhancements.
diff --git a/plugins/wordpress-importer/wordpress-importer.php b/plugins/wordpress-importer/wordpress-importer.php
index 966182a..5e38484 100644
--- a/plugins/wordpress-importer/wordpress-importer.php
+++ b/plugins/wordpress-importer/wordpress-importer.php
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/extend/plugins/wordpress-importer/
Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
Author: wordpressdotorg
Author URI: http://wordpress.org/
-Version: 0.4
+Version: 0.5
Text Domain: wordpress-importer
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@@ -335,6 +335,8 @@ class WP_Import extends WP_Importer {
$create_users = $this->allow_create_users();
foreach ( (array) $_POST['imported_authors'] as $i => $old_login ) {
+ // Multsite adds strtolower to sanitize_user. Need to sanitize here to stop breakage in process_posts.
+ $santized_old_login = sanitize_user( $old_login, true );
$old_id = isset( $this->authors[$old_login]['author_id'] ) ? intval($this->authors[$old_login]['author_id']) : false;
if ( ! empty( $_POST['user_map'][$i] ) ) {
@@ -342,7 +344,7 @@ class WP_Import extends WP_Importer {
if ( isset( $user->ID ) ) {
if ( $old_id )
$this->processed_authors[$old_id] = $user->ID;
- $this->author_mapping[$old_login] = $user->ID;
+ $this->author_mapping[$santized_old_login] = $user->ID;
}
} else if ( $create_users ) {
if ( ! empty($_POST['user_new'][$i]) ) {
@@ -362,7 +364,7 @@ class WP_Import extends WP_Importer {
if ( ! is_wp_error( $user_id ) ) {
if ( $old_id )
$this->processed_authors[$old_id] = $user_id;
- $this->author_mapping[$old_login] = $user_id;
+ $this->author_mapping[$santized_old_login] = $user_id;
} else {
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']) );
if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
@@ -372,10 +374,10 @@ class WP_Import extends WP_Importer {
}
// failsafe: if the user_id was invalid, default to the current user
- if ( ! isset( $this->author_mapping[$old_login] ) ) {
+ if ( ! isset( $this->author_mapping[$santized_old_login] ) ) {
if ( $old_id )
$this->processed_authors[$old_id] = (int) get_current_user_id();
- $this->author_mapping[$old_login] = (int) get_current_user_id();
+ $this->author_mapping[$santized_old_login] = (int) get_current_user_id();
}
}
}
@@ -523,7 +525,7 @@ class WP_Import extends WP_Importer {
continue;
}
- if ( isset( $this->processed_posts[$post['post_id']] ) )
+ if ( isset( $this->processed_posts[$post['post_id']] ) && ! empty( $post['post_id'] ) )
continue;
if ( $post['status'] == 'auto-draft' )
@@ -654,6 +656,7 @@ class WP_Import extends WP_Importer {
$newcomments[$comment_id]['comment_approved'] = $comment['comment_approved'];
$newcomments[$comment_id]['comment_type'] = $comment['comment_type'];
$newcomments[$comment_id]['comment_parent'] = $comment['comment_parent'];
+ $newcomments[$comment_id]['commentmeta'] = isset( $comment['commentmeta'] ) ? $comment['commentmeta'] : array();
if ( isset( $this->processed_authors[$comment['comment_user_id']] ) )
$newcomments[$comment_id]['user_id'] = $this->processed_authors[$comment['comment_user_id']];
}
@@ -666,6 +669,12 @@ class WP_Import extends WP_Importer {
$comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
$comment = wp_filter_comment( $comment );
$inserted_comments[$key] = wp_insert_comment( $comment );
+
+ foreach( $comment['commentmeta'] as $meta ) {
+ $value = maybe_unserialize( $meta['value'] );
+ add_comment_meta( $inserted_comments[$key], $meta['key'], $value );
+ }
+
$num_comments++;
}
}
@@ -1005,7 +1014,7 @@ class WP_Import extends WP_Importer {
function greet() {
echo '<div class="narrow">';
echo '<p>'.__( 'Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import the posts, pages, comments, custom fields, categories, and tags into this site.', 'wordpress-importer' ).'</p>';
- echo '<p>'.__( 'Choose a WXR file to upload, then click Upload file and import.', 'wordpress-importer' ).'</p>';
+ echo '<p>'.__( 'Choose a WXR (.xml) file to upload, then click Upload file and import.', 'wordpress-importer' ).'</p>';
wp_import_upload_form( 'admin.php?import=wordpress&step=1' );
echo '</div>';
}
diff --git a/plugins/wp-syntax/README.txt b/plugins/wp-syntax/README.txt
index 3a32264..174ac43 100644
--- a/plugins/wp-syntax/README.txt
+++ b/plugins/wp-syntax/README.txt
@@ -3,8 +3,8 @@ Contributors: shazahm1@hotmail.com, rmm5t
Donate link: http://connections-pro.com
Tags: syntax highlighting, syntax, highlight, code, formatting
Requires at least: 3.0
-Tested up to: 3.1.3
-Stable tag: 0.9.10
+Tested up to: 3.2.1
+Stable tag: 0.9.12
WP-Syntax provides clean syntax highlighting for embedding source code within pages or posts.
@@ -167,8 +167,11 @@ review the [GeSHi Documentation](http://qbnz.com/highlighter/geshi-doc.html).
== Changelog ==
-**0.9.10** : Fix for security vulnerability when register_globals in php is
- enabled;
+**0.9.12** : Fixed a range bug in the new highlight feature.
+
+**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/)
+
+**0.9.10** : Fix for security vulnerability when register_globals in php is enabled.
**0.9.9** : Fix to support child theme's. WP-Syntax now requires WP >= 3.0.
Credit to [OddOneOut](http://wordpress.org/support/topic/wp-syntax-css-with-twenty-ten-child-theme)
diff --git a/plugins/wp-syntax/wp-syntax.php b/plugins/wp-syntax/wp-syntax.php
index db9ea98..3d195ea 100644
--- a/plugins/wp-syntax/wp-syntax.php
+++ b/plugins/wp-syntax/wp-syntax.php
@@ -3,11 +3,13 @@
Plugin Name: WP-Syntax
Plugin URI: http://wordpress.org/extend/plugins/wp-syntax/
Description: Syntax highlighting using <a href="http://qbnz.com/highlighter/">GeSHi</a> supporting a wide range of popular languages. Wrap code blocks with <code><pre lang="LANGUAGE" line="1"></code> and <code></pre></code> where <code>LANGUAGE</code> is a geshi supported language syntax. The <code>line</code> attribute is optional.
-Author: Ryan McGeary, Steven A. Zahm
-Version: 0.9.10
+Author: Steven A. Zahm
+Version: 0.9.12
Author URI: http://connections-pro.com
*/
+# Original Author: Ryan McGeary
+
#
# Copyright (c) 2007-2009 Ryan McGeary 2010 Steven A. Zahm
#
@@ -37,12 +39,14 @@ if (!CUSTOM_TAGS) {
'escaped' => array(),
'style' => array(),
'width' => array(),
+ 'highlight' => array()
);
//Allow plugin use in comments
$allowedtags['pre'] = array(
'lang' => array(),
'line' => array(),
'escaped' => array(),
+ 'highlight' => array()
);
}
@@ -101,22 +105,44 @@ function wp_syntax_line_numbers($code, $start)
function wp_syntax_highlight($match)
{
global $wp_syntax_matches;
-
+
$i = intval($match[1]);
$match = $wp_syntax_matches[$i];
-
+
$language = strtolower(trim($match[1]));
$line = trim($match[2]);
$escaped = trim($match[3]);
- $code = wp_syntax_code_trim($match[4]);
+
+ $code = wp_syntax_code_trim($match[5]);
if ($escaped == "true") $code = htmlspecialchars_decode($code);
-
+
$geshi = new GeSHi($code, $language);
$geshi->enable_keyword_links(false);
do_action_ref_array('wp_syntax_init_geshi', array(&$geshi));
-
+
+ //START LINE HIGHLIGHT SUPPORT
+ $highlight = array();
+ if ( !empty($match[4]) )
+ {
+ $highlight = strpos($match[4],',') == false ? array($match[4]) : explode(',', $match[4]);
+
+ $h_lines = array();
+ for( $i=0; $i<sizeof($highlight); $i++ )
+ {
+ $h_range = explode('-', $highlight[$i]);
+
+ if( sizeof($h_range) == 2 )
+ $h_lines = array_merge( $h_lines, range($h_range[0], $h_range[1]) );
+ else
+ array_push($h_lines, $highlight[$i]);
+ }
+
+ $geshi->highlight_lines_extra( $h_lines );
+ }
+ //END LINE HIGHLIGHT SUPPORT
+
$output = "\n<div class=\"wp_syntax\">";
-
+
if ($line)
{
$output .= "<table><tr><td class=\"line_numbers\">";
@@ -132,16 +158,16 @@ function wp_syntax_highlight($match)
$output .= "</div>";
}
return
-
+
$output .= "</div>\n";
-
+
return $output;
}
function wp_syntax_before_filter($content)
{
return preg_replace_callback(
- "/\s*<pre(?:lang=[\"']([\w-]+)[\"']|line=[\"'](\d*)[\"']|escaped=[\"'](true|false)?[\"']|\s)+>(.*)<\/pre>\s*/siU",
+ "/\s*<pre(?:lang=[\"']([\w-]+)[\"']|line=[\"'](\d*)[\"']|escaped=[\"'](true|false)?[\"']|highlight=[\"']((?:\d+[,-])*\d+)[\"']|\s)+>(.*)<\/pre>\s*/siU",
"wp_syntax_substitute",
$content
);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-01 11:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 11:18 [gentoo-commits] proj/blogs-gentoo:master commit in: plugins/wordpress-importer/, plugins/wordpress-importer/languages/, Theo Chatzimichos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox