git-svn-id: https://192.168.0.254/svn/Proyectos.EstudioJuridicoAlmagro_Web/trunk@3 c22fe52d-42d7-ba4f-95f7-33effcf65713
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* @author Mike Jolley
|
|
*
|
|
* http://blue-anvil.com/archives/8-fun-useful-shortcode-functions-for-wordpress/
|
|
*/
|
|
|
|
function theme_shortcode_chart( $atts ) {
|
|
extract(shortcode_atts(array(
|
|
'data' => '',
|
|
'colors' => '',
|
|
'size' => '400x200',
|
|
'bg' => 'bg,s,ffffff',
|
|
'title' => '',
|
|
'labels' => '',
|
|
'advanced' => '',
|
|
'type' => 'pie'
|
|
), $atts));
|
|
|
|
switch ($type) {
|
|
case 'line' :
|
|
$charttype = 'lc'; break;
|
|
case 'xyline' :
|
|
$charttype = 'lxy'; break;
|
|
case 'sparkline' :
|
|
$charttype = 'ls'; break;
|
|
case 'meter' :
|
|
$charttype = 'gom'; break;
|
|
case 'scatter' :
|
|
$charttype = 's'; break;
|
|
case 'venn' :
|
|
$charttype = 'v'; break;
|
|
case 'pie' :
|
|
$charttype = 'p3'; break;
|
|
case 'pie2d' :
|
|
$charttype = 'p'; break;
|
|
default :
|
|
$charttype = $type;
|
|
break;
|
|
}
|
|
|
|
if ($title) $string .= '&chtt='.$title.'';
|
|
if ($labels) $string .= '&chl='.$labels.'';
|
|
if ($colors) $string .= '&chco='.$colors.'';
|
|
$string .= '&chs='.$size.'';
|
|
$string .= '&chd=t:'.$data.'';
|
|
$string .= '&chf='.$bg.'';
|
|
|
|
return wpv_get_lazy_load('http://chart.apis.google.com/chart?cht='.$charttype.''.$string.$advanced, $title);
|
|
}
|
|
add_shortcode('chart', 'theme_shortcode_chart'); |