PluginProbe ʕ •ᴥ•ʔ
SureForms – Drag & Drop Contact Form & Form Builder, Payment Form, Survey, Quiz & Calculator / 2.12.0
SureForms – Drag & Drop Contact Form & Form Builder, Payment Form, Survey, Quiz & Calculator v2.12.0
2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 0.0.8 0.0.9 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.1.1 1.1.2 1.10.0 1.10.1 1.11.0 1.12.0 1.12.1 1.12.2 1.12.3 1.13.0 1.13.1 1.13.2 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.2 2.6.0
sureforms / inc / database / register.php
sureforms / inc / database Last commit date
tables 1 week ago base.php 3 weeks ago register.php 7 months ago
register.php
71 lines
1 <?php
2 /**
3 * SureForms Database Tables Register Class.
4 *
5 * @link https://sureforms.com
6 * @since 0.0.10
7 * @package SureForms
8 * @author SureForms <https://sureforms.com/>
9 */
10
11 namespace SRFM\Inc\Database;
12
13 use SRFM\Inc\Database\Tables\Entries;
14 use SRFM\Inc\Database\Tables\Payments;
15
16 // Exit if accessed directly.
17 defined( 'ABSPATH' ) || exit;
18
19 /**
20 * SureForms Database Tables Register Class
21 *
22 * @since 0.0.13
23 */
24 class Register {
25 /**
26 * Init database registration.
27 *
28 * @since 0.0.13
29 * @return void
30 */
31 public static function init() {
32 /*
33 * ### Here, order is important. ###
34 * 1. Start the DB upgrade which also manages the internal versioning of each tables.
35 * 2. Init create method, which create the table if the table does not exists.
36 * 3. Init maybe_add_new_columns, it only runs if we have new columns definition and DB is upgradable ( has new version ).
37 * 4. Init maybe_rename_columns, it only runs if got any columns to rename and DB is upgradable ( has new version ).
38 * 5. Finally, stop the DB upgrade and update the current version in option table.
39 *
40 * Replaced self::get_db_tables() to static::get_db_tables() for allowing overrides.
41 * @since 1.13.0
42 */
43 foreach ( static::get_db_tables() as $instance ) {
44 $instance->start_db_upgrade();
45
46 if ( $instance->is_db_upgradable() ) {
47 // Only execute below methods if DB is upgradable.
48 $instance->create( $instance->get_columns_definition() );
49 $instance->maybe_add_new_columns( $instance->get_new_columns_definition() );
50 $instance->maybe_rename_columns( $instance->get_columns_to_rename() );
51 }
52
53 // Stop the upgrade process of current table and move to next.
54 $instance->stop_db_upgrade();
55 }
56 }
57
58 /**
59 * Returns an array of instances/objects of our custom tables.
60 *
61 * @since 0.0.13
62 * @return array<string,\SRFM\Inc\Database\Base>
63 */
64 public static function get_db_tables() {
65 return [
66 'entries' => Entries::get_instance(),
67 'payments' => Payments::get_instance(),
68 ];
69 }
70 }
71