forked from mediebruket/custom-csv-exporter
-
Notifications
You must be signed in to change notification settings - Fork 9
/
simple-csv-xls-exporter.php
74 lines (59 loc) · 2.45 KB
/
simple-csv-xls-exporter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* Plugin Name: Simple CSV/XLS Exporter
* Plugin URI: https://wordpress.org/plugins/simple-csv-xls-exporter/
* Description: Export posts to CSV or XLS, through a link from backend/frontend. Supports custom post types, WooCommerce products, custom taxonomies and fields. Check the plugin's FAQ for all possible options and plugin uses.
* Author: Shambix
* Author URI: http://www.shambix.com
* Version: 1.5.8
*/
/**
* Forked at https://github.com/Jany-M/simple-csv-xls-exporter
* Original author 2013 Ethan Hinson (email : [email protected])
*/
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* @project Simple CSV Exporter
*/
/** Prevents this file from being called directly */
if(!function_exists("add_action")) {
return;
}
define('SIMPLE_CSV_EXPORTER_VERSION', '1.5.5.1');
define('SIMPLE_CSV_EXPORTER_TEXTDOMAIN', 'simple-csv-cls-exporter');
define("SIMPLE_CSV_EXPORTER_PLUGIN_URL", plugin_dir_url(__FILE__));
define('TEXTDOMAIN', SIMPLE_CSV_EXPORTER_TEXTDOMAIN); // Todo: Remove
$upload_dir = wp_upload_dir();
/** Define plugin path */
if(!defined('SIMPLE_CSV_XLS_EXPORTER_PLUGIN_PATH')) {
define('SIMPLE_CSV_XLS_EXPORTER_PLUGIN_PATH', plugin_dir_path(__FILE__));
}
/** Define plugin path to /process/ subdirectory */
if(!defined('SIMPLE_CSV_XLS_EXPORTER_PROCESS')) {
define('SIMPLE_CSV_XLS_EXPORTER_PROCESS', SIMPLE_CSV_XLS_EXPORTER_PLUGIN_PATH . 'process/');
}
/** Define extra file name */
if(!defined('SIMPLE_CSV_XLS_EXPORTER_EXTRA_FILE_NAME')) {
define('SIMPLE_CSV_XLS_EXPORTER_EXTRA_FILE_NAME', '');
}
$include_directories = array(
"classes",
"includes"
);
foreach($include_directories as $include_directory) {
$include_directory = SIMPLE_CSV_XLS_EXPORTER_PLUGIN_PATH . $include_directory;
$files = glob("$include_directory/*.php");
foreach($files as $file) {
if(is_file($file)) {
require_once $file;
}
}
}
register_activation_hook(__FILE__, array('Simple_CSV_Exporter', 'activate'));
register_deactivation_hook(__FILE__, array('Simple_CSV_Exporter', 'deactivate'));
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'simple_csv_exporter_plugin_settings_link');
$SIMPLE_CSV_EXPORTER = new Simple_CSV_Exporter();