-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple-queries.php
46 lines (39 loc) · 1.11 KB
/
simple-queries.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Plugin Name: Simple Queries
* Plugin URI: https://github.com/williarin/wordpress-simple-queries
* Description: Query the database in your plugins and templates using WordpressInterop library.
* Version: {plugin-version}
* Author: William Arin
* Author URI: https://github.com/williarin
* License: GPL-3.0
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Domain Path: /languages/
* Requires at least: 5.6
* Requires PHP: 8.0
**/
declare(strict_types=1);
use Williarin\SimpleQueries\SimpleQuery;
use Williarin\SimpleQueries\Vendor\Williarin\WordpressInterop\EntityManagerInterface;
if (!defined('ABSPATH')) {
exit;
}
if (
!defined('DB_USER')
|| !defined('DB_PASSWORD')
|| !defined('DB_HOST')
|| !defined('DB_NAME')
|| !defined('DB_CHARSET')
) {
return;
}
const SIMPLE_QUERIES_ENABLED = true;
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require __DIR__ . '/vendor/autoload.php';
}
if (!function_exists('SimpleQuery')) {
function SimpleQuery(): EntityManagerInterface
{
return SimpleQuery::getInstance()->getManager();
}
}