[gnomeweb-wp: 4/13] Changing the indentation of the database-export.php file
- From: Vinicius Scopel Depizzol <vdepizzol src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnomeweb-wp: 4/13] Changing the indentation of the database-export.php file
- Date: Wed, 26 Jan 2011 23:00:50 +0000 (UTC)
commit 7b3acad9fb689035944a18057ff20a8879d84be1
Author: Lincoln de Sousa <lincoln comum org>
Date: Wed Nov 10 19:55:44 2010 -0200
Changing the indentation of the database-export.php file
Also, some blank lines were removed and lines that had more than 78
chars were split in more lines.
wp-content/themes/gnome-grass/database-export.php | 33 +++++++--------------
1 files changed, 11 insertions(+), 22 deletions(-)
---
diff --git a/wp-content/themes/gnome-grass/database-export.php b/wp-content/themes/gnome-grass/database-export.php
index 0cc6a36..6a79255 100644
--- a/wp-content/themes/gnome-grass/database-export.php
+++ b/wp-content/themes/gnome-grass/database-export.php
@@ -3,15 +3,20 @@
// vdepizzol gmail com
-// This code by now only generates a XML with all the content from WordPress database.
+// This code by now only generates a XML with all the content from
+// WordPress database.
require_once(ABSPATH . "wp-config.php");
function generate_po_xml () {
global $wpdb;
- $myrows = $wpdb->get_results( "SELECT ID, post_content, post_title, post_excerpt, post_name FROM wp_posts WHERE post_type != 'revision' && post_type != 'nav_menu_item'" );
-
+ $myrows = $wpdb->get_results("
+ SELECT ID, post_content, post_title, post_excerpt, post_name
+ FROM
+ wp_posts
+ WHERE post_type != 'revision' && post_type != 'nav_menu_item'"
+ );
header("Content-type: text/xml");
@@ -19,47 +24,36 @@ function generate_po_xml () {
$dom = new DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;
-
$root = $dom->createElement("website");
foreach($myrows as $key => $value) {
-
$page = $dom->createElement("page");
-
// ID
-
$page_id = $dom->createAttribute('id');
$page_id_value = $dom->createTextNode($value->ID);
$page_id->appendChild($page_id_value);
$page->appendChild($page_id);
-
// page_title
-
$page_title = $dom->createElement("title");
$page_title_value = $dom->createTextNode($value->post_title);
$page_title->appendChild($page_title_value);
$page->appendChild($page_title);
-
// page_name
-
$page_name = $dom->createElement("name");
$page_name_value = $dom->createTextNode($value->post_name);
$page_name->appendChild($page_name_value);
$page->appendChild($page_name);
-
// page_content
-
-
$value->post_content = wpautop($value->post_content);
-
$content_xml = $dom->createDocumentFragment();
$content_xml->appendXML('<html>'.$value->post_content.'</html>');
- if($content_xml == false) {
+
+ if ($content_xml == false) {
$broken_dom_pages[] = $value->ID;
}
@@ -68,15 +62,10 @@ function generate_po_xml () {
$page->appendChild($page_content);
$root->appendChild($page);
-
}
- $dom->appendChild($root);
+ $dom->appendChild($root);
$content = $dom->saveXML();
return $content;
}
-
-if (isset($_REQUEST['print']))
- print generate_po_xml ();
-
?>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]