wordpress-starter 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +1 -0
- data/LICENSE +20 -0
- data/README.md +34 -0
- data/lib/wordpress-starter.rb +29 -0
- data/stylesheets/_wordpress.scss +9 -0
- data/stylesheets/wordpress/_base.scss +74 -0
- data/stylesheets/wordpress/_defaults.scss +28 -0
- data/stylesheets/wordpress/_layout.scss +56 -0
- data/stylesheets/wordpress/_mixins.scss +57 -0
- data/stylesheets/wordpress/_page.scss +364 -0
- data/stylesheets/wordpress/_responsive.scss +231 -0
- data/stylesheets/wordpress/_theme.scss +83 -0
- data/stylesheets/wordpress/_typography.scss +135 -0
- data/stylesheets/wordpress/_utils.scss +64 -0
- data/templates/project/ie.scss +1 -0
- data/templates/project/manifest.rb +21 -0
- data/templates/project/print.css +4 -0
- data/templates/project/print.scss +104 -0
- data/templates/project/readme.txt +1 -0
- data/templates/project/screen.scss +1 -0
- data/templates/project/style.css +13 -0
- data/templates/starter/404.php +24 -0
- data/templates/starter/admin/README.txt +25 -0
- data/templates/starter/admin/assets/css/admin-style.css +838 -0
- data/templates/starter/admin/assets/css/colorpicker.css +177 -0
- data/templates/starter/admin/assets/images/1col.png +0 -0
- data/templates/starter/admin/assets/images/2-col-portfolio.png +0 -0
- data/templates/starter/admin/assets/images/2cl.png +0 -0
- data/templates/starter/admin/assets/images/2cr.png +0 -0
- data/templates/starter/admin/assets/images/3-col-portfolio.png +0 -0
- data/templates/starter/admin/assets/images/3cm.png +0 -0
- data/templates/starter/admin/assets/images/3cr.png +0 -0
- data/templates/starter/admin/assets/images/4-col-portfolio.png +0 -0
- data/templates/starter/admin/assets/images/accept.png +0 -0
- data/templates/starter/admin/assets/images/button_check.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/blank.gif +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_background.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_hex.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_hsb_b.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_hsb_h.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_hsb_s.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_indic.gif +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_overlay.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_rgb_b.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_rgb_g.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_rgb_r.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_select.gif +0 -0
- data/templates/starter/admin/assets/images/colorpicker/colorpicker_submit.png +0 -0
- data/templates/starter/admin/assets/images/colorpicker/select.png +0 -0
- data/templates/starter/admin/assets/images/dropdown-arrow.png +0 -0
- data/templates/starter/admin/assets/images/favicon.ico +0 -0
- data/templates/starter/admin/assets/images/icon-add.png +0 -0
- data/templates/starter/admin/assets/images/icon-backup.png +0 -0
- data/templates/starter/admin/assets/images/icon-delete.png +0 -0
- data/templates/starter/admin/assets/images/icon-docs.png +0 -0
- data/templates/starter/admin/assets/images/icon-edit.png +0 -0
- data/templates/starter/admin/assets/images/icon-home.png +0 -0
- data/templates/starter/admin/assets/images/icon-info.png +0 -0
- data/templates/starter/admin/assets/images/icon-notice.png +0 -0
- data/templates/starter/admin/assets/images/icon-paint.png +0 -0
- data/templates/starter/admin/assets/images/icon-settings.png +0 -0
- data/templates/starter/admin/assets/images/icon-slider.png +0 -0
- data/templates/starter/admin/assets/images/icon-warn.png +0 -0
- data/templates/starter/admin/assets/images/icon_option.png +0 -0
- data/templates/starter/admin/assets/images/loading-bottom.gif +0 -0
- data/templates/starter/admin/assets/images/select.png +0 -0
- data/templates/starter/admin/assets/images/sign_warning.png +0 -0
- data/templates/starter/admin/assets/images/stop.png +0 -0
- data/templates/starter/admin/assets/images/toggle_tabs.png +0 -0
- data/templates/starter/admin/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/templates/starter/admin/assets/images/warning.png +0 -0
- data/templates/starter/admin/assets/images/wrench.png +0 -0
- data/templates/starter/admin/assets/images/wrench16.png +0 -0
- data/templates/starter/admin/assets/js/ajaxupload.js +606 -0
- data/templates/starter/admin/assets/js/colorpicker.js +455 -0
- data/templates/starter/admin/assets/js/cookie.js +1 -0
- data/templates/starter/admin/assets/js/jquery.maskedinput-1.2.2.js +252 -0
- data/templates/starter/admin/assets/js/jquery.tipsy.js +241 -0
- data/templates/starter/admin/assets/js/of-medialibrary-uploader.js +168 -0
- data/templates/starter/admin/assets/js/smof.js +623 -0
- data/templates/starter/admin/classes/class.options-machine.php +627 -0
- data/templates/starter/admin/front-end/options.php +77 -0
- data/templates/starter/admin/functions/functions.admin.php +76 -0
- data/templates/starter/admin/functions/functions.interface.php +232 -0
- data/templates/starter/admin/functions/functions.load.php +14 -0
- data/templates/starter/admin/functions/functions.mediauploader.php +194 -0
- data/templates/starter/admin/functions/functions.options.php +507 -0
- data/templates/starter/admin/functions/functions.php +0 -0
- data/templates/starter/admin/index.php +86 -0
- data/templates/starter/admin/layouts/default.css +0 -0
- data/templates/starter/admin/layouts/placebo.css +0 -0
- data/templates/starter/app.js +97 -0
- data/templates/starter/archive.php +57 -0
- data/templates/starter/category.php +40 -0
- data/templates/starter/comments.php +65 -0
- data/templates/starter/content-aside.php +26 -0
- data/templates/starter/content-image.php +29 -0
- data/templates/starter/content-link.php +27 -0
- data/templates/starter/content-none.php +21 -0
- data/templates/starter/content-page.php +24 -0
- data/templates/starter/content-quote.php +26 -0
- data/templates/starter/content-status.php +33 -0
- data/templates/starter/content.php +67 -0
- data/templates/starter/editor-style.scss +359 -0
- data/templates/starter/footer.php +29 -0
- data/templates/starter/functions.php +1211 -0
- data/templates/starter/header.php +63 -0
- data/templates/starter/ie.scss +1 -0
- data/templates/starter/images/bg/bg0.png +0 -0
- data/templates/starter/images/bg/bg1.png +0 -0
- data/templates/starter/images/bg/bg10.png +0 -0
- data/templates/starter/images/bg/bg11.png +0 -0
- data/templates/starter/images/bg/bg2.png +0 -0
- data/templates/starter/images/bg/bg3.png +0 -0
- data/templates/starter/images/bg/bg4.png +0 -0
- data/templates/starter/images/bg/bg5.png +0 -0
- data/templates/starter/images/bg/bg6.jpg +0 -0
- data/templates/starter/images/bg/bg7.jpg +0 -0
- data/templates/starter/images/bg/bg8.png +0 -0
- data/templates/starter/images/bg/bg9.png +0 -0
- data/templates/starter/index.php +19 -0
- data/templates/starter/loop.php +30 -0
- data/templates/starter/manifest.rb +149 -0
- data/templates/starter/moderninzr.min.js +4 -0
- data/templates/starter/options.php +407 -0
- data/templates/starter/page.php +29 -0
- data/templates/starter/print.scss +104 -0
- data/templates/starter/readme.txt +1 -0
- data/templates/starter/screen.scss +1 -0
- data/templates/starter/search.php +31 -0
- data/templates/starter/search.png +0 -0
- data/templates/starter/searchform.php +14 -0
- data/templates/starter/sidebar.php +15 -0
- data/templates/starter/single.php +31 -0
- data/templates/starter/style.css +13 -0
- data/templates/starter/tag.php +41 -0
- metadata +230 -0
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* SMOF Options Machine Class
|
|
4
|
+
*
|
|
5
|
+
* @package WordPress
|
|
6
|
+
* @subpackage SMOF
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
* @author Syamil MJ
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
class Options_Machine {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* PHP5 contructor
|
|
15
|
+
*
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
function __construct( $options ) {
|
|
19
|
+
|
|
20
|
+
$return = $this->optionsframework_machine( $options );
|
|
21
|
+
|
|
22
|
+
$this->Inputs = $return[0];
|
|
23
|
+
$this->Menu = $return[1];
|
|
24
|
+
$this->Defaults = $return[2];
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Process options data and build option fields
|
|
31
|
+
*
|
|
32
|
+
* @uses get_option()
|
|
33
|
+
*
|
|
34
|
+
* @access public
|
|
35
|
+
* @since 1.0.0
|
|
36
|
+
*
|
|
37
|
+
* @return array
|
|
38
|
+
*/
|
|
39
|
+
public static function optionsframework_machine( $options ) {
|
|
40
|
+
|
|
41
|
+
$data = get_option( OPTIONS );
|
|
42
|
+
|
|
43
|
+
$defaults = array();
|
|
44
|
+
$counter = 0;
|
|
45
|
+
$menu = $output = '';
|
|
46
|
+
|
|
47
|
+
foreach ( $options as $value ) {
|
|
48
|
+
$counter++;
|
|
49
|
+
$val = '';
|
|
50
|
+
|
|
51
|
+
//create array of defaults
|
|
52
|
+
if ( $value['type'] == 'multicheck' ) {
|
|
53
|
+
if ( is_array( $value['std'] ) ) {
|
|
54
|
+
foreach ( $value['std'] as $i => $key ) {
|
|
55
|
+
$defaults[$value['id']][$key] = true;
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
$defaults[$value['id']][$value['std']] = true;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
if ( isset( $value['id'] ) ) $defaults[$value['id']] = $value['std'];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//Start Heading
|
|
65
|
+
if ( $value['type'] != 'heading' ) {
|
|
66
|
+
$class = '';
|
|
67
|
+
if ( isset( $value['class'] ) ) {
|
|
68
|
+
$class = $value['class'];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//hide items in checkbox group
|
|
72
|
+
$fold = '';
|
|
73
|
+
if ( array_key_exists( 'fold', $value ) ) {
|
|
74
|
+
if ( $data[$value['fold']] ) {
|
|
75
|
+
$fold = 'f_'.$value['fold'].' ';
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
$fold = 'f_'.$value['fold'].' temphide ';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
$output .= '<div id="section-'.$value['id'].'" class="'.$fold.'section section-'.$value['type'].' '. $class .'">'."\n";
|
|
83
|
+
|
|
84
|
+
//only show header if 'name' value exists
|
|
85
|
+
if ( $value['name'] ) $output .= '<h3 class="heading">'. $value['name'] .'</h3>'."\n";
|
|
86
|
+
|
|
87
|
+
$output .= '<div class="option">'."\n" . '<div class="controls">'."\n";
|
|
88
|
+
}
|
|
89
|
+
//End Heading
|
|
90
|
+
|
|
91
|
+
//switch statement to handle various options type
|
|
92
|
+
switch ( $value['type'] ) {
|
|
93
|
+
//text input
|
|
94
|
+
case 'text':
|
|
95
|
+
$t_value = '';
|
|
96
|
+
$t_value = stripslashes( $data[$value['id']] );
|
|
97
|
+
|
|
98
|
+
$mini = '';
|
|
99
|
+
if ( ! isset( $value['mod'] ) ) $value['mod'] = '';
|
|
100
|
+
if ( $value['mod'] == 'mini' ) {
|
|
101
|
+
$mini = 'mini';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
$output .= '<input class="of-input '.$mini.'" name="'.$value['id'].'" id="'. $value['id'] .'" type="'. $value['type'] .'" value="'. $t_value .'" />';
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
//select option
|
|
108
|
+
case 'select':
|
|
109
|
+
$mini = '';
|
|
110
|
+
if ( ! isset( $value['mod'] ) ) $value['mod'] = '';
|
|
111
|
+
if ( $value['mod'] == 'mini' ) {
|
|
112
|
+
$mini = 'mini';
|
|
113
|
+
}
|
|
114
|
+
$output .= '<div class="select_wrapper ' . $mini . '">';
|
|
115
|
+
$output .= '<select class="select of-input" name="'.$value['id'].'" id="'. $value['id'] .'">';
|
|
116
|
+
foreach ( $value['options'] as $select_ID => $option ) {
|
|
117
|
+
$output .= '<option id="' . $select_ID . '" value="'.$option.'" ' . selected( $data[$value['id']], $option, false ) . ' />'.$option.'</option>';
|
|
118
|
+
}
|
|
119
|
+
$output .= '</select></div>';
|
|
120
|
+
break;
|
|
121
|
+
//textarea option
|
|
122
|
+
case 'textarea':
|
|
123
|
+
$cols = '8';
|
|
124
|
+
$ta_value = '';
|
|
125
|
+
|
|
126
|
+
if ( isset( $value['options'] ) ) {
|
|
127
|
+
$ta_options = $value['options'];
|
|
128
|
+
if ( isset( $ta_options['cols'] ) ) {
|
|
129
|
+
$cols = $ta_options['cols'];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
$ta_value = stripslashes( $data[$value['id']] );
|
|
134
|
+
$output .= '<textarea class="of-input" name="'.$value['id'].'" id="'. $value['id'] .'" cols="'. $cols .'" rows="8">'.$ta_value.'</textarea>';
|
|
135
|
+
break;
|
|
136
|
+
//radiobox option
|
|
137
|
+
case 'radio':
|
|
138
|
+
foreach ( $value['options'] as $option => $name ) {
|
|
139
|
+
$output .= '<input class="of-input of-radio" name="'.$value['id'].'" type="radio" value="'.$option.'" ' . checked( $data[$value['id']], $option, false ) . ' /><label class="radio">'.$name.'</label><br/>';
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
|
|
143
|
+
//checkbox option
|
|
144
|
+
case 'checkbox':
|
|
145
|
+
if ( ! isset( $data[$value['id']] ) ) {
|
|
146
|
+
$data[$value['id']] = 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
$fold = '';
|
|
150
|
+
if ( array_key_exists( 'folds', $value ) )
|
|
151
|
+
$fold = 'fld ';
|
|
152
|
+
|
|
153
|
+
$output .= '<input type="hidden" class="'.$fold.'checkbox aq-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="0"/>';
|
|
154
|
+
$output .= '<input type="checkbox" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="1" '. checked( $data[$value['id']], 1, false ) .' />';
|
|
155
|
+
break;
|
|
156
|
+
|
|
157
|
+
//multiple checkbox option
|
|
158
|
+
case 'multicheck':
|
|
159
|
+
$multi_stored = $data[$value['id']];
|
|
160
|
+
|
|
161
|
+
foreach ( $value['options'] as $key => $option ) {
|
|
162
|
+
if ( !isset( $multi_stored[$key] ) ) {
|
|
163
|
+
$multi_stored[$key] = '';
|
|
164
|
+
}
|
|
165
|
+
$of_key_string = $value['id'] . '_' . $key;
|
|
166
|
+
$output .= '<input type="checkbox" class="checkbox of-input" name="'.$value['id'].'['.$key.']'.'" id="'. $of_key_string .'" value="1" '. checked( $multi_stored[$key], 1, false ) .' /><label class="multicheck" for="'. $of_key_string .'">'. $option .'</label><br />';
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
//ajax image upload option
|
|
170
|
+
case 'upload':
|
|
171
|
+
if ( !isset( $value['mod'] ) ) $value['mod'] = '';
|
|
172
|
+
$output .= Options_Machine::optionsframework_uploader_function( $value['id'], $value['std'], $value['mod'] );
|
|
173
|
+
break;
|
|
174
|
+
// native media library uploader - @uses optionsframework_media_uploader_function()
|
|
175
|
+
case 'media':
|
|
176
|
+
$_id = strip_tags( strtolower( $value['id'] ) );
|
|
177
|
+
$int = '';
|
|
178
|
+
$int = optionsframework_mlu_get_silentpost( $_id );
|
|
179
|
+
if ( ! isset( $value['mod'] ) )
|
|
180
|
+
$value['mod'] = '';
|
|
181
|
+
$output .= Options_Machine::optionsframework_media_uploader_function( $value['id'], $value['std'], $int, $value['mod'] ); // New AJAX Uploader using Media Library
|
|
182
|
+
break;
|
|
183
|
+
|
|
184
|
+
//colorpicker option
|
|
185
|
+
case 'color':
|
|
186
|
+
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: '.$data[$value['id']].'"></div></div>';
|
|
187
|
+
$output .= '<input class="of-color" name="'.$value['id'].'" id="'. $value['id'] .'" type="text" value="'. $data[$value['id']] .'" />';
|
|
188
|
+
break;
|
|
189
|
+
|
|
190
|
+
//typography option
|
|
191
|
+
case 'typography':
|
|
192
|
+
$typography_stored = isset( $data[$value['id']] ) ? $data[$value['id']] : $value['std'];
|
|
193
|
+
/* Font Size */
|
|
194
|
+
if ( isset( $typography_stored['size'] ) ) {
|
|
195
|
+
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
|
|
196
|
+
$output .= '<select class="of-typography of-typography-size select" name="'.$value['id'].'[size]" id="'. $value['id'].'_size">';
|
|
197
|
+
for ( $i = 9; $i < 20; $i++ ) {
|
|
198
|
+
$test = $i.'px';
|
|
199
|
+
$output .= '<option value="'. $i .'px" ' . selected( $typography_stored['size'], $test, false ) . '>'. $i .'px</option>';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
$output .= '</select></div>';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* Line Height */
|
|
206
|
+
if ( isset( $typography_stored['height'] ) ) {
|
|
207
|
+
$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
|
|
208
|
+
$output .= '<select class="of-typography of-typography-height select" name="'.$value['id'].'[height]" id="'. $value['id'].'_height">';
|
|
209
|
+
for ( $i = 20; $i < 38; $i++ ) {
|
|
210
|
+
$test = $i.'px';
|
|
211
|
+
$output .= '<option value="'. $i .'px" ' . selected( $typography_stored['height'], $test, false ) . '>'. $i .'px</option>';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
$output .= '</select></div>';
|
|
215
|
+
}
|
|
216
|
+
/* Font Face */
|
|
217
|
+
if ( isset( $typography_stored['face'] ) ) {
|
|
218
|
+
$output .= '<div class="select_wrapper typography-face" original-title="Font family">';
|
|
219
|
+
$output .= '<select class="of-typography of-typography-face select" name="'.$value['id'].'[face]" id="'. $value['id'].'_face">';
|
|
220
|
+
$faces = array(
|
|
221
|
+
'arial' => 'Arial',
|
|
222
|
+
'verdana' => 'Verdana, Geneva',
|
|
223
|
+
'trebuchet' => 'Trebuchet',
|
|
224
|
+
'georgia' => 'Georgia',
|
|
225
|
+
'times' => 'Times New Roman',
|
|
226
|
+
'tahoma' => 'Tahoma, Geneva',
|
|
227
|
+
'palatino' => 'Palatino',
|
|
228
|
+
'helvetica' => 'Helvetica',
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
foreach ( $faces as $i => $face ) {
|
|
232
|
+
$output .= '<option value="'. $i .'" ' . selected( $typography_stored['face'], $i, false ) . '>'. $face .'</option>';
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
$output .= '</select></div>';
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* Font Weight */
|
|
239
|
+
if ( isset( $typography_stored['style'] ) ) {
|
|
240
|
+
$output .= '<div class="select_wrapper typography-style" original-title="Font style">';
|
|
241
|
+
$output .= '<select class="of-typography of-typography-style select" name="'.$value['id'].'[style]" id="'. $value['id'].'_style">';
|
|
242
|
+
$styles = array(
|
|
243
|
+
'normal' => 'Normal',
|
|
244
|
+
'italic' => 'Italic',
|
|
245
|
+
'bold' => 'Bold',
|
|
246
|
+
'bold italic' => 'Bold Italic',
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
foreach ( $styles as $i => $style ) {
|
|
250
|
+
$output .= '<option value="'. $i .'" ' . selected( $typography_stored['style'], $i, false ) . '>'. $style .'</option>';
|
|
251
|
+
}
|
|
252
|
+
$output .= '</select></div>';
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Font Color */
|
|
256
|
+
if ( isset( $typography_stored['color'] ) ) {
|
|
257
|
+
$output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: '.$typography_stored['color'].'"></div></div>';
|
|
258
|
+
$output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="'.$value['id'].'[color]" id="'. $value['id'] .'_color" type="text" value="'. $typography_stored['color'] .'" />';
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
// border option
|
|
262
|
+
case 'border':
|
|
263
|
+
/* Border Width */
|
|
264
|
+
$border_stored = $data[$value['id']];
|
|
265
|
+
$output .= '<div class="select_wrapper border-width">';
|
|
266
|
+
$output .= '<select class="of-border of-border-width select" name="'.$value['id'].'[width]" id="'. $value['id'].'_width">';
|
|
267
|
+
for ( $i = 0; $i < 21; $i++ ) {
|
|
268
|
+
$output .= '<option value="'. $i .'" ' . selected( $border_stored['width'], $i, false ) . '>'. $i .'</option>';
|
|
269
|
+
}
|
|
270
|
+
$output .= '</select></div>';
|
|
271
|
+
|
|
272
|
+
/* Border Style */
|
|
273
|
+
$output .= '<div class="select_wrapper border-style">';
|
|
274
|
+
$output .= '<select class="of-border of-border-style select" name="'.$value['id'].'[style]" id="'. $value['id'].'_style">';
|
|
275
|
+
|
|
276
|
+
$styles = array(
|
|
277
|
+
'none' => 'None',
|
|
278
|
+
'solid' => 'Solid',
|
|
279
|
+
'dashed' => 'Dashed',
|
|
280
|
+
'dotted' => 'Dotted',
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
foreach ( $styles as $i => $style ) {
|
|
284
|
+
$output .= '<option value="'. $i .'" ' . selected( $border_stored['style'], $i, false ) . '>'. $style .'</option>';
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
$output .= '</select></div>';
|
|
288
|
+
|
|
289
|
+
/* Border Color */
|
|
290
|
+
$output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: '.$border_stored['color'].'"></div></div>';
|
|
291
|
+
$output .= '<input class="of-color of-border of-border-color" name="'.$value['id'].'[color]" id="'. $value['id'] .'_color" type="text" value="'. $border_stored['color'] .'" />';
|
|
292
|
+
break;
|
|
293
|
+
// images checkbox - use image as checkboxes
|
|
294
|
+
case 'images':
|
|
295
|
+
$i = 0;
|
|
296
|
+
$select_value = $data[$value['id']];
|
|
297
|
+
|
|
298
|
+
foreach ( $value['options'] as $key => $option ) {
|
|
299
|
+
$i++;
|
|
300
|
+
|
|
301
|
+
$checked = $selected = '';
|
|
302
|
+
if ( NULL != checked( $select_value, $key, false ) ) {
|
|
303
|
+
$checked = checked( $select_value, $key, false );
|
|
304
|
+
$selected = 'of-radio-img-selected';
|
|
305
|
+
}
|
|
306
|
+
$output .= '<span>';
|
|
307
|
+
$output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="'.$key.'" name="'.$value['id'].'" '.$checked.' />';
|
|
308
|
+
$output .= '<div class="of-radio-img-label">'. $key .'</div>';
|
|
309
|
+
$output .= '<img src="'.$option.'" alt="" class="of-radio-img-img '. $selected .'" onClick="document.getElementById(\'of-radio-img-'. $value['id'] . $i.'\').checked = true;" />';
|
|
310
|
+
$output .= '</span>';
|
|
311
|
+
}
|
|
312
|
+
break;
|
|
313
|
+
// info (for small intro box etc)
|
|
314
|
+
case 'info':
|
|
315
|
+
$info_text = $value['std'];
|
|
316
|
+
$output .= '<div class="of-info">'.$info_text.'</div>';
|
|
317
|
+
break;
|
|
318
|
+
// display a single image
|
|
319
|
+
case 'image':
|
|
320
|
+
$src = $value['std'];
|
|
321
|
+
$output .= '<img src="'.$src.'">';
|
|
322
|
+
break;
|
|
323
|
+
// tab heading
|
|
324
|
+
case 'heading':
|
|
325
|
+
if ( $counter >= 2 ) {
|
|
326
|
+
$output .= '</div>'."\n";
|
|
327
|
+
}
|
|
328
|
+
$header_class = str_replace( ' ', '', strtolower( $value['name'] ) );
|
|
329
|
+
$jquery_click_hook = str_replace( ' ', '', strtolower( $value['name'] ) );
|
|
330
|
+
$jquery_click_hook = 'of-option-' . $jquery_click_hook;
|
|
331
|
+
$menu .= '<li class="'. $header_class .'"><a title="'. $value['name'] .'" href="#'. $jquery_click_hook .'">'. $value['name'] .'</a></li>';
|
|
332
|
+
$output .= '<div class="group" id="'. $jquery_click_hook .'"><h2>'.$value['name'].'</h2>'."\n";
|
|
333
|
+
break;
|
|
334
|
+
// drag & drop slide manager
|
|
335
|
+
case 'slider':
|
|
336
|
+
$_id = strip_tags( strtolower( $value['id'] ) );
|
|
337
|
+
$int = '';
|
|
338
|
+
$int = optionsframework_mlu_get_silentpost( $_id );
|
|
339
|
+
$output .= '<div class="slider"><ul id="'.$value['id'].'" rel="'.$int.'">';
|
|
340
|
+
$slides = $data[$value['id']];
|
|
341
|
+
$count = count( $slides );
|
|
342
|
+
if ( $count < 2 ) {
|
|
343
|
+
$oldorder = 1;
|
|
344
|
+
$order = 1;
|
|
345
|
+
$output .= Options_Machine::optionsframework_slider_function( $value['id'], $value['std'], $oldorder, $order, $int );
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
$i = 0;
|
|
349
|
+
foreach ( $slides as $slide ) {
|
|
350
|
+
$oldorder = $slide['order'];
|
|
351
|
+
$i++;
|
|
352
|
+
$order = $i;
|
|
353
|
+
$output .= Options_Machine::optionsframework_slider_function( $value['id'], $value['std'], $oldorder, $order, $int );
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
$output .= '</ul>';
|
|
357
|
+
$output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
|
|
358
|
+
break;
|
|
359
|
+
// drag & drop block manager
|
|
360
|
+
case 'sorter':
|
|
361
|
+
$sortlists = isset( $data[$value['id']] ) && ! empty( $data[$value['id']] ) ? $data[$value['id']] : $value['std'];
|
|
362
|
+
$output .= '<div id="'.$value['id'].'" class="sorter">';
|
|
363
|
+
|
|
364
|
+
if ( $sortlists ) {
|
|
365
|
+
foreach ( $sortlists as $group => $sortlist ) {
|
|
366
|
+
$output .= '<ul id="'.$value['id'].'_'.$group.'" class="sortlist_'.$value['id'].'">';
|
|
367
|
+
$output .= '<h3>'.$group.'</h3>';
|
|
368
|
+
foreach ( $sortlist as $key => $list ) {
|
|
369
|
+
$output .= '<input class="sorter-placebo" type="hidden" name="'.$value['id'].'['.$group.'][placebo]" value="placebo">';
|
|
370
|
+
if ( $key != 'placebo' ) {
|
|
371
|
+
$output .= '<li id="'.$key.'" class="sortee">';
|
|
372
|
+
$output .= '<input class="position" type="hidden" name="'.$value['id'].'['.$group.']['.$key.']" value="'.$list.'">';
|
|
373
|
+
$output .= $list;
|
|
374
|
+
$output .= '</li>';
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
$output .= '</ul>';
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
$output .= '</div>';
|
|
381
|
+
break;
|
|
382
|
+
// background images option
|
|
383
|
+
case 'tiles':
|
|
384
|
+
$i = 0;
|
|
385
|
+
$select_value = isset( $data[$value['id']] ) && !empty( $data[$value['id']] ) ? $data[$value['id']] : '';
|
|
386
|
+
foreach ( $value['options'] as $key => $option ) {
|
|
387
|
+
$i++;
|
|
388
|
+
$checked = $selected = '';
|
|
389
|
+
if ( NULL != checked( $select_value, $option, false ) ) {
|
|
390
|
+
$checked = checked( $select_value, $option, false );
|
|
391
|
+
$selected = 'of-radio-tile-selected';
|
|
392
|
+
}
|
|
393
|
+
$output .= '<span>';
|
|
394
|
+
$output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="'.$option.'" name="'.$value['id'].'" '.$checked.' />';
|
|
395
|
+
$output .= '<div class="of-radio-tile-img '. $selected .'" style="background: url('.$option.')" onClick="document.getElementById(\'of-radio-tile-'. $value['id'] . $i.'\').checked = true;"></div>';
|
|
396
|
+
$output .= '</span>';
|
|
397
|
+
}
|
|
398
|
+
break;
|
|
399
|
+
// backup and restore options data
|
|
400
|
+
case 'backup':
|
|
401
|
+
$instructions = $value['desc'];
|
|
402
|
+
$backup = get_option( BACKUPS );
|
|
403
|
+
if ( !isset( $backup['backup_log'] ) ) {
|
|
404
|
+
$log = 'No backups yet';
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
$log = $backup['backup_log'];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
$output .= '<div class="backup-box">';
|
|
411
|
+
$output .= '<div class="instructions">'.$instructions."\n";
|
|
412
|
+
$output .= '<p><strong>'. __( 'Last Backup : ' ).'<span class="backup-log">'.$log.'</span></strong></p></div>'."\n";
|
|
413
|
+
$output .= '<a href="#" id="of_backup_button" class="button" title="'.__( 'Backup Options', 'starter' ).'">'.__( 'Backup Options', 'starter' ).'</a>';
|
|
414
|
+
$output .= '<a href="#" id="of_restore_button" class="button" title="'.__( 'Restore Options', 'starter' ).'">'.__( 'Restore Options', 'starter' ).'</a>';
|
|
415
|
+
$output .= '</div>';
|
|
416
|
+
break;
|
|
417
|
+
// export or import data between different installs
|
|
418
|
+
case 'transfer':
|
|
419
|
+
$instructions = $value['desc'];
|
|
420
|
+
$output .= '<textarea id="export_data" rows="8">'.base64_encode( serialize( $data ) ) /* 100% safe - ignore theme check nag */ .'</textarea>'."\n";
|
|
421
|
+
$output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">'.__( 'Import Options', 'starter' ).'</a>';
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// description of each option
|
|
426
|
+
if ( $value['type'] != 'heading' ) {
|
|
427
|
+
if ( ! isset( $value['desc'] ) ) {
|
|
428
|
+
$explain_value = '';
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
$explain_value = '<div class="explain">'. $value['desc'] .'</div>'."\n";
|
|
432
|
+
}
|
|
433
|
+
$output .= '</div>'.$explain_value."\n";
|
|
434
|
+
$output .= '<div class="clear"> </div></div></div>'."\n";
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
$output .= '</div>';
|
|
438
|
+
|
|
439
|
+
return array( $output, $menu, $defaults );
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Ajax image uploader - supports various types of image types
|
|
444
|
+
*
|
|
445
|
+
* @uses get_option()
|
|
446
|
+
*
|
|
447
|
+
* @access public
|
|
448
|
+
* @since 1.0.0
|
|
449
|
+
*
|
|
450
|
+
* @return string
|
|
451
|
+
*/
|
|
452
|
+
public static function optionsframework_uploader_function( $id, $std, $mod ) {
|
|
453
|
+
$data = get_option( OPTIONS );
|
|
454
|
+
|
|
455
|
+
$uploader = '';
|
|
456
|
+
$upload = $data[$id];
|
|
457
|
+
$hide = '';
|
|
458
|
+
|
|
459
|
+
if ( $mod == 'min' ) {
|
|
460
|
+
$hide = 'hide';
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if ( $upload != '' ) {
|
|
464
|
+
$val = $upload;
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
$val = $std;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
$uploader .= '<input class="'.$hide.' upload of-input" name="'. $id .'" id="'. $id .'_upload" value="'. $val .'" />';
|
|
471
|
+
$uploader .= '<div class="upload_button_div"><span class="button image_upload_button" id="'.$id.'">'._( 'Upload' ).'</span>';
|
|
472
|
+
|
|
473
|
+
if ( ! empty( $upload ) ) {
|
|
474
|
+
$hide = '';
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
$hide = 'hide';
|
|
478
|
+
}
|
|
479
|
+
$uploader .= '<span class="button image_reset_button '. $hide.'" id="reset_'. $id .'" title="' . $id . '">'.__( 'Remove', 'starter' ).'</span>';
|
|
480
|
+
$uploader .= '</div>' . "\n";
|
|
481
|
+
$uploader .= '<div class="clear"></div>' . "\n";
|
|
482
|
+
if ( ! empty( $upload ) ) {
|
|
483
|
+
$uploader .= '<div class="screenshot">';
|
|
484
|
+
$uploader .= '<a class="of-uploaded-image" href="'. $upload . '">';
|
|
485
|
+
$uploader .= '<img class="of-option-image" id="image_'.$id.'" src="'.$upload.'" alt="" />';
|
|
486
|
+
$uploader .= '</a>';
|
|
487
|
+
$uploader .= '</div>';
|
|
488
|
+
}
|
|
489
|
+
$uploader .= '<div class="clear"></div>' . "\n";
|
|
490
|
+
|
|
491
|
+
return $uploader;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Native media library uploader
|
|
496
|
+
*
|
|
497
|
+
* @uses get_option()
|
|
498
|
+
*
|
|
499
|
+
* @access public
|
|
500
|
+
* @since 1.0.0
|
|
501
|
+
*
|
|
502
|
+
* @return string
|
|
503
|
+
*/
|
|
504
|
+
public static function optionsframework_media_uploader_function( $id, $std, $int, $mod ) {
|
|
505
|
+
$data = get_option( OPTIONS );
|
|
506
|
+
|
|
507
|
+
$uploader = '';
|
|
508
|
+
$upload = $data[$id];
|
|
509
|
+
$hide = '';
|
|
510
|
+
|
|
511
|
+
if ( $mod == 'min' ) {
|
|
512
|
+
$hide = 'hide';
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if ( $upload != '' ) {
|
|
516
|
+
$val = $upload;
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
$val = $std;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
$uploader .= '<input class="'.$hide.' upload of-input" name="'. $id .'" id="'. $id .'_upload" value="'. $val .'" />';
|
|
523
|
+
$uploader .= '<div class="upload_button_div"><span class="button media_upload_button" id="'.$id.'" rel="' . $int . '">'.__( 'Upload', 'starter' ).'</span>';
|
|
524
|
+
|
|
525
|
+
if ( ! empty( $upload ) ) {
|
|
526
|
+
$hide = '';
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
$hide = 'hide';
|
|
530
|
+
}
|
|
531
|
+
$uploader .= '<span class="button mlu_remove_button '. $hide.'" id="reset_'. $id .'" title="' . $id . '">'.__( 'Remove', 'starter' ).'</span>';
|
|
532
|
+
$uploader .= '</div>' . "\n";
|
|
533
|
+
$uploader .= '<div class="screenshot">';
|
|
534
|
+
if ( ! empty( $upload ) ) {
|
|
535
|
+
$uploader .= '<a class="of-uploaded-image" href="'. $upload . '">';
|
|
536
|
+
$uploader .= '<img class="of-option-image" id="image_'.$id.'" src="'.$upload.'" alt="" />';
|
|
537
|
+
$uploader .= '</a>';
|
|
538
|
+
}
|
|
539
|
+
$uploader .= '</div>';
|
|
540
|
+
$uploader .= '<div class="clear"></div>' . "\n";
|
|
541
|
+
|
|
542
|
+
return $uploader;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Drag and drop slides manager
|
|
547
|
+
*
|
|
548
|
+
* @uses get_option()
|
|
549
|
+
*
|
|
550
|
+
* @access public
|
|
551
|
+
* @since 1.0.0
|
|
552
|
+
*
|
|
553
|
+
* @return string
|
|
554
|
+
*/
|
|
555
|
+
public static function optionsframework_slider_function( $id, $std, $oldorder, $order, $int ) {
|
|
556
|
+
$data = get_option( OPTIONS );
|
|
557
|
+
|
|
558
|
+
$slider = '';
|
|
559
|
+
$slide = array();
|
|
560
|
+
$slide = $data[$id];
|
|
561
|
+
|
|
562
|
+
if ( isset( $slide[$oldorder] ) ) {
|
|
563
|
+
$val = $slide[$oldorder];
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
$val = $std;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
//initialize all vars
|
|
570
|
+
$slidevars = array( 'title', 'url', 'link', 'description' );
|
|
571
|
+
|
|
572
|
+
foreach ( $slidevars as $slidevar ) {
|
|
573
|
+
if ( ! isset( $val[$slidevar] ) ) {
|
|
574
|
+
$val[$slidevar] = '';
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// begin slider interface
|
|
579
|
+
if ( ! empty( $val['title'] ) ) {
|
|
580
|
+
$slider .= '<li><div class="slide_header"><strong>'.stripslashes( $val['title'] ).'</strong>';
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
$slider .= '<li><div class="slide_header"><strong>Slide '.$order.'</strong>';
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
$slider .= '<input type="hidden" class="slide of-input order" name="'. $id .'['.$order.'][order]" id="'. $id.'_'.$order .'_slide_order" value="'.$order.'" />';
|
|
587
|
+
$slider .= '<a class="slide_edit_button" href="#">'.__( 'Edit', 'starter' ).'</a></div>';
|
|
588
|
+
$slider .= '<div class="slide_body">';
|
|
589
|
+
|
|
590
|
+
$slider .= '<label>'.__( 'Title', 'starter' ).'</label>';
|
|
591
|
+
$slider .= '<input class="slide of-input of-slider-title" name="'. $id .'['.$order.'][title]" id="'. $id .'_'.$order .'_slide_title" value="'. stripslashes( $val['title'] ) .'" />';
|
|
592
|
+
|
|
593
|
+
$slider .= '<label>'.__( 'Image URL', 'starter' ).'</label>';
|
|
594
|
+
$slider .= '<input class="slide of-input" name="'. $id .'['.$order.'][url]" id="'. $id .'_'.$order .'_slide_url" value="'. $val['url'] .'" />';
|
|
595
|
+
$slider .= '<div class="upload_button_div"><span class="button media_upload_button" id="'.$id.'_'.$order .'" rel="' . $int . '">'.__( 'Upload', 'starter' ).'</span>';
|
|
596
|
+
|
|
597
|
+
if ( ! empty( $val['url'] ) ) {
|
|
598
|
+
$hide = '';
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
$hide = 'hide';
|
|
602
|
+
}
|
|
603
|
+
$slider .= '<span class="button mlu_remove_button '. $hide.'" id="reset_'. $id .'_'.$order .'" title="' . $id . '_'.$order .'">'.__( 'Remove', 'starter' ).'</span>';
|
|
604
|
+
$slider .= '</div>' . "\n";
|
|
605
|
+
$slider .= '<div class="screenshot">';
|
|
606
|
+
if ( ! empty( $val['url'] ) ) {
|
|
607
|
+
$slider .= '<a class="of-uploaded-image" href="'. $val['url'] . '">';
|
|
608
|
+
$slider .= '<img class="of-option-image" id="image_'.$id.'_'.$order .'" src="'.$val['url'].'" alt="" />';
|
|
609
|
+
$slider .= '</a>';
|
|
610
|
+
}
|
|
611
|
+
$slider .= '</div>';
|
|
612
|
+
$slider .= '<label>'.__( 'Link URL (optional)', 'starter' ).'</label>';
|
|
613
|
+
$slider .= '<input class="slide of-input" name="'. $id .'['.$order.'][link]" id="'. $id .'_'.$order .'_slide_link" value="'. $val['link'] .'" />';
|
|
614
|
+
|
|
615
|
+
$slider .= '<label>'.__( 'Description (optional)', 'starter' ).'</label>';
|
|
616
|
+
$slider .= '<textarea class="slide of-input" name="'. $id .'['.$order.'][description]" id="'. $id .'_'.$order .'_slide_description" cols="8" rows="8">'.stripslashes( $val['description'] ).'</textarea>';
|
|
617
|
+
|
|
618
|
+
$slider .= '<a class="slide_delete_button" href="#">'.__( 'Delete', 'starter' ).'</a>';
|
|
619
|
+
$slider .= '<div class="clear"></div>' . "\n";
|
|
620
|
+
|
|
621
|
+
$slider .= '</div>';
|
|
622
|
+
$slider .= '</li>';
|
|
623
|
+
|
|
624
|
+
return $slider;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
} // end Options Machine class
|