| 1 |
<?php |
| 2 |
/** |
| 3 |
* Give Exports Tab |
| 4 |
* |
| 5 |
* @package Give |
| 6 |
* @subpackage Classes/Give_Settings_Export |
| 7 |
* @copyright Copyright (c) 2016, GiveWP |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.8 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; // Exit if accessed directly |
| 14 |
} |
| 15 |
|
| 16 |
if ( ! class_exists( 'Give_Settings_Export' ) ) : |
| 17 |
|
| 18 |
/** |
| 19 |
* Give_Settings_Export. |
| 20 |
* |
| 21 |
* @sine 1.8 |
| 22 |
*/ |
| 23 |
class Give_Settings_Export extends Give_Settings_Page { |
| 24 |
/** |
| 25 |
* Flag to check if enable saving option for setting page or not |
| 26 |
* |
| 27 |
* @since 1.8.17 |
| 28 |
* @var bool |
| 29 |
*/ |
| 30 |
protected $enable_save = false; |
| 31 |
|
| 32 |
/** |
| 33 |
* Constructor. |
| 34 |
*/ |
| 35 |
public function __construct() { |
| 36 |
$this->id = 'export'; |
| 37 |
$this->label = __( 'Export', 'give' ); |
| 38 |
|
| 39 |
parent::__construct(); |
| 40 |
|
| 41 |
add_action( 'give_admin_field_tools_export', array( 'Give_Settings_Export', 'render_export_field' ), 10, 2 ); |
| 42 |
|
| 43 |
// Do not use main donor for this tab. |
| 44 |
if ( give_get_current_setting_tab() === $this->id ) { |
| 45 |
add_action( 'give-tools_open_form', '__return_empty_string' ); |
| 46 |
add_action( 'give-tools_close_form', '__return_empty_string' ); |
| 47 |
|
| 48 |
require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-give-export-donations.php'; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Get settings array. |
| 54 |
* |
| 55 |
* @since 1.8 |
| 56 |
* @return array |
| 57 |
*/ |
| 58 |
public function get_settings() { |
| 59 |
/** |
| 60 |
* Filter the settings. |
| 61 |
* |
| 62 |
* @since 1.8 |
| 63 |
* @param array $settings |
| 64 |
*/ |
| 65 |
$settings = apply_filters( |
| 66 |
'give_get_settings_' . $this->id, |
| 67 |
array( |
| 68 |
array( |
| 69 |
'id' => 'give_tools_export', |
| 70 |
'type' => 'title', |
| 71 |
'table_html' => false, |
| 72 |
), |
| 73 |
array( |
| 74 |
'id' => 'export', |
| 75 |
'name' => __( 'Export', 'give' ), |
| 76 |
'type' => 'tools_export', |
| 77 |
), |
| 78 |
array( |
| 79 |
'id' => 'give_tools_export', |
| 80 |
'type' => 'sectionend', |
| 81 |
'table_html' => false, |
| 82 |
), |
| 83 |
) |
| 84 |
); |
| 85 |
|
| 86 |
// Output. |
| 87 |
return $settings; |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* Render report export field |
| 92 |
* |
| 93 |
* @since 1.8 |
| 94 |
* @access public |
| 95 |
* |
| 96 |
* @param $field |
| 97 |
* @param $option_value |
| 98 |
*/ |
| 99 |
public static function render_export_field( $field, $option_value ) { |
| 100 |
include_once 'views/html-admin-page-exports.php'; |
| 101 |
} |
| 102 |
} |
| 103 |
|
| 104 |
endif; |
| 105 |
|
| 106 |
return new Give_Settings_Export(); |
| 107 |
|