data
5 years ago
export
3 years ago
import
3 years ago
views
3 years ago
class-settings-api.php
6 years ago
class-settings-data.php
5 years ago
class-settings-export.php
6 years ago
class-settings-import.php
6 years ago
class-settings-logs.php
5 years ago
class-settings-system-info.php
6 years ago
class-settings-import.php
134 lines
| 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-core-settings.php'; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Get settings array. |
| 75 | * |
| 76 | * @since 1.8.13 |
| 77 | * @return array |
| 78 | */ |
| 79 | public function get_settings() { |
| 80 | /** |
| 81 | * Filter the settings. |
| 82 | * |
| 83 | * @since 1.8.13 |
| 84 | * |
| 85 | * @param array $settings |
| 86 | */ |
| 87 | $settings = apply_filters( |
| 88 | 'give_get_settings_' . $this->id, |
| 89 | array( |
| 90 | array( |
| 91 | 'id' => 'give_tools_import', |
| 92 | 'type' => 'title', |
| 93 | 'table_html' => false, |
| 94 | ), |
| 95 | array( |
| 96 | 'id' => 'import', |
| 97 | 'name' => __( 'Import', 'give' ), |
| 98 | 'type' => 'tools_import', |
| 99 | ), |
| 100 | array( |
| 101 | 'name' => esc_html__( 'Import Docs Link', 'give' ), |
| 102 | 'id' => 'import_docs_link', |
| 103 | 'url' => esc_url( 'http://docs.givewp.com/tools-importer' ), |
| 104 | 'title' => __( 'Import Tab', 'give' ), |
| 105 | 'type' => 'give_docs_link', |
| 106 | ), |
| 107 | array( |
| 108 | 'id' => 'give_tools_import', |
| 109 | 'type' => 'sectionend', |
| 110 | 'table_html' => false, |
| 111 | ), |
| 112 | ) |
| 113 | ); |
| 114 | |
| 115 | // Output. |
| 116 | return $settings; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Render report import field |
| 121 | * |
| 122 | * @since 1.8.13 |
| 123 | * @access public |
| 124 | * |
| 125 | * @param $field |
| 126 | * @param $option_value |
| 127 | */ |
| 128 | public static function render_import_field( $field, $option_value ) { |
| 129 | include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php'; |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | return new Give_Settings_Import(); |
| 134 |