-
Notifications
You must be signed in to change notification settings - Fork 1
/
kwik-framework.php
56 lines (45 loc) · 1.77 KB
/
kwik-framework.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
<?php
/**
* Plugin Name: Kwik Framework
* Plugin URI: http://kevinchappell.github.io/kwik-framework/
* Description: Reusable utilities and inputs to aid in WordPress theme and plugin creation
* Author: Kevin Chappell
* Version: 0.5.7
* Author URI: http://kevin-chappell.com
*/
if ( ! class_exists( 'KwikUtils' ) ) {
define( 'KF_BASENAME', basename( dirname( __FILE__ ) ) );
define( 'KF_FUNC', preg_replace( '/-/', '_', KF_BASENAME ) );
define( 'KF_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );
define( 'KF_PATH', untrailingslashit( dirname( __FILE__ ) ) );
define( 'KF_CACHE', trailingslashit( dirname( __FILE__ ) ) . 'cache' );
define( 'KF_PREFIX', 'kf_' );
foreach ( glob( KF_PATH . '/inc/*.php' ) as $inc_filename ) {
include $inc_filename;
}
foreach ( glob( KF_PATH . '/components/*.php' ) as $component_filename ) {
include $component_filename;
}
// Load Widgets
foreach ( glob( KF_PATH . '/widgets/*.php' ) as $widget_filename ) {
include $widget_filename;
}
if ( ! file_exists( KF_CACHE ) ) {
mkdir( KF_CACHE, 0755, true );
}
/**
* Enqueues scripts and styles for admin screens
* @category scripts_and_styles
* @since KwikFramework .1
*/
function kf_admin_js_css( $hook ) {
wp_enqueue_style( 'kwik-framework-resource', KF_URL . '/css/' . KF_PREFIX . 'resource.css', false, '2014-10-28' );
wp_enqueue_style( 'kwik-framework-admin', KF_URL . '/css/' . KF_PREFIX . 'admin.css', false, '2014-10-28' );
wp_enqueue_script( 'kwik-framework-admin', KF_URL . '/js/' . KF_PREFIX . 'admin.js', array( 'jquery' ), null, true );
}
add_action( 'admin_enqueue_scripts', 'kf_admin_js_css' );
function kf_scripts() {
wp_enqueue_style( 'kf-style', KF_URL . '/css/' . KF_PREFIX . 'style.css' );
}
add_action( 'wp_enqueue_scripts', 'kf_scripts' );
}