This repository has been archived by the owner on Sep 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
wp-blog-meta.php
100 lines (86 loc) · 2.3 KB
/
wp-blog-meta.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
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
<?php
/**
* Plugin Name: WP Blog Meta
* Plugin URI: http://wordpress.org/plugins/wp-blog-meta/
* Author: John James Jacoby
* Author URI: https://profiles.wordpress.org/johnjamesjacoby/
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Description: A global, joinable meta-data table for your WordPress Multisite sites
* Version: 2.0.0
* Text Domain: wp-blog-meta
* Domain Path: /assets/lang/
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
// Load immediately, to get ahead of everything else
_wp_blog_meta();
/**
* Wrapper for includes and setting up the database table
*
* @since 1.0.0
*/
function _wp_blog_meta() {
// Get the plugin path
$plugin_path = wp_blog_meta_get_plugin_path();
// Classes
require_once $plugin_path . 'includes/classes/class-wp-blog-meta-query.php';
require_once $plugin_path . 'includes/classes/class-wp-blog-meta-db-table.php';
// WP_CLI
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once $plugin_path . 'includes/classes/class-wp-cli.php';
}
// Functions
require_once $plugin_path . 'includes/functions/metadata.php';
require_once $plugin_path . 'includes/functions/transients.php';
require_once $plugin_path . 'includes/functions/filters.php';
// Register database table
if ( empty( $GLOBALS['wpdb']->blogmeta ) ) {
$GLOBALS['wpdb']->blogmeta = "{$GLOBALS['wpdb']->base_prefix}blogmeta";
$GLOBALS['wpdb']->ms_global_tables[] = 'blogmeta';
}
// Register global cache group
if ( function_exists( 'wp_cache_add_global_groups' ) ) {
wp_cache_add_global_groups( array( 'blog_meta', 'blog-transient' ) );
}
}
/**
* Return the path to the plugin's root file
*
* @since 1.0.0
*
* @return string
*/
function wp_blog_meta_get_plugin_file() {
return __FILE__;
}
/**
* Return the path to the plugin's directory
*
* @since 1.0.0
*
* @return string
*/
function wp_blog_meta_get_plugin_path() {
return dirname( wp_blog_meta_get_plugin_file() ) . '/wp-blog-meta/';
}
/**
* Return the plugin's URL
*
* @since 1.0.0
*
* @return string
*/
function wp_blog_meta_get_plugin_url() {
return plugin_dir_url( wp_blog_meta_get_plugin_file() ) . 'wp-blog-meta/';
}
/**
* Return the asset version
*
* @since 1.0.0
*
* @return int
*/
function wp_blog_meta_get_asset_version() {
return 201609100001;
}