This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Finalized cleanup and cancel

git-svn-id: http://plugins.svn.wordpress.org/canalblog-importer/branches/1.2@385152 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information...
1 parent 79b71d1 commit b90ebbca8dd9e25a40a360886a543fe00cfb4e07 oncletom committed May 15, 2011
Binary file not shown.
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Oncle Tom\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-15 18:21+0100\n"
-"PO-Revision-Date: 2011-05-15 18:21+0100\n"
+"POT-Creation-Date: 2011-05-15 19:28+0100\n"
+"PO-Revision-Date: 2011-05-15 19:29+0100\n"
"Last-Translator: Oncle Tom <thomas@oncle-tom.net>\n"
"Language-Team: Oncle Tom <thomas+i18n@oncle-tom.net>\n"
"MIME-Version: 1.0\n"
@@ -24,14 +24,6 @@ msgstr ""
msgid "Enables content importing from a blog hosted on Canalblog platform."
msgstr "Active l'import du contenu d'un blog hébergé sur la plateforme Canalblog."
-#: ../lib/Importer.class.php:53
-msgid "Cancel"
-msgstr "Annuler"
-
-#: ../lib/Importer.class.php:53
-msgid "Done"
-msgstr "Terminé"
-
#: ../lib/Plugin.class.php:54
msgid "Import a Canalblog blog"
msgstr "Importer un blog Canalblog"
@@ -90,6 +82,11 @@ msgstr "Catégorie <strong>%s</strong> créée."
msgid "<strong>%s</strong> category creation failed."
msgstr "<strong>%s</strong> : échec de la création de la catégorie."
+#: ../lib/Importer/Cleanup.class.php:54
+#, php-format
+msgid "%s posts cleanup up."
+msgstr "%s billets nettoyés."
+
#: ../lib/Importer/Post.class.php:74
msgid "error"
msgstr "erreur"
@@ -403,6 +400,10 @@ msgstr "Et pour terminer ..."
msgid "Once you're done, delete your Canalblog account and <a href='http://www.canalblog.com/cf/contact.cfm' target='_blank'>write a mail to their team</a> explaining why you left. They have not evolved, you did."
msgstr "Une fois que vous en avez fini, supprimez votre compte Canalblog et <a href='http://www.canalblog.com/cf/contact.cfm' target='_blank'>adressez un email à leur équipe</a> en expliquant les raisons de votre départ. Ils n'ont pas évolué, vous oui."
+#: ../pages/07-ccln.php:45
+msgid "Done"
+msgstr "Terminé"
+
#: ../pages/07-ccln.php:46
msgid "I'm aware I've finally left Canalblog and this importer saved my life. Almost."
msgstr "Je suis conscient(e) que j'ai finalement quitté Canalblog et que cet outil m'a sauvé la vie. Enfin presque."
@@ -421,7 +422,11 @@ msgstr "Démarrer l'import"
#: ../pages/form-submit.php:3
msgid "Next Step &rarr;"
-msgstr "Étape suivante &arr;"
+msgstr "Étape suivante &rarr;"
+
+#: ../pages/form-submit.php:4
+msgid "Cancel"
+msgstr "Annuler"
#: ../pages/wordpress-importer-missing.php:3
#, php-format
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Canalblog Importer\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-15 18:21+0100\n"
-"PO-Revision-Date: 2011-05-15 18:21+0100\n"
+"POT-Creation-Date: 2011-05-15 19:28+0100\n"
+"PO-Revision-Date: 2011-05-15 19:28+0100\n"
"Last-Translator: Oncle Tom <thomas@oncle-tom.net>\n"
"Language-Team: <LL@li.org>\n"
"MIME-Version: 1.0\n"
@@ -23,14 +23,6 @@ msgstr ""
msgid "Enables content importing from a blog hosted on Canalblog platform."
msgstr ""
-#: ../lib/Importer.class.php:53
-msgid "Cancel"
-msgstr ""
-
-#: ../lib/Importer.class.php:53
-msgid "Done"
-msgstr ""
-
#: ../lib/Plugin.class.php:54
msgid "Import a Canalblog blog"
msgstr ""
@@ -89,6 +81,11 @@ msgstr ""
msgid "<strong>%s</strong> category creation failed."
msgstr ""
+#: ../lib/Importer/Cleanup.class.php:54
+#, php-format
+msgid "%s posts cleanup up."
+msgstr ""
+
#: ../lib/Importer/Post.class.php:74
msgid "error"
msgstr ""
@@ -402,6 +399,10 @@ msgstr ""
msgid "Once you're done, delete your Canalblog account and <a href='http://www.canalblog.com/cf/contact.cfm' target='_blank'>write a mail to their team</a> explaining why you left. They have not evolved, you did."
msgstr ""
+#: ../pages/07-ccln.php:45
+msgid "Done"
+msgstr ""
+
#: ../pages/07-ccln.php:46
msgid "I'm aware I've finally left Canalblog and this importer saved my life. Almost."
msgstr ""
@@ -422,6 +423,10 @@ msgstr ""
msgid "Next Step &rarr;"
msgstr ""
+#: ../pages/form-submit.php:4
+msgid "Cancel"
+msgstr ""
+
#: ../pages/wordpress-importer-missing.php:3
#, php-format
msgid "Sorry but no WordPress Importer has been found. It is used to import post images. <a href='%s'>Please install it</a>, or import without getting back your pictures attachment."
View
@@ -50,10 +50,12 @@ public function dispatch()
/*
* Do we cancel sometime?
*/
- if (isset($_REQUEST['submit']) && in_array($_REQUEST['submit'], array(__('Cancel', 'canalblog-importer'), __('Done', 'canalblog-importer')), true))
+ if (isset($_REQUEST['cancel'], $_REQUEST['_wpnonce']) && 1 === (int)$_REQUEST['cancel'] && wp_verify_nonce($_REQUEST['_wpnonce'], 'import-canalblog-cancel'))
{
- $this->stop();
- wp_redirect(get_admin_url(null, 'import.php?import=canalblog&canceled=true'), 307);
+ $this->stop();
+ printf('<script type="text/javascript">document.location.href="%s";</script>',
+ get_admin_url(null, 'import.php?import=canalblog&canceled=1')
+ );
}
$this->is_ready_to_process = !!$operation->dispatch();
@@ -159,10 +161,14 @@ protected function stop()
delete_transient('canalblog_tags');
delete_transient('canalblog_categories');
delete_transient('canalblog_months');
+ delete_transient('canalblog_permalinks');
delete_transient('canalblog_post_uris');
- delete_transient('canablog_have_finished_tags');
- delete_transient('canablog_have_finished_categories');
- delete_transient('canablog_have_finished_archives');
+ delete_transient('canalblog_step_offset');
+ delete_transient('canalblog_have_finished_tags');
+ delete_transient('canalblog_have_finished_categories');
+ delete_transient('canalblog_have_finished_archives');
+ delete_transient('canalblog_have_finished_posts');
+ delete_transient('canalblog_have_finished_cleanup');
}
}
@@ -22,9 +22,9 @@ public function dispatch()
*/
public function process()
{
- if (!!get_transient('canablog_have_finished_archives'))
+ if (!!get_transient('canalblog_have_finished_archives'))
{
- delete_transient('canablog_have_finished_archives');
+ delete_transient('canalblog_have_finished_archives');
delete_transient('canalblog_months');
delete_transient('canalblog_step_offset');
@@ -55,7 +55,7 @@ public function processRemote(WP_Ajax_Response $response)
$is_finished = true;
$progress = 100;
$new_offset = count($months);
- set_transient('canablog_have_finished_archives', 1);
+ set_transient('canalblog_have_finished_archives', 1);
break;
}
@@ -22,9 +22,9 @@ public function dispatch()
*/
public function process()
{
- if (!!get_transient('canablog_have_finished_categories'))
+ if (!!get_transient('canalblog_have_finished_categories'))
{
- delete_transient('canablog_have_finished_categories');
+ delete_transient('canalblog_have_finished_categories');
delete_transient('canalblog_categories');
delete_transient('canalblog_step_offset');
@@ -49,7 +49,7 @@ public function processRemote(WP_Ajax_Response $response)
$is_finished = true;
$progress = 100;
$new_offset = count($categories);
- set_transient('canablog_have_finished_categories', 1);
+ set_transient('canalblog_have_finished_categories', 1);
break;
}
@@ -19,6 +19,18 @@ public function dispatch()
* @see lib/Importer/CanalblogImporterImporterBase#process()
*/
public function process()
+ {
+ if (!!get_transient('canalblog_have_finished_cleanup'))
+ {
+ delete_transient('canalblog_have_finished_cleanup');
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public function processRemote(WP_Ajax_Response $response)
{
/*
* Retrieves posts IDs
@@ -37,11 +49,21 @@ public function process()
{
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, '%s', '%s')", $old_uri, $new_uri));
}
+
+ $response->add(array(
+ 'data' => sprintf(__('%s posts cleanup up.', 'canalblog-importer'), count($replacements)),
+ ));
- return true;
+ set_transient('canalblog_have_finished_cleanup', 1);
+ $response->add(array(
+ 'what' => 'operation',
+ 'supplemental' => array(
+ 'finished' => true,
+ 'progress' => 100,
+ )
+ ));
}
-
// sort by strlen, longest string first
function cmpr_strlen($a, $b) {
return strlen($b) - strlen($a);
@@ -23,9 +23,9 @@ public function dispatch()
*/
public function process()
{
- if (!!get_transient('canablog_have_finished_posts'))
+ if (!!get_transient('canalblog_have_finished_posts'))
{
- delete_transient('canablog_have_finished_posts');
+ delete_transient('canalblog_have_finished_posts');
delete_transient('canalblog_permalinks');
delete_transient('canalblog_step_offset');
@@ -49,7 +49,7 @@ public function processRemote(WP_Ajax_Response $response)
$is_finished = true;
$progress = 100;
$new_offset = count($this->arguments['permalinks']);
- set_transient('canablog_have_finished_posts', 1);
+ set_transient('canalblog_have_finished_posts', 1);
break;
}
@@ -27,9 +27,9 @@ public function dispatch()
*/
public function process()
{
- if (!!get_transient('canablog_have_finished_tags'))
+ if (!!get_transient('canalblog_have_finished_tags'))
{
- delete_transient('canablog_have_finished_tags');
+ delete_transient('canalblog_have_finished_tags');
delete_transient('canalblog_tags');
delete_transient('canalblog_tags_offset');
@@ -54,7 +54,7 @@ public function processRemote(WP_Ajax_Response $response)
$is_finished = true;
$progress = 100;
$new_offset = count($tags);
- set_transient('canablog_have_finished_tags', 1);
+ set_transient('canalblog_have_finished_tags', 1);
break;
}
View
@@ -42,7 +42,7 @@
</ol>
<p class="submit">
- <input type="submit" name="submit" class="button-primary next-operation" value="<?php echo esc_attr__('Done', 'canalblog-importer') ?>" />
+ <a href="<?php echo wp_nonce_url('import.php?import=canalblog&cancel=1', 'import-canalblog-cancel') ?>" class="button button-primary next-operation"><?php echo esc_attr__('Done', 'canalblog-importer') ?></a>
<?php _e("I'm aware I've finally left Canalblog and this importer saved my life. Almost.", 'canalblog-importer') ?>
</p>
</form>

0 comments on commit b90ebbc

Please sign in to comment.