PluginProbe
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.5.8
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.5.8
1.8.0 1.7.2 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 All 59 releases
hostinger-reach / src / Admin / Database / DatabaseTable.php

DatabaseTable.php in Hostinger Reach – AI-Powered Email Marketing for WordPress 1.5.8, at src/Admin/Database/DatabaseTable.php

41 lines 1013 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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