-
Notifications
You must be signed in to change notification settings - Fork 28
/
gistpress.php
92 lines (84 loc) · 2.64 KB
/
gistpress.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
<?php
/**
* GistPress
*
* @package GistPress
* @author Brady Vercher <[email protected]>
* @author Gary Jones <[email protected]>
* @copyright Copyright (c) 2013, Blazer Six, Inc.
* @license GPL-2.0+
*
* @wordpress-plugin
* Plugin Name: GistPress
* Plugin URI: https://github.com/bradyvercher/gistpress
* Description: Gist oEmbed and shortcode support with caching.
* Version: 3.0.3
* Author: Blazer Six
* Author URI: http://www.blazersix.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: gistpress
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/bradyvercher/gistpress
* GitHub Branch: master
*/
// Instantiate main plugin class.
if ( ! class_exists( 'GistPress' ) ) {
require( plugin_dir_path( __FILE__ ) . 'includes/class-gistpress.php' );
}
$GLOBALS['gistpress'] = new GistPress;
// Instantiate logging class.
if ( ! class_exists( 'GistPress_Log' ) ) {
require( plugin_dir_path( __FILE__ ) . 'includes/class-gistpress-log.php' );
}
$GLOBALS['gistpress_logger'] = new GistPress_Log;
/**
* Support localization for plugin.
*
* @see http://www.geertdedeckere.be/article/loading-wordpress-language-files-the-right-way
*
* @since 1.1.0
*/
function gistpress_i18n() {
$domain = 'gistpress';
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages' );
}
add_action( 'init', 'gistpress_i18n' );
/**
* Set plugin logger class and initialise plugin.
*
* If you want a different logger class, then unhook this function, and hook
* in your own which does what you need.
*
* @since 1.1.0
*/
function gistpress_init() {
global $gistpress, $gistpress_logger;
if ( $gistpress instanceof GistPress ) {
$gistpress->set_logger( $gistpress_logger );
$gistpress->run();
}
}
add_action( 'init', 'gistpress_init' );
/**
* Add instance of our debug bar panel to Debug Bar plugin if not in the admin.
*
* @since 1.1.0
*
* @param array $panels
*
* @return array Debug Bar panels.
*/
function gistpress_add_debug_bar_panel( array $panels ) {
global $gistpress_logger;
if ( ! is_admin() ) {
if ( ! class_exists( 'GistPress_Debug_Bar_Panel' ) ) {
require( plugin_dir_path( __FILE__ ) . 'includes/class-gistpress-debug-bar-panel.php' );
}
$panels[] = new GistPress_Debug_Bar_Panel( $gistpress_logger );
}
return $panels;
}
add_filter( 'debug_bar_panels', 'gistpress_add_debug_bar_panel' );