diff --git a/README.markdown b/README.markdown index cc15b6f..750aecd 100644 --- a/README.markdown +++ b/README.markdown @@ -9,6 +9,11 @@ This allows you to create post, category, and options configurations to test spe Clone the repository into your `wp-content/plugins` directory. Activate it like a normal plugin. +### From WordPress Plugins + +Download the plugin from the WordPress plugins repository: http://wordpress.org/extend/plugins/post-fixtures/. Activate it like any other plugin. +**Post Fixtures** requires PHP 5 or above. + ## Using **Post Fixtures** places a new menu item under *Tools* called *Post Fixtures*. diff --git a/Readme.txt b/Readme.txt new file mode 100644 index 0000000..d5e2941 --- /dev/null +++ b/Readme.txt @@ -0,0 +1,115 @@ +=== Post Fixtures === +Contributors: johncoswell +Donate link: http://www.coswellproductions.com/wordpress/wordpress-plugins +Tags: admin, developer, database +Requires at least: 2.8 +Tested up to: 2.9.1 +Stable tag: 0.2 + +Post Fixtures let you quickly tear down and set up test environments within your development WordPress environment. + +== Description == + +Post Fixtures let you quickly tear down and set up test environments within your development WordPress environment. +This allows you to create post, category, and options configurations to test specific issues and features of your themes and plugins. + +**Post Fixtures** places a new menu item under *Tools* called *Post Fixtures*. +When you visit the page, you'll see a large textarea in which to copy and paste your JSON fixture data. +Submitting the form with valid JSON data will cause your posts and categories to be deleted & overwritten, +and any options provided to be overwritten or deleted. + +As of the current release on GitHub, the following WordPress features are supported: + +* Posts + * Most post data found in the `posts` table + * Post metadata with serialization +* Categories +* Tags +* Blog options with serialization and deletion + +== Installation == + +Activate it like any other plugin. **Post Fixtures** requires PHP 5 or above. + +== Frequently Asked Questions == + += What are the data formats accepted? = + +**JSON** + +
+{
+	"posts": [
+		{
+			"post_date": "2010-01-01 9:00am",
+			"post_title": "This is a sample post",
+			"post_content": "This is the post's content",
+			"categories": [ "Top Level 1/Sub Category 1", "Top Level 2/Sub Category 2" ],
+			"metadata": {
+				"field-1": "value 1",
+				"field-2": {
+					"a_complex": "field",
+					"with": [
+						"lots", "of", "nested", "datatypes"
+					]
+				}
+			},
+			"tags": "tag 1,tag 2"
+		},
+		{
+			"post_date": "2010-01-01 10:00am",
+			"post_title": "This is the second sample post",
+			"post_content": "This is the second post's content",
+			"categories": [ "Top Level 1/Sub Category 2", "Top Level 2/Sub Category 2" ]
+		}
+	],
+	"options": {
+		"an-option-to-set": "simple-string",
+		"an-option-to-serialize": {
+			"this": "is a hash"
+		},
+		"an-option-to-delete": false
+	}
+}
+
+ +**PHP** + +
+// build an object immediately, and get the new post's ID
+$post_id = $builder->post('This is a sample post')
+                   ->date('2010-01-01 9:00am')
+                   ->content("This is the post's content")
+                   ->categories("Top Level 1/Sub Category 1,Top Level 2/Sub Category 2")
+                   ->metadata('field-1', 'value-1')
+                   ->metadata('field-2', array(
+                       'a_complex' => 'field',
+                       'with' => array(
+                       	'lots', 'of', 'nested', 'datatypes'
+                       )
+                     ))
+                   ->tags('tag 1,tag 2')->build();
+
+// build and object at the end, if order doesn't matter
+$builder->post('This is the second sample post')
+        ->date('2010-01-01 10:00am')
+        ->content("This is the second post's content")
+        ->categories("Top Level 1/Sub Category 2,Top Level 2/Sub Category 2")->defer();
+
+// convenience wrapper around options setting
+$builder->option('an-option-to-set', 'simple-string')
+        ->option('an-option-to-serialize', array('this' => 'is a hash'))
+        ->option('an-option-to-delete', false);
+
+ +== Changelog == + += 0.2 = + +* Initial release on WordPress Plugins site. + +== Upgrade Notice == + += 0.2 = + +* Initial release. diff --git a/post-fixtures.php b/post-fixtures.php index 89210ed..f410e60 100644 --- a/post-fixtures.php +++ b/post-fixtures.php @@ -3,11 +3,11 @@ Plugin Name: Post Fixtures Plugin URI: http://www.coswellproductions.com/wordpress/wordpress-plugins/ Description: Tear down and build up well crafted posts, categories, meta data, and other WordPress data in a test environment. -Version: 0.1 +Version: 0.2 Author: John Bintz Author URI: http://www.coswellproductions.com/wordpress/ -Copyright 2009 John Bintz (email : john@coswellproductions.com) +Copyright 2009-2010 John Bintz (email : john@coswellproductions.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by