Changeset 514216
- Timestamp:
- 03/04/2012 01:12:22 PM (14 years ago)
- Location:
- fotherplot/tags/0.0.9
- Files:
-
- 6 copied
-
. (copied) (copied from fotherplot/trunk)
-
fotherplot.php (copied) (copied from fotherplot/trunk/fotherplot.php) (2 diffs)
-
page_fotherplot.php (copied) (copied from fotherplot/trunk/page_fotherplot.php)
-
readme.txt (copied) (copied from fotherplot/trunk/readme.txt) (6 diffs)
-
screenshot-1.png (copied) (copied from fotherplot/trunk/screenshot-1.png)
-
screenshot-2.png (copied) (copied from fotherplot/trunk/screenshot-2.png)
Legend:
- Unmodified
- Added
- Removed
-
fotherplot/tags/0.0.9/fotherplot.php
r451645 r514216 2 2 /* 3 3 Plugin Name: Fotherplot 4 Version: 0.0. 84 Version: 0.0.9 5 5 Plugin URI: http://www.tomfotherby.com/Websites/Fotherplot 6 6 Description: A plugin for listing and plotting your data against time using the Google charts API. Originally used to plot my weight by using a custom field called "weight" in posts but useful for all sorts of other value tracking (e.g. gym-time, money, hours in office, mood rating, etc, etc). … … 206 206 } 207 207 208 // Hook for adding chart anchor text 209 add_filter('the_content', 'filterFotherplot'); 210 211 // Action function for above hook - i.e. Add chart where '[[fotherplot]]' text is embedded 212 function filterFotherplot($content) 213 { 214 if(preg_match("[fotherplot]",$content)) 215 { 216 $posOfFilter = strpos($content,'[[fotherplot]]'); 217 if ($posOfFilter !== FALSE) 218 { 219 $contentStart = substr($content,0,$posOfFilter); 220 $contentEnd = substr($content,$posOfFilter+strlen('[[fotherplot]]'),strlen($content)); 221 $content = $contentStart . plotDataAgainstTime("",1,0) . $contentEnd; 222 } 223 } 224 225 return $content; 226 } 208 // Handle the '[fotherplot]' shortcode if embedded into a post or page. 209 function fotherplot_func( $atts ) 210 { 211 // Handle shortcode parameters and set default values. 212 extract(shortcode_atts(array( 213 'customfieldname' => '', 214 'showgraph' => 1, 215 'showlist' => 0, 216 ), $atts 217 ) 218 ); 219 return plotDataAgainstTime($customfieldname, $showgraph, $showlist); 220 } 221 // Hook for adding the foterhplot shortcode. 222 add_shortcode( 'fotherplot', 'fotherplot_func' ); 227 223 228 224 ?> -
fotherplot/tags/0.0.9/readme.txt
r451646 r514216 2 2 Contributors: Tom Fotherby 3 3 Donate link: http://www.amazon.co.uk/gp/registry/wishlist/5EU9QS88QKOI 4 Tags: graph,chart, custom fields,google chart API,weight tracking,diet5 Requires at least: 2. 06 Tested up to: 3. 2.17 Stable tag: 0.0. 84 Tags: graph,chart,plot,custom fields,google chart API,weight tracking,diet 5 Requires at least: 2.5 6 Tested up to: 3.3.1 7 Stable tag: 0.0.9 8 8 9 A plugin for listing and plotting your data against time using the Google charts API.9 A WordPress plugin for plotting some data in a custom field against time. It uses the Google charts API to render a simple line chart. 10 10 11 11 == Description == 12 12 13 After [working out how to plot time-based data using Google charts API](http://www.tomfotherby.com/blog/index.php/2009/01/how-to-plot-dates-in-google-charts-api/ "A post from my blog"), I created a Word press plugin to plot values stored in a custom field against the published-on date of Wordpress blog posts that use the field.13 After [working out how to plot time-based data using Google charts API](http://www.tomfotherby.com/blog/index.php/2009/01/how-to-plot-dates-in-google-charts-api/ "A post from my blog"), I created a WordPress plugin to plot values stored in a custom field against the published-on date of WordPress blog posts that use the field. 14 14 15 15 == Installation == 16 16 17 1. Download the **fotherplot** plugin and you will get a directory called "fotherplot" when you unzip the downloaded file. Upload the "fotherplot" directory to your wordpress plugins directory (e.g. `/wp-content/plugins/`)18 1. Activate the plugin through the 'Plugins' menu in the Word press dashboard.17 1. Download the **fotherplot** plugin and you will get a directory called "fotherplot" when you unzip the downloaded file. Upload the "fotherplot" directory to your WordPress plugins directory (e.g. `/wp-content/plugins/`) 18 1. Activate the plugin through the 'Plugins' menu in the WordPress dashboard. 19 19 1. Do you already have some data that you want to chart contained in a custom field? If so, go to the Fotherplot settings page and specify the custom field name in the dropdown. If not, decide what the name of the custom field that you want to plot is going to be and create a couple of posts (with different publish dates) first. 20 20 1. To display the graph on your blog see http://wordpress.org/extend/plugins/fotherplot/faq/ … … 29 29 = How do I display the fotherplot chart on my blog? = 30 30 31 By default the fotherplot chart is only non-publically displayed in the settings page in the Word press dashboard. You have three options to display the fotherplot chart on the public side of your blog:31 By default the fotherplot chart is only non-publically displayed in the settings page in the WordPress dashboard. You have three options to display the fotherplot chart on the public side of your blog: 32 32 33 1. To display the chart on any post or page, simple embed the text "[ [fotherplot]]" into the content. The tag will be replaced with the chart image.33 1. To display the chart on any post or page, simple embed the text "[fotherplot]" into the content. The tag will be replaced with the chart image. 34 34 1. If you want to display the chart on a page: 35 35 1. Copy the `page_fotherplot.php` page template from the plugin directory to the folder of the theme you're currently using (`/wp-content/themes/<currentThemeName>/`). 36 1. From the Word press dashboard, create a new page.36 1. From the WordPress dashboard, create a new page. 37 37 1. From the "Template" dropdown in the sidebar, select "Fotherplot". 38 38 1. Use preview to check it works (remember you need to have a couple of values input before you'll see a chart). … … 46 46 1. Optional Parameter 3: Whether to show chart image. 1=yes, 0=no. Defaults to yes. 47 47 1. Optional Parameter 4: Whether to show list of custom values. 1=yes, 0=no, Defaults to yes. 48 49 Examples: 50 48 1. Examples: 51 49 `<phpcode> 52 50 <?php echo plotDataAgainstTime("customFieldName"); ?> … … 54 52 <?php echo plotDataAgainstTime("customFieldName",0,1); ?> 55 53 </phpcode>` 54 1. You can also use the same parameters in the shortcode: `[fotherplot customfieldname="mycustomfield" showgraph=1 showlist=1]`. 56 55 57 56 == Changelog == 57 58 = 0.0.9 = 59 * Modified code to use the shortcode API in order to allow parameters. Now we can use `[fotherplot showlist=1]` to show the list of posts that contain the data we're plotting. 58 60 59 61 = 0.0.8 = … … 67 69 68 70 = 0.0.5 = 69 * Added "[fotherplot]" Word press shortcode.71 * Added "[fotherplot]" WordPress shortcode. 70 72 * Fixed date bug. 71 73 72 74 = 0.0.4 = 73 * Added a fotherplot settings page in the Word press dashboard where you can specify the custom field you want to chart (Yay! no need to touch PHP code anymore).75 * Added a fotherplot settings page in the WordPress dashboard where you can specify the custom field you want to chart (Yay! no need to touch PHP code anymore). 74 76 * Added some error messages: e.g. displays error if non-numeric custom field values are used, or if not enough data is input or if no custom fields are available. 75 77 … … 78 80 79 81 = 0.0.2 = 80 * First Word press plugin version. Two features: 1) Draw chart of custom field value over time. 2) Display list of values in time order.82 * First WordPress plugin version. Two features: 1) Draw chart of custom field value over time. 2) Display list of values in time order. 81 83 82 84 = 0.0.1 = 83 * Inital draft version (Not in proper Word press plugin format)85 * Inital draft version (Not in proper WordPress plugin format) 84 86 85 87 == Usage Example == 86 88 87 I use this plugin to keep a track of my weight. I have a private Word press journal with a custom field called "Weight (kgs)" and each week when I make my journal entry I fill in my weight in this custom field. I have page called "My Weight" which is empty but uses the **Fotherplot** Template.89 I use this plugin to keep a track of my weight. I have a private WordPress journal with a custom field called "Weight (kgs)" and each week when I make my journal entry I fill in my weight in this custom field. I have page called "My Weight" which is empty but uses the **Fotherplot** Template. 88 90 89 91 The plugin outputs [a image](http://chart.apis.google.com/chart?&cht=lxy&chs=450x300&chma=10,10,10,10&chds=0,364,98.9,116.1&chg=0,5&chxt=y,x&chxl=0:|98.9|102.34|105.78|109.22|112.66|116.1|1:|20/Jan/08|11/Feb/08|17/Jul/08|18/Oct/08|10/Jan/09&chm=D,FF0000,0,-1,1|o,000000,0,-1,4|N,000000,0,-1,9&chd=t:0,8,15,22,50,79,180,224,263,273,290,350,357,364|103.4,102.9,102.3,100.9,99.3,98.9,103.4,110.5,112.9,109.7,110,116.1,113.4,110.67 "Generated from Google Charts API") and a list of the relevant data, example:
Note: See TracChangeset
for help on using the changeset viewer.