PluginProbe
SQL Chart Builder / 1.0.2
SQL Chart Builder v1.0.2
3.0.2 3.0.1 trunk 1.0.2 1.0.3 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.7.1 2.3.7.2 2.3.8 3.0.0
sql-chart-builder / initial_data.php

initial_data.php in SQL Chart Builder 1.0.2, at initial_data.php

58 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 function gvn_chart_sample_nonxml_data(){
3 $data['titles']=array(
4 'Posts by month',
5 'Posts by year',
6 'Popular users/publishers',
7 );
8
9 $data['sql_queries']=array(
10 'select count(*) pcount,SUBSTRING(`post_date`,6,2) aysay,SUBSTRING(`post_date`,1,4) ilsay,SUBSTRING(`post_date`,1,7) ayilsay from wp_posts group by aysay,ilsay order by aysay ',
11
12 'select count(*) pcount, SUBSTR(`post_date`,1,4) il from wp_posts group by il order by il asc limit 10 ',
13
14 'select count(*) as pcount,a.post_author,b.display_name as dname
15 from wp_posts a
16 inner join wp_users b ON a.post_author=b.ID
17 where a.post_status="publish"
18 group by a.post_author order by pcount desc limit 10',
19 );
20
21 $data['others']=array(
22
23 array('Post count','pcount','Monthes','ayilsay',500,400,'column'),
24
25 array('Post count','pcount','Years','il',500,400,'pie'),
26
27 array('Post count','pcount','Display name','dname',500,400,'3dpie'),
28
29
30 );
31
32 $existence= get_page_by_title( 'Posts by month', OBJECT, 'gvn_schart' );
33
34 if (empty($existence)){
35 foreach ($data['titles'] as $key => $value) {
36 $newid=wp_insert_post(
37 array('post_title' => $value,
38 'post_type'=>'gvn_schart',
39 'post_status'=>'private'
40 )
41 );
42
43
44 add_post_meta($newid,'guaven_sqlcharts_code',$data["sql_queries"][$key]);
45
46 add_post_meta($newid,'guaven_sqlcharts_chartwidth',$data["others"][$key][4]);
47 add_post_meta($newid,'guaven_sqlcharts_chartheight',$data["others"][$key][5]);
48 add_post_meta($newid,'guaven_sqlcharts_xarg_s',$data["others"][$key][1]);
49 add_post_meta($newid,'guaven_sqlcharts_xarg_l',$data["others"][$key][0]);
50 add_post_meta($newid,'guaven_sqlcharts_yarg_s',$data["others"][$key][3]);
51 add_post_meta($newid,'guaven_sqlcharts_yarg_l',$data["others"][$key][2]);
52 add_post_meta($newid,'guaven_sqlcharts_graphtype',$data["others"][$key][6]);
53 }
54 }
55
56
57 }
58 ?>