Ticket #13960: ljimporter.diff

File ljimporter.diff, 1.0 KB (added by nacin, 3 years ago)
  • livejournal-importer.php

     
    1010License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    1111*/ 
    1212 
     13add_action( 'wp_ajax_lj-importer', 'livejournal_import_ajax_handler' ); 
     14 
     15function livejournal_import_ajax_handler() { 
     16        check_ajax_referer( 'lj-api-import' ); 
     17        if ( !current_user_can( 'publish_posts' ) ) 
     18                die('-1'); 
     19        if ( empty( $_POST['step'] ) ) 
     20                die( '-1' ); 
     21        define('WP_IMPORTING', true); 
     22        include( ABSPATH . 'wp-admin/import/livejournal.php' ); 
     23        $result = $lj_api_import->{ 'step' . ( (int) $_POST['step'] ) }(); 
     24        if ( is_wp_error( $result ) ) 
     25                echo $result->get_error_message(); 
     26        die; 
     27} 
     28 
    1329if ( !defined('WP_LOAD_IMPORTERS') ) 
    1430        return; 
    1531 
     
    10701086                do_action( 'import_end' ); 
    10711087        } 
    10721088 
    1073         function LJ_API_Import() { 
    1074                 $this->__construct(); 
    1075         } 
    1076  
    1077         function __construct() { 
    1078                 // Nothing 
    1079         } 
    10801089} 
    10811090 
    10821091$lj_api_import = new LJ_API_Import();