PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 1.0.4
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v1.0.4
2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 All 68 releases
better-payment / includes / Classes / Migrator.php

Migrator.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 1.0.4, at includes/Classes/Migrator.php

49 lines 1017 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Better_Payment\Lite\Classes;
4
5 /**
6 * Exit if accessed directly
7 */
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 /**
13 * The plugin migrator class
14 *
15 * @since 0.0.2
16 */
17 class Migrator
18 {
19
20 /**
21 * Initialize the plugin
22 *
23 * @since 0.0.2
24 */
25 public static function migrator() {
26 self::update_tables();
27 }
28
29 /**
30 * Update the plugin tables
31 *
32 * @since 0.0.2
33 */
34 public static function update_tables() {
35 global $wpdb;
36 $wpdb->hide_errors();
37 $table_name = "{$wpdb->prefix}better_payment";
38
39 //Add column
40 $column_name = sanitize_text_field("refund_info");
41 $column_type = sanitize_text_field("longtext");
42 $row = $wpdb->get_results( "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '$table_name' AND column_name = '$column_name'" );
43
44 if(empty($row)){
45 $wpdb->query($wpdb->prepare("ALTER TABLE $table_name ADD $column_name $column_type"));
46 }
47 }
48 }
49