0
Validation results

Divi Ecommerce

Divi Ecommerce

WordPress 5.0.3 theme
0
  • THEME TYPEWordPress theme 5.0.3
  • FILE NAMEdiviecommerce-DS-1.0.5.zip
  • FILE SIZE396122 bytes
  • MD507f95fd73477eefe17dec97cf71a1a01
  • SHA1ffadc2558ac8b811036a10e32c6b5b90e6559b80
  • LICENSENone
  • FILES INCLUDEDCSS, PHP, XML, Bitmap images, Adobe Illustrator
  • VERSION1.0.5
  • AUTHOR URI
  • CREATION DATE2018-10-25
  • LAST FILE UPDATE2018-10-25
  • LAST VALIDATION2018-10-25 21:20
  • OTHER VERSIONS

    1.0.4 : 0%

    1.0.3 : 0%

Critical alerts
  1. Title : Title No reference to add_theme_support( "title-tag" ) was found in the theme.The theme needs to have <title> tags, ideally in the header.php file.The theme needs to have a call to wp_title(), ideally in the header.php file.
  2. Unwanted files : hidden file(s) or folder(s) .ds_store .htaccess was found.
  3. Presence of iframes : iframes are sometimes used to load unwanted adverts and malicious code on another site Found <iframe id="ags-demo-importer-frame" name="ags-demo-importer-frame" src="about:blank"> in file aspen-importer.php.
    Ligne431: <iframe id='ags-demo-importer-frame' name='ags-demo-importer-frame' src='ab
  4. Malware : Operations on file system file_get_contents was found in the file aspen-importer.php
    Ligne766: $fileContents = file_get_contents($file);
    Ligne822: $data = @unserialize(file_get_contents( $file ));
    Ligne1026: $data = file_get_contents( $file );
    Ligne1444: $form_config = file_get_contents($file);
    file_put_contents was found in the file aspen-importer.php
    Ligne768: if (!empty($fileContents) && file_put_contents($file, preg_replace('/[^\PC\r\n\t]/u', '', $fileContents)
    file_get_contents was found in the file aspen-importer.php
    Ligne766: $fileContents = file_get_contents($file);
    Ligne822: $data = @unserialize(file_get_contents( $file ));
    Ligne1026: $data = file_get_contents( $file );
    Ligne1444: $form_config = file_get_contents($file);
    file_get_contents was found in the file aspen-importer.php
    Ligne766: $fileContents = file_get_contents($file);
    Ligne822: $data = @unserialize(file_get_contents( $file ));
    Ligne1026: $data = file_get_contents( $file );
    Ligne1444: $form_config = file_get_contents($file);
    file_get_contents was found in the file aspen-importer.php
    Ligne766: $fileContents = file_get_contents($file);
    Ligne822: $data = @unserialize(file_get_contents( $file ));
    Ligne1026: $data = file_get_contents( $file );
    Ligne1444: $form_config = file_get_contents($file);
    file_get_contents was found in the file parsers.php
    Ligne252: if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) {
    
    
    fopen was found in the file parsers.php
    Ligne398: $fp = $this->fopen( $file, 'r' );
    
    
    Ligne615: function fopen( $filename, $mode = 'r' ) {
    
    
    Ligne618: return fopen( $filename, $mode );
    
    
    fclose was found in the file parsers.php
    Ligne447: $this->fclose($fp);
    
    
    Ligne633: function fclose( $fp ) {
    
    
    Ligne636: return fclose( $fp );
    
    
    fopen was found in the file parsers.php
    Ligne398: $fp = $this->fopen( $file, 'r' );
    
    
    Ligne615: function fopen( $filename, $mode = 'r' ) {
    
    
    Ligne618: return fopen( $filename, $mode );
    
    
    fopen was found in the file parsers.php
    Ligne398: $fp = $this->fopen( $file, 'r' );
    
    
    Ligne615: function fopen( $filename, $mode = 'r' ) {
    
    
    Ligne618: return fopen( $filename, $mode );
    
    
    fclose was found in the file parsers.php
    Ligne447: $this->fclose($fp);
    
    
    Ligne633: function fclose( $fp ) {
    
    
    Ligne636: return fclose( $fp );
    
    
    fclose was found in the file parsers.php
    Ligne447: $this->fclose($fp);
    
    
    Ligne633: function fclose( $fp ) {
    
    
    Ligne636: return fclose( $fp );
    
    
  5. Admin menu : Themes should use add_theme_page() for adding admin pages. File aspen-plugin-installer.php :
    Ligne1: <?php
    /**
     * Plugin installation and activation for WordPress themes.
     *
     * Please note that this is a drop-in library for a theme or plugin.
     * The authors of this library (Thomas, Gary and Juliette) are NOT responsible
     * for the support of your plugin or theme. Please contact the plugin
     * or theme author for support.
     *
     * @package   TGM-Plugin-Activation
     * @version   2.6.1
     * @link      http://tgmpluginactivation.com/
     * @author    Thomas Griffin, Gary Jones, Juliette Reinders Folmer
     * @copyright Copyright (c) 2011, Thomas Griffin
     * @license   GPL-2.0+
     */
    
    /*
    	Copyright 2011 Thomas Griffin (thomasgriffinmedia.com)
    
    	This program is free software; you can redistribute it and/or modify
    	it under the terms of the GNU General Public License, version 2, as
    	published by the Free Software Foundation.
    
    	This program is distributed in the hope that it will be useful,
    	but WITHOUT ANY WARRANTY; without even the implied warranty of
    	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    	GNU General Public License for more details.
    
    	You should have received a copy of the GNU General Public License
    	along with this program; if not, write to the Free Software
    	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
    
    	/**
    	 * Automatic plugin installation and activation library.
    	 *
    	 * Creates a way to automatically install and activate plugins from within themes.
    	 * The plugins can be either bundled, downloaded from the WordPress
    	 * Plugin Repository or downloaded from another external source.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @package TGM-Plugin-Activation
    	 * @author  Thomas Griffin
    	 * @author  Gary Jones
    	 */
    	class TGM_Plugin_Activation {
    		/**
    		 * TGMPA version number.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @const string Version number.
    		 */
    		const TGMPA_VERSION = '2.6.1';
    
    		/**
    		 * Regular expression to test if a URL is a WP plugin repo URL.
    		 *
    		 * @const string Regex.
    		 *
    		 * @since 2.5.0
    		 */
    		const WP_REPO_REGEX = '|^http[s]?://wordpress\.org/(?:extend/)?plugins/|';
    
    		/**
    		 * Arbitrary regular expression to test if a string starts with a URL.
    		 *
    		 * @const string Regex.
    		 *
    		 * @since 2.5.0
    		 */
    		const IS_URL_REGEX = '|^http[s]?://|';
    
    		/**
    		 * Holds a copy of itself, so it can be referenced by the class name.
    		 *
    		 * @since 1.0.0
    		 *
    		 * @var TGM_Plugin_Activation
    		 */
    		public static $instance;
    
    		/**
    		 * Holds arrays of plugin details.
    		 *
    		 * @since 1.0.0
    		 * @since 2.5.0 the array has the plugin slug as an associative key.
    		 *
    		 * @var array
    		 */
    		public $plugins = array();
    
    		/**
    		 * Holds arrays of plugin names to use to sort the plugins array.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @var array
    		 */
    		protected $sort_order = array();
    
    		/**
    		 * Whether any plugins have the 'force_activation' setting set to true.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @var bool
    		 */
    		protected $has_forced_activation = false;
    
    		/**
    		 * Whether any plugins have the 'force_deactivation' setting set to true.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @var bool
    		 */
    		protected $has_forced_deactivation = false;
    
    		/**
    		 * Name of the unique ID to hash notices.
    		 *
    		 * @since 2.4.0
    		 *
    		 * @var string
    		 */
    		public $id = 'tgmpa';
    
    		/**
    		 * Name of the query-string argument for the admin page.
    		 *
    		 * @since 1.0.0
    		 *
    		 * @var string
    		 */
    		protected $menu = 'tgmpa-install-plugins';
    
    		/**
    		 * Parent menu file slug.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @var string
    		 */
    		public $parent_slug = 'themes.php';
    
    		/**
    		 * Capability needed to view the plugin installation menu item.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @var string
    		 */
    		public $capability = 'edit_theme_options';
    
    		/**
    		 * Default absolute path to folder containing bundled plugin zip files.
    		 *
    		 * @since 2.0.0
    		 *
    		 * @var string Absolute path prefix to zip file location for bundled plugins. Default is empty string.
    		 */
    		public $default_path = '';
    
    		/**
    		 * Flag to show admin notices or not.
    		 *
    		 * @since 2.1.0
    		 *
    		 * @var boolean
    		 */
    		public $has_notices = true;
    
    		/**
    		 * Flag to determine if the user can dismiss the notice nag.
    		 *
    		 * @since 2.4.0
    		 *
    		 * @var boolean
    		 */
    		public $dismissable = true;
    
    		/**
    		 * Message to be output above nag notice if dismissable is false.
    		 *
    		 * @since 2.4.0
    		 *
    		 * @var string
    		 */
    		public $dismiss_msg = '';
    
    		/**
    		 * Flag to set automatic activation of plugins. Off by default.
    		 *
    		 * @since 2.2.0
    		 *
    		 * @var boolean
    		 */
    		public $is_automatic = false;
    
    		/**
    		 * Optional message to display before the plugins table.
    		 *
    		 * @since 2.2.0
    		 *
    		 * @var string Message filtered by wp_kses_post(). Default is empty string.
    		 */
    		public $message = '';
    
    		/**
    		 * Holds configurable array of strings.
    		 *
    		 * Default values are added in the constructor.
    		 *
    		 * @since 2.0.0
    		 *
    		 * @var array
    		 */
    		public $strings = array();
    
    		/**
    		 * Holds the version of WordPress.
    		 *
    		 * @since 2.4.0
    		 *
    		 * @var int
    		 */
    		public $wp_version;
    
    		/**
    		 * Holds the hook name for the admin page.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @var string
    		 */
    		public $page_hook;
    
    		/**
    		 * Adds a reference of this object to $instance, populates default strings,
    		 * does the tgmpa_init action hook, and hooks in the interactions to init.
    		 *
    		 * {@internal This method should be `protected`, but as too many TGMPA implementations
    		 * haven't upgraded beyond v2.3.6 yet, this gives backward compatibility issues.
    		 * Reverted back to public for the time being.}}
    		 *
    		 * @since 1.0.0
    		 *
    		 * @see TGM_Plugin_Activation::init()
    		 */
    		public function __construct() {
    			// Set the current WordPress version.
    			$this->wp_version = $GLOBALS['wp_version'];
    
    			// Announce that the class is ready, and pass the object (for advanced use).
    			do_action_ref_array( 'tgmpa_init', array( $this ) );
    
    			/*
    			 * Load our text domain and allow for overloading the fall-back file.
    			 *
    			 * {@internal IMPORTANT! If this code changes, review the regex in the custom TGMPA
    			 * generator on the website.}}
    			 */
    			add_action( 'init', array( $this, 'load_textdomain' ), 5 );
    			add_filter( 'load_textdomain_mofile', array( $this, 'overload_textdomain_mofile' ), 10, 2 );
    
    			// When the rest of WP has loaded, kick-start the rest of the class.
    			add_action( 'init', array( $this, 'init' ) );
    		}
    
    		/**
    		 * Magic method to (not) set protected properties from outside of this class.
    		 *
    		 * {@internal hackedihack... There is a serious bug in v2.3.2 - 2.3.6  where the `menu` property
    		 * is being assigned rather than tested in a conditional, effectively rendering it useless.
    		 * This 'hack' prevents this from happening.}}
    		 *
    		 * @see https://github.com/TGMPA/TGM-Plugin-Activation/blob/2.3.6/tgm-plugin-activation/class-tgm-plugin-activation.php#L1593
    		 *
    		 * @since 2.5.2
    		 *
    		 * @param string $name  Name of an inaccessible property.
    		 * @param mixed  $value Value to assign to the property.
    		 * @return void  Silently fail to set the property when this is tried from outside of this class context.
    		 *               (Inside this class context, the __set() method if not used as there is direct access.)
    		 */
    		public function __set( $name, $value ) {
    			return;
    		}
    
    		/**
    		 * Magic method to get the value of a protected property outside of this class context.
    		 *
    		 * @since 2.5.2
    		 *
    		 * @param string $name Name of an inaccessible property.
    		 * @return mixed The property value.
    		 */
    		public function __get( $name ) {
    			return $this->{$name};
    		}
    
    		/**
    		 * Initialise the interactions between this class and WordPress.
    		 *
    		 * Hooks in three new methods for the class: admin_menu, notices and styles.
    		 *
    		 * @since 2.0.0
    		 *
    		 * @see TGM_Plugin_Activation::admin_menu()
    		 * @see TGM_Plugin_Activation::notices()
    		 * @see TGM_Plugin_Activation::styles()
    		 */
    		public function init() {
    			/**
    			 * By default TGMPA only loads on the WP back-end and not in an Ajax call. Using this filter
    			 * you can overrule that behaviour.
    			 *
    			 * @since 2.5.0
    			 *
    			 * @param bool $load Whether or not TGMPA should load.
    			 *                   Defaults to the return of `is_admin() && ! defined( 'DOING_AJAX' )`.
    			 */
    			if ( true !== apply_filters( 'tgmpa_load', ( is_admin() && ! defined( 'DOING_AJAX' ) ) ) ) {
    				return;
    			}
    
    			// Load class strings.
    			$this->strings = array(
    				'page_title'                      => __( 'Install Required Plugins', 'tgmpa' ),
    				'menu_title'                      => __( 'Install Plugins', 'tgmpa' ),
    				/* translators: %s: plugin name. */
    				'installing'                      => __( 'Installing Plugin: %s', 'tgmpa' ),
    				/* translators: %s: plugin name. */
    				'updating'                        => __( 'Updating Plugin: %s', 'tgmpa' ),
    				'oops'                            => __( 'Something went wrong with the plugin API.', 'tgmpa' ),
    				'notice_can_install_required'     => _n_noop(
    					/* translators: 1: plugin name(s). */
    					'This theme requires the following plugin: %1$s.',
    					'This theme requires the following plugins: %1$s.',
    					'tgmpa'
    				),
    				'notice_can_install_recommended'  => _n_noop(
    					/* translators: 1: plugin name(s). */
    					'This theme recommends the following plugin: %1$s.',
    					'This theme recommends the following plugins: %1$s.',
    					'tgmpa'
    				),
    				'notice_ask_to_update'            => _n_noop(
    					/* translators: 1: plugin name(s). */
    					'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
    					'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
    					'tgmpa'
    				),
    				'notice_ask_to_update_maybe'      => _n_noop(
    					/* translators: 1: plugin name(s). */
    					'There is an update available for: %1$s.',
    					'There are updates available for the following plugins: %1$s.',
    					'tgmpa'
    				),
    				'notice_can_activate_required'    => _n_noop(
    					/* translators: 1: plugin name(s). */
    					'The following required plugin is currently inactive: %1$s.',
    					'The following required plugins are currently inactive: %1$s.',
    					'tgmpa'
    				),
    				'notice_can_activate_recommended' => _n_noop(
    					/* translators: 1: plugin name(s). */
    					'The following recommended plugin is currently inactive: %1$s.',
    					'The following recommended plugins are currently inactive: %1$s.',
    					'tgmpa'
    				),
    				'install_link'                    => _n_noop(
    					'Begin installing plugin',
    					'Begin installing plugins',
    					'tgmpa'
    				),
    				'update_link'                     => _n_noop(
    					'Begin updating plugin',
    					'Begin updating plugins',
    					'tgmpa'
    				),
    				'activate_link'                   => _n_noop(
    					'Begin activating plugin',
    					'Begin activating plugins',
    					'tgmpa'
    				),
    				'return'                          => __( 'Return to Required Plugins Installer', 'tgmpa' ),
    				'dashboard'                       => __( 'Return to the Dashboard', 'tgmpa' ),
    				'plugin_activated'                => __( 'Plugin activated successfully.', 'tgmpa' ),
    				'activated_successfully'          => __( 'The following plugin was activated successfully:', 'tgmpa' ),
    				/* translators: 1: plugin name. */
    				'plugin_already_active'           => __( 'No action taken. Plugin %1$s was already active.', 'tgmpa' ),
    				/* translators: 1: plugin name. */
    				'plugin_needs_higher_version'     => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'tgmpa' ),
    				/* translators: 1: dashboard link. */
    				'complete'                        => __( 'All plugins installed and activated successfully. %1$s', 'tgmpa' ),
    				'dismiss'                         => __( 'Dismiss this notice', 'tgmpa' ),
    				'notice_cannot_install_activate'  => __( 'There are one or more required or recommended plugins to install, update or activate.', 'tgmpa' ),
    				'contact_admin'                   => __( 'Please contact the administrator of this site for help.', 'tgmpa' ),
    			);
    
    			do_action( 'tgmpa_register' );
    
    			/* After this point, the plugins should be registered and the configuration set. */
    
    			// Proceed only if we have plugins to handle.
    			if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
    				return;
    			}
    
    			// Set up the menu and notices if we still have outstanding actions.
    			if ( true !== $this->is_tgmpa_complete() ) {
    				// Sort the plugins.
    				array_multisort( $this->sort_order, SORT_ASC, $this->plugins );
    
    				add_action( 'admin_menu', array( $this, 'admin_menu' ) );
    				add_action( 'admin_head', array( $this, 'dismiss' ) );
    
    				// Prevent the normal links from showing underneath a single install/update page.
    				add_filter( 'install_plugin_complete_actions', array( $this, 'actions' ) );
    				add_filter( 'update_plugin_complete_actions', array( $this, 'actions' ) );
    
    				if ( $this->has_notices ) {
    					add_action( 'admin_notices', array( $this, 'notices' ) );
    					add_action( 'admin_init', array( $this, 'admin_init' ), 1 );
    					add_action( 'admin_enqueue_scripts', array( $this, 'thickbox' ) );
    				}
    			}
    
    			// If needed, filter plugin action links.
    			add_action( 'load-plugins.php', array( $this, 'add_plugin_action_link_filters' ), 1 );
    
    			// Make sure things get reset on switch theme.
    			add_action( 'switch_theme', array( $this, 'flush_plugins_cache' ) );
    
    			if ( $this->has_notices ) {
    				add_action( 'switch_theme', array( $this, 'update_dismiss' ) );
    			}
    
    			// Setup the force activation hook.
    			if ( true === $this->has_forced_activation ) {
    				add_action( 'admin_init', array( $this, 'force_activation' ) );
    			}
    
    			// Setup the force deactivation hook.
    			if ( true === $this->has_forced_deactivation ) {
    				add_action( 'switch_theme', array( $this, 'force_deactivation' ) );
    			}
    
    			// Add CSS for the TGMPA admin page.
    			add_action( 'admin_head',  array( $this, 'admin_css' ) );
    		}
    
    		/**
    		 * Load translations.
    		 *
    		 * @since 2.6.0
    		 *
    		 * (@internal Uses `load_theme_textdomain()` rather than `load_plugin_textdomain()` to
    		 * get round the different ways of handling the path and deprecated notices being thrown
    		 * and such. For plugins, the actual file name will be corrected by a filter.}}
    		 *
    		 * {@internal IMPORTANT! If this function changes, review the regex in the custom TGMPA
    		 * generator on the website.}}
    		 */
    		public function load_textdomain() {
    			if ( is_textdomain_loaded( 'tgmpa' ) ) {
    				return;
    			}
    
    			if ( false !== strpos( __FILE__, WP_PLUGIN_DIR ) || false !== strpos( __FILE__, WPMU_PLUGIN_DIR ) ) {
    				// Plugin, we'll need to adjust the file name.
    				add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 );
    				load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' );
    				remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 );
    			} else {
    				load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' );
    			}
    		}
    
    		/**
    		 * Correct the .mo file name for (must-use) plugins.
    		 *
    		 * Themese use `/path/{locale}.mo` while plugins use `/path/{text-domain}-{locale}.mo`.
    		 *
    		 * {@internal IMPORTANT! If this function changes, review the regex in the custom TGMPA
    		 * generator on the website.}}
    		 *
    		 * @since 2.6.0
    		 *
    		 * @param string $mofile Full path to the target mofile.
    		 * @param string $domain The domain for which a language file is being loaded.
    		 * @return string $mofile
    		 */
    		public function correct_plugin_mofile( $mofile, $domain ) {
    			// Exit early if not our domain (just in case).
    			if ( 'tgmpa' !== $domain ) {
    				return $mofile;
    			}
    			return preg_replace( '`/([a-z]{2}_[A-Z]{2}.mo)$`', '/tgmpa-$1', $mofile );
    		}
    
    		/**
    		 * Potentially overload the fall-back translation file for the current language.
    		 *
    		 * WP, by default since WP 3.7, will load a local translation first and if none
    		 * can be found, will try and find a translation in the /wp-content/languages/ directory.
    		 * As this library is theme/plugin agnostic, translation files for TGMPA can exist both
    		 * in the WP_LANG_DIR /plugins/ subdirectory as well as in the /themes/ subdirectory.
    		 *
    		 * This method makes sure both directories are checked.
    		 *
    		 * {@internal IMPORTANT! If this function changes, review the regex in the custom TGMPA
    		 * generator on the website.}}
    		 *
    		 * @since 2.6.0
    		 *
    		 * @param string $mofile Full path to the target mofile.
    		 * @param string $domain The domain for which a language file is being loaded.
    		 * @return string $mofile
    		 */
    		public function overload_textdomain_mofile( $mofile, $domain ) {
    			// Exit early if not our domain, not a WP_LANG_DIR load or if the file exists and is readable.
    			if ( 'tgmpa' !== $domain || false === strpos( $mofile, WP_LANG_DIR ) || @is_readable( $mofile ) ) {
    				return $mofile;
    			}
    
    			// Current fallback file is not valid, let's try the alternative option.
    			if ( false !== strpos( $mofile, '/themes/' ) ) {
    				return str_replace( '/themes/', '/plugins/', $mofile );
    			} elseif ( false !== strpos( $mofile, '/plugins/' ) ) {
    				return str_replace( '/plugins/', '/themes/', $mofile );
    			} else {
    				return $mofile;
    			}
    		}
    
    		/**
    		 * Hook in plugin action link filters for the WP native plugins page.
    		 *
    		 * - Prevent activation of plugins which don't meet the minimum version requirements.
    		 * - Prevent deactivation of force-activated plugins.
    		 * - Add update notice if update available.
    		 *
    		 * @since 2.5.0
    		 */
    		public function add_plugin_action_link_filters() {
    			foreach ( $this->plugins as $slug => $plugin ) {
    				if ( false === $this->can_plugin_activate( $slug ) ) {
    					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 );
    				}
    
    				if ( true === $plugin['force_activation'] ) {
    					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 );
    				}
    
    				if ( false !== $this->does_plugin_require_update( $slug ) ) {
    					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 );
    				}
    			}
    		}
    
    		/**
    		 * Remove the 'Activate' link on the WP native plugins page if the plugin does not meet the
    		 * minimum version requirements.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @param array $actions Action links.
    		 * @return array
    		 */
    		public function filter_plugin_action_links_activate( $actions ) {
    			unset( $actions['activate'] );
    
    			return $actions;
    		}
    
    		/**
    		 * Remove the 'Deactivate' link on the WP native plugins page if the plugin has been set to force activate.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @param array $actions Action links.
    		 * @return array
    		 */
    		public function filter_plugin_action_links_deactivate( $actions ) {
    			unset( $actions['deactivate'] );
    
    			return $actions;
    		}
    
    		/**
    		 * Add a 'Requires update' link on the WP native plugins page if the plugin does not meet the
    		 * minimum version requirements.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @param array $actions Action links.
    		 * @return array
    		 */
    		public function filter_plugin_action_links_update( $actions ) {
    			$actions['update'] = sprintf(
    				'<a href='%1$s' title='%2$s' class='edit'>%3$s</a>',
    				esc_url( $this->get_tgmpa_status_url( 'update' ) ),
    				esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ),
    				esc_html__( 'Update Required', 'tgmpa' )
    			);
    
    			return $actions;
    		}
    
    		/**
    		 * Handles calls to show plugin information via links in the notices.
    		 *
    		 * We get the links in the admin notices to point to the TGMPA page, rather
    		 * than the typical plugin-install.php file, so we can prepare everything
    		 * beforehand.
    		 *
    		 * WP does not make it easy to show the plugin information in the thickbox -
    		 * here we have to require a file that includes a function that does the
    		 * main work of displaying it, enqueue some styles, set up some globals and
    		 * finally call that function before exiting.
    		 *
    		 * Down right easy once you know how...
    		 *
    		 * Returns early if not the TGMPA page.
    		 *
    		 * @since 2.1.0
    		 *
    		 * @global string $tab Used as iframe div class names, helps with styling
    		 * @global string $body_id Used as the iframe body ID, helps with styling
    		 *
    		 * @return null Returns early if not the TGMPA page.
    		 */
    		public function admin_init() {
    			if ( ! $this->is_tgmpa_page() ) {
    				return;
    			}
    
    			if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) {
    				// Needed for install_plugin_information().
    				require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
    
    				wp_enqueue_style( 'plugin-install' );
    
    				global $tab, $body_id;
    				$body_id = 'plugin-information';
    				// @codingStandardsIgnoreStart
    				$tab     = 'plugin-information';
    				// @codingStandardsIgnoreEnd
    
    				install_plugin_information();
    
    				exit;
    			}
    		}
    
    		/**
    		 * Enqueue thickbox scripts/styles for plugin info.
    		 *
    		 * Thickbox is not automatically included on all admin pages, so we must
    		 * manually enqueue it for those pages.
    		 *
    		 * Thickbox is only loaded if the user has not dismissed the admin
    		 * notice or if there are any plugins left to install and activate.
    		 *
    		 * @since 2.1.0
    		 */
    		public function thickbox() {
    			if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) {
    				add_thickbox();
    			}
    		}
    
    		/**
    		 * Adds submenu page if there are plugin actions to take.
    		 *
    		 * This method adds the submenu page letting users know that a required
    		 * plugin needs to be installed.
    		 *
    		 * This page disappears once the plugin has been installed and activated.
    		 *
    		 * @since 1.0.0
    		 *
    		 * @see TGM_Plugin_Activation::init()
    		 * @see TGM_Plugin_Activation::install_plugins_page()
    		 *
    		 * @return null Return early if user lacks capability to install a plugin.
    		 */
    		public function admin_menu() {
    			// Make sure privileges are correct to see the page.
    			if ( ! current_user_can( 'install_plugins' ) ) {
    				return;
    			}
    
    			$args = apply_filters(
    				'tgmpa_admin_menu_args',
    				array(
    					'parent_slug' => $this->parent_slug,                     // Parent Menu slug.
    					'page_title'  => $this->strings['page_title'],           // Page title.
    					'menu_title'  => $this->strings['menu_title'],           // Menu title.
    					'capability'  => $this->capability,                      // Capability.
    					'menu_slug'   => $this->menu,                            // Menu slug.
    					'function'    => array( $this, 'install_plugins_page' ), // Callback.
    				)
    			);
    
    			$this->add_admin_menu( $args );
    		}
    
    		/**
    		 * Add the menu item.
    		 *
    		 * {@internal IMPORTANT! If this function changes, review the regex in the custom TGMPA
    		 * generator on the website.}}
    		 *
    		 * @since 2.5.0
    		 *
    		 * @param array $args Menu item configuration.
    		 */
    		protected function add_admin_menu( array $args ) {
    			if ( has_filter( 'tgmpa_admin_menu_use_add_theme_page' ) ) {
    				_deprecated_function( 'The 'tgmpa_admin_menu_use_add_theme_page' filter', '2.5.0', esc_html__( 'Set the parent_slug config variable instead.', 'tgmpa' ) );
    			}
    
    			if ( 'themes.php' === $this->parent_slug ) {
    				$this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
    			} else {
    				$this->page_hook = call_user_func( 'add_submenu_page', $args['parent_slug'], $args['page_title'], $args['menu_t
    File functions.php :
    Ligne191: add_menu_page('Divi Ecommerce', 'Divi Ecommerce', 'switch_themes', 'divieco
    File functions.php :
    Ligne202: add_submenu_page('diviecommerce-options', __('Theme Options', 'Divi'), __('
    File admin-menu.php :
    Ligne10: add_submenu_page('diviecommerce-options', __( 'Import Demo Data', 'Divi' ),
  6. Fundamental theme elements : Presence of DOCTYPE Could not find .
  7. Comment reply : Declaration of comment reply Could not find the comment-reply js script enqueued.
  8. Content width : Proper definition of content_width No content width has been defined. Example:
    if ( ! isset( $content_width ) ) $content_width = 900;
  9. Deprecated functions : screen_icon screen_icon found in file wordpress-importer.php. Deprecated since version 3.8.
    Ligne1: <?php
    /*
    Plugin Name: WordPress Importer
    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.6.3
    Text Domain: wordpress-importer
    License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    */
    
    if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
    	return;
    
    /** Display verbose errors */
    if (!defined('IMPORT_DEBUG')) {
    	define( 'IMPORT_DEBUG', false );
    }
    
    // Load Importer API
    require_once ABSPATH . 'wp-admin/includes/import.php';
    
    if ( ! class_exists( 'WP_Importer' ) ) {
    	$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
    	if ( file_exists( $class_wp_importer ) )
    		require $class_wp_importer;
    }
    
    // include WXR file parsers
    require dirname( __FILE__ ) . '/parsers.php';
    
    /**
     * WordPress Importer class for managing the import process of a WXR file
     *
     * @package WordPress
     * @subpackage Importer
     */
    if ( class_exists( 'WP_Importer' ) ) {
    class WP_Import extends WP_Importer {
    	var $max_wxr_version = 1.2; // max. supported WXR version
    
    	var $id; // WXR attachment ID
    
    	// information to import from WXR file
    	var $version;
    	var $authors = array();
    	var $posts = array();
    	var $terms = array();
    	var $categories = array();
    	var $tags = array();
    	var $base_url = '';
    
    	// mappings from old information to new
    	var $processed_authors = array();
    	var $author_mapping = array();
    	var $processed_terms = array();
    	var $processed_posts = array();
    	var $post_orphans = array();
    	var $processed_menu_items = array();
    	var $menu_item_orphans = array();
    	var $missing_menu_items = array();
    
    	var $fetch_attachments = false;
    	var $url_remap = array();
    	var $featured_images = array();
    
    	/**
    	 * Registered callback function for the WordPress Importer
    	 *
    	 * Manages the three separate stages of the WXR import process
    	 */
    	function dispatch() {
    		$this->header();
    
    		$step = empty( $_GET['step'] ) ? 0 : (int) $_GET['step'];
    		switch ( $step ) {
    			case 0:
    				$this->greet();
    				break;
    			case 1:
    				check_admin_referer( 'import-upload' );
    				if ( $this->handle_upload() )
    					$this->import_options();
    				break;
    			case 2:
    				check_admin_referer( 'import-wordpress' );
    				$this->fetch_attachments = ( ! empty( $_POST['fetch_attachments'] ) && $this->allow_fetch_attachments() );
    				$this->id = (int) $_POST['import_id'];
    				$file = get_attached_file( $this->id );
    				set_time_limit(0);
    				$this->import( $file );
    				break;
    		}
    
    		$this->footer();
    	}
    
    	/**
    	 * The main controller for the actual import stage.
    	 *
    	 * @param string $file Path to the WXR file for importing
    	 */
    	function import( $file ) {
    		$aspenImporter = AGS_Theme_Importer::$instance;
    	
    		add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
    		add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
    
    		$this->import_start( $file );
    
    		$this->get_author_mapping();
    
    		wp_suspend_cache_invalidation( true );
    		
    		$aspenImporter->progress('content_start');
    		
    		$this->process_categories();
    		$aspenImporter->progress('content_categories');
    		$this->process_tags();
    		$aspenImporter->progress('content_tags');
    		$this->process_terms();
    		$aspenImporter->progress('content_terms');
    		$this->process_posts();
    		$aspenImporter->progress('content_posts');
    		wp_suspend_cache_invalidation( false );
    
    		// update incorrect/missing information in the DB
    		$this->backfill_parents();
    		$this->backfill_attachment_urls();
    		$this->remap_featured_images();
    
    		$this->import_end();
    		$aspenImporter->progress('content_end');
    	}
    
    	/**
    	 * Parses the WXR file and prepares us for the task of processing parsed data
    	 *
    	 * @param string $file Path to the WXR file for importing
    	 */
    	function import_start( $file ) {
    		if ( ! is_file($file) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			echo __( 'The file does not exist, please try again.', 'wordpress-importer' ) . '</p>';
    			$this->footer();
    			die();
    		}
    
    		$import_data = $this->parse( $file );
    
    		if ( is_wp_error( $import_data ) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			echo esc_html( $import_data->get_error_message() ) . '</p>';
    			$this->footer();
    			die();
    		}
    
    		$this->version = $import_data['version'];
    		$this->get_authors_from_import( $import_data );
    		$this->posts = $import_data['posts'];
    		$this->terms = $import_data['terms'];
    		$this->categories = $import_data['categories'];
    		$this->tags = $import_data['tags'];
    		$this->base_url = esc_url( $import_data['base_url'] );
    
    		wp_defer_term_counting( true );
    		wp_defer_comment_counting( true );
    
    		do_action( 'import_start' );
    	}
    
    	/**
    	 * Performs post-import cleanup of files and the cache
    	 */
    	function import_end() {
    		wp_import_cleanup( $this->id );
    
    		wp_cache_flush();
    		foreach ( get_taxonomies() as $tax ) {
    			delete_option( '{$tax}_children' );
    			_get_term_hierarchy( $tax );
    		}
    
    		wp_defer_term_counting( false );
    		wp_defer_comment_counting( false );
    
    		//echo '<p>' . __( 'All done.', 'wordpress-importer' ) . ' <a href='' . admin_url() . ''>' . __( 'Have fun!', 'wordpress-importer' ) . '</a>' . '</p>';
    		//echo '<p>' . __( 'Remember to update the passwords and roles of imported users.', 'wordpress-importer' ) . '</p>';
    
    		do_action( 'import_end' );
    	}
    
    	/**
    	 * Handles the WXR upload and initial parsing of the file to prepare for
    	 * displaying author import options
    	 *
    	 * @return bool False if error uploading or invalid file, true otherwise
    	 */
    	function handle_upload() {
    		$file = wp_import_handle_upload();
    
    		if ( isset( $file['error'] ) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			echo esc_html( $file['error'] ) . '</p>';
    			return false;
    		} else if ( ! file_exists( $file['file'] ) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			printf( __( 'The export file could not be found at <code>%s</code>. It is likely that this was caused by a permissions problem.', 'wordpress-importer' ), esc_html( $file['file'] ) );
    			echo '</p>';
    			return false;
    		}
    
    		$this->id = (int) $file['id'];
    		$import_data = $this->parse( $file['file'] );
    		if ( is_wp_error( $import_data ) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			echo esc_html( $import_data->get_error_message() ) . '</p>';
    			return false;
    		}
    
    		$this->version = $import_data['version'];
    		if ( $this->version > $this->max_wxr_version ) {
    			echo '<div class='error'><p><strong>';
    			printf( __( 'This WXR file (version %s) may not be supported by this version of the importer. Please consider updating.', 'wordpress-importer' ), esc_html($import_data['version']) );
    			echo '</strong></p></div>';
    		}
    
    		$this->get_authors_from_import( $import_data );
    
    		return true;
    	}
    
    	/**
    	 * Retrieve authors from parsed WXR data
    	 *
    	 * Uses the provided author information from WXR 1.1 files
    	 * or extracts info from each post for WXR 1.0 files
    	 *
    	 * @param array $import_data Data returned by a WXR parser
    	 */
    	function get_authors_from_import( $import_data ) {
    		if ( ! empty( $import_data['authors'] ) ) {
    			$this->authors = $import_data['authors'];
    		// no author information, grab it from the posts
    		} else {
    			foreach ( $import_data['posts'] as $post ) {
    				$login = sanitize_user( $post['post_author'], true );
    				if ( empty( $login ) ) {
    					printf( __( 'Failed to import author %s. Their posts will be attributed to the current user.', 'wordpress-importer' ), esc_html( $post['post_author'] ) );
    					echo '<br />';
    					continue;
    				}
    
    				if ( ! isset($this->authors[$login]) )
    					$this->authors[$login] = array(
    						'author_login' => $login,
    						'author_display_name' => $post['post_author']
    					);
    			}
    		}
    	}
    
    	/**
    	 * Display pre-import options, author importing/mapping and option to
    	 * fetch attachments
    	 */
    	function import_options() {
    		$j = 0;
    ?>
    <form action='<?php echo admin_url( 'admin.php?import=wordpress&amp;step=2' ); ?>' method='post'>
    	<?php wp_nonce_field( 'import-wordpress' ); ?>
    	<input type='hidden' name='import_id' value='<?php echo $this->id; ?>' />
    
    <?php if ( ! empty( $this->authors ) ) : ?>
    	<h3><?php _e( 'Assign Authors', 'wordpress-importer' ); ?></h3>
    	<p><?php _e( '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 site. For example, you may want to import all the entries as <code>admin</code>s entries.', 'wordpress-importer' ); ?></p>
    <?php if ( $this->allow_create_users() ) : ?>
    	<p><?php printf( __( 'If a new user is created by WordPress, a new password will be randomly generated and the new user&#8217;s role will be set as %s. Manually changing the new user&#8217;s details will be necessary.', 'wordpress-importer' ), esc_html( get_option('default_role') ) ); ?></p>
    <?php endif; ?>
    	<ol id='authors'>
    <?php foreach ( $this->authors as $author ) : ?>
    		<li><?php $this->author_select( $j++, $author ); ?></li>
    <?php endforeach; ?>
    	</ol>
    <?php endif; ?>
    
    <?php if ( $this->allow_fetch_attachments() ) : ?>
    	<h3><?php _e( 'Import Attachments', 'wordpress-importer' ); ?></h3>
    	<p>
    		<input type='checkbox' value='1' name='fetch_attachments' id='import-attachments' />
    		<label for='import-attachments'><?php _e( 'Download and import file attachments', 'wordpress-importer' ); ?></label>
    	</p>
    <?php endif; ?>
    
    	<p class='submit'><input type='submit' class='button' value='<?php esc_attr_e( 'Submit', 'wordpress-importer' ); ?>' /></p>
    </form>
    <?php
    	}
    
    	/**
    	 * Display import options for an individual author. That is, either create
    	 * a new user based on import info or map to an existing user
    	 *
    	 * @param int $n Index for each author in the form
    	 * @param array $author Author information, e.g. login, display name, email
    	 */
    	function author_select( $n, $author ) {
    		_e( 'Import author:', 'wordpress-importer' );
    		echo ' <strong>' . esc_html( $author['author_display_name'] );
    		if ( $this->version != '1.0' ) echo ' (' . esc_html( $author['author_login'] ) . ')';
    		echo '</strong><br />';
    
    		if ( $this->version != '1.0' )
    			echo '<div style='margin-left:18px'>';
    
    		$create_users = $this->allow_create_users();
    		if ( $create_users ) {
    			if ( $this->version != '1.0' ) {
    				_e( 'or create new user with login name:', 'wordpress-importer' );
    				$value = '';
    			} else {
    				_e( 'as a new user:', 'wordpress-importer' );
    				$value = esc_attr( sanitize_user( $author['author_login'], true ) );
    			}
    
    			echo ' <input type='text' name='user_new['.$n.']' value=''. $value .'' /><br />';
    		}
    
    		if ( ! $create_users && $this->version == '1.0' )
    			_e( 'assign posts to an existing user:', 'wordpress-importer' );
    		else
    			_e( 'or assign posts to an existing user:', 'wordpress-importer' );
    		wp_dropdown_users( array( 'name' => 'user_map[$n]', 'multi' => true, 'show_option_all' => __( '- Select -', 'wordpress-importer' ) ) );
    		echo '<input type='hidden' name='imported_authors['.$n.']' value='' . esc_attr( $author['author_login'] ) . '' />';
    
    		if ( $this->version != '1.0' )
    			echo '</div>';
    	}
    
    	/**
    	 * Map old author logins to local user IDs based on decisions made
    	 * in import options form. Can map to an existing user, create a new user
    	 * or falls back to the current user in case of error with either of the previous
    	 */
    	function get_author_mapping() {
    		if ( ! isset( $_POST['imported_authors'] ) )
    			return;
    
    		$create_users = $this->allow_create_users();
    
    		foreach ( (array) $_POST['imported_authors'] as $i => $old_login ) {
    			// Multisite 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] ) ) {
    				$user = get_userdata( intval($_POST['user_map'][$i]) );
    				if ( isset( $user->ID ) ) {
    					if ( $old_id )
    						$this->processed_authors[$old_id] = $user->ID;
    					$this->author_mapping[$santized_old_login] = $user->ID;
    				}
    			} else if ( $create_users ) {
    				if ( ! empty($_POST['user_new'][$i]) ) {
    					$user_id = wp_create_user( $_POST['user_new'][$i], wp_generate_password() );
    				} else if ( $this->version != '1.0' ) {
    					$user_data = array(
    						'user_login' => $old_login,
    						'user_pass' => wp_generate_password(),
    						'user_email' => isset( $this->authors[$old_login]['author_email'] ) ? $this->authors[$old_login]['author_email'] : '',
    						'display_name' => $this->authors[$old_login]['author_display_name'],
    						'first_name' => isset( $this->authors[$old_login]['author_first_name'] ) ? $this->authors[$old_login]['author_first_name'] : '',
    						'last_name' => isset( $this->authors[$old_login]['author_last_name'] ) ? $this->authors[$old_login]['author_last_name'] : '',
    					);
    					$user_id = wp_insert_user( $user_data );
    				}
    
    				if ( ! is_wp_error( $user_id ) ) {
    					if ( $old_id )
    						$this->processed_authors[$old_id] = $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 )
    						echo ' ' . $user_id->get_error_message();
    					echo '<br />';
    				}
    			}
    
    			// failsafe: if the user_id was invalid, default to the current user
    			if ( ! isset( $this->author_mapping[$santized_old_login] ) ) {
    				if ( $old_id )
    					$this->processed_authors[$old_id] = (int) get_current_user_id();
    				$this->author_mapping[$santized_old_login] = (int) get_current_user_id();
    			}
    		}
    	}
    
    	/**
    	 * Create new categories based on import information
    	 *
    	 * Doesn't create a new category if its slug already exists
    	 */
    	function process_categories() {
    		$this->categories = apply_filters( 'wp_import_categories', $this->categories );
    
    		if ( empty( $this->categories ) )
    			return;
    	
    		$aspenImporter = AGS_Theme_Importer::$instance;
    		$i = -1;
    		$total = count($this->categories);
    		foreach ( $this->categories as $cat ) {
    			$aspenImporter->progress('content_categories', ++$i / $total);
    			
    			// if the category already exists leave it alone
    			$term_id = term_exists( $cat['category_nicename'], 'category' );
    			if ( $term_id ) {
    				if ( is_array($term_id) ) $term_id = $term_id['term_id'];
    				if ( isset($cat['term_id']) )
    					$this->processed_terms[intval($cat['term_id'])] = (int) $term_id;
    				continue;
    			}
    
    			$category_parent = empty( $cat['category_parent'] ) ? 0 : category_exists( $cat['category_parent'] );
    			$category_description = isset( $cat['category_description'] ) ? $cat['category_description'] : '';
    			$catarr = array(
    				'category_nicename' => $cat['category_nicename'],
    				'category_parent' => $category_parent,
    				'cat_name' => $cat['cat_name'],
    				'category_description' => $category_description
    			);
    			$catarr = wp_slash( $catarr );
    
    			$id = wp_insert_category( $catarr );
    			if ( ! is_wp_error( $id ) ) {
    				if ( isset($cat['term_id']) )
    					$this->processed_terms[intval($cat['term_id'])] = $id;
    			} else {
    				printf( __( 'Failed to import category %s', 'wordpress-importer' ), esc_html($cat['category_nicename']) );
    				if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    					echo ': ' . $id->get_error_message();
    				echo '<br />';
    				continue;
    			}
    
    			$this->process_termmeta( $cat, $id['term_id'] );
    		}
    
    		unset( $this->categories );
    	}
    
    	/**
    	 * Create new post tags based on import information
    	 *
    	 * Doesn't create a tag if its slug already exists
    	 */
    	function process_tags() {
    		$this->tags = apply_filters( 'wp_import_tags', $this->tags );
    
    		if ( empty( $this->tags ) )
    			return;
    		
    		$aspenImporter = AGS_Theme_Importer::$instance;
    		$i = -1;
    		$total = count($this->tags);
    		foreach ( $this->tags as $tag ) {
    			$aspenImporter->progress('content_tags', ++$i / $total);
    			
    			// if the tag already exists leave it alone
    			$term_id = term_exists( $tag['tag_slug'], 'post_tag' );
    			if ( $term_id ) {
    				if ( is_array($term_id) ) $term_id = $term_id['term_id'];
    				if ( isset($tag['term_id']) )
    					$this->processed_terms[intval($tag['term_id'])] = (int) $term_id;
    				continue;
    			}
    
    			$tag = wp_slash( $tag );
    			$tag_desc = isset( $tag['tag_description'] ) ? $tag['tag_description'] : '';
    			$tagarr = array( 'slug' => $tag['tag_slug'], 'description' => $tag_desc );
    
    			$id = wp_insert_term( $tag['tag_name'], 'post_tag', $tagarr );
    			if ( ! is_wp_error( $id ) ) {
    				if ( isset($tag['term_id']) )
    					$this->processed_terms[intval($tag['term_id'])] = $id['term_id'];
    			} else {
    				printf( __( 'Failed to import post tag %s', 'wordpress-importer' ), esc_html($tag['tag_name']) );
    				if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    					echo ': ' . $id->get_error_message();
    				echo '<br />';
    				continue;
    			}
    
    			$this->process_termmeta( $tag, $id['term_id'] );
    		}
    
    		unset( $this->tags );
    	}
    
    	/**
    	 * Create new terms based on import information
    	 *
    	 * Doesn't create a term its slug already exists
    	 */
    	function process_terms() {
    		$this->terms = apply_filters( 'wp_import_terms', $this->terms );
    
    		if ( empty( $this->terms ) )
    			return;
    			
    		$aspenImporter = AGS_Theme_Importer::$instance;
    		$i = -1;
    		$total = count($this->terms);
    		
    		foreach ( $this->terms as $term ) {
    			$aspenImporter->progress('content_terms', ++$i / $total);
    			
    			// if the term already exists in the correct taxonomy leave it alone
    			$term_id = term_exists( $term['slug'], $term['term_taxonomy'] );
    			if ( $term_id ) {
    				if ( is_array($term_id) ) $term_id = $term_id['term_id'];
    				if ( isset($term['term_id']) )
    					$this->processed_terms[intval($term['term_id'])] = (int) $term_id;
    				continue;
    			}
    
    			if ( empty( $term['term_parent'] ) ) {
    				$parent = 0;
    			} else {
    				$parent = term_exists( $term['term_parent'], $term['term_taxonomy'] );
    				if ( is_array( $parent ) ) $parent = $parent['term_id'];
    			}
    			$term = wp_slash( $term );
    			$description = isset( $term['term_description'] ) ? $term['term_description'] : '';
    			$termarr = array( 'slug' => $term['slug'], 'description' => $description, 'parent' => intval($parent) );
    
    			$id = wp_insert_term( $term['term_name'], $term['term_taxonomy'], $termarr );
    			if ( ! is_wp_error( $id ) ) {
    				if ( isset($term['term_id']) )
    					$this->processed_terms[intval($term['term_id'])] = $id['term_id'];
    			} else {
    				printf( __( 'Failed to import %s %s', 'wordpress-importer' ), esc_html($term['term_taxonomy']), esc_html($term['term_name']) );
    				if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    					echo ': ' . $id->get_error_message();
    				echo '<br />';
    				continue;
    			}
    
    			$this->process_termmeta( $term, $id['term_id'] );
    		}
    
    		unset( $this->terms );
    	}
    
    	/**
    	 * Add metadata to imported term.
    	 *
    	 * @since 0.6.2
    	 *
    	 * @param array $term    Term data from WXR import.
    	 * @param int   $term_id ID of the newly created term.
    	 */
    	protected function process_termmeta( $term, $term_id ) {
    		if ( ! isset( $term['termmeta'] ) ) {
    			$term['termmeta'] = array();
    		}
    
    		/**
    		 * Filters the metadata attached to an imported term.
    		 *
    		 * @since 0.6.2
    		 *
    		 * @param array $termmeta Array of term meta.
    		 * @param int   $term_id  ID of the newly created term.
    		 * @param array $term     Term data from the WXR import.
    		 */
    		$term['termmeta'] = apply_filters( 'wp_import_term_meta', $term['termmeta'], $term_id, $term );
    
    		if ( empty( $term['termmeta'] ) ) {
    			return;
    		}
    
    		foreach ( $term['termmeta'] as $meta ) {
    			/**
    			 * Filters the meta key for an imported piece of term meta.
    			 *
    			 * @since 0.6.2
    			 *
    			 * @param string $meta_key Meta key.
    			 * @param int    $term_id  ID of the newly created term.
    			 * @param array  $term     Term data from the WXR import.
    			 */
    			$key = apply_filters( 'import_term_meta_key', $meta['key'], $term_id, $term );
    			if ( ! $key ) {
    				continue;
    			}
    
    			// Export gets meta straight from the DB so could have a serialized string
    			$value = maybe_unserialize( $meta['value'] );
    
    			add_term_meta( $term_id, $key, $value );
    
    			/**
    			 * Fires after term meta is imported.
    			 *
    			 * @since 0.6.2
    			 *
    			 * @param int    $term_id ID of the newly created term.
    			 * @param string $key     Meta key.
    			 * @param mixed  $value   Meta value.
    			 */
    			do_action( 'import_term_meta', $term_id, $key, $value );
    		}
    	}
    
    	/**
    	 * Create new posts based on import information
    	 *
    	 * Posts marked as having a parent which doesn't exist will become top level items.
    	 * Doesn't create a new post if: the post type doesn't exist, the given post ID
    	 * is already noted as imported or a post with the same title and date already exists.
    	 * Note that new/updated terms, comments and meta are imported for the last of the above.
    	 */
    	function process_posts() {
    		$this->posts = apply_filters( 'wp_import_posts', $this->posts );
    
    		$aspenImporter = AGS_Theme_Importer::$instance;
    		$i = -1;
    		$total = count($this->posts);
    		
    		foreach ( $this->posts as $post ) {
    			$aspenImporter->progress('content_posts', ++$i / $total);
    			
    			$post = apply_filters( 'wp_import_post_data_raw', $post );
    
    			if ( ! post_type_exists( $post['post_type'] ) ) {
    				printf( __( 'Failed to import &#8220;%s&#8221;: Invalid post type %s', 'wordpress-importer' ),
    					esc_html($post['post_title']), esc_html($post['post_type']) );
    				echo '<br />';
    				do_action( 'wp_import_post_exists', $post );
    				continue;
    			}
    
    			if ( isset( $this->processed_posts[$post['post_id']] ) && ! empty( $post['post_id'] ) )
    				continue;
    
    			if ( $post['status'] == 'auto-draft' )
    				continue;
    
    			if ( 'nav_menu_item' == $post['post_type'] ) {
    				$this->process_menu_item( $post );
    				continue;
    			}
    
    			$post_type_object = get_post_type_object( $post['post_type'] );
    
    			$post_exists = post_exists( $post['post_title'], '', $post['post_date'] );
    
    			/**
    			* Filter ID of the existing post corresponding to post currently importing.
    			*
    			* Return 0 to force the post to be imported. Filter the ID to be something else
    			* to override which existing post is mapped to the imported post.
    			*
    			* @see post_exists()
    			* @since 0.6.2
    			*
    			* @param int   $post_exists  Post ID, or 0 if post did not exist.
    			* @param array $post         The post array to be inserted.
    			*/
    			$post_exists = apply_filters( 'wp_import_existing_post', $post_exists, $post );
    
    			if ( $post_exists && get_post_type( $post_exists ) == $post['post_type'] ) {
    				printf( __('%s &#8220;%s&#8221; already exists.', 'wordpress-importer'), $post_type_object->labels->singular_name, esc_html($post['post_title']) );
    				echo '<br />';
    				$comment_post_ID = $post_id = $post_exists;
    				$this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists );
    			} else {
    				$post_parent = (int) $post['post_parent'];
    				if ( $post_parent ) {
    					// if we already know the parent, map it to the new local ID
    					if ( isset( $this->processed_posts[$post_parent] ) ) {
    						$post_parent = $this->processed_posts[$post_parent];
    					// otherwise record the parent for later
    					} else {
    						$this->post_orphans[intval($post['post_id'])] = $post_parent;
    						$post_parent = 0;
    					}
    				}
    
    				// map the post author
    				$author = sanitize_user( $post['post_author'], true );
    				if ( isset( $this->author_mapping[$author] ) )
    					$author = $this->author_mapping[$author];
    				else
    					$author = (int) get_current_user_id();
    
    				$postdata = array(
    					'import_id' => $post['post_id'], 'post_author' => $author, 'post_date' => $post['post_date'],
    					'post_date_gmt' => $post['post_date_gmt'], 'post_content' => $post['post_content'],
    					'post_excerpt' => $post['post_excerpt'], 'post_title' => $post['post_title'],
    					'post_status' => $post['status'], 'post_name' => $post['post_name'],
    					'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'],
    					'guid' => $post['guid'], 'post_parent' => $post_parent, 'menu_order' => $post['menu_order'],
    					'post_type' => $post['post_type'], 'post_password' => $post['post_password']
    				);
    
    				$original_post_ID = $post['post_id'];
    				$postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $post );
    
    				$postdata = wp_slash( $postdata );
    
    				if ( 'attachment' == $postdata['post_type'] ) {
    					$remote_url = ! empty($post['attachment_url']) ? $post['attachment_url'] : $post['guid'];
    
    					// try to use _wp_attached file for upload folder placement to ensure the same location as the export site
    					// e.g. location is 2003/05/image.jpg but the attachment post_date is 2010/09, see media_handle_upload()
    					$postdata['upload_date'] = $post['post_date'];
    					if ( isset( $post['postmeta'] ) ) {
    						foreach( $post['postmeta'] as $meta ) {
    							if ( $meta['key'] == '_wp_attached_file' ) {
    								if ( preg_match( '%^[0-9]{4}/[0-9]{2}%', $meta['value'], $matches ) )
    									$postdata['upload_date'] = $matches[0];
    								break;
    							}
    						}
    					}
    
    					$comment_post_ID = $post_id = $this->process_attachment( $postdata, $remote_url );
    				} else {
    					$comment_post_ID = $post_id = wp_insert_post( $postdata, true );
    					do_action( 'wp_import_insert_post', $post_id, $original_post_ID, $postdata, $post );
    				}
    
    				if ( is_wp_error( $post_id ) ) {
    					printf( __( 'Failed to import %s &#8220;%s&#8221;', 'wordpress-importer' ),
    						$post_type_object->labels->singular_name, esc_html($post['post_title']) );
    					if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    						echo ': ' . $post_id->get_error_message();
    					echo '<br />';
    					continue;
    				}
    
    				if ( $post['is_sticky'] == 1 )
    					stick_post( $post_id );
    			}
    
    			// map pre-import ID to local ID
    			$this->processed_posts[intval($post['post_id'])] = (int) $post_id;
    
    			if ( ! isset( $post['terms'] ) )
    				$post['terms'] = array();
    
    			$post['terms'] = apply_filters( 'wp_import_post_terms', $post['terms'], $post_id, $post );
    
    			// add categories, tags and other terms
    			if ( ! empty( $post['terms'] ) ) {
    				$terms_to_set = array();
    				foreach ( $post['terms'] as $term ) {
    					// back compat with WXR 1.0 map 'tag' to 'post_tag'
    					$taxonomy = ( 'tag' == $term['domain'] ) ? 'post_tag' : $term['domain'];
    					$term_exists = term_exists( $term['slug'], $taxonomy );
    					$term_id = is_array( $term_exists ) ? $term_exists['term_id'] : $term_exists;
    					if ( ! $term_id ) {
    						$t = wp_insert_term( $term['name'], $taxonomy, array( 'slug' => $term['slug'] ) );
    						if ( ! is_wp_error( $t ) ) {
    							$term_id = $t['term_id'];
    							do_action( 'wp_import_insert_term', $t, $term, $post_id, $post );
    						} else {
    							printf( __( 'Failed to import %s %s', 'wordpress-importer' ), esc_html($taxonomy), esc_html($term['name']) );
    							if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    								echo ': ' . $t->get_error_message();
    							echo '<br />';
    							do_action( 'wp_import_insert_term_failed', $t, $term, $post_id, $post );
    							continue;
    						}
    					}
    					$terms_to_set[$taxonomy][] = intval( $term_id );
    				}
    
    				foreach ( $terms_to_set as $tax => $ids ) {
    					$tt_ids = wp_set_post_terms( $post_id, $ids, $tax );
    					do_action( 'wp_import_set_post_terms', $tt_ids, $ids, $tax, $post_id, $post );
    				}
    				unset( $post['terms'], $terms_to_set );
    			}
    
    			if ( ! isset( $post['comments'] ) )
    				$post['comments'] = array();
    
    			$post['comments'] = apply_filters( 'wp_import_post_comments', $post['comments'], $post_id, $post );
    
    			// add/update comments
    			if ( ! empty( $post['comments'] ) ) {
    				$num_comments = 0;
    				$inserted_comments = array();
    				foreach ( $post['comments'] as $comment ) {
    					$comment_id	= $comment['comment_id'];
    					$newcomments[$comment_id]['comment_post_ID']      = $comment_post_ID;
    					$newcomments[$comment_id]['comment_author']       = $comment['comment_author'];
    					$newcomments[$comment_id]['comment_author_email'] = $comment['comment_author_email'];
    					$newcomments[$comment_id]['comment_author_IP']    = $comment['comment_author_IP'];
    					$newcomments[$comment_id]['comment_author_url']   = $comment['comment_author_url'];
    					$newcomments[$comment_id]['comment_date']         = $comment['comment_date'];
    					$newcomments[$comment_id]['comment_date_gmt']     = $comment['comment_date_gmt'];
    					$newcomments[$comment_id]['comment_content']      = $comment['comment_content'];
    					$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']];
    				}
    				ksort( $newcomments );
    
    				foreach ( $newcomments as $key => $comment ) {
    					// if this is a new post we can skip the comment_exists() check
    					if ( ! $post_exists || ! comment_exists( $comment['comment_author'], $comment['comment_date'] ) ) {
    						if ( isset( $inserted_comments[$comment['comment_parent']] ) )
    							$comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
    						$comment = wp_filter_comment( $comment );
    						$inserted_comments[$key] = wp_insert_comment( $comment );
    						do_action( 'wp_import_insert_comment', $inserted_comments[$key], $comment, $comment_post_ID, $post );
    
    						foreach( $comment['commentmeta'] as $meta ) {
    							$value = maybe_unserialize( $meta['value'] );
    							add_comment_meta( $inserted_comments[$key], $meta['key'], $value );
    						}
    
    						$num_comments++;
    					}
    				}
    				unset( $newcomments, $inserted_comments, $post['comments'] );
    			}
    
    			if ( ! isset( $post['postmeta'] ) )
    				$post['postmeta'] = array();
    
    			$post['postmeta'] = apply_filters( 'wp_import_post_meta', $post['postmeta'], $post_id, $post );
    
    			// add/update post meta
    			if ( ! empty( $post['postmeta'] ) ) {
    				foreach ( $post['postmeta'] as $meta ) {
    					$key = apply_filters( 'import_post_meta_key', $meta['key'], $post_id, $post );
    					$value = false;
    
    					if ( '_edit_last' == $key ) {
    						if ( isset( $this->processed_authors[intval($meta['value'])] ) )
    							$value = $this->processed_authors[intval($meta['value'])];
    						else
    							$key = false;
    					}
    
    					if ( $key ) {
    						// export gets meta straight from the DB so could have a serialized string
    						if ( ! $value )
    							$value = maybe_unserialize( $meta['value'] );
    
    						add_post_meta( $post_id, $key, $value );
    						do_action( 'import_post_meta', $post_id, $key, $value );
    
    						// if the post has a featured image, take note of this in case of remap
    						if ( '_thumbnail_id' == $key )
    							$this->featured_images[$post_id] = (int) $value;
    					}
    				}
    			}
    		}
    
    		unset( $this->posts );
    	}
    
    	/**
    	 * Attempt to create a new menu item from import data
    	 *
    	 * Fails for draft, orphaned menu items and those without an associated nav_menu
    	 * or an invalid nav_menu term. If the post type or term object which the menu item
    	 * represents doesn't exist then the menu item will not be imported (waits until the
    	 * end of the import to retry again before discarding).
    	 *
    	 * @param array $item Menu item details from WXR file
    	 */
    	function process_menu_item( $item ) {
    		// skip draft, orphaned menu items
    		if ( 'draft' == $item['status'] )
    			return;
    
    		$menu_slug = false;
    		if ( isset($item['terms']) ) {
    			// loop through terms, assume first nav_menu term is correct menu
    			foreach ( $item['terms'] as $term ) {
    				if ( 'nav_menu' == $term['domain'] ) {
    					$menu_slug = $term['slug'];
    					break;
    				}
    			}
    		}
    
    		// no nav_menu term associated with this menu item
    		if ( ! $menu_slug ) {
    			_e( 'Menu item skipped due to missing menu slug', 'wordpress-importer' );
    			echo '<br />';
    			return;
    		}
    
    		$menu_id = term_exists( $menu_slug, 'nav_menu' );
    		if ( ! $menu_id ) {
    			printf( __( 'Menu item skipped due to invalid menu slug: %s', 'wordpress-importer' ), esc_html( $menu_slug ) );
    			echo '<br />';
    			return;
    		} else {
    			$menu_id = is_array( $menu_id ) ? $menu_id['term_id'] : $menu_id;
    		}
    		
    		foreach ( $item['postmeta'] as $meta )
    			${$meta['key']} = $meta['value'];
    
    		if ( 'taxonomy' == $_menu_item_type && isset( $this->processed_terms[intval($_menu_item_object_id)] ) ) {
    			$_menu_item_object_id = $this->processed_terms[intval($_menu_item_object_id)];
    		} else if ( 'post_type' == $_menu_item_type && isset( $this->processed_posts[intval($_menu_item_object_id)] ) ) {
    			$_menu_item_object_id = $this->processed_posts[intval($_menu_item_object_id)];
    		} else if ( 'custom' != $_menu_item_type ) {
    			// associated object is missing or not imported yet, we'll retry later
    			$this->missing_menu_items[] = $item;
    			return;
    		}
    
    		if ( isset( $this->processed_menu_items[intval($_menu_item_menu_item_parent)] ) ) {
    			$_menu_item_menu_item_parent = $this->processed_menu_items[intval($_menu_item_menu_item_parent)];
    		} else if ( $_menu_item_menu_item_parent ) {
    			$this->menu_item_orphans[intval($item['post_id'])] = (int) $_menu_item_menu_item_parent;
    			$_menu_item_menu_item_parent = 0;
    		}
    
    		// wp_update_nav_menu_item expects CSS classes as a space separated string
    		$_menu_item_classes = maybe_unserialize( $_menu_item_classes );
    		if ( is_array( $_menu_item_classes ) )
    			$_menu_item_classes = implode( ' ', $_menu_item_classes );
    
    		$args = array(
    			'menu-item-object-id' => $_menu_item_object_id,
    			'menu-item-object' => $_menu_item_object,
    			'menu-item-parent-id' => $_menu_item_menu_item_parent,
    			'menu-item-position' => intval( $item['menu_order'] ),
    			'menu-item-type' => $_menu_item_type,
    			'menu-item-title' => $item['post_title'],
    			'menu-item-url' => $_menu_item_url,
    			'menu-item-description' => $item['post_content'],
    			'menu-item-attr-title' => $item['post_excerpt'],
    			'menu-item-target' => $_menu_item_target,
    			'menu-item-classes' => $_menu_item_classes,
    			'menu-item-xfn' => $_menu_item_xfn,
    			'menu-item-status' => $item['status']
    		);
    
    		$id = wp_update_nav_menu_item( $menu_id, 0, $args );
    		if ( $id && ! is_wp_error( $id ) )
    			$this->processed_menu_items[intval($item['post_id'])] = (int) $id;
    	}
    
    	/**
    	 * If fetching attachments is enabled then attempt to create a new attachment
    	 *
    	 * @param array $post Attachment post details from WXR
    	 * @param string $url URL to fetch attachment from
    	 * @return int|WP_Error Post ID on success, WP_Error otherwise
    	 */
    	function process_attachment( $post, $url ) {
    		if ( ! $this->fetch_attachments )
    			return new WP_Error( 'attachment_processing_error',
    				__( 'Fetching attachments is not enabled', 'wordpress-importer' ) );
    
    		// if the URL is absolute, but does not contain address, then upload it assuming base_site_url
    		if ( preg_match( '|^/[\w\W]+$|', $url ) )
    			$url = rtrim( $this->base_url, '/' ) . $url;
    
    		$upload = $this->fetch_remote_file( $url, $post );
    		if ( is_wp_error( $upload ) )
    			return $upload;
    
    		if ( $info = wp_check_filetype( $upload['file'] ) )
    			$post['post_mime_type'] = $info['type'];
    		else
    			return new WP_Error( 'attachment_processing_error', __('Invalid file type', 'wordpress-importer') );
    
    		$post['guid'] = $upload['url'];
    
    		// as per wp-admin/includes/upload.php
    		$post_id = wp_insert_attachment( $post, $upload['file'] );
    		wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) );
    
    		// remap resized image URLs, works by stripping the extension and remapping the URL stub.
    		if ( preg_match( '!^image/!', $info['type'] ) ) {
    			$parts = pathinfo( $url );
    			$name = basename( $parts['basename'], '.{$parts['extension']}' ); // PATHINFO_FILENAME in PHP 5.2
    
    			$parts_new = pathinfo( $upload['url'] );
    			$name_new = basename( $parts_new['basename'], '.{$parts_new['extension']}' );
    
    			$this->url_remap[$parts['dirname'] . '/' . $name] = $parts_new['dirname'] . '/' . $name_new;
    		}
    
    		return $post_id;
    	}
    
    	/**
    	 * Attempt to download a remote file attachment
    	 *
    	 * @param string $url URL of item to fetch
    	 * @param array $post Attachment details
    	 * @return array|WP_Error Local file location details on success, WP_Error otherwise
    	 */
    	function fetch_remote_file( $url, $post ) {
    		// extract the file name and extension from the url
    		$file_name = basename( $url );
    
    		// get placeholder file in the upload dir with a unique, sanitized filename
    		$upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
    		if ( $upload['error'] )
    			return new WP_Error( 'upload_dir_error', $upload['error'] );
    
    		// fetch the remote url and write it to the placeholder file
    		global $ags_wp_importer_http;
    		if (!isset($ags_wp_importer_http)) {
    			$ags_wp_importer_http = new WP_Http();
    		}
    		$result = $ags_wp_importer_http->request( $url, array(
    			'stream' => true,
    			'filename' => $upload['file']
    		));
    		
    		// request failed
    		if ( is_wp_error($result) || empty($result['response']['code']) ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', __('Remote server did not respond', 'wordpress-importer') );
    		}
    
    		// make sure the fetch was successful
    		if ( $result['response']['code'] != '200' ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($result['response']['code']), get_status_header_desc($result['response']['code']) ) );
    		}
    
    		$filesize = filesize( $upload['file'] );
    
    		if ( isset( $result['headers']['content-length'] ) && $filesize != $result['headers']['content-length'] ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', __('Remote file is incorrect size', 'wordpress-importer') );
    		}
    
    		if ( 0 == $filesize ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', __('Zero size file downloaded', 'wordpress-importer') );
    		}
    
    		$max_size = (int) $this->max_attachment_size();
    		if ( ! empty( $max_size ) && $filesize > $max_size ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', 'wordpress-importer'), size_format($max_size) ) );
    		}
    
    		// keep track of the old and new urls so we can substitute them later
    		$this->url_remap[$url] = $upload['url'];
    		$this->url_remap[$post['guid']] = $upload['url']; // r13735, really needed?
    		// keep track of the destination if the remote url is redirected somewhere else
    		if ( isset($result['headers']['x-final-location']) && $result['headers']['x-final-location'] != $url )
    			$this->url_remap[$result['headers']['x-final-location']] = $upload['url'];
    
    		return $upload;
    	}
    
    	/**
    	 * Attempt to associate posts and menu items with previously missing parents
    	 *
    	 * An imported post's parent may not have been imported when it was first created
    	 * so try again. Similarly for child menu items and menu items which were missing
    	 * the object (e.g. post) they represent in the menu
    	 */
    	function backfill_parents() {
    		global $wpdb;
    
    		// find parents for post orphans
    		foreach ( $this->post_orphans as $child_id => $parent_id ) {
    			$local_child_id = $local_parent_id = false;
    			if ( isset( $this->processed_posts[$child_id] ) )
    				$local_child_id = $this->processed_posts[$child_id];
    			if ( isset( $this->processed_posts[$parent_id] ) )
    				$local_parent_id = $this->processed_posts[$parent_id];
    
    			if ( $local_child_id && $local_parent_id )
    				$wpdb->update( $wpdb->posts, array( 'post_parent' => $local_parent_id ), array( 'ID' => $local_child_id ), '%d', '%d' );
    		}
    
    		// all other posts/terms are imported, retry menu items with missing associated object
    		$missing_menu_items = $this->missing_menu_items;
    		foreach ( $missing_menu_items as $item )
    			$this->process_menu_item( $item );
    
    		// find parents for menu item orphans
    		foreach ( $this->menu_item_orphans as $child_id => $parent_id ) {
    			$local_child_id = $local_parent_id = 0;
    			if ( isset( $this->processed_menu_items[$child_id] ) )
    				$local_child_id = $this->processed_menu_items[$child_id];
    			if ( isset( $this->processed_menu_items[$parent_id] ) )
    				$local_parent_id = $this->processed_menu_items[$parent_id];
    
    			if ( $local_child_id && $local_parent_id )
    				update_post_meta( $local_child_id, '_menu_item_menu_item_parent', (int) $local_parent_id );
    		}
    	}
    
    	/**
    	 * Use stored mapping information to update old attachment URLs
    	 */
    	function backfill_attachment_urls() {
    		global $wpdb;
    		// make sure we do the longest urls first, in case one is a substring of another
    		uksort( $this->url_remap, array(&$this, 'cmpr_strlen') );
    
    		foreach ( $this->url_remap as $from_url => $to_url ) {
    			// remap urls in post_content
    			$wpdb->query( $wpdb->prepare('UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)', $from_url, $to_url) );
    			// remap enclosure urls
    			$result = $wpdb->query( $wpdb->prepare('UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'', $from_url, $to_url) );
    		}
    	}
    
    	/**
    	 * Update _thumbnail_id meta to new, imported attachment IDs
    	 */
    	function remap_featured_images() {
    		// cycle through posts that have a featured image
    		foreach ( $this->featured_images as $post_id => $value ) {
    			if ( isset( $this->processed_posts[$value] ) ) {
    				$new_id = $this->processed_posts[$value];
    				// only update if there's a difference
    				if ( $new_id != $value )
    					update_post_meta( $post_id, '_thumbnail_id', $new_id );
    			}
    		}
    	}
    
    	/**
    	 * Parse a WXR file
    	 *
    	 * @param string $file Path to WXR file for parsing
    	 * @return array Information gathered from the WXR file
    	 */
    	function parse( $file ) {
    		$parser = new WXR_Parser();
    		return $parser->parse( $file );
    	}
    
    	// Display import page title
    	function header() {
    		echo '<div class='wrap'>';
    		screen_icon();
    		echo '<h2>' . __( 'Import WordPress', 'wordpress-importer'
  10. Post pagination : Implementation The theme doesn't have post pagination code in it. Use posts_nav_link() or paginate_links() or the_posts_pagination() or the_posts_navigation() or next_posts_link() and previous_posts_link() to add post pagination.
Warning
  1. theme tags : Presence of bad theme tagsFound wrong tag in style.css header.
  2. Text domain : Incorrect use of translation functions.Wrong installation directory for the theme name. The directory name must match the slug of the theme. This theme's correct slug and text-domain is divi-ecommerce.
  3. Text domain : Incorrect use of translation functions.More than one text-domain is being used in this theme. This means the theme will not be compatible with WordPress.org language packs. The domains found are tgmpa, Divi, textdomain, divi_ecommerce, aspengrove-updater, radium, ags-demo-installer, wordpress-importer.
  4. Plugin territory : Plugin territory functionalitiesThe theme uses the add_shortcode() function. Custom post-content shortcodes are plugin-territory functionality.
  5. Fundamental theme elements : Presence of wp_footer()Could not find wp_footer.
  6. Fundamental theme elements : Presence of wp_head()Could not find wp_head.
  7. Fundamental theme elements : Presence of language_attributes()Could not find .
  8. Fundamental theme elements : Definition of a charsetCould not find charset.
  9. Fundamental theme elements : Presence of add_theme_support()Could not find add_theme_support( 'automatic-feed-links' ).
  10. Fundamental theme elements : Presence of wp_list_comments()Could not find wp_list_comments.
  11. Fundamental theme elements : Presence of comment_form()Could not find comment_form.
  12. Fundamental theme elements : Presence of body_class()Could not find body_class call in body tag.
  13. Comment pagination : Declaration of comment paginationThe theme doesn't have comment pagination code in it. Use paginate_comments_links() to add comment pagination, or older previous_comments_link() and next_comments_link() functions.
  14. Custom elements : Presence of custom headerNo reference to custom header was found in the theme.
  15. Custom elements : Presence of custom backgroundNo reference to custom background was found in the theme.
  16. Deprecated functions : screen_iconscreen_icon found in file wordpress-importer.php. Deprecated since version 3.8.
    Ligne1: <?php
    /*
    Plugin Name: WordPress Importer
    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.6.3
    Text Domain: wordpress-importer
    License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    */
    
    if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
    	return;
    
    /** Display verbose errors */
    if (!defined('IMPORT_DEBUG')) {
    	define( 'IMPORT_DEBUG', false );
    }
    
    // Load Importer API
    require_once ABSPATH . 'wp-admin/includes/import.php';
    
    if ( ! class_exists( 'WP_Importer' ) ) {
    	$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
    	if ( file_exists( $class_wp_importer ) )
    		require $class_wp_importer;
    }
    
    // include WXR file parsers
    require dirname( __FILE__ ) . '/parsers.php';
    
    /**
     * WordPress Importer class for managing the import process of a WXR file
     *
     * @package WordPress
     * @subpackage Importer
     */
    if ( class_exists( 'WP_Importer' ) ) {
    class WP_Import extends WP_Importer {
    	var $max_wxr_version = 1.2; // max. supported WXR version
    
    	var $id; // WXR attachment ID
    
    	// information to import from WXR file
    	var $version;
    	var $authors = array();
    	var $posts = array();
    	var $terms = array();
    	var $categories = array();
    	var $tags = array();
    	var $base_url = '';
    
    	// mappings from old information to new
    	var $processed_authors = array();
    	var $author_mapping = array();
    	var $processed_terms = array();
    	var $processed_posts = array();
    	var $post_orphans = array();
    	var $processed_menu_items = array();
    	var $menu_item_orphans = array();
    	var $missing_menu_items = array();
    
    	var $fetch_attachments = false;
    	var $url_remap = array();
    	var $featured_images = array();
    
    	/**
    	 * Registered callback function for the WordPress Importer
    	 *
    	 * Manages the three separate stages of the WXR import process
    	 */
    	function dispatch() {
    		$this->header();
    
    		$step = empty( $_GET['step'] ) ? 0 : (int) $_GET['step'];
    		switch ( $step ) {
    			case 0:
    				$this->greet();
    				break;
    			case 1:
    				check_admin_referer( 'import-upload' );
    				if ( $this->handle_upload() )
    					$this->import_options();
    				break;
    			case 2:
    				check_admin_referer( 'import-wordpress' );
    				$this->fetch_attachments = ( ! empty( $_POST['fetch_attachments'] ) && $this->allow_fetch_attachments() );
    				$this->id = (int) $_POST['import_id'];
    				$file = get_attached_file( $this->id );
    				set_time_limit(0);
    				$this->import( $file );
    				break;
    		}
    
    		$this->footer();
    	}
    
    	/**
    	 * The main controller for the actual import stage.
    	 *
    	 * @param string $file Path to the WXR file for importing
    	 */
    	function import( $file ) {
    		$aspenImporter = AGS_Theme_Importer::$instance;
    	
    		add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
    		add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
    
    		$this->import_start( $file );
    
    		$this->get_author_mapping();
    
    		wp_suspend_cache_invalidation( true );
    		
    		$aspenImporter->progress('content_start');
    		
    		$this->process_categories();
    		$aspenImporter->progress('content_categories');
    		$this->process_tags();
    		$aspenImporter->progress('content_tags');
    		$this->process_terms();
    		$aspenImporter->progress('content_terms');
    		$this->process_posts();
    		$aspenImporter->progress('content_posts');
    		wp_suspend_cache_invalidation( false );
    
    		// update incorrect/missing information in the DB
    		$this->backfill_parents();
    		$this->backfill_attachment_urls();
    		$this->remap_featured_images();
    
    		$this->import_end();
    		$aspenImporter->progress('content_end');
    	}
    
    	/**
    	 * Parses the WXR file and prepares us for the task of processing parsed data
    	 *
    	 * @param string $file Path to the WXR file for importing
    	 */
    	function import_start( $file ) {
    		if ( ! is_file($file) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			echo __( 'The file does not exist, please try again.', 'wordpress-importer' ) . '</p>';
    			$this->footer();
    			die();
    		}
    
    		$import_data = $this->parse( $file );
    
    		if ( is_wp_error( $import_data ) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			echo esc_html( $import_data->get_error_message() ) . '</p>';
    			$this->footer();
    			die();
    		}
    
    		$this->version = $import_data['version'];
    		$this->get_authors_from_import( $import_data );
    		$this->posts = $import_data['posts'];
    		$this->terms = $import_data['terms'];
    		$this->categories = $import_data['categories'];
    		$this->tags = $import_data['tags'];
    		$this->base_url = esc_url( $import_data['base_url'] );
    
    		wp_defer_term_counting( true );
    		wp_defer_comment_counting( true );
    
    		do_action( 'import_start' );
    	}
    
    	/**
    	 * Performs post-import cleanup of files and the cache
    	 */
    	function import_end() {
    		wp_import_cleanup( $this->id );
    
    		wp_cache_flush();
    		foreach ( get_taxonomies() as $tax ) {
    			delete_option( '{$tax}_children' );
    			_get_term_hierarchy( $tax );
    		}
    
    		wp_defer_term_counting( false );
    		wp_defer_comment_counting( false );
    
    		//echo '<p>' . __( 'All done.', 'wordpress-importer' ) . ' <a href='' . admin_url() . ''>' . __( 'Have fun!', 'wordpress-importer' ) . '</a>' . '</p>';
    		//echo '<p>' . __( 'Remember to update the passwords and roles of imported users.', 'wordpress-importer' ) . '</p>';
    
    		do_action( 'import_end' );
    	}
    
    	/**
    	 * Handles the WXR upload and initial parsing of the file to prepare for
    	 * displaying author import options
    	 *
    	 * @return bool False if error uploading or invalid file, true otherwise
    	 */
    	function handle_upload() {
    		$file = wp_import_handle_upload();
    
    		if ( isset( $file['error'] ) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			echo esc_html( $file['error'] ) . '</p>';
    			return false;
    		} else if ( ! file_exists( $file['file'] ) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			printf( __( 'The export file could not be found at <code>%s</code>. It is likely that this was caused by a permissions problem.', 'wordpress-importer' ), esc_html( $file['file'] ) );
    			echo '</p>';
    			return false;
    		}
    
    		$this->id = (int) $file['id'];
    		$import_data = $this->parse( $file['file'] );
    		if ( is_wp_error( $import_data ) ) {
    			echo '<p><strong>' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '</strong><br />';
    			echo esc_html( $import_data->get_error_message() ) . '</p>';
    			return false;
    		}
    
    		$this->version = $import_data['version'];
    		if ( $this->version > $this->max_wxr_version ) {
    			echo '<div class='error'><p><strong>';
    			printf( __( 'This WXR file (version %s) may not be supported by this version of the importer. Please consider updating.', 'wordpress-importer' ), esc_html($import_data['version']) );
    			echo '</strong></p></div>';
    		}
    
    		$this->get_authors_from_import( $import_data );
    
    		return true;
    	}
    
    	/**
    	 * Retrieve authors from parsed WXR data
    	 *
    	 * Uses the provided author information from WXR 1.1 files
    	 * or extracts info from each post for WXR 1.0 files
    	 *
    	 * @param array $import_data Data returned by a WXR parser
    	 */
    	function get_authors_from_import( $import_data ) {
    		if ( ! empty( $import_data['authors'] ) ) {
    			$this->authors = $import_data['authors'];
    		// no author information, grab it from the posts
    		} else {
    			foreach ( $import_data['posts'] as $post ) {
    				$login = sanitize_user( $post['post_author'], true );
    				if ( empty( $login ) ) {
    					printf( __( 'Failed to import author %s. Their posts will be attributed to the current user.', 'wordpress-importer' ), esc_html( $post['post_author'] ) );
    					echo '<br />';
    					continue;
    				}
    
    				if ( ! isset($this->authors[$login]) )
    					$this->authors[$login] = array(
    						'author_login' => $login,
    						'author_display_name' => $post['post_author']
    					);
    			}
    		}
    	}
    
    	/**
    	 * Display pre-import options, author importing/mapping and option to
    	 * fetch attachments
    	 */
    	function import_options() {
    		$j = 0;
    ?>
    <form action='<?php echo admin_url( 'admin.php?import=wordpress&amp;step=2' ); ?>' method='post'>
    	<?php wp_nonce_field( 'import-wordpress' ); ?>
    	<input type='hidden' name='import_id' value='<?php echo $this->id; ?>' />
    
    <?php if ( ! empty( $this->authors ) ) : ?>
    	<h3><?php _e( 'Assign Authors', 'wordpress-importer' ); ?></h3>
    	<p><?php _e( '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 site. For example, you may want to import all the entries as <code>admin</code>s entries.', 'wordpress-importer' ); ?></p>
    <?php if ( $this->allow_create_users() ) : ?>
    	<p><?php printf( __( 'If a new user is created by WordPress, a new password will be randomly generated and the new user&#8217;s role will be set as %s. Manually changing the new user&#8217;s details will be necessary.', 'wordpress-importer' ), esc_html( get_option('default_role') ) ); ?></p>
    <?php endif; ?>
    	<ol id='authors'>
    <?php foreach ( $this->authors as $author ) : ?>
    		<li><?php $this->author_select( $j++, $author ); ?></li>
    <?php endforeach; ?>
    	</ol>
    <?php endif; ?>
    
    <?php if ( $this->allow_fetch_attachments() ) : ?>
    	<h3><?php _e( 'Import Attachments', 'wordpress-importer' ); ?></h3>
    	<p>
    		<input type='checkbox' value='1' name='fetch_attachments' id='import-attachments' />
    		<label for='import-attachments'><?php _e( 'Download and import file attachments', 'wordpress-importer' ); ?></label>
    	</p>
    <?php endif; ?>
    
    	<p class='submit'><input type='submit' class='button' value='<?php esc_attr_e( 'Submit', 'wordpress-importer' ); ?>' /></p>
    </form>
    <?php
    	}
    
    	/**
    	 * Display import options for an individual author. That is, either create
    	 * a new user based on import info or map to an existing user
    	 *
    	 * @param int $n Index for each author in the form
    	 * @param array $author Author information, e.g. login, display name, email
    	 */
    	function author_select( $n, $author ) {
    		_e( 'Import author:', 'wordpress-importer' );
    		echo ' <strong>' . esc_html( $author['author_display_name'] );
    		if ( $this->version != '1.0' ) echo ' (' . esc_html( $author['author_login'] ) . ')';
    		echo '</strong><br />';
    
    		if ( $this->version != '1.0' )
    			echo '<div style='margin-left:18px'>';
    
    		$create_users = $this->allow_create_users();
    		if ( $create_users ) {
    			if ( $this->version != '1.0' ) {
    				_e( 'or create new user with login name:', 'wordpress-importer' );
    				$value = '';
    			} else {
    				_e( 'as a new user:', 'wordpress-importer' );
    				$value = esc_attr( sanitize_user( $author['author_login'], true ) );
    			}
    
    			echo ' <input type='text' name='user_new['.$n.']' value=''. $value .'' /><br />';
    		}
    
    		if ( ! $create_users && $this->version == '1.0' )
    			_e( 'assign posts to an existing user:', 'wordpress-importer' );
    		else
    			_e( 'or assign posts to an existing user:', 'wordpress-importer' );
    		wp_dropdown_users( array( 'name' => 'user_map[$n]', 'multi' => true, 'show_option_all' => __( '- Select -', 'wordpress-importer' ) ) );
    		echo '<input type='hidden' name='imported_authors['.$n.']' value='' . esc_attr( $author['author_login'] ) . '' />';
    
    		if ( $this->version != '1.0' )
    			echo '</div>';
    	}
    
    	/**
    	 * Map old author logins to local user IDs based on decisions made
    	 * in import options form. Can map to an existing user, create a new user
    	 * or falls back to the current user in case of error with either of the previous
    	 */
    	function get_author_mapping() {
    		if ( ! isset( $_POST['imported_authors'] ) )
    			return;
    
    		$create_users = $this->allow_create_users();
    
    		foreach ( (array) $_POST['imported_authors'] as $i => $old_login ) {
    			// Multisite 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] ) ) {
    				$user = get_userdata( intval($_POST['user_map'][$i]) );
    				if ( isset( $user->ID ) ) {
    					if ( $old_id )
    						$this->processed_authors[$old_id] = $user->ID;
    					$this->author_mapping[$santized_old_login] = $user->ID;
    				}
    			} else if ( $create_users ) {
    				if ( ! empty($_POST['user_new'][$i]) ) {
    					$user_id = wp_create_user( $_POST['user_new'][$i], wp_generate_password() );
    				} else if ( $this->version != '1.0' ) {
    					$user_data = array(
    						'user_login' => $old_login,
    						'user_pass' => wp_generate_password(),
    						'user_email' => isset( $this->authors[$old_login]['author_email'] ) ? $this->authors[$old_login]['author_email'] : '',
    						'display_name' => $this->authors[$old_login]['author_display_name'],
    						'first_name' => isset( $this->authors[$old_login]['author_first_name'] ) ? $this->authors[$old_login]['author_first_name'] : '',
    						'last_name' => isset( $this->authors[$old_login]['author_last_name'] ) ? $this->authors[$old_login]['author_last_name'] : '',
    					);
    					$user_id = wp_insert_user( $user_data );
    				}
    
    				if ( ! is_wp_error( $user_id ) ) {
    					if ( $old_id )
    						$this->processed_authors[$old_id] = $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 )
    						echo ' ' . $user_id->get_error_message();
    					echo '<br />';
    				}
    			}
    
    			// failsafe: if the user_id was invalid, default to the current user
    			if ( ! isset( $this->author_mapping[$santized_old_login] ) ) {
    				if ( $old_id )
    					$this->processed_authors[$old_id] = (int) get_current_user_id();
    				$this->author_mapping[$santized_old_login] = (int) get_current_user_id();
    			}
    		}
    	}
    
    	/**
    	 * Create new categories based on import information
    	 *
    	 * Doesn't create a new category if its slug already exists
    	 */
    	function process_categories() {
    		$this->categories = apply_filters( 'wp_import_categories', $this->categories );
    
    		if ( empty( $this->categories ) )
    			return;
    	
    		$aspenImporter = AGS_Theme_Importer::$instance;
    		$i = -1;
    		$total = count($this->categories);
    		foreach ( $this->categories as $cat ) {
    			$aspenImporter->progress('content_categories', ++$i / $total);
    			
    			// if the category already exists leave it alone
    			$term_id = term_exists( $cat['category_nicename'], 'category' );
    			if ( $term_id ) {
    				if ( is_array($term_id) ) $term_id = $term_id['term_id'];
    				if ( isset($cat['term_id']) )
    					$this->processed_terms[intval($cat['term_id'])] = (int) $term_id;
    				continue;
    			}
    
    			$category_parent = empty( $cat['category_parent'] ) ? 0 : category_exists( $cat['category_parent'] );
    			$category_description = isset( $cat['category_description'] ) ? $cat['category_description'] : '';
    			$catarr = array(
    				'category_nicename' => $cat['category_nicename'],
    				'category_parent' => $category_parent,
    				'cat_name' => $cat['cat_name'],
    				'category_description' => $category_description
    			);
    			$catarr = wp_slash( $catarr );
    
    			$id = wp_insert_category( $catarr );
    			if ( ! is_wp_error( $id ) ) {
    				if ( isset($cat['term_id']) )
    					$this->processed_terms[intval($cat['term_id'])] = $id;
    			} else {
    				printf( __( 'Failed to import category %s', 'wordpress-importer' ), esc_html($cat['category_nicename']) );
    				if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    					echo ': ' . $id->get_error_message();
    				echo '<br />';
    				continue;
    			}
    
    			$this->process_termmeta( $cat, $id['term_id'] );
    		}
    
    		unset( $this->categories );
    	}
    
    	/**
    	 * Create new post tags based on import information
    	 *
    	 * Doesn't create a tag if its slug already exists
    	 */
    	function process_tags() {
    		$this->tags = apply_filters( 'wp_import_tags', $this->tags );
    
    		if ( empty( $this->tags ) )
    			return;
    		
    		$aspenImporter = AGS_Theme_Importer::$instance;
    		$i = -1;
    		$total = count($this->tags);
    		foreach ( $this->tags as $tag ) {
    			$aspenImporter->progress('content_tags', ++$i / $total);
    			
    			// if the tag already exists leave it alone
    			$term_id = term_exists( $tag['tag_slug'], 'post_tag' );
    			if ( $term_id ) {
    				if ( is_array($term_id) ) $term_id = $term_id['term_id'];
    				if ( isset($tag['term_id']) )
    					$this->processed_terms[intval($tag['term_id'])] = (int) $term_id;
    				continue;
    			}
    
    			$tag = wp_slash( $tag );
    			$tag_desc = isset( $tag['tag_description'] ) ? $tag['tag_description'] : '';
    			$tagarr = array( 'slug' => $tag['tag_slug'], 'description' => $tag_desc );
    
    			$id = wp_insert_term( $tag['tag_name'], 'post_tag', $tagarr );
    			if ( ! is_wp_error( $id ) ) {
    				if ( isset($tag['term_id']) )
    					$this->processed_terms[intval($tag['term_id'])] = $id['term_id'];
    			} else {
    				printf( __( 'Failed to import post tag %s', 'wordpress-importer' ), esc_html($tag['tag_name']) );
    				if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    					echo ': ' . $id->get_error_message();
    				echo '<br />';
    				continue;
    			}
    
    			$this->process_termmeta( $tag, $id['term_id'] );
    		}
    
    		unset( $this->tags );
    	}
    
    	/**
    	 * Create new terms based on import information
    	 *
    	 * Doesn't create a term its slug already exists
    	 */
    	function process_terms() {
    		$this->terms = apply_filters( 'wp_import_terms', $this->terms );
    
    		if ( empty( $this->terms ) )
    			return;
    			
    		$aspenImporter = AGS_Theme_Importer::$instance;
    		$i = -1;
    		$total = count($this->terms);
    		
    		foreach ( $this->terms as $term ) {
    			$aspenImporter->progress('content_terms', ++$i / $total);
    			
    			// if the term already exists in the correct taxonomy leave it alone
    			$term_id = term_exists( $term['slug'], $term['term_taxonomy'] );
    			if ( $term_id ) {
    				if ( is_array($term_id) ) $term_id = $term_id['term_id'];
    				if ( isset($term['term_id']) )
    					$this->processed_terms[intval($term['term_id'])] = (int) $term_id;
    				continue;
    			}
    
    			if ( empty( $term['term_parent'] ) ) {
    				$parent = 0;
    			} else {
    				$parent = term_exists( $term['term_parent'], $term['term_taxonomy'] );
    				if ( is_array( $parent ) ) $parent = $parent['term_id'];
    			}
    			$term = wp_slash( $term );
    			$description = isset( $term['term_description'] ) ? $term['term_description'] : '';
    			$termarr = array( 'slug' => $term['slug'], 'description' => $description, 'parent' => intval($parent) );
    
    			$id = wp_insert_term( $term['term_name'], $term['term_taxonomy'], $termarr );
    			if ( ! is_wp_error( $id ) ) {
    				if ( isset($term['term_id']) )
    					$this->processed_terms[intval($term['term_id'])] = $id['term_id'];
    			} else {
    				printf( __( 'Failed to import %s %s', 'wordpress-importer' ), esc_html($term['term_taxonomy']), esc_html($term['term_name']) );
    				if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    					echo ': ' . $id->get_error_message();
    				echo '<br />';
    				continue;
    			}
    
    			$this->process_termmeta( $term, $id['term_id'] );
    		}
    
    		unset( $this->terms );
    	}
    
    	/**
    	 * Add metadata to imported term.
    	 *
    	 * @since 0.6.2
    	 *
    	 * @param array $term    Term data from WXR import.
    	 * @param int   $term_id ID of the newly created term.
    	 */
    	protected function process_termmeta( $term, $term_id ) {
    		if ( ! isset( $term['termmeta'] ) ) {
    			$term['termmeta'] = array();
    		}
    
    		/**
    		 * Filters the metadata attached to an imported term.
    		 *
    		 * @since 0.6.2
    		 *
    		 * @param array $termmeta Array of term meta.
    		 * @param int   $term_id  ID of the newly created term.
    		 * @param array $term     Term data from the WXR import.
    		 */
    		$term['termmeta'] = apply_filters( 'wp_import_term_meta', $term['termmeta'], $term_id, $term );
    
    		if ( empty( $term['termmeta'] ) ) {
    			return;
    		}
    
    		foreach ( $term['termmeta'] as $meta ) {
    			/**
    			 * Filters the meta key for an imported piece of term meta.
    			 *
    			 * @since 0.6.2
    			 *
    			 * @param string $meta_key Meta key.
    			 * @param int    $term_id  ID of the newly created term.
    			 * @param array  $term     Term data from the WXR import.
    			 */
    			$key = apply_filters( 'import_term_meta_key', $meta['key'], $term_id, $term );
    			if ( ! $key ) {
    				continue;
    			}
    
    			// Export gets meta straight from the DB so could have a serialized string
    			$value = maybe_unserialize( $meta['value'] );
    
    			add_term_meta( $term_id, $key, $value );
    
    			/**
    			 * Fires after term meta is imported.
    			 *
    			 * @since 0.6.2
    			 *
    			 * @param int    $term_id ID of the newly created term.
    			 * @param string $key     Meta key.
    			 * @param mixed  $value   Meta value.
    			 */
    			do_action( 'import_term_meta', $term_id, $key, $value );
    		}
    	}
    
    	/**
    	 * Create new posts based on import information
    	 *
    	 * Posts marked as having a parent which doesn't exist will become top level items.
    	 * Doesn't create a new post if: the post type doesn't exist, the given post ID
    	 * is already noted as imported or a post with the same title and date already exists.
    	 * Note that new/updated terms, comments and meta are imported for the last of the above.
    	 */
    	function process_posts() {
    		$this->posts = apply_filters( 'wp_import_posts', $this->posts );
    
    		$aspenImporter = AGS_Theme_Importer::$instance;
    		$i = -1;
    		$total = count($this->posts);
    		
    		foreach ( $this->posts as $post ) {
    			$aspenImporter->progress('content_posts', ++$i / $total);
    			
    			$post = apply_filters( 'wp_import_post_data_raw', $post );
    
    			if ( ! post_type_exists( $post['post_type'] ) ) {
    				printf( __( 'Failed to import &#8220;%s&#8221;: Invalid post type %s', 'wordpress-importer' ),
    					esc_html($post['post_title']), esc_html($post['post_type']) );
    				echo '<br />';
    				do_action( 'wp_import_post_exists', $post );
    				continue;
    			}
    
    			if ( isset( $this->processed_posts[$post['post_id']] ) && ! empty( $post['post_id'] ) )
    				continue;
    
    			if ( $post['status'] == 'auto-draft' )
    				continue;
    
    			if ( 'nav_menu_item' == $post['post_type'] ) {
    				$this->process_menu_item( $post );
    				continue;
    			}
    
    			$post_type_object = get_post_type_object( $post['post_type'] );
    
    			$post_exists = post_exists( $post['post_title'], '', $post['post_date'] );
    
    			/**
    			* Filter ID of the existing post corresponding to post currently importing.
    			*
    			* Return 0 to force the post to be imported. Filter the ID to be something else
    			* to override which existing post is mapped to the imported post.
    			*
    			* @see post_exists()
    			* @since 0.6.2
    			*
    			* @param int   $post_exists  Post ID, or 0 if post did not exist.
    			* @param array $post         The post array to be inserted.
    			*/
    			$post_exists = apply_filters( 'wp_import_existing_post', $post_exists, $post );
    
    			if ( $post_exists && get_post_type( $post_exists ) == $post['post_type'] ) {
    				printf( __('%s &#8220;%s&#8221; already exists.', 'wordpress-importer'), $post_type_object->labels->singular_name, esc_html($post['post_title']) );
    				echo '<br />';
    				$comment_post_ID = $post_id = $post_exists;
    				$this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists );
    			} else {
    				$post_parent = (int) $post['post_parent'];
    				if ( $post_parent ) {
    					// if we already know the parent, map it to the new local ID
    					if ( isset( $this->processed_posts[$post_parent] ) ) {
    						$post_parent = $this->processed_posts[$post_parent];
    					// otherwise record the parent for later
    					} else {
    						$this->post_orphans[intval($post['post_id'])] = $post_parent;
    						$post_parent = 0;
    					}
    				}
    
    				// map the post author
    				$author = sanitize_user( $post['post_author'], true );
    				if ( isset( $this->author_mapping[$author] ) )
    					$author = $this->author_mapping[$author];
    				else
    					$author = (int) get_current_user_id();
    
    				$postdata = array(
    					'import_id' => $post['post_id'], 'post_author' => $author, 'post_date' => $post['post_date'],
    					'post_date_gmt' => $post['post_date_gmt'], 'post_content' => $post['post_content'],
    					'post_excerpt' => $post['post_excerpt'], 'post_title' => $post['post_title'],
    					'post_status' => $post['status'], 'post_name' => $post['post_name'],
    					'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'],
    					'guid' => $post['guid'], 'post_parent' => $post_parent, 'menu_order' => $post['menu_order'],
    					'post_type' => $post['post_type'], 'post_password' => $post['post_password']
    				);
    
    				$original_post_ID = $post['post_id'];
    				$postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $post );
    
    				$postdata = wp_slash( $postdata );
    
    				if ( 'attachment' == $postdata['post_type'] ) {
    					$remote_url = ! empty($post['attachment_url']) ? $post['attachment_url'] : $post['guid'];
    
    					// try to use _wp_attached file for upload folder placement to ensure the same location as the export site
    					// e.g. location is 2003/05/image.jpg but the attachment post_date is 2010/09, see media_handle_upload()
    					$postdata['upload_date'] = $post['post_date'];
    					if ( isset( $post['postmeta'] ) ) {
    						foreach( $post['postmeta'] as $meta ) {
    							if ( $meta['key'] == '_wp_attached_file' ) {
    								if ( preg_match( '%^[0-9]{4}/[0-9]{2}%', $meta['value'], $matches ) )
    									$postdata['upload_date'] = $matches[0];
    								break;
    							}
    						}
    					}
    
    					$comment_post_ID = $post_id = $this->process_attachment( $postdata, $remote_url );
    				} else {
    					$comment_post_ID = $post_id = wp_insert_post( $postdata, true );
    					do_action( 'wp_import_insert_post', $post_id, $original_post_ID, $postdata, $post );
    				}
    
    				if ( is_wp_error( $post_id ) ) {
    					printf( __( 'Failed to import %s &#8220;%s&#8221;', 'wordpress-importer' ),
    						$post_type_object->labels->singular_name, esc_html($post['post_title']) );
    					if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    						echo ': ' . $post_id->get_error_message();
    					echo '<br />';
    					continue;
    				}
    
    				if ( $post['is_sticky'] == 1 )
    					stick_post( $post_id );
    			}
    
    			// map pre-import ID to local ID
    			$this->processed_posts[intval($post['post_id'])] = (int) $post_id;
    
    			if ( ! isset( $post['terms'] ) )
    				$post['terms'] = array();
    
    			$post['terms'] = apply_filters( 'wp_import_post_terms', $post['terms'], $post_id, $post );
    
    			// add categories, tags and other terms
    			if ( ! empty( $post['terms'] ) ) {
    				$terms_to_set = array();
    				foreach ( $post['terms'] as $term ) {
    					// back compat with WXR 1.0 map 'tag' to 'post_tag'
    					$taxonomy = ( 'tag' == $term['domain'] ) ? 'post_tag' : $term['domain'];
    					$term_exists = term_exists( $term['slug'], $taxonomy );
    					$term_id = is_array( $term_exists ) ? $term_exists['term_id'] : $term_exists;
    					if ( ! $term_id ) {
    						$t = wp_insert_term( $term['name'], $taxonomy, array( 'slug' => $term['slug'] ) );
    						if ( ! is_wp_error( $t ) ) {
    							$term_id = $t['term_id'];
    							do_action( 'wp_import_insert_term', $t, $term, $post_id, $post );
    						} else {
    							printf( __( 'Failed to import %s %s', 'wordpress-importer' ), esc_html($taxonomy), esc_html($term['name']) );
    							if ( defined('IMPORT_DEBUG') && IMPORT_DEBUG )
    								echo ': ' . $t->get_error_message();
    							echo '<br />';
    							do_action( 'wp_import_insert_term_failed', $t, $term, $post_id, $post );
    							continue;
    						}
    					}
    					$terms_to_set[$taxonomy][] = intval( $term_id );
    				}
    
    				foreach ( $terms_to_set as $tax => $ids ) {
    					$tt_ids = wp_set_post_terms( $post_id, $ids, $tax );
    					do_action( 'wp_import_set_post_terms', $tt_ids, $ids, $tax, $post_id, $post );
    				}
    				unset( $post['terms'], $terms_to_set );
    			}
    
    			if ( ! isset( $post['comments'] ) )
    				$post['comments'] = array();
    
    			$post['comments'] = apply_filters( 'wp_import_post_comments', $post['comments'], $post_id, $post );
    
    			// add/update comments
    			if ( ! empty( $post['comments'] ) ) {
    				$num_comments = 0;
    				$inserted_comments = array();
    				foreach ( $post['comments'] as $comment ) {
    					$comment_id	= $comment['comment_id'];
    					$newcomments[$comment_id]['comment_post_ID']      = $comment_post_ID;
    					$newcomments[$comment_id]['comment_author']       = $comment['comment_author'];
    					$newcomments[$comment_id]['comment_author_email'] = $comment['comment_author_email'];
    					$newcomments[$comment_id]['comment_author_IP']    = $comment['comment_author_IP'];
    					$newcomments[$comment_id]['comment_author_url']   = $comment['comment_author_url'];
    					$newcomments[$comment_id]['comment_date']         = $comment['comment_date'];
    					$newcomments[$comment_id]['comment_date_gmt']     = $comment['comment_date_gmt'];
    					$newcomments[$comment_id]['comment_content']      = $comment['comment_content'];
    					$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']];
    				}
    				ksort( $newcomments );
    
    				foreach ( $newcomments as $key => $comment ) {
    					// if this is a new post we can skip the comment_exists() check
    					if ( ! $post_exists || ! comment_exists( $comment['comment_author'], $comment['comment_date'] ) ) {
    						if ( isset( $inserted_comments[$comment['comment_parent']] ) )
    							$comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
    						$comment = wp_filter_comment( $comment );
    						$inserted_comments[$key] = wp_insert_comment( $comment );
    						do_action( 'wp_import_insert_comment', $inserted_comments[$key], $comment, $comment_post_ID, $post );
    
    						foreach( $comment['commentmeta'] as $meta ) {
    							$value = maybe_unserialize( $meta['value'] );
    							add_comment_meta( $inserted_comments[$key], $meta['key'], $value );
    						}
    
    						$num_comments++;
    					}
    				}
    				unset( $newcomments, $inserted_comments, $post['comments'] );
    			}
    
    			if ( ! isset( $post['postmeta'] ) )
    				$post['postmeta'] = array();
    
    			$post['postmeta'] = apply_filters( 'wp_import_post_meta', $post['postmeta'], $post_id, $post );
    
    			// add/update post meta
    			if ( ! empty( $post['postmeta'] ) ) {
    				foreach ( $post['postmeta'] as $meta ) {
    					$key = apply_filters( 'import_post_meta_key', $meta['key'], $post_id, $post );
    					$value = false;
    
    					if ( '_edit_last' == $key ) {
    						if ( isset( $this->processed_authors[intval($meta['value'])] ) )
    							$value = $this->processed_authors[intval($meta['value'])];
    						else
    							$key = false;
    					}
    
    					if ( $key ) {
    						// export gets meta straight from the DB so could have a serialized string
    						if ( ! $value )
    							$value = maybe_unserialize( $meta['value'] );
    
    						add_post_meta( $post_id, $key, $value );
    						do_action( 'import_post_meta', $post_id, $key, $value );
    
    						// if the post has a featured image, take note of this in case of remap
    						if ( '_thumbnail_id' == $key )
    							$this->featured_images[$post_id] = (int) $value;
    					}
    				}
    			}
    		}
    
    		unset( $this->posts );
    	}
    
    	/**
    	 * Attempt to create a new menu item from import data
    	 *
    	 * Fails for draft, orphaned menu items and those without an associated nav_menu
    	 * or an invalid nav_menu term. If the post type or term object which the menu item
    	 * represents doesn't exist then the menu item will not be imported (waits until the
    	 * end of the import to retry again before discarding).
    	 *
    	 * @param array $item Menu item details from WXR file
    	 */
    	function process_menu_item( $item ) {
    		// skip draft, orphaned menu items
    		if ( 'draft' == $item['status'] )
    			return;
    
    		$menu_slug = false;
    		if ( isset($item['terms']) ) {
    			// loop through terms, assume first nav_menu term is correct menu
    			foreach ( $item['terms'] as $term ) {
    				if ( 'nav_menu' == $term['domain'] ) {
    					$menu_slug = $term['slug'];
    					break;
    				}
    			}
    		}
    
    		// no nav_menu term associated with this menu item
    		if ( ! $menu_slug ) {
    			_e( 'Menu item skipped due to missing menu slug', 'wordpress-importer' );
    			echo '<br />';
    			return;
    		}
    
    		$menu_id = term_exists( $menu_slug, 'nav_menu' );
    		if ( ! $menu_id ) {
    			printf( __( 'Menu item skipped due to invalid menu slug: %s', 'wordpress-importer' ), esc_html( $menu_slug ) );
    			echo '<br />';
    			return;
    		} else {
    			$menu_id = is_array( $menu_id ) ? $menu_id['term_id'] : $menu_id;
    		}
    		
    		foreach ( $item['postmeta'] as $meta )
    			${$meta['key']} = $meta['value'];
    
    		if ( 'taxonomy' == $_menu_item_type && isset( $this->processed_terms[intval($_menu_item_object_id)] ) ) {
    			$_menu_item_object_id = $this->processed_terms[intval($_menu_item_object_id)];
    		} else if ( 'post_type' == $_menu_item_type && isset( $this->processed_posts[intval($_menu_item_object_id)] ) ) {
    			$_menu_item_object_id = $this->processed_posts[intval($_menu_item_object_id)];
    		} else if ( 'custom' != $_menu_item_type ) {
    			// associated object is missing or not imported yet, we'll retry later
    			$this->missing_menu_items[] = $item;
    			return;
    		}
    
    		if ( isset( $this->processed_menu_items[intval($_menu_item_menu_item_parent)] ) ) {
    			$_menu_item_menu_item_parent = $this->processed_menu_items[intval($_menu_item_menu_item_parent)];
    		} else if ( $_menu_item_menu_item_parent ) {
    			$this->menu_item_orphans[intval($item['post_id'])] = (int) $_menu_item_menu_item_parent;
    			$_menu_item_menu_item_parent = 0;
    		}
    
    		// wp_update_nav_menu_item expects CSS classes as a space separated string
    		$_menu_item_classes = maybe_unserialize( $_menu_item_classes );
    		if ( is_array( $_menu_item_classes ) )
    			$_menu_item_classes = implode( ' ', $_menu_item_classes );
    
    		$args = array(
    			'menu-item-object-id' => $_menu_item_object_id,
    			'menu-item-object' => $_menu_item_object,
    			'menu-item-parent-id' => $_menu_item_menu_item_parent,
    			'menu-item-position' => intval( $item['menu_order'] ),
    			'menu-item-type' => $_menu_item_type,
    			'menu-item-title' => $item['post_title'],
    			'menu-item-url' => $_menu_item_url,
    			'menu-item-description' => $item['post_content'],
    			'menu-item-attr-title' => $item['post_excerpt'],
    			'menu-item-target' => $_menu_item_target,
    			'menu-item-classes' => $_menu_item_classes,
    			'menu-item-xfn' => $_menu_item_xfn,
    			'menu-item-status' => $item['status']
    		);
    
    		$id = wp_update_nav_menu_item( $menu_id, 0, $args );
    		if ( $id && ! is_wp_error( $id ) )
    			$this->processed_menu_items[intval($item['post_id'])] = (int) $id;
    	}
    
    	/**
    	 * If fetching attachments is enabled then attempt to create a new attachment
    	 *
    	 * @param array $post Attachment post details from WXR
    	 * @param string $url URL to fetch attachment from
    	 * @return int|WP_Error Post ID on success, WP_Error otherwise
    	 */
    	function process_attachment( $post, $url ) {
    		if ( ! $this->fetch_attachments )
    			return new WP_Error( 'attachment_processing_error',
    				__( 'Fetching attachments is not enabled', 'wordpress-importer' ) );
    
    		// if the URL is absolute, but does not contain address, then upload it assuming base_site_url
    		if ( preg_match( '|^/[\w\W]+$|', $url ) )
    			$url = rtrim( $this->base_url, '/' ) . $url;
    
    		$upload = $this->fetch_remote_file( $url, $post );
    		if ( is_wp_error( $upload ) )
    			return $upload;
    
    		if ( $info = wp_check_filetype( $upload['file'] ) )
    			$post['post_mime_type'] = $info['type'];
    		else
    			return new WP_Error( 'attachment_processing_error', __('Invalid file type', 'wordpress-importer') );
    
    		$post['guid'] = $upload['url'];
    
    		// as per wp-admin/includes/upload.php
    		$post_id = wp_insert_attachment( $post, $upload['file'] );
    		wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) );
    
    		// remap resized image URLs, works by stripping the extension and remapping the URL stub.
    		if ( preg_match( '!^image/!', $info['type'] ) ) {
    			$parts = pathinfo( $url );
    			$name = basename( $parts['basename'], '.{$parts['extension']}' ); // PATHINFO_FILENAME in PHP 5.2
    
    			$parts_new = pathinfo( $upload['url'] );
    			$name_new = basename( $parts_new['basename'], '.{$parts_new['extension']}' );
    
    			$this->url_remap[$parts['dirname'] . '/' . $name] = $parts_new['dirname'] . '/' . $name_new;
    		}
    
    		return $post_id;
    	}
    
    	/**
    	 * Attempt to download a remote file attachment
    	 *
    	 * @param string $url URL of item to fetch
    	 * @param array $post Attachment details
    	 * @return array|WP_Error Local file location details on success, WP_Error otherwise
    	 */
    	function fetch_remote_file( $url, $post ) {
    		// extract the file name and extension from the url
    		$file_name = basename( $url );
    
    		// get placeholder file in the upload dir with a unique, sanitized filename
    		$upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
    		if ( $upload['error'] )
    			return new WP_Error( 'upload_dir_error', $upload['error'] );
    
    		// fetch the remote url and write it to the placeholder file
    		global $ags_wp_importer_http;
    		if (!isset($ags_wp_importer_http)) {
    			$ags_wp_importer_http = new WP_Http();
    		}
    		$result = $ags_wp_importer_http->request( $url, array(
    			'stream' => true,
    			'filename' => $upload['file']
    		));
    		
    		// request failed
    		if ( is_wp_error($result) || empty($result['response']['code']) ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', __('Remote server did not respond', 'wordpress-importer') );
    		}
    
    		// make sure the fetch was successful
    		if ( $result['response']['code'] != '200' ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($result['response']['code']), get_status_header_desc($result['response']['code']) ) );
    		}
    
    		$filesize = filesize( $upload['file'] );
    
    		if ( isset( $result['headers']['content-length'] ) && $filesize != $result['headers']['content-length'] ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', __('Remote file is incorrect size', 'wordpress-importer') );
    		}
    
    		if ( 0 == $filesize ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', __('Zero size file downloaded', 'wordpress-importer') );
    		}
    
    		$max_size = (int) $this->max_attachment_size();
    		if ( ! empty( $max_size ) && $filesize > $max_size ) {
    			@unlink( $upload['file'] );
    			return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', 'wordpress-importer'), size_format($max_size) ) );
    		}
    
    		// keep track of the old and new urls so we can substitute them later
    		$this->url_remap[$url] = $upload['url'];
    		$this->url_remap[$post['guid']] = $upload['url']; // r13735, really needed?
    		// keep track of the destination if the remote url is redirected somewhere else
    		if ( isset($result['headers']['x-final-location']) && $result['headers']['x-final-location'] != $url )
    			$this->url_remap[$result['headers']['x-final-location']] = $upload['url'];
    
    		return $upload;
    	}
    
    	/**
    	 * Attempt to associate posts and menu items with previously missing parents
    	 *
    	 * An imported post's parent may not have been imported when it was first created
    	 * so try again. Similarly for child menu items and menu items which were missing
    	 * the object (e.g. post) they represent in the menu
    	 */
    	function backfill_parents() {
    		global $wpdb;
    
    		// find parents for post orphans
    		foreach ( $this->post_orphans as $child_id => $parent_id ) {
    			$local_child_id = $local_parent_id = false;
    			if ( isset( $this->processed_posts[$child_id] ) )
    				$local_child_id = $this->processed_posts[$child_id];
    			if ( isset( $this->processed_posts[$parent_id] ) )
    				$local_parent_id = $this->processed_posts[$parent_id];
    
    			if ( $local_child_id && $local_parent_id )
    				$wpdb->update( $wpdb->posts, array( 'post_parent' => $local_parent_id ), array( 'ID' => $local_child_id ), '%d', '%d' );
    		}
    
    		// all other posts/terms are imported, retry menu items with missing associated object
    		$missing_menu_items = $this->missing_menu_items;
    		foreach ( $missing_menu_items as $item )
    			$this->process_menu_item( $item );
    
    		// find parents for menu item orphans
    		foreach ( $this->menu_item_orphans as $child_id => $parent_id ) {
    			$local_child_id = $local_parent_id = 0;
    			if ( isset( $this->processed_menu_items[$child_id] ) )
    				$local_child_id = $this->processed_menu_items[$child_id];
    			if ( isset( $this->processed_menu_items[$parent_id] ) )
    				$local_parent_id = $this->processed_menu_items[$parent_id];
    
    			if ( $local_child_id && $local_parent_id )
    				update_post_meta( $local_child_id, '_menu_item_menu_item_parent', (int) $local_parent_id );
    		}
    	}
    
    	/**
    	 * Use stored mapping information to update old attachment URLs
    	 */
    	function backfill_attachment_urls() {
    		global $wpdb;
    		// make sure we do the longest urls first, in case one is a substring of another
    		uksort( $this->url_remap, array(&$this, 'cmpr_strlen') );
    
    		foreach ( $this->url_remap as $from_url => $to_url ) {
    			// remap urls in post_content
    			$wpdb->query( $wpdb->prepare('UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)', $from_url, $to_url) );
    			// remap enclosure urls
    			$result = $wpdb->query( $wpdb->prepare('UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'', $from_url, $to_url) );
    		}
    	}
    
    	/**
    	 * Update _thumbnail_id meta to new, imported attachment IDs
    	 */
    	function remap_featured_images() {
    		// cycle through posts that have a featured image
    		foreach ( $this->featured_images as $post_id => $value ) {
    			if ( isset( $this->processed_posts[$value] ) ) {
    				$new_id = $this->processed_posts[$value];
    				// only update if there's a difference
    				if ( $new_id != $value )
    					update_post_meta( $post_id, '_thumbnail_id', $new_id );
    			}
    		}
    	}
    
    	/**
    	 * Parse a WXR file
    	 *
    	 * @param string $file Path to WXR file for parsing
    	 * @return array Information gathered from the WXR file
    	 */
    	function parse( $file ) {
    		$parser = new WXR_Parser();
    		return $parser->parse( $file );
    	}
    
    	// Display import page title
    	function header() {
    		echo '<div class='wrap'>';
    		screen_icon();
    		echo '<h2>' . __( 'Import WordPress', 'wordpress-importer'
  17. Editor style : Presence of editor styleNo reference to add_editor_style() was found in the theme. It is recommended that the theme implements editor styling, so as to make the editor content match the resulting post output in the theme, for a better user experience.
  18. Avatar : Support of standard avatar functionsThis theme doesn't seem to support the standard avatar functions. Use get_avatar or wp_list_comments to add this support.
  19. Featured image : Use of add_theme_support( 'post-thumbnails' ) in functions.php fileNo reference to post-thumbnails was found in the theme.
  20. CSS files : Presence of license typeLicense: is missing from style.css header.
  21. CSS files : Presence of license urlLicense URI: is missing from style.css header.
  22. CSS files : Presence of text domainText Domain: is missing from your style.css header.
  23. CSS files : Presence of .sticky class.sticky css class is needed in theme css.
  24. CSS files : Presence of .bypostauthor class.bypostauthor css class is needed in theme css.
  25. CSS files : Presence of .alignleft class.alignleft css class is needed in theme css.
  26. CSS files : Presence of .alignright class.alignright css class is needed in theme css.
  27. CSS files : Presence of .aligncenter class.aligncenter css class is needed in theme css.
  28. CSS files : Presence of .wp-caption class.wp-caption css class is needed in theme css.
  29. CSS files : Presence of .wp-caption-text class.wp-caption-text css class is needed in theme css.
  30. CSS files : Presence of .gallery-caption class.gallery-caption css class is needed in theme css.
  31. CSS files : Presence of .screen-reader-text class.screen-reader-text css class is needed in your theme css. See : the Codex for an example implementation.
  32. CSS files : Presence of Theme URICould not find Theme URL.
  33. Tags : Tags displayThis theme doesn't seem to display tags.
Tip-off
  1. Mandatory files : Presence of file comments.phpCould not find file comments.php in the theme.
  2. Optional files : Presence of rtl stylesheet rtl.cssThis theme does not contain optional file rtl.php.
  3. Optional files : Presence of comments template file comments.phpThis theme does not contain optional file comments.php.
  4. Optional files : Presence of front page template file front-page.phpThis theme does not contain optional file front-page.php.
  5. Optional files : Presence of home template file home.phpThis theme does not contain optional file home.php.
  6. Optional files : Presence of single post template file single.phpThis theme does not contain optional file comments.php.
  7. Optional files : Presence of page template file page.phpThis theme does not contain optional file page.php.
  8. Optional files : Presence of category template file category.phpThis theme does not contain optional file category.php.
  9. Optional files : Presence of tag template file tag.phpThis theme does not contain optional file tag.php.
  10. Optional files : Presence of term template file taxonomy.phpThis theme does not contain optional file taxonomy.php.
  11. Optional files : Presence of author template file author.phpThis theme does not contain optional file author.php.
  12. Optional files : Presence of date/time template file date.phpThis theme does not contain optional file date.php.
  13. Optional files : Presence of archive template file archive.phpThis theme does not contain optional file archive.php.
  14. Optional files : Presence of search results template file search.phpThis theme does not contain optional file search.php.
  15. Optional files : Presence of attachment template file attachment.phpThis theme does not contain optional file attachment.php.
  16. Optional files : Presence of image template file image.phpThis theme does not contain optional file image.php.
  17. Use of includes : Use of include or requireThe theme appears to use include or require : init.php
    Ligne23: require_once( dirname( __FILE__ ) . '/importer/aspen-importer.php' ); //loa
    If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Otherwise, use include_once or require_once instead.
    The theme appears to use include or require : admin-menu.php
    Ligne26: include(dirname(__FILE__).'/init.php');
    Ligne48: include(dirname(__FILE__).'/init.php');
    If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Otherwise, use include_once or require_once instead.
    The theme appears to use include or require : aspen-importer.php
    Ligne700: require_once($class_wp_importer);
    Ligne730: require_once($class_wp_import);
    If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Otherwise, use include_once or require_once instead.
Other checked themes