Repository navigation
Expand file tree
/
Copy pathbook-database.php
More file actions
115 lines (106 loc) · 2.96 KB
/
Copy pathbook-database.php
File metadata and controls
115 lines (106 loc) · 2.96 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
* Plugin Name: Book Database
* Plugin URI: https://shop.nosegraze.com/product/book-database/
* Description: Maintain a database of books and reviews.
* Version: 1.5.0-beta1
* Author: Ashley Gibson
* Author URI: http://www.nosegraze.com
* License: GPL2 License
* URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: book-database
* Domain Path: /languages
* Requires at least: 6.5
* Requires PHP: 8.0
*
* Book Database is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* any later version.
*
* Book Database is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Book Database. If not, see <http://www.gnu.org/licenses/>.
*
* @package book-database
* @copyright Copyright (c) 2026, Ashley Gibson
* @license GPL2+
*/
namespace Book_Database;
if (! defined('BDB_VERSION')) {
define('BDB_VERSION', '1.5.0-beta1');
}
if (! defined('BDB_DIR')) {
define('BDB_DIR', plugin_dir_path(__FILE__));
}
if (! defined('BDB_URL')) {
define('BDB_URL', plugin_dir_url(__FILE__));
}
if (! defined('BDB_FILE')) {
define('BDB_FILE', __FILE__);
}
if (! defined('NOSE_GRAZE_STORE_URL')) {
define('NOSE_GRAZE_STORE_URL', 'https://shop.nosegraze.com');
}
if (! defined('BDB_MIN_PHP_VERSION')) {
define('BDB_MIN_PHP_VERSION', '8.0');
}
/**
* Insufficient PHP version notice.
*
* @return void
*/
function insufficient_php_version()
{
?>
<div class="notice notice-error">
<p>
<?php
printf(
__(
'Book Database requires PHP version %s or greater. You have version %s. Please contact your web host to upgrade your version of PHP.',
'book-database'
),
BDB_MIN_PHP_VERSION,
PHP_VERSION
);
?>
</p>
</div>
<?php
}
/**
* Returns the main instance of Book_Database.
*
* @return Plugin
*/
function book_database($abstract = null)
{
$instance = Plugin::instance();
if ($abstract !== null) {
return $instance->make($abstract);
}
return $instance;
}
if (version_compare(PHP_VERSION, BDB_MIN_PHP_VERSION, '>=')) {
require_once BDB_DIR.'vendor/autoload.php';
book_database();
} else {
add_action('admin_notices', __NAMESPACE__.'\insufficient_php_version');
}
/**
* On activation, create an option. We'll use this as a flag to actually run our activation later.
*
* @see Plugin::install()
*
* @since 1.0
*/
function activate()
{
add_option('bdb_run_activation', date('Y-m-d H:i:s'));
}
register_activation_hook(__FILE__, __NAMESPACE__.'\activate');