%s and go to %s for details.', 'wpv-views'), 'http://wp-types.com', 'http://wp-types.com', 'http://wp-types.com/shop/account/?acct=affiliate', 'http://wp-types.com/shop/account/?acct=affiliate'); ?>



'view'); foreach ($views as $key => $post) { $post = (array) $post; if ($post['post_name']) { $post_data = array(); $copy_data = array('ID', 'post_content', 'post_title', 'post_name', 'post_excerpt', 'post_type', 'post_status'); foreach ($copy_data as $copy) { if (isset($post[$copy])) { $post_data[$copy] = $post[$copy]; } } $data['views']['view-' . $post['ID']] = $post_data; $meta = get_post_custom($post['ID']); if (!empty($meta)) { $data['view']['view-' . $post['ID']]['meta'] = array(); foreach ($meta as $meta_key => $meta_value) { if ($meta_key == '_wpv_settings') { $value = maybe_unserialize($meta_value[0]); $value = $WP_Views->convert_ids_to_names_in_settings($value); $data['views']['view-' . $post['ID']]['meta'][$meta_key] = $value; } if ($meta_key == '_wpv_layout_settings') { $value = maybe_unserialize($meta_value[0]); $value = $WP_Views->convert_ids_to_names_in_layout_settings($value); $data['views']['view-' . $post['ID']]['meta'][$meta_key] = $value; } } if (empty($data['views']['view-' . $post['ID']]['meta'])) { unset($data['views']['view-' . $post['ID']]['meta']); } } } } } // Get the view templates $view_templates = get_posts('post_type=view-template&post_status=any&posts_per_page=-1'); if (!empty($view_templates)) { $data['view-templates'] = array('__key' => 'view-template'); foreach ($view_templates as $key => $post) { $post = (array) $post; if ($post['post_name']) { $post_data = array(); $copy_data = array('ID', 'post_content', 'post_title', 'post_name', 'post_excerpt', 'post_type', 'post_status'); foreach ($copy_data as $copy) { if (isset($post[$copy])) { $post_data[$copy] = $post[$copy]; } } $data['view-templates']['view-template-' . $post['ID']] = $post_data; } } } // Offer for download $data = $xml->array2xml($data, 'views'); $sitename = sanitize_key(get_bloginfo('name')); if (!empty($sitename)) { $sitename .= '.'; } $filename = $sitename . 'views.' . date('Y-m-d') . '.xml'; $code = ""; if (class_exists('ZipArchive')) { $zipname = $sitename . 'views.' . date('Y-m-d') . '.zip'; $zip = new ZipArchive(); $file = tempnam("tmp", "zip"); $zip->open($file, ZipArchive::OVERWRITE); $res = $zip->addFromString('settings.xml', $data); $zip->addFromString('settings.php', $code); $zip->close(); $data = file_get_contents($file); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=" . $zipname); header("Content-Type: application/zip"); header("Content-length: " . strlen($data) . "\n\n"); header("Content-Transfer-Encoding: binary"); echo $data; unlink($file); die(); } else { // download the xml. header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=" . $filename); header("Content-Type: application/xml"); header("Content-length: " . strlen($data) . "\n\n"); echo $data; die(); } }