| @@ 16-139 (lines=124) @@ | ||
| 13 | exit; // Exit if accessed directly |
|
| 14 | } |
|
| 15 | ||
| 16 | if ( ! class_exists( 'Give_Earnings_Report' ) ) : |
|
| 17 | ||
| 18 | /** |
|
| 19 | * Give_Earnings_Report. |
|
| 20 | * |
|
| 21 | * @sine 1.8 |
|
| 22 | */ |
|
| 23 | class Give_Earnings_Report { |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Setting page id. |
|
| 27 | * |
|
| 28 | * @since 1.8 |
|
| 29 | * @var string |
|
| 30 | */ |
|
| 31 | protected $id = ''; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Setting page label. |
|
| 35 | * |
|
| 36 | * @since 1.8 |
|
| 37 | * @var string |
|
| 38 | */ |
|
| 39 | protected $label = ''; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Constructor. |
|
| 43 | */ |
|
| 44 | public function __construct() { |
|
| 45 | $this->id = 'earnings'; |
|
| 46 | $this->label = esc_html__( 'Income', 'give' ); |
|
| 47 | ||
| 48 | add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
| 49 | add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 50 | add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 ); |
|
| 51 | ||
| 52 | // Do not use main form for this tab. |
|
| 53 | if( give_get_current_setting_tab() === $this->id ) { |
|
| 54 | add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
| 55 | add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Add this page to settings. |
|
| 61 | * |
|
| 62 | * @since 1.8 |
|
| 63 | * @param array $pages Lst of pages. |
|
| 64 | * @return array |
|
| 65 | */ |
|
| 66 | public function add_settings_page( $pages ) { |
|
| 67 | $pages[ $this->id ] = $this->label; |
|
| 68 | ||
| 69 | return $pages; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Get settings array. |
|
| 74 | * |
|
| 75 | * @since 1.8 |
|
| 76 | * @return array |
|
| 77 | */ |
|
| 78 | public function get_settings() { |
|
| 79 | // Hide save button. |
|
| 80 | $GLOBALS['give_hide_save_button'] = true; |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Filter the settings. |
|
| 84 | * |
|
| 85 | * @since 1.8 |
|
| 86 | * @param array $settings |
|
| 87 | */ |
|
| 88 | $settings = apply_filters( |
|
| 89 | 'give_get_settings_' . $this->id, |
|
| 90 | array( |
|
| 91 | array( |
|
| 92 | 'id' => 'give_tools_earnings', |
|
| 93 | 'type' => 'title', |
|
| 94 | 'table_html' => false |
|
| 95 | ), |
|
| 96 | array( |
|
| 97 | 'id' => 'earnings', |
|
| 98 | 'name' => esc_html__( 'Income', 'give' ), |
|
| 99 | 'type' => 'report_earnings', |
|
| 100 | ), |
|
| 101 | array( |
|
| 102 | 'id' => 'give_tools_earnings', |
|
| 103 | 'type' => 'sectionend', |
|
| 104 | 'table_html' => false |
|
| 105 | ) |
|
| 106 | ) |
|
| 107 | ); |
|
| 108 | ||
| 109 | // Output. |
|
| 110 | return $settings; |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * Output the settings. |
|
| 115 | * |
|
| 116 | * @since 1.8 |
|
| 117 | * @return void |
|
| 118 | */ |
|
| 119 | public function output() { |
|
| 120 | $settings = $this->get_settings(); |
|
| 121 | ||
| 122 | Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * Render earning field |
|
| 127 | * |
|
| 128 | * @since 1.8 |
|
| 129 | * @access public |
|
| 130 | * |
|
| 131 | * @param $field |
|
| 132 | * @param $option_value |
|
| 133 | */ |
|
| 134 | public function render_report_earnings_field( $field, $option_value ) { |
|
| 135 | do_action( 'give_reports_view_earnings' ); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | endif; |
|
| 140 | ||
| 141 | return new Give_Earnings_Report(); |
|
| 142 | ||
| @@ 16-139 (lines=124) @@ | ||
| 13 | exit; // Exit if accessed directly |
|
| 14 | } |
|
| 15 | ||
| 16 | if ( ! class_exists( 'Give_Gateways_Report' ) ) : |
|
| 17 | ||
| 18 | /** |
|
| 19 | * Give_Gateways_Report. |
|
| 20 | * |
|
| 21 | * @sine 1.8 |
|
| 22 | */ |
|
| 23 | class Give_Gateways_Report { |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Setting page id. |
|
| 27 | * |
|
| 28 | * @since 1.8 |
|
| 29 | * @var string |
|
| 30 | */ |
|
| 31 | protected $id = ''; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Setting page label. |
|
| 35 | * |
|
| 36 | * @since 1.8 |
|
| 37 | * @var string |
|
| 38 | */ |
|
| 39 | protected $label = ''; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Constructor. |
|
| 43 | */ |
|
| 44 | public function __construct() { |
|
| 45 | $this->id = 'gateways'; |
|
| 46 | $this->label = esc_html__( 'Donation Methods', 'give' ); |
|
| 47 | ||
| 48 | add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
| 49 | add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 50 | add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 ); |
|
| 51 | ||
| 52 | // Do not use main form for this tab. |
|
| 53 | if( give_get_current_setting_tab() === $this->id ) { |
|
| 54 | add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
| 55 | add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Add this page to settings. |
|
| 61 | * |
|
| 62 | * @since 1.8 |
|
| 63 | * @param array $pages Lst of pages. |
|
| 64 | * @return array |
|
| 65 | */ |
|
| 66 | public function add_settings_page( $pages ) { |
|
| 67 | $pages[ $this->id ] = $this->label; |
|
| 68 | ||
| 69 | return $pages; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Get settings array. |
|
| 74 | * |
|
| 75 | * @since 1.8 |
|
| 76 | * @return array |
|
| 77 | */ |
|
| 78 | public function get_settings() { |
|
| 79 | // Hide save button. |
|
| 80 | $GLOBALS['give_hide_save_button'] = true; |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Filter the settings. |
|
| 84 | * |
|
| 85 | * @since 1.8 |
|
| 86 | * @param array $settings |
|
| 87 | */ |
|
| 88 | $settings = apply_filters( |
|
| 89 | 'give_get_settings_' . $this->id, |
|
| 90 | array( |
|
| 91 | array( |
|
| 92 | 'id' => 'give_reports_gateways', |
|
| 93 | 'type' => 'title', |
|
| 94 | 'table_html' => false |
|
| 95 | ), |
|
| 96 | array( |
|
| 97 | 'id' => 'gateways', |
|
| 98 | 'name' => esc_html__( 'Gateways', 'give' ), |
|
| 99 | 'type' => 'report_gateways', |
|
| 100 | ), |
|
| 101 | array( |
|
| 102 | 'id' => 'give_reports_gateways', |
|
| 103 | 'type' => 'sectionend', |
|
| 104 | 'table_html' => false |
|
| 105 | ) |
|
| 106 | ) |
|
| 107 | ); |
|
| 108 | ||
| 109 | // Output. |
|
| 110 | return $settings; |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * Output the settings. |
|
| 115 | * |
|
| 116 | * @since 1.8 |
|
| 117 | * @return void |
|
| 118 | */ |
|
| 119 | public function output() { |
|
| 120 | $settings = $this->get_settings(); |
|
| 121 | ||
| 122 | Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * Render earning field |
|
| 127 | * |
|
| 128 | * @since 1.8 |
|
| 129 | * @access public |
|
| 130 | * |
|
| 131 | * @param $field |
|
| 132 | * @param $option_value |
|
| 133 | */ |
|
| 134 | public function render_report_gateways_field( $field, $option_value ) { |
|
| 135 | do_action( 'give_reports_view_gateways'); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | endif; |
|
| 140 | ||
| 141 | return new Give_Gateways_Report(); |
|
| 142 | ||
| @@ 16-139 (lines=124) @@ | ||
| 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 { |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Setting page id. |
|
| 27 | * |
|
| 28 | * @since 1.8 |
|
| 29 | * @var string |
|
| 30 | */ |
|
| 31 | protected $id = ''; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Setting page label. |
|
| 35 | * |
|
| 36 | * @since 1.8 |
|
| 37 | * @var string |
|
| 38 | */ |
|
| 39 | protected $label = ''; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Constructor. |
|
| 43 | */ |
|
| 44 | public function __construct() { |
|
| 45 | $this->id = 'export'; |
|
| 46 | $this->label = __( 'Export', 'give' ); |
|
| 47 | ||
| 48 | add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
| 49 | add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
| 50 | add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 ); |
|
| 51 | ||
| 52 | // Do not use main donor for this tab. |
|
| 53 | if( give_get_current_setting_tab() === $this->id ) { |
|
| 54 | add_action( 'give-tools_open_form', '__return_empty_string' ); |
|
| 55 | add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Add this page to settings. |
|
| 61 | * |
|
| 62 | * @since 1.8 |
|
| 63 | * @param array $pages Lst of pages. |
|
| 64 | * @return array |
|
| 65 | */ |
|
| 66 | public function add_settings_page( $pages ) { |
|
| 67 | $pages[ $this->id ] = $this->label; |
|
| 68 | ||
| 69 | return $pages; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Get settings array. |
|
| 74 | * |
|
| 75 | * @since 1.8 |
|
| 76 | * @return array |
|
| 77 | */ |
|
| 78 | public function get_settings() { |
|
| 79 | // Hide save button. |
|
| 80 | $GLOBALS['give_hide_save_button'] = true; |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Filter the settings. |
|
| 84 | * |
|
| 85 | * @since 1.8 |
|
| 86 | * @param array $settings |
|
| 87 | */ |
|
| 88 | $settings = apply_filters( |
|
| 89 | 'give_get_settings_' . $this->id, |
|
| 90 | array( |
|
| 91 | array( |
|
| 92 | 'id' => 'give_tools_export', |
|
| 93 | 'type' => 'title', |
|
| 94 | 'table_html' => false |
|
| 95 | ), |
|
| 96 | array( |
|
| 97 | 'id' => 'export', |
|
| 98 | 'name' => __( 'Export', 'give' ), |
|
| 99 | 'type' => 'tools_export', |
|
| 100 | ), |
|
| 101 | array( |
|
| 102 | 'id' => 'give_tools_export', |
|
| 103 | 'type' => 'sectionend', |
|
| 104 | 'table_html' => false |
|
| 105 | ) |
|
| 106 | ) |
|
| 107 | ); |
|
| 108 | ||
| 109 | // Output. |
|
| 110 | return $settings; |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * Output the settings. |
|
| 115 | * |
|
| 116 | * @since 1.8 |
|
| 117 | * @return void |
|
| 118 | */ |
|
| 119 | public function output() { |
|
| 120 | $settings = $this->get_settings(); |
|
| 121 | ||
| 122 | Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * Render report export field |
|
| 127 | * |
|
| 128 | * @since 1.8 |
|
| 129 | * @access public |
|
| 130 | * |
|
| 131 | * @param $field |
|
| 132 | * @param $option_value |
|
| 133 | */ |
|
| 134 | public function render_export_field( $field, $option_value ) { |
|
| 135 | include_once( 'views/html-admin-page-exports.php' ); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | endif; |
|
| 140 | ||
| 141 | return new Give_Settings_Export(); |
|
| 142 | ||