PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.1
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.1
1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / src / Admin / Database / DatabaseTable.php
hostinger-reach / src / Admin / Database Last commit date
CartsTable.php 9 months ago ContactListsTable.php 1 year ago DatabaseInterface.php 9 months ago DatabaseTable.php 1 year ago FormsTable.php 9 months ago
DatabaseTable.php
41 lines
1 <?php
2
3 namespace Hostinger\Reach\Admin\Database;
4
5 use wpdb;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 die;
9 }
10
11 abstract class DatabaseTable implements DatabaseInterface {
12 private wpdb $wpdb;
13 private string $prefix = 'hostinger_reach_';
14 protected string $table_name;
15
16 public function __construct( wpdb $wpdb ) {
17 $this->wpdb = $wpdb;
18 }
19
20 public function create(): void {
21 $charset_collate = $this->wpdb->get_charset_collate();
22 $schema = implode( ",\n", $this->schema() );
23 $table = $this->table_name();
24
25 $sql = "CREATE TABLE $table (\n$schema\n) $charset_collate;";
26
27 $this->execute_db_delta( $sql );
28 }
29
30 public function table_name(): string {
31 return $this->wpdb->prefix . $this->prefix . $this->table_name;
32 }
33
34 abstract public function schema(): array;
35
36 public function execute_db_delta( string $sql ): void {
37 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
38 dbDelta( $sql );
39 }
40 }
41