| @@ -20,14 +20,20 @@ | ||
| 20 | 20 | * |
| 21 | 21 | * @sine 1.8 |
| 22 | 22 | */ |
| 23 | 23 | class Give_Settings_Data extends Give_Settings_Page { |
| 24 | - /** | |
| 25 | - * Migrations list table app container ID | |
| 26 | - * @since 2.10.0 | |
| 27 | - */ | |
| 28 | - const CONTAINER_ID = 'give_migrations_table_app'; | |
| 24 | + /** | |
| 25 | + * Migrations list table app container ID | |
| 26 | + * @since 4.2.0 rename to GIVE_MIGRATIONS_TABLE_APP | |
| 27 | + * @since 2.10.0 | |
| 28 | + */ | |
| 29 | + const GIVE_MIGRATIONS_TABLE_APP = 'give_migrations_table_app'; | |
| 29 | 30 | |
| 31 | + /** | |
| 32 | + * @since 4.2.0 | |
| 33 | + */ | |
| 34 | + const GIVE_ORPHANED_FORMS_TABLE_APP = 'give_orphaned_forms_app'; | |
| 35 | + | |
| 30 | 36 | /** |
| 31 | 37 | * Flag to check if enable saving option for setting page or not |
| 32 | 38 | * |
| 33 | 39 | * @since 1.8.17 |
| @@ -49,12 +55,20 @@ | ||
| 49 | 55 | if ( give_get_current_setting_tab() === $this->id ) { |
| 50 | 56 | add_action( 'give-tools_open_form', '__return_empty_string' ); |
| 51 | 57 | add_action( 'give-tools_close_form', '__return_empty_string' ); |
| 52 | 58 | /** |
| 53 | - * Render app container | |
| 59 | + * Render migrations container | |
| 54 | 60 | * @since 2.10.0 |
| 55 | 61 | */ |
| 56 | - add_action( 'give_admin_field_' . self::CONTAINER_ID, [ $this, 'render_container' ] ); | |
| 62 | + add_action( 'give_admin_field_' . self::GIVE_MIGRATIONS_TABLE_APP, [$this, 'render_migrations_container'] ); | |
| 63 | + /** | |
| 64 | + * Render orphaned forms container | |
| 65 | + * @since 4.2.0 | |
| 66 | + */ | |
| 67 | + if ('enabled' === give_get_option('show_orphaned_forms_table', 'disabled')) { | |
| 68 | + add_action( 'give_admin_field_' . self::GIVE_ORPHANED_FORMS_TABLE_APP, [$this, 'render_orphaned_forms_container'] ); | |
| 69 | + } | |
| 70 | + | |
| 57 | 71 | } |
| 58 | 72 | } |
| 59 | 73 | |
| 60 | 74 | /** |
| @@ -94,14 +108,25 @@ | ||
| 94 | 108 | |
| 95 | 109 | case 'database_updates': |
| 96 | 110 | $settings = [ |
| 97 | 111 | [ |
| 98 | - 'id' => self::CONTAINER_ID, | |
| 99 | - 'type' => self::CONTAINER_ID, | |
| 112 | + 'id' => self::GIVE_MIGRATIONS_TABLE_APP, | |
| 113 | + 'type' => self::GIVE_MIGRATIONS_TABLE_APP, | |
| 100 | 114 | ], |
| 101 | 115 | ]; |
| 102 | 116 | |
| 103 | 117 | break; |
| 118 | + | |
| 119 | + | |
| 120 | + case 'orphaned_forms': | |
| 121 | + $settings = [ | |
| 122 | + [ | |
| 123 | + 'id' => self::GIVE_ORPHANED_FORMS_TABLE_APP, | |
| 124 | + 'type' => self::GIVE_ORPHANED_FORMS_TABLE_APP, | |
| 125 | + ], | |
| 126 | + ]; | |
| 127 | + | |
| 128 | + break; | |
| 104 | 129 | } |
| 105 | 130 | |
| 106 | 131 | /** |
| 107 | 132 | * Filter the settings. |
| @@ -127,21 +152,35 @@ | ||
| 127 | 152 | 'database_updates' => __( 'Database updates', 'give' ), |
| 128 | 153 | 'give_recount_stats' => __( 'Recount stats', 'give' ), |
| 129 | 154 | ]; |
| 130 | 155 | |
| 156 | + if ('enabled' === give_get_option('show_orphaned_forms_table', 'disabled')) { | |
| 157 | + $sections['orphaned_forms'] = __( 'Orphaned donation forms', 'give' ); | |
| 158 | + } | |
| 159 | + | |
| 131 | 160 | $sections = apply_filters( 'give_data_views', $sections ); |
| 132 | 161 | |
| 133 | 162 | return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
| 134 | 163 | } |
| 135 | 164 | |
| 136 | - /** | |
| 137 | - * Render Migrations list table app container | |
| 138 | - * | |
| 139 | - * @since 2.10.0 | |
| 140 | - */ | |
| 141 | - public function render_container() { | |
| 142 | - printf( '<div id="%s" style="padding-top: 20px"></div>', self::CONTAINER_ID ); | |
| 165 | + /** | |
| 166 | + * Render Migrations list table app container | |
| 167 | + * | |
| 168 | + * @since 4.2.0 renamed to render_migrations_container | |
| 169 | + * @since 2.10.0 | |
| 170 | + */ | |
| 171 | + public function render_migrations_container() { | |
| 172 | + printf( '<div id="%s" style="padding-top: 20px"></div>', self::GIVE_MIGRATIONS_TABLE_APP ); | |
| 143 | 173 | } |
| 174 | + | |
| 175 | + /** | |
| 176 | + * Render orphaned forms container | |
| 177 | + * | |
| 178 | + * @since 4.2.0 | |
| 179 | + */ | |
| 180 | + public function render_orphaned_forms_container() { | |
| 181 | + printf( '<div id="%s" style="padding-top: 20px"></div>', self::GIVE_ORPHANED_FORMS_TABLE_APP ); | |
| 182 | + } | |
| 144 | 183 | } |
| 145 | 184 | |
| 146 | 185 | endif; |
| 147 | 186 | |