class-activation.php
1 year ago
class-admin-columns-manager.php
1 year ago
class-admin-menu-organizer.php
1 year ago
class-auto-publish-posts-with-missed-schedule.php
1 year ago
class-avif-upload.php
1 year ago
class-change-login-url.php
1 year ago
class-cleanup-admin-bar.php
1 year ago
class-code-snippets-manager.php
1 year ago
class-common-methods.php
1 year ago
class-content-duplication.php
1 year ago
class-content-order.php
1 year ago
class-custom-admin-footer-text.php
1 year ago
class-custom-body-class.php
1 year ago
class-custom-content-types.php
1 year ago
class-custom-css.php
1 year ago
class-custom-nav-menu-items-in-new-tab.php
1 year ago
class-deactivation.php
1 year ago
class-disable-comments.php
1 year ago
class-disable-dashboard-widgets.php
1 year ago
class-disable-feeds.php
1 year ago
class-disable-gutenberg.php
1 year ago
class-disable-rest-api.php
1 year ago
class-disable-smaller-components.php
1 year ago
class-disable-updates.php
1 year ago
class-disable-xml-rpc.php
1 year ago
class-display-system-summary.php
1 year ago
class-email-address-obfuscator.php
1 year ago
class-email-delivery.php
1 year ago
class-enhance-list-tables.php
1 year ago
class-external-permalinks.php
1 year ago
class-heartbeat-control.php
1 year ago
class-hide-admin-bar.php
1 year ago
class-hide-admin-notices.php
1 year ago
class-image-sizes-panel.php
1 year ago
class-image-upload-control.php
1 year ago
class-insert-head-body-footer-code.php
1 year ago
class-last-login-column.php
1 year ago
class-limit-login-attempts.php
1 year ago
class-login-id-type.php
1 year ago
class-login-logout-menu.php
1 year ago
class-maintenance-mode.php
1 year ago
class-manage-ads-appads-txt.php
1 year ago
class-manage-robots-txt.php
1 year ago
class-media-replacement.php
1 year ago
class-multiple-user-roles.php
1 year ago
class-obfuscate-author-slugs.php
1 year ago
class-open-external-links-in-new-tab.php
1 year ago
class-password-protection.php
1 year ago
class-redirect-after-login.php
1 year ago
class-redirect-after-logout.php
1 year ago
class-redirect-fourofour.php
1 year ago
class-revisions-control.php
1 year ago
class-search-engines-visibility.php
1 year ago
class-settings-fields-render.php
1 year ago
class-settings-sanitization.php
1 year ago
class-settings-sections-fields.php
1 year ago
class-show-custom-taxonomy-filters.php
1 year ago
class-site-identity-on-login-page.php
1 year ago
class-svg-upload.php
1 year ago
class-various-admin-ui-enhancements.php
1 year ago
class-view-admin-as-role.php
1 year ago
class-wider-admin-menu.php
1 year ago
class-activation.php
112 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ASENHA\Classes; |
| 4 | |
| 5 | /** |
| 6 | * Plugin Activation |
| 7 | * |
| 8 | * @since 1.0.0 |
| 9 | */ |
| 10 | class Activation { |
| 11 | |
| 12 | /** |
| 13 | * Create failed login log table for Limit Login Attempts feature |
| 14 | * |
| 15 | * @since 2.5.0 |
| 16 | */ |
| 17 | public function create_failed_logins_log_table() { |
| 18 | |
| 19 | global $wpdb; |
| 20 | |
| 21 | // Limit Login Attempts Log Table |
| 22 | |
| 23 | $table_name = $wpdb->prefix . 'asenha_failed_logins'; |
| 24 | |
| 25 | if ( ! empty( $wpdb->charset ) ) { |
| 26 | $charset_collation_sql = "DEFAULT CHARACTER SET $wpdb->charset"; |
| 27 | } |
| 28 | |
| 29 | if ( ! empty( $wpdb->collate ) ) { |
| 30 | $charset_collation_sql .= " COLLATE $wpdb->collate"; |
| 31 | } |
| 32 | |
| 33 | // Drop table if already exists |
| 34 | $wpdb->query("DROP TABLE IF EXISTS `". $table_name ."`"); |
| 35 | |
| 36 | // Create database table. This procedure may also be called |
| 37 | $sql = |
| 38 | "CREATE TABLE {$table_name} ( |
| 39 | id int(6) unsigned NOT NULL auto_increment, |
| 40 | ip_address varchar(40) NOT NULL DEFAULT '', |
| 41 | username varchar(24) NOT NULL DEFAULT '', |
| 42 | fail_count int(10) NOT NULL DEFAULT '0', |
| 43 | lockout_count int(10) NOT NULL DEFAULT '0', |
| 44 | request_uri varchar(24) NOT NULL DEFAULT '', |
| 45 | unixtime int(10) NOT NULL DEFAULT '0', |
| 46 | datetime_wp varchar(36) NOT NULL DEFAULT '', |
| 47 | -- datetime_utc datetime NULL DEFAULT CURRENT_TIMESTAMP, |
| 48 | info varchar(64) NOT NULL DEFAULT '', |
| 49 | UNIQUE (ip_address), |
| 50 | PRIMARY KEY (id) |
| 51 | ) {$charset_collation_sql}"; |
| 52 | |
| 53 | require_once ABSPATH . '/wp-admin/includes/upgrade.php'; |
| 54 | |
| 55 | dbDelta( $sql ); |
| 56 | |
| 57 | return true; |
| 58 | |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Create email delivery log table for Email Delivery module |
| 63 | * |
| 64 | * @since 7.1.0 |
| 65 | */ |
| 66 | public function create_email_delivery_log_table() { |
| 67 | |
| 68 | global $wpdb; |
| 69 | $table_name = $wpdb->prefix . 'asenha_email_delivery'; |
| 70 | |
| 71 | if ( ! empty( $wpdb->charset ) ) { |
| 72 | $charset_collation_sql = "DEFAULT CHARACTER SET $wpdb->charset"; |
| 73 | } |
| 74 | |
| 75 | if ( ! empty( $wpdb->collate ) ) { |
| 76 | $charset_collation_sql .= " COLLATE $wpdb->collate"; |
| 77 | } |
| 78 | |
| 79 | // Drop table if already exists |
| 80 | $wpdb->query("DROP TABLE IF EXISTS `". $table_name ."`"); |
| 81 | |
| 82 | // Create database table. This procedure may also be called |
| 83 | $sql = |
| 84 | "CREATE TABLE {$table_name} ( |
| 85 | id int(6) unsigned NOT NULL auto_increment, |
| 86 | status enum('successful','failed','unknown') NOT NULL DEFAULT 'unknown', |
| 87 | error varchar(250) NOT NULL DEFAULT '', |
| 88 | subject varchar(250) NOT NULL DEFAULT '', |
| 89 | message longtext NOT NULL DEFAULT '', |
| 90 | send_to varchar(256) NOT NULL DEFAULT '', |
| 91 | sender varchar(256) NOT NULL DEFAULT '', |
| 92 | reply_to varchar(256) NOT NULL DEFAULT '', |
| 93 | headers text NOT NULL DEFAULT '', |
| 94 | content_type text NOT NULL DEFAULT '', |
| 95 | attachments text NOT NULL DEFAULT '', |
| 96 | backtrace text NOT NULL DEFAULT '', |
| 97 | processor text NOT NULL DEFAULT '', |
| 98 | sent_on datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 99 | sent_on_unixtime int(10) NOT NULL DEFAULT '0', |
| 100 | extra longtext NOT NULL DEFAULT '', |
| 101 | PRIMARY KEY (id) |
| 102 | ) {$charset_collation_sql}"; |
| 103 | |
| 104 | require_once ABSPATH . '/wp-admin/includes/upgrade.php'; |
| 105 | |
| 106 | dbDelta( $sql ); |
| 107 | |
| 108 | return true; |
| 109 | |
| 110 | } |
| 111 | |
| 112 | } |