-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-style-guide.php
114 lines (88 loc) · 2.84 KB
/
wp-style-guide.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
* WP Style Guide: creates a style guide for designers and their clients.
*
* @package WP Style Guide
* @author Slushman <[email protected]>
* @copyright Copyright (c) 2016, Slushman
* @license GPL-2.0+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* @link http://slushman.com/plugins/wp-style-guide
* @version 0.1
*
* @wordpress-plugin
* Plugin Name: WP Style Guide
* Plugin URI: http://slushman.com/plugins/wp-style-guide
* Description: Creates a style guide for designers and their clients.
* Version: 0.1
* Author: Slushman
* Author URI: http://slushman.com
* Text Domain: wp-style-guide
* Domain Path: /languages
* Github Plugin URI: https://github.com/slushman/wp-style-guide
*
* @todo Add WP photo gallery - maybe multiple columns layouts
* @todo Add navigation - older/newer, post navi, numbered, etc
* @todo Add breadcrumbs, jetpack breadcrumbs, Yoast Breadcrumbs, etc
* @todo Add sidebar with all default WP widgets
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) { die; }
/**
* Define constants
*/
define( 'WPSTYLEGUIDE_VERSION', '1.0.0' );
define( 'WPSTYLEGUIDE_SLUG', 'wp-style-guide' );
define( 'WPSTYLEGUIDE_FILE', plugin_basename( __FILE__ ) );
/**
* Activation/Deactivation Hooks
*/
register_activation_hook( __FILE__, array( 'WP_Style_Guide_Activator', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'WP_Style_Guide_Deactivator', 'deactivate' ) );
/**
* Autoloader function
*
* Will search both plugin root and includes folder for class
*
* @param string $class_name
*/
if ( ! function_exists( 'wp_style_guide_autoloader' ) ) :
function wp_style_guide_autoloader( $class_name ) {
$class_name = str_replace( 'WP_Style_Guide_', '', $class_name );
$lower = strtolower( $class_name );
$file = 'class-' . str_replace( '_', '-', $lower ) . '.php';
$base_path = plugin_dir_path( __FILE__ );
$paths[] = $base_path . $file;
$paths[] = $base_path . 'classes/' . $file;
/**
* wp_style_guide_autoloader_paths filter
*/
$paths = apply_filters( 'wp-style-guide-autoloader-paths', $paths );
foreach ( $paths as $path ) :
if ( is_readable( $path ) && file_exists( $path ) ) {
require_once( $path );
return;
}
endforeach;
} // wp_style_guide_autoloader()
endif;
spl_autoload_register( 'wp_style_guide_autoloader' );
if ( ! function_exists( 'wp_style_guide' ) ) :
/**
* Function wrapper to get instance of plugin
*
* @return WP_Style_Guide
*/
function wp_style_guide() {
return WP_Style_Guide::get_instance();
} // wp_style_guide()
endif;
if ( ! function_exists( 'wp_style_guide_init' ) ) :
/**
* Function to initialize plugin
*/
function wp_style_guide_init() {
wp_style_guide()->run();
}
add_action( 'plugins_loaded', 'wp_style_guide_init' );
endif;