-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathplugin.php
More file actions
53 lines (47 loc) · 1.74 KB
/
plugin.php
File metadata and controls
53 lines (47 loc) · 1.74 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
<?php
/*
Plugin Name: Styles: Font Menu
Plugin URI: http://github.com/stylesplugin/styles-font-menu
Description: Display an up-to-date menu of Google Fonts. Include it in your own plugins and themes, or install as a plugin for testing and a live demo. Uses the Chosen library to allow menu search and styles.
Version: 1.0.2
Author: Brainstorm Media
Author URI: http://brainstormmedia.com
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
/**
* Only include library in admin by default. Override with the filter
*
* @example add_filter( 'styles_font_menu_include_on_frontend', '__return_true' );
*/
if (
apply_filters( 'styles_font_menu_include_on_frontend', is_admin() )
&& !class_exists( 'SFM_Plugin' )
&& version_compare( $GLOBALS['wp_version'], '3.4', '>=' )
) {
require_once dirname( __FILE__ ) . '/classes/sfm-plugin.php';
if ( did_action( 'init' ) ) {
SFM_Plugin::get_instance();
}else {
add_action( 'init', 'SFM_Plugin::get_instance' );
}
}else if (
version_compare( $GLOBALS['wp_version'], '3.4', '<' )
&& apply_filters( 'styles_font_menu_exit_on_php_version_error', true )
&& !function_exists( 'styles_font_menu_wp_version_notice' )
) {
/**
* Exit and warn by default. Use the filter to disable exiting,
* or add your own behavior and return false.
*
* @example add_filter( 'styles_font_menu_include_on_frontend', '__return_false' );
*/
function styles_font_menu_wp_version_notice() {
echo sprintf(
'<div class="error"><p>%s<a href="http://codex.wordpress.org/Upgrading_WordPress">%s</a></p></div>',
__( 'Styles Font Menu requires WordPress 3.4 or newer.', 'styles-font-menu' ),
__( 'Please update.', 'styles-font-menu' )
);
}
add_action( 'admin_notices', 'styles_font_menu_wp_version_notice' );
}