<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13734] trunk/wp-admin/import/livejournal.php: LJ importer tweaks.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13734">13734</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-03-17 16:52:44 +0000 (Wed, 17 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>LJ importer tweaks. Props briancolinger. fixes <a href="http://trac.wordpress.org/ticket/12620">#12620</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminimportlivejournalphp">trunk/wp-admin/import/livejournal.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminimportlivejournalphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/livejournal.php (13733 => 13734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/livejournal.php        2010-03-17 16:27:25 UTC (rev 13733)
+++ trunk/wp-admin/import/livejournal.php        2010-03-17 16:52:44 UTC (rev 13734)
</span><span class="lines">@@ -184,7 +184,7 @@
</span><span class="cx">                         &lt;input type=&quot;hidden&quot; name=&quot;step&quot; value=&quot;&lt;?php echo esc_attr( get_option( 'ljapi_step' ) ) ?&gt;&quot; /&gt;
</span><span class="cx">                         &lt;p&gt;&lt;?php _e( 'It looks like you attempted to import your LiveJournal posts previously and got interrupted.' ) ?&gt;&lt;/p&gt;
</span><span class="cx">                         &lt;p class=&quot;submit&quot;&gt;
</span><del>-                                &lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; value=&quot;&lt;?php esc_attr_e( 'Continue previous import' ) ?&gt;&quot; /&gt;
</del><ins>+                                &lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e( 'Continue previous import' ) ?&gt;&quot; /&gt;
</ins><span class="cx">                         &lt;/p&gt;
</span><span class="cx">                         &lt;p class=&quot;submitbox&quot;&gt;&lt;a href=&quot;&lt;?php echo esc_url($_SERVER['PHP_SELF'] . '?import=livejournal&amp;amp;step=-1&amp;amp;_wpnonce=' . wp_create_nonce( 'lj-api-import' ) . '&amp;amp;_wp_http_referer=' . esc_attr( $_SERVER['REQUEST_URI'] )) ?&gt;&quot; class=&quot;deletion submitdelete&quot;&gt;&lt;?php _e( 'Cancel &amp;amp; start a new import' ) ?&gt;&lt;/a&gt;&lt;/p&gt;
</span><span class="cx">                         &lt;p&gt;
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx">                         &lt;p&gt;&lt;?php _e( &quot;&lt;strong&gt;WARNING:&lt;/strong&gt; This can take a really long time if you have a lot of entries in your LiveJournal, or a lot of comments. Ideally, you should only start this process if you can leave your computer alone while it finishes the import.&quot; ) ?&gt;&lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;p class=&quot;submit&quot;&gt;
</span><del>-                                &lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; value=&quot;&lt;?php esc_attr_e( 'Connect to LiveJournal and Import' ) ?&gt;&quot; /&gt;
</del><ins>+                                &lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e( 'Connect to LiveJournal and Import' ) ?&gt;&quot; /&gt;
</ins><span class="cx">                         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;p&gt;&lt;?php _e( '&lt;strong&gt;NOTE:&lt;/strong&gt; If the import process is interrupted for &lt;em&gt;any&lt;/em&gt; reason, come back to this page and it will continue from where it stopped automatically.' ) ?&gt;&lt;/p&gt;
</span><span class="lines">@@ -762,6 +762,9 @@
</span><span class="cx">         // Check form inputs and start importing posts
</span><span class="cx">         function step1() {
</span><span class="cx">                 global $verified;
</span><ins>+
+                do_action( 'import_start' );
+
</ins><span class="cx">                 set_time_limit( 0 );
</span><span class="cx">                 update_option( 'ljapi_step', 1 );
</span><span class="cx">                 if ( !$this-&gt;ixr ) $this-&gt;ixr = new IXR_Client( $this-&gt;ixr_url, false, 80, 30 );
</span><span class="lines">@@ -821,7 +824,7 @@
</span><span class="cx">                         &lt;form action=&quot;admin.php?import=livejournal&quot; method=&quot;post&quot; id=&quot;ljapi-auto-repost&quot;&gt;
</span><span class="cx">                         &lt;?php wp_nonce_field( 'lj-api-import' ) ?&gt;
</span><span class="cx">                         &lt;input type=&quot;hidden&quot; name=&quot;step&quot; id=&quot;step&quot; value=&quot;1&quot; /&gt;
</span><del>-                        &lt;p&gt;&lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; value=&quot;&lt;?php esc_attr_e( 'Import the next batch' ) ?&gt;&quot; /&gt; &lt;span id=&quot;auto-message&quot;&gt;&lt;/span&gt;&lt;/p&gt;
</del><ins>+                        &lt;p&gt;&lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e( 'Import the next batch' ) ?&gt;&quot; /&gt; &lt;span id=&quot;auto-message&quot;&gt;&lt;/span&gt;&lt;/p&gt;
</ins><span class="cx">                         &lt;/form&gt;
</span><span class="cx">                         &lt;?php $this-&gt;auto_ajax( 'ljapi-auto-repost', 'auto-message', 0 ); ?&gt;
</span><span class="cx">                 &lt;?php
</span><span class="lines">@@ -835,6 +838,8 @@
</span><span class="cx"> 
</span><span class="cx">         // Download comments to local XML
</span><span class="cx">         function step2() {
</span><ins>+                do_action( 'import_start' );
+
</ins><span class="cx">                 set_time_limit( 0 );
</span><span class="cx">                 update_option( 'ljapi_step', 2 );
</span><span class="cx">                 $this-&gt;username = get_option( 'ljapi_username' );
</span><span class="lines">@@ -871,7 +876,7 @@
</span><span class="cx">                         &lt;p&gt;&lt;strong&gt;&lt;?php printf( __( 'Imported comment batch %d of &lt;strong&gt;approximately&lt;/strong&gt; %d' ), get_option( 'ljapi_comment_batch' ), $batch ) ?&gt;&lt;/strong&gt;&lt;/p&gt;
</span><span class="cx">                         &lt;?php wp_nonce_field( 'lj-api-import' ) ?&gt;
</span><span class="cx">                         &lt;input type=&quot;hidden&quot; name=&quot;step&quot; id=&quot;step&quot; value=&quot;2&quot; /&gt;
</span><del>-                        &lt;p&gt;&lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; value=&quot;&lt;?php esc_attr_e( 'Import the next batch' ) ?&gt;&quot; /&gt; &lt;span id=&quot;auto-message&quot;&gt;&lt;/span&gt;&lt;/p&gt;
</del><ins>+                        &lt;p&gt;&lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e( 'Import the next batch' ) ?&gt;&quot; /&gt; &lt;span id=&quot;auto-message&quot;&gt;&lt;/span&gt;&lt;/p&gt;
</ins><span class="cx">                         &lt;/form&gt;
</span><span class="cx">                         &lt;?php $this-&gt;auto_ajax( 'ljapi-auto-repost', 'auto-message', 0 ); ?&gt;
</span><span class="cx">                 &lt;?php
</span><span class="lines">@@ -886,6 +891,9 @@
</span><span class="cx">         // Re-thread comments already in the DB
</span><span class="cx">         function step3() {
</span><span class="cx">                 global $wpdb;
</span><ins>+
+                do_action( 'import_start' );
+
</ins><span class="cx">                 set_time_limit( 0 );
</span><span class="cx">                 update_option( 'ljapi_step', 3 );
</span><span class="cx"> 
</span><span class="lines">@@ -947,7 +955,7 @@
</span><span class="cx">                 $str .= wp_nonce_field( 'lj-api-import', '_wpnonce', true, false );
</span><span class="cx">                 $str .= wp_referer_field( false );
</span><span class="cx">                 $str .= '&lt;input type=&quot;hidden&quot; name=&quot;step&quot; id=&quot;step&quot; value=&quot;' . esc_attr($next_step) . '&quot; /&gt;';
</span><del>-                $str .= '&lt;p&gt;&lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; value=&quot;' . esc_attr( $label ) . '&quot; /&gt; &lt;span id=&quot;auto-message&quot;&gt;&lt;/span&gt;&lt;/p&gt;';
</del><ins>+                $str .= '&lt;p&gt;&lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;' . esc_attr( $label ) . '&quot; /&gt; &lt;span id=&quot;auto-message&quot;&gt;&lt;/span&gt;&lt;/p&gt;';
</ins><span class="cx">                 $str .= '&lt;/form&gt;';
</span><span class="cx"> 
</span><span class="cx">                 return $str;
</span><span class="lines">@@ -1000,6 +1008,7 @@
</span><span class="cx">                                                 str = '&lt;?php _e( &quot;Processing next batch.&quot; ) ?&gt; &lt;img src=&quot;&lt;?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?&gt;&quot; alt=&quot;&quot; id=&quot;processing&quot; align=&quot;top&quot; /&gt;';
</span><span class="cx">                                                 jQuery( '#&lt;?php echo $msg ?&gt;' ).html( str );
</span><span class="cx">                                                 jQuery('#ljapi-status').load(ajaxurl, {'action':'lj-importer',
</span><ins>+                                                                                                                                'import':'livejournal',
</ins><span class="cx">                                                                                                                                 'step':jQuery('#step').val(),
</span><span class="cx">                                                                                                                                 '_wpnonce':'&lt;?php echo wp_create_nonce( 'lj-api-import' ) ?&gt;',
</span><span class="cx">                                                                                                                                 '_wp_http_referer':'&lt;?php echo $_SERVER['REQUEST_URI'] ?&gt;'});
</span><span class="lines">@@ -1042,6 +1051,8 @@
</span><span class="cx">                 $wpdb-&gt;update( $wpdb-&gt;comments,
</span><span class="cx">                                                 array( 'comment_karma' =&gt; 0, 'comment_agent' =&gt; 'WP LJ Importer', 'comment_type' =&gt; '' ),
</span><span class="cx">                                                 array( 'comment_type' =&gt; 'livejournal' ) );
</span><ins>+
+                do_action( 'import_end' );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function LJ_API_Import() {
</span></span></pre>
</div>
</div>

</body>
</html>