| Server IP : 54.36.91.62 / Your IP : 216.73.216.15 Web Server : Apache System : Linux webm021.cluster127.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : uxhactp ( 169076) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/uxhactp/www/wp-content/plugins/link-factory/includes/ |
Upload File : |
<?php
/**
* Repository for the wp_link_factory_sentences table.
*
* @package LinkFactory
*/
namespace LinkFactory;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Repository {
public static function install_schema() {
global $wpdb;
$table_name = $wpdb->prefix . LINK_FACTORY_TABLE;
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE IF NOT EXISTS {$table_name} (
id varchar(64) NOT NULL,
html longtext NOT NULL,
sitewide tinyint(1) NOT NULL DEFAULT 0,
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
) {$charset_collate};";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta( $sql );
}
public function insert( $id, $html, $sitewide ) {
global $wpdb;
$table = $wpdb->prefix . LINK_FACTORY_TABLE;
return $wpdb->insert(
$table,
array(
'id' => $id,
'html' => $html,
'sitewide' => $sitewide ? 1 : 0,
'created_at' => current_time( 'mysql', true ),
),
array( '%s', '%s', '%d', '%s' )
);
}
public function find_all() {
global $wpdb;
$table = $wpdb->prefix . LINK_FACTORY_TABLE;
return $wpdb->get_results( "SELECT id, html FROM {$table} ORDER BY created_at ASC", ARRAY_A );
}
public function find_sitewide() {
global $wpdb;
$table = $wpdb->prefix . LINK_FACTORY_TABLE;
return $wpdb->get_results( "SELECT id, html FROM {$table} WHERE sitewide = 1 ORDER BY created_at ASC", ARRAY_A );
}
public function delete_by_id( $id ) {
global $wpdb;
$table = $wpdb->prefix . LINK_FACTORY_TABLE;
return (int) $wpdb->delete( $table, array( 'id' => $id ), array( '%s' ) );
}
}