-
Notifications
You must be signed in to change notification settings - Fork 0
/
wider-flux-layout.php
122 lines (86 loc) · 2.53 KB
/
wider-flux-layout.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
115
116
117
118
119
120
121
122
<?php
/*
Plugin Name: WP Flux Layout
Plugin URI: http://wider.co.uk
Description: Adds Flux Layout responsive CSS framework to your WordPress site. Configure options through the WordPress Customizer (View website -> Top Admin Bar -> Customize).
Author: Jonny Allbut
Version: 0.3
Author URI: https://jonnya.net
*/
/*
Text domain for translation: wp-flux-layout
///////// VERSION HISTORY
0.1 - Initial work-in-progress
0.2 - Main Wonderflux options working in Customizer (whoot!)
0.3 - More Wonderflux options, refactor code and enqueue Flux Layout files
*/
/**
*
* Setup text domain for translation
* Same name as plugin directory
*
*/
add_action( 'plugins_loaded', 'wider_fluxl_textdom') ;
function wider_fluxl_textdom() {
load_plugin_textdomain( 'wp-flux-layout', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
}
/**
*
* Deploy Flux Layout CSS
*
*/
add_action( 'wp_enqueue_scripts', 'wider_fluxl_css' );
function wider_fluxl_css() {
if ( !is_admin() ) {
new wider_flux_layout;
}
}
/**
*
* Customizer controls
*
*/
add_action( 'after_setup_theme','wider_fluxl_customizer', 1 );
function wider_fluxl_customizer() {
if ( ( is_user_logged_in() && is_customize_preview() ) && current_user_can( 'edit_theme_options' ) ) {
new wider_flux_layout_customizer;
}
}
class wider_flux_layout {
var $version = 0.3; /* Plugin version */
var $defaults = false; /* Holds default values for all options */
var $db_key = 'wp_flux_layout'; /* Sets up option_name, switch to Wonderflux options if required */
var $datatype = 'theme_mod'; /* How data is saved - theme_mod or option for Wonderflux */
var $default_vals = array(
'columns_num' => 16,
'container_w' => 80,
'container_p' => 'middle',
'rwd_full' => 'small',
'content_s' => 'three_quarter',
'sidebar_s' => 'quarter',
'sidebar_d' => 'Y',
'sidebar_p' => 'left',
'content_s_px' => '400',
'page_t' => '',
'doc_type' => 'transitional',
'doc_lang' => 'en'
);
function __construct() {
// WORK IN PROGRESS - Wonderflux theme framework options integration, cute!
if ( class_exists( 'wflux_theme_all' ) ) {
$this->db_key = 'wonderflux_display';
$this->datatype = 'option';
// Added as a plugin, need Flux Layout!
} else {
include_once( plugin_dir_path( __FILE__ ) . '/wider-flux-css.php' );
new flux_layout_css;
}
}
}
class wider_flux_layout_customizer {
function __construct() {
include_once( plugin_dir_path( __FILE__ ) . '/wider-flux-customizer.php' );
new flux_layout_customizer;
}
}
?>