PluginProbe
Smart Forms – when you need more than just a contact form / 0.8
Smart Forms – when you need more than just a contact form v0.8
trunk 0.5 0.5.5 0.6 0.7 0.8 0.8.5 0.9.1
smart-forms / smart-forms-exporter.php

smart-forms-exporter.php in Smart Forms – when you need more than just a contact form 0.8, at smart-forms-exporter.php

49 lines 861 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require_once('../../../wp-config.php');
3
4 if(!defined('ABSPATH'))
5 die('Forbidden');
6
7 if(!current_user_can('manage_options'))
8 die('Forbidden');
9
10
11 $data=GetPostValue("exportdata");
12 $json=json_decode($data,true);
13
14 header('Content-Encoding: UTF-8');
15 header('Content-type: text/csv; charset=UTF-8');
16 header('Content-Disposition: attachment; filename=Export.csv');
17
18 if(count($json)<=0)
19 die();
20 $keys=array_keys($json[0]);
21 $firstColumn=true;
22 foreach($keys as $header)
23 {
24 if(!$firstColumn)
25 echo ",";
26 $firstColumn=false;
27 echo '"'.$header.'"';
28 }
29 foreach($json as $row)
30 {
31 $firstColumn=true;
32 echo "\r\n";
33 foreach($row as $column)
34 {
35 if(!$firstColumn)
36 echo ",";
37 $firstColumn=false;
38 echo '"'.$column.'"';
39 }
40
41 }
42
43 echo "\xEF\xBB\xBF";
44
45
46
47
48
49