Plugin Directory

Changeset 514216


Ignore:
Timestamp:
03/04/2012 01:12:22 PM (14 years ago)
Author:
tfotherby
Message:

tagging version 0.0.9

Location:
fotherplot/tags/0.0.9
Files:
6 copied

Legend:

Unmodified
Added
Removed
  • fotherplot/tags/0.0.9/fotherplot.php

    r451645 r514216  
    22/*
    33Plugin Name: Fotherplot
    4 Version: 0.0.8
     4Version: 0.0.9
    55Plugin URI: http://www.tomfotherby.com/Websites/Fotherplot
    66Description: 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).
     
    206206}
    207207
    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.
     209function 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.
     222add_shortcode( 'fotherplot', 'fotherplot_func' );
    227223
    228224?>
  • fotherplot/tags/0.0.9/readme.txt

    r451646 r514216  
    22Contributors: Tom Fotherby
    33Donate link: http://www.amazon.co.uk/gp/registry/wishlist/5EU9QS88QKOI
    4 Tags: graph,chart,custom fields,google chart API,weight tracking,diet
    5 Requires at least: 2.0
    6 Tested up to: 3.2.1
    7 Stable tag: 0.0.8
     4Tags: graph,chart,plot,custom fields,google chart API,weight tracking,diet
     5Requires at least: 2.5
     6Tested up to: 3.3.1
     7Stable tag: 0.0.9
    88
    9 A plugin for listing and plotting your data against time using the Google charts API.
     9A WordPress plugin for plotting some data in a custom field against time. It uses the Google charts API to render a simple line chart.
    1010
    1111== Description ==
    1212
    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.
     13After [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.
    1414
    1515== Installation ==
    1616
    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.
     171. 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/`)
     181. Activate the plugin through the 'Plugins' menu in the WordPress dashboard.
    19191. 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.
    20201. To display the graph on your blog see http://wordpress.org/extend/plugins/fotherplot/faq/
     
    2929= How do I display the fotherplot chart on my blog? =
    3030
    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:
     31By 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:
    3232
    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.
     331. 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.
    34341. If you want to display the chart on a page:
    3535 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 Wordpress dashboard, create a new page.
     36 1. From the WordPress dashboard, create a new page.
    3737 1. From the "Template" dropdown in the sidebar, select "Fotherplot".
    3838 1. Use preview to check it works (remember you need to have a couple of values input before you'll see a chart).
     
    46461. Optional Parameter 3: Whether to show chart image. 1=yes, 0=no. Defaults to yes.
    47471. Optional Parameter 4: Whether to show list of custom values. 1=yes, 0=no, Defaults to yes.
    48 
    49 Examples:
    50 
     48 1. Examples:
    5149`<phpcode>
    5250<?php echo plotDataAgainstTime("customFieldName"); ?>
     
    5452<?php echo plotDataAgainstTime("customFieldName",0,1); ?>
    5553</phpcode>`
     54 1. You can also use the same parameters in the shortcode: `[fotherplot customfieldname="mycustomfield" showgraph=1 showlist=1]`.
    5655
    5756== 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.
    5860
    5961= 0.0.8 =
     
    6769
    6870= 0.0.5 =
    69 * Added "[fotherplot]" Wordpress shortcode.
     71* Added "[fotherplot]" WordPress shortcode.
    7072* Fixed date bug.
    7173
    7274= 0.0.4 =
    73 * 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).
     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).
    7476* 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.
    7577
     
    7880
    7981= 0.0.2 =
    80 * First Wordpress 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.
    8183
    8284= 0.0.1 =
    83 * Inital draft version (Not in proper Wordpress plugin format)
     85* Inital draft version (Not in proper WordPress plugin format)
    8486
    8587== Usage Example ==
    8688
    87 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.
     89I 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.
    8890
    8991The 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.