PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / includes / admin / tools / class-settings-import.php

class-settings-import.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at includes/admin/tools/class-settings-import.php

135 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Give Settings Page/Tab
4 *
5 * @package Give
6 * @subpackage Classes/Give_Settings_Import
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_Import' ) ) {
17
18 /**
19 * Give_Settings_Import.
20 *
21 * Add a submenu page in give tools menu called Import donations which import the donations from the CSV files.
22 *
23 * @since 1.8.13
24 */
25 class Give_Settings_Import extends Give_Settings_Page {
26 /**
27 * Flag to check if enable saving option for setting page or not
28 *
29 * @since 1.8.17
30 * @var bool
31 */
32 protected $enable_save = false;
33
34 /**
35 * Importing donation per page.
36 *
37 * @since 1.8.13
38 *
39 * @var int
40 */
41 public static $per_page = 5;
42
43 /**
44 * Constructor.
45 */
46 public function __construct() {
47 $this->id = 'import';
48 $this->label = __( 'Import', 'give' );
49
50 parent::__construct();
51
52 // Will display html of the import donation.
53 add_action(
54 'give_admin_field_tools_import',
55 array(
56 'Give_Settings_Import',
57 'render_import_field',
58 ),
59 10,
60 2
61 );
62
63 // Do not use main form for this tab.
64 if ( give_get_current_setting_tab() === $this->id ) {
65 add_action( 'give-tools_open_form', '__return_empty_string' );
66 add_action( 'give-tools_close_form', '__return_empty_string' );
67
68 require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-donations.php';
69 require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-subscriptions.php';
70 require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-core-settings.php';
71 }
72 }
73
74 /**
75 * Get settings array.
76 *
77 * @since 1.8.13
78 * @return array
79 */
80 public function get_settings() {
81 /**
82 * Filter the settings.
83 *
84 * @since 1.8.13
85 *
86 * @param array $settings
87 */
88 $settings = apply_filters(
89 'give_get_settings_' . $this->id,
90 array(
91 array(
92 'id' => 'give_tools_import',
93 'type' => 'title',
94 'table_html' => false,
95 ),
96 array(
97 'id' => 'import',
98 'name' => __( 'Import', 'give' ),
99 'type' => 'tools_import',
100 ),
101 array(
102 'name' => esc_html__( 'Import Docs Link', 'give' ),
103 'id' => 'import_docs_link',
104 'url' => esc_url( 'http://docs.givewp.com/tools-importer' ),
105 'title' => __( 'Import Tab', 'give' ),
106 'type' => 'give_docs_link',
107 ),
108 array(
109 'id' => 'give_tools_import',
110 'type' => 'sectionend',
111 'table_html' => false,
112 ),
113 )
114 );
115
116 // Output.
117 return $settings;
118 }
119
120 /**
121 * Render report import field
122 *
123 * @since 1.8.13
124 * @access public
125 *
126 * @param $field
127 * @param $option_value
128 */
129 public static function render_import_field( $field, $option_value ) {
130 include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php';
131 }
132 }
133 }
134 return new Give_Settings_Import();
135