PK ! 68
import.phpnu [ demos_path = apply_filters( 'rb_importer_demos_path', trailingslashit( plugin_dir_path( __FILE__ ) . 'demos' ) );
$this->demos_url = apply_filters( 'rb_importer_demos_url', trailingslashit( plugin_dir_url( __FILE__ ) . 'demos' ) );
$this->demos = RB_ADMIN_CORE::get_instance()->get_imports();
}
/** set sub page */
public function set_sub_page() {
$this->page_title = esc_html__( 'Demo Importer', 'foxiz-core' );
$this->menu_title = esc_html__( 'Demo Importer', 'foxiz-core' );
$this->menu_slug = 'rb-demo-importer';
$this->capability = 'administrator';
}
public function get_slug() {
if ( ! $this->validate() ) {
return 'admin/templates/validate';
} else {
return 'admin/import/template';
}
}
public function get_name() {
if ( ! $this->validate() ) {
return 'redirect';
} else {
return false;
}
}
/**
* @param $url
* @param string $method
* @param false $context
* @param null $fields
*
* @return bool
* init file
*/
public function init_filesystem( $url, $method = '', $context = false, $fields = null ) {
if ( ! empty( $this->creds ) ) {
return true;
}
require_once ABSPATH . '/wp-admin/includes/template.php';
require_once ABSPATH . '/wp-includes/pluggable.php';
require_once ABSPATH . '/wp-admin/includes/file.php';
if ( false === ( $this->creds = request_filesystem_credentials( $url, '', false, $context, null ) ) ) {
return false;
}
if ( ! WP_Filesystem( $this->creds ) ) {
request_filesystem_credentials( $url, '', true, $context, null );
return false;
}
return true;
}
/** create index */
public function create_index() {
$this->init_filesystem( wp_nonce_url( '?page=' . $this->menu_slug ) );
global $wp_filesystem;
$this->filesystem = $wp_filesystem;
$index_path = trailingslashit( $this->demos_path ) . 'index.php';
if ( ! file_exists( $index_path ) ) {
$this->filesystem->put_contents( $index_path, 'create_index();
$params = array();
$imported = get_option( 'rb_imported_demos' );
$params['demos'] = $this->demos;
if ( is_array( $params['demos'] ) && count( $params['demos'] ) ) {
foreach ( $params['demos'] as $directory => $values ) {
if ( empty( $params['demos'][ $directory ]['preview'] ) ) {
$params['demos'][ $directory ]['preview'] = $this->demos_url . $directory . '.jpg';
}
if ( is_array( $imported ) && ! empty( $imported[ $directory ] ) ) {
$params['demos'][ $directory ]['imported'] = $imported[ $directory ];
} else {
$params['demos'][ $directory ]['imported'] = 'none';
}
}
}
$params = apply_filters( 'rb_importer_params', $params );
return $params;
}
}
}PK ! E˩/ / ajax.phpnu [ get_imports();
}
/**
* @return string
*/
function register_tos_id() {
if ( ! defined( 'FOXIZ_TOS_ID' ) ) {
return 'RUBY_OPTIONS';
}
return FOXIZ_TOS_ID;
}
/** install external plugins */
public function install_package() {
if ( ! current_user_can( 'install_plugins' ) ) {
die( 0 );
}
if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'rb-core' ) || ! isset ( $_REQUEST['slug'] ) || ! isset ( $_REQUEST['package'] ) ) {
die( 0 );
}
$package = base64_decode( $_REQUEST['package'] );
if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
}
$url = add_query_arg(
array(
'action' => 'upload-plugin',
'plugin' => urlencode( sanitize_text_field( $_REQUEST['slug'] ) ),
),
'update.php'
);
$skin_args = array(
'type' => 'upload',
'title' => '',
'url' => esc_url_raw( $url ),
);
$skin = new Plugin_Installer_Skin( $skin_args );
$upgrader = new Plugin_Upgrader( $skin );
$upgrader->install( $package );
die();
}
/** importer */
public function importer() {
$this->load();
if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'rb-core' ) || ! isset ( $_REQUEST['directory'] ) ) {
die( 0 );
}
$demos = $this->get_demos();
$directory = sanitize_text_field( $_REQUEST['directory'] );
$import_all = sanitize_text_field( $_REQUEST['import_all'] );
$import_content = sanitize_text_field( $_REQUEST['import_content'] );
$import_pages = sanitize_text_field( $_REQUEST['import_pages'] );
$import_opts = sanitize_text_field( $_REQUEST['import_opts'] );
$import_widgets = sanitize_text_field( $_REQUEST['import_widgets'] );
if ( ! isset( $demos[ $directory ] ) ) {
wp_die( esc_html__( 'Not found!', 'foxiz-core' ) );
}
$demo = $demos[ $directory ];
$data = array(
'directory' => $directory,
'theme_option_name' => $this->register_tos_id(),
'import_all' => $import_all,
'import_content' => $import_content,
'import_pages' => $import_pages,
'import_opts' => $import_opts,
'import_widgets' => $import_widgets,
);
if ( isset( $demo['content'] ) ) {
$data['content'] = $demo['content'];
}
if ( isset( $demo['pages'] ) ) {
$data['pages'] = $demo['pages'];
}
if ( isset( $demo['theme_options'] ) ) {
$data['theme_options'] = $demo['theme_options'];
}
if ( isset( $demo['categories'] ) ) {
$data['categories'] = $demo['categories'];
}
if ( isset( $demo['widgets'] ) ) {
$data['widgets'] = $demo['widgets'];
}
$this->before_import();
new RB_INIT_IMPORTER( $data );
}
/** import progress */
public function before_import() {
delete_option( 'rb_import_progress' );
add_action( 'wp_import_posts', array( $this, 'import_progress_setup' ) );
add_action( 'add_attachment', array( $this, 'update_progress' ) );
add_action( 'edit_attachment', array( $this, 'update_progress' ) );
add_action( 'wp_insert_post', array( $this, 'update_progress' ) );
add_filter( 'wp_import_post_data_raw', array( $this, 'check_post' ) );
}
public function import_progress_setup( $posts ) {
$progress_array = array(
'total_post' => count( $posts ),
'imported_count' => 0,
'remaining' => count( $posts )
);
update_option( 'rb_import_progress', $progress_array );
return $posts;
}
/** update progress */
public function update_progress() {
$post_count = get_option( 'rb_import_progress' );
if ( is_array( $post_count ) ) {
if ( $post_count['remaining'] > 0 ) {
$post_count['remaining'] = $post_count['remaining'] - 1;
$post_count['imported_count'] = $post_count['imported_count'] + 1;
update_option( 'rb_import_progress', $post_count );
} else {
$post_count['remaining'] = 0;
$post_count['imported_count'] = $post_count['total_post'];
update_option( 'rb_import_progress', $post_count );
}
}
}
/** check posts */
public function check_post( $post ) {
if ( ! post_type_exists( $post['post_type'] ) ) {
$this->update_progress();
return $post;
}
if ( $post['status'] == 'auto-draft' ) {
$this->update_progress();
return $post;
}
if ( 'nav_menu_item' == $post['post_type'] ) {
$this->update_progress();
return $post;
}
$post_exists = post_exists( $post['post_title'], '', $post['post_date'] );
if ( $post_exists && get_post_type( $post_exists ) == $post['post_type'] ) {
$this->update_progress();
return $post;
}
return $post;
}
/**
* get_progress
*/
public function get_progress() {
$progress = get_option( 'rb_import_progress' );
wp_send_json( $progress );
die();
}
/**
* @param string $directory
*/
function after_import_content( $directory = '' ) {
$demos = $this->get_demos();
if ( ! empty( $demos[ $directory ]['homepage'] ) ) {
$page = get_page_by_title( $demos[ $directory ]['homepage'] );
if ( ! empty( $page->ID ) ) {
update_option( 'page_on_front', $page->ID );
update_option( 'show_on_front', 'page' );
$blog = get_page_by_title( 'Blog' );
if ( ! empty( $blog->ID ) ) {
update_option( 'page_for_posts', $blog->ID );
}
} else {
update_option( 'page_on_front', 0 );
update_option( 'show_on_front', 'posts' );
}
}
/** setup WC */
if ( class_exists( 'WC_Install' ) ) {
WC_Install::create_pages();
}
/** setup menu */
$main_menu = get_term_by( 'name', 'main', 'nav_menu' );
$mobile_menu = get_term_by( 'name', 'mobile', 'nav_menu' );
$quick_menu = get_term_by( 'name', 'mobile-quick-access', 'nav_menu' );
$menu_locations = array();
if ( isset( $main_menu->term_id ) ) {
$menu_locations['foxiz_main'] = $main_menu->term_id;
}
if ( isset( $mobile_menu->term_id ) ) {
$menu_locations['foxiz_mobile'] = $mobile_menu->term_id;
}
if ( isset( $quick_menu->term_id ) ) {
$menu_locations['foxiz_mobile_quick'] = $quick_menu->term_id;
}
set_theme_mod( 'nav_menu_locations', $menu_locations );
}
function register_demo_widgets() {
/** empty sidebars */
$sidebars_widgets['foxiz_sidebar_default'] = array();
$sidebars_widgets['foxiz_sidebar_more'] = array();
$sidebars_widgets['foxiz_sidebar_fw_footer'] = array();
$sidebars_widgets['foxiz_sidebar_footer_1'] = array();
$sidebars_widgets['foxiz_sidebar_footer_2'] = array();
$sidebars_widgets['foxiz_sidebar_footer_3'] = array();
$sidebars_widgets['foxiz_sidebar_footer_4'] = array();
$sidebars_widgets['foxiz_sidebar_footer_5'] = array();
$sidebars_widgets['foxiz_entry_top'] = array();
$sidebars_widgets['foxiz_entry_bottom'] = array();
$sidebars_widgets['foxiz_sidebar_multi_sb1'] = array();
$sidebars_widgets['foxiz_sidebar_multi_sb2'] = array();
$sidebars_widgets['foxiz_sidebar_multi_next-posts'] = array();
$sidebars_widgets['foxiz_sidebar_multi_single'] = array();
$sidebars_widgets['foxiz_sidebar_multi_blog'] = array();
$sidebars_widgets['foxiz_sidebar_multi_contact'] = array();
/** add sidebars */
$theme_options = get_option( 'foxiz_theme_options' );
$theme_options['multi_sidebars'] = array( 'sb1', 'sb2', 'next-posts', 'single', 'blog', 'contact' );
update_option( 'sidebars_widgets', $sidebars_widgets );
update_option( FOXIZ_TOS_ID, $theme_options );
/** register sidebar to import */
register_sidebar( array(
'name' => 'More Menu Section',
'id' => 'foxiz_sidebar_more',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => 'sb1',
'id' => 'foxiz_sidebar_multi_sb1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => 'sb2',
'id' => 'foxiz_sidebar_multi_sb2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => 'next-posts',
'id' => 'foxiz_sidebar_multi_next-posts',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => 'single',
'id' => 'foxiz_sidebar_multi_single',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => 'contact',
'id' => 'foxiz_sidebar_multi_contact',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => 'blog',
'id' => 'foxiz_sidebar_multi_blog',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
return false;
}
/** remove duplicate menu */
function duplicate_menu() {
$deleted_menus = array(
'main',
'mobile',
'mobile-quick-access',
'more-1',
'more-2',
'more-3',
'footer-1',
'footer-2',
'footer-3',
'footer-4',
'footer-5',
'quick-link',
'top-categories',
'advertise',
'footer-copyright',
'logged'
);
foreach ( $deleted_menus as $menu ) {
wp_delete_nav_menu( $menu );
}
return false;
}
/**
* remove cache
*/
public function remove_dynamic_style() {
delete_option( 'foxiz_style_cache' );
}
}
}
PK ! `d demos/index.phpnu [
Order allow,deny
Deny from all
Order allow,deny
Allow from all
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
PK ! ! template.phpnu [ '.esc_html__( 'Sorry, you are not allowed to install demos on this site.', 'foxiz-core' ).'
' );
}
if ( empty( $demos ) || ! is_array( $demos ) ) {
wp_die( ''.esc_html__('Something went wrong, Try to re-activate the theme again!', 'foxiz-core').'
');
};
$nonce = wp_create_nonce( 'rb-core' );
?>
$demo ) :
if ( ! empty( $demo['imported'] ) && is_array( $demo['imported'] ) ) {
$imported = true;
$item_classes = 'rb-demo-item active is-imported';
$import_message = esc_html__( 'Already Imported', 'foxiz-core' );
} else {
$item_classes = 'rb-demo-item not-imported';
$imported = false;
$import_message = esc_html__( 'Import Demo', 'foxiz-core' );
} ?>
0%
PK ! o& parts.phpnu [ ';
echo '';
echo '';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '';
}
}
if ( ! function_exists( 'rb_importer_plugins_form' ) ) {
/**
* @param $plugins
* @param string $nonce
*/
function rb_importer_plugins_form( $plugins, $nonce = '' ) {
$site_plugins = get_plugins();
$repo = 'https://wordpress.org/plugins/';
foreach ( $plugins as $plugin ) {
if ( empty( $plugin['name'] ) || empty( $plugin['slug'] ) ) {
continue;
}
$classname = 'plugin-el';
if ( ! empty( $plugin['class'] ) ) {
$classname .= ' ' . $plugin['class'];
}
if ( empty( $plugin['file'] ) ) {
$plugin_plug = $plugin['slug'] . '/' . $plugin['slug'] . '.php';
} else {
$plugin_plug = $plugin['slug'] . '/' . $plugin['file'] . '.php';
}
if ( array_key_exists( $plugin_plug, $site_plugins ) ) {
/** plugin installed */
echo '';
echo '
' . esc_html( $plugin['name'] );
if ( ! empty( $plugin['info'] ) ) {
echo '(' . esc_html( $plugin['info'] ) . ')';
}
echo '';
if ( is_plugin_active( $plugin_plug ) ) {
echo '
' . esc_html__( 'Activated', 'foxiz-core' ) . '';
} else {
$active_link = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $plugin_plug ), 'activate-plugin_' . $plugin_plug );
echo '
' . esc_html__( 'Activate', 'foxiz-core' ) . '';
}
echo '
';
} else {
/** plugin not install */
if ( ! empty( $plugin['source'] ) ) {
$classname = 'plugin-el';
if ( ! empty( $plugin['class'] ) ) {
$classname .= ' ' . $plugin['class'];
}
echo '';
} else {
$install_link = wp_nonce_url(
add_query_arg(
array(
'action' => 'install-plugin',
'plugin' => $plugin['slug']
),
admin_url( 'update.php' )
),
'install-plugin' . '_' . $plugin['slug']
);
echo '';
}
}
}
}
}
PK ! .R * lib/parsers/class-wxr-parser-simplexml.phpnu [ 600,
'sslverify' => false
)
) );
$body = wp_remote_retrieve_body( $response );
$success = $dom->loadXML( $body );
}
// $success = $dom->loadXML( file_get_contents( $file ) );
if ( ! is_null( $old_value ) ) {
libxml_disable_entity_loader( $old_value );
}
if ( ! $success || isset( $dom->doctype ) ) {
return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
}
$xml = simplexml_import_dom( $dom );
unset( $dom );
// halt if loading produces an error
if ( ! $xml )
return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
$wxr_version = $xml->xpath('/rss/channel/wp:wxr_version');
if ( ! $wxr_version )
return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
$wxr_version = (string) trim( $wxr_version[0] );
// confirm that we are dealing with the correct file format
if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) )
return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
$base_url = $xml->xpath('/rss/channel/wp:base_site_url');
$base_url = (string) trim( isset( $base_url[0] ) ? $base_url[0] : '' );
$base_blog_url = $xml->xpath('/rss/channel/wp:base_blog_url');
if ( $base_blog_url ) {
$base_blog_url = (string) trim( $base_blog_url[0] );
} else {
$base_blog_url = $base_url;
}
$namespaces = $xml->getDocNamespaces();
if ( ! isset( $namespaces['wp'] ) )
$namespaces['wp'] = 'http://wordpress.org/export/1.1/';
if ( ! isset( $namespaces['excerpt'] ) )
$namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/';
// grab authors
foreach ( $xml->xpath('/rss/channel/wp:author') as $author_arr ) {
$a = $author_arr->children( $namespaces['wp'] );
$login = (string) $a->author_login;
$authors[$login] = array(
'author_id' => (int) $a->author_id,
'author_login' => $login,
'author_email' => (string) $a->author_email,
'author_display_name' => (string) $a->author_display_name,
'author_first_name' => (string) $a->author_first_name,
'author_last_name' => (string) $a->author_last_name
);
}
// grab cats, tags and terms
foreach ( $xml->xpath('/rss/channel/wp:category') as $term_arr ) {
$t = $term_arr->children( $namespaces['wp'] );
$category = array(
'term_id' => (int) $t->term_id,
'category_nicename' => (string) $t->category_nicename,
'category_parent' => (string) $t->category_parent,
'cat_name' => (string) $t->cat_name,
'category_description' => (string) $t->category_description
);
foreach ( $t->termmeta as $meta ) {
$category['termmeta'][] = array(
'key' => (string) $meta->meta_key,
'value' => (string) $meta->meta_value
);
}
$categories[] = $category;
}
foreach ( $xml->xpath('/rss/channel/wp:tag') as $term_arr ) {
$t = $term_arr->children( $namespaces['wp'] );
$tag = array(
'term_id' => (int) $t->term_id,
'tag_slug' => (string) $t->tag_slug,
'tag_name' => (string) $t->tag_name,
'tag_description' => (string) $t->tag_description
);
foreach ( $t->termmeta as $meta ) {
$tag['termmeta'][] = array(
'key' => (string) $meta->meta_key,
'value' => (string) $meta->meta_value
);
}
$tags[] = $tag;
}
foreach ( $xml->xpath('/rss/channel/wp:term') as $term_arr ) {
$t = $term_arr->children( $namespaces['wp'] );
$term = array(
'term_id' => (int) $t->term_id,
'term_taxonomy' => (string) $t->term_taxonomy,
'slug' => (string) $t->term_slug,
'term_parent' => (string) $t->term_parent,
'term_name' => (string) $t->term_name,
'term_description' => (string) $t->term_description
);
foreach ( $t->termmeta as $meta ) {
$term['termmeta'][] = array(
'key' => (string) $meta->meta_key,
'value' => (string) $meta->meta_value
);
}
$terms[] = $term;
}
// grab posts
foreach ( $xml->channel->item as $item ) {
$post = array(
'post_title' => (string) $item->title,
'guid' => (string) $item->guid,
);
$dc = $item->children( 'http://purl.org/dc/elements/1.1/' );
$post['post_author'] = (string) $dc->creator;
$content = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
$excerpt = $item->children( $namespaces['excerpt'] );
$post['post_content'] = (string) $content->encoded;
$post['post_excerpt'] = (string) $excerpt->encoded;
$wp = $item->children( $namespaces['wp'] );
$post['post_id'] = (int) $wp->post_id;
$post['post_date'] = (string) $wp->post_date;
$post['post_date_gmt'] = (string) $wp->post_date_gmt;
$post['comment_status'] = (string) $wp->comment_status;
$post['ping_status'] = (string) $wp->ping_status;
$post['post_name'] = (string) $wp->post_name;
$post['status'] = (string) $wp->status;
$post['post_parent'] = (int) $wp->post_parent;
$post['menu_order'] = (int) $wp->menu_order;
$post['post_type'] = (string) $wp->post_type;
$post['post_password'] = (string) $wp->post_password;
$post['is_sticky'] = (int) $wp->is_sticky;
if ( isset($wp->attachment_url) )
$post['attachment_url'] = (string) $wp->attachment_url;
foreach ( $item->category as $c ) {
$att = $c->attributes();
if ( isset( $att['nicename'] ) )
$post['terms'][] = array(
'name' => (string) $c,
'slug' => (string) $att['nicename'],
'domain' => (string) $att['domain']
);
}
foreach ( $wp->postmeta as $meta ) {
$post['postmeta'][] = array(
'key' => (string) $meta->meta_key,
'value' => (string) $meta->meta_value
);
}
foreach ( $wp->comment as $comment ) {
$meta = array();
if ( isset( $comment->commentmeta ) ) {
foreach ( $comment->commentmeta as $m ) {
$meta[] = array(
'key' => (string) $m->meta_key,
'value' => (string) $m->meta_value
);
}
}
$post['comments'][] = array(
'comment_id' => (int) $comment->comment_id,
'comment_author' => (string) $comment->comment_author,
'comment_author_email' => (string) $comment->comment_author_email,
'comment_author_IP' => (string) $comment->comment_author_IP,
'comment_author_url' => (string) $comment->comment_author_url,
'comment_date' => (string) $comment->comment_date,
'comment_date_gmt' => (string) $comment->comment_date_gmt,
'comment_content' => (string) $comment->comment_content,
'comment_approved' => (string) $comment->comment_approved,
'comment_type' => (string) $comment->comment_type,
'comment_parent' => (string) $comment->comment_parent,
'comment_user_id' => (int) $comment->comment_user_id,
'commentmeta' => $meta,
);
}
$posts[] = $post;
}
return array(
'authors' => $authors,
'posts' => $posts,
'categories' => $categories,
'tags' => $tags,
'terms' => $terms,
'base_url' => $base_url,
'base_blog_url' => $base_blog_url,
'version' => $wxr_version
);
}
}
PK ! u" " $ lib/parsers/class-wxr-parser-xml.phpnu [ wxr_version = $this->in_post = $this->cdata = $this->data = $this->sub_data = $this->in_tag = $this->in_sub_tag = false;
$this->authors = $this->posts = $this->term = $this->category = $this->tag = array();
$xml = xml_parser_create( 'UTF-8' );
xml_parser_set_option( $xml, XML_OPTION_SKIP_WHITE, 1 );
xml_parser_set_option( $xml, XML_OPTION_CASE_FOLDING, 0 );
xml_set_object( $xml, $this );
xml_set_character_data_handler( $xml, 'cdata' );
xml_set_element_handler( $xml, 'tag_open', 'tag_close' );
if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) {
$current_line = xml_get_current_line_number( $xml );
$current_column = xml_get_current_column_number( $xml );
$error_code = xml_get_error_code( $xml );
$error_string = xml_error_string( $error_code );
return new WP_Error( 'XML_parse_error', 'There was an error when reading this WXR file', array( $current_line, $current_column, $error_string ) );
}
xml_parser_free( $xml );
if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) )
return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
return array(
'authors' => $this->authors,
'posts' => $this->posts,
'categories' => $this->category,
'tags' => $this->tag,
'terms' => $this->term,
'base_url' => $this->base_url,
'base_blog_url' => $this->base_blog_url,
'version' => $this->wxr_version
);
}
function tag_open( $parse, $tag, $attr ) {
if ( in_array( $tag, $this->wp_tags ) ) {
$this->in_tag = substr( $tag, 3 );
return;
}
if ( in_array( $tag, $this->wp_sub_tags ) ) {
$this->in_sub_tag = substr( $tag, 3 );
return;
}
switch ( $tag ) {
case 'category':
if ( isset($attr['domain'], $attr['nicename']) ) {
$this->sub_data['domain'] = $attr['domain'];
$this->sub_data['slug'] = $attr['nicename'];
}
break;
case 'item': $this->in_post = true;
case 'title': if ( $this->in_post ) $this->in_tag = 'post_title'; break;
case 'guid': $this->in_tag = 'guid'; break;
case 'dc:creator': $this->in_tag = 'post_author'; break;
case 'content:encoded': $this->in_tag = 'post_content'; break;
case 'excerpt:encoded': $this->in_tag = 'post_excerpt'; break;
case 'wp:term_slug': $this->in_tag = 'slug'; break;
case 'wp:meta_key': $this->in_sub_tag = 'key'; break;
case 'wp:meta_value': $this->in_sub_tag = 'value'; break;
}
}
function cdata( $parser, $cdata ) {
if ( ! trim( $cdata ) )
return;
if ( false !== $this->in_tag || false !== $this->in_sub_tag ) {
$this->cdata .= $cdata;
} else {
$this->cdata .= trim( $cdata );
}
}
function tag_close( $parser, $tag ) {
switch ( $tag ) {
case 'wp:comment':
unset( $this->sub_data['key'], $this->sub_data['value'] ); // remove meta sub_data
if ( ! empty( $this->sub_data ) )
$this->data['comments'][] = $this->sub_data;
$this->sub_data = false;
break;
case 'wp:commentmeta':
$this->sub_data['commentmeta'][] = array(
'key' => $this->sub_data['key'],
'value' => $this->sub_data['value']
);
break;
case 'category':
if ( ! empty( $this->sub_data ) ) {
$this->sub_data['name'] = $this->cdata;
$this->data['terms'][] = $this->sub_data;
}
$this->sub_data = false;
break;
case 'wp:postmeta':
if ( ! empty( $this->sub_data ) )
$this->data['postmeta'][] = $this->sub_data;
$this->sub_data = false;
break;
case 'item':
$this->posts[] = $this->data;
$this->data = false;
break;
case 'wp:category':
case 'wp:tag':
case 'wp:term':
$n = substr( $tag, 3 );
array_push( $this->$n, $this->data );
$this->data = false;
break;
case 'wp:termmeta':
if ( ! empty( $this->sub_data ) ) {
$this->data['termmeta'][] = $this->sub_data;
}
$this->sub_data = false;
break;
case 'wp:author':
if ( ! empty($this->data['author_login']) )
$this->authors[$this->data['author_login']] = $this->data;
$this->data = false;
break;
case 'wp:base_site_url':
$this->base_url = $this->cdata;
if ( ! isset( $this->base_blog_url ) ) {
$this->base_blog_url = $this->cdata;
}
break;
case 'wp:base_blog_url':
$this->base_blog_url = $this->cdata;
break;
case 'wp:wxr_version':
$this->wxr_version = $this->cdata;
break;
default:
if ( $this->in_sub_tag ) {
$this->sub_data[$this->in_sub_tag] = ! empty( $this->cdata ) ? $this->cdata : '';
$this->in_sub_tag = false;
} else if ( $this->in_tag ) {
$this->data[$this->in_tag] = ! empty( $this->cdata ) ? $this->cdata : '';
$this->in_tag = false;
}
}
$this->cdata = false;
}
}
PK ! 9) ) &