Responsive Select Menu - Version 1.0

Version Description

  • Initial version

=

Download this release

Release Info

Developer sevenspark
Plugin Icon wp plugin Responsive Select Menu
Version 1.0
Comparing to
See all releases

Version 1.0

readme.txt ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Responsive Select Menu ===
2
+ Contributors: sevenspark
3
+ Donate link: http://bit.ly/DonateResponsiveSelect
4
+ Tags: responsive, menu, select, drop down,
5
+ Requires at least: 3.3
6
+ Tested up to: 3.3.2
7
+ Stable tag: trunk
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ The Responsive Select Menu plugin automatically turns any WordPress 3 Menu into a select box / dropdown on mobile devices.
12
+
13
+ == Description ==
14
+
15
+ [View the Demo](http://wpmegamenu.com/responsive-select-menu/)
16
+
17
+ One common UI paradigm for navigation menus with responsive design is to display a select box (form element)
18
+ for mobile devices. This plugin allows you to turn your WordPress 3 menu into a select box below a width of your choice.
19
+
20
+ = Features =
21
+
22
+ * Takes up less screen real estate on mobile devices
23
+ * Easier navigation for touch screens
24
+ * Works automatically - no need to add extra PHP code
25
+
26
+
27
+ = Highly Configurable =
28
+
29
+ Through the Responsive Select Menu Control Panel you can:
30
+
31
+ * Set your width breakpoint (where your menu switches from your standard menu to a select box)
32
+ * Configure how many levels you wish to include in the select menu. Set it to 1 to include only the top-level menu items.
33
+ * Choose the character used to indent your submenu items within the select box
34
+ * Choose whether or not to exclude “dummy” items that don’t have links
35
+ * Set the text of the first menu item
36
+
37
+ The demo is built with [UberMenu - Wordpress Mega Menu Plugin](http://wpmegamenu.com/) , but it is designed to work with any UL-based WordPress 3 menu.
38
+
39
+ Based on the excellent tutorial from [Chris Coyier and CSS Tricks](http://css-tricks.com/convert-menu-to-dropdown/) - thanks!
40
+
41
+ == Installation ==
42
+
43
+ This section describes how to install the plugin and get it working.
44
+
45
+ 1. Upload the plugin zip through your WordPress admin
46
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
47
+ 1. Navigate to Appearance > Responsive Select to configure your menu
48
+
49
+
50
+ == Frequently Asked Questions ==
51
+
52
+ = Do I have to have a "Navigate" item as my first item =
53
+
54
+ You can change the name of this item, but it has to exist. Otherwise, you won't be able to navigate to the first item in the menu
55
+ if you're not using the "Show currently selected item" - even if you have that option enabled, the issue would still exist on pages not
56
+ in the menu.
57
+
58
+
59
+
60
+ == Screenshots ==
61
+
62
+ 1. Responsive select menu on the iPhone/iPod Touch
63
+ 2. Responsive select menu Control Panel
64
+
65
+ == Changelog ==
66
+
67
+ = 1.0 =
68
+ * Initial version
69
+
70
+
71
+ == Upgrade Notice ==
72
+
73
+
responsive-select-menu.php ADDED
@@ -0,0 +1,527 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: Responsive Select Menu
5
+ Plugin URI: http://wpmegamenu.com/responsive-select-menu
6
+ Description: Turn your menu into a select box at small viewport sizes
7
+ Version: 1.0
8
+ Author: Chris Mavricos, SevenSpark
9
+ Author URI: http://sevenspark.com
10
+ Copyright 2011-2012 Chris Mavricos, SevenSpark http://sevenspark.com (email : chris@sevenspark.com)
11
+ */
12
+
13
+ define( 'RESPONSIVE_SELECT_MENU_VERSION', '1.0' );
14
+ define( 'RESPONSIVE_SELECT_MENU_SETTINGS', 'responsive-select-menu' );
15
+
16
+ require_once( 'sparkoptions/SparkOptions.class.php' ); //SevenSpark Options Panel
17
+
18
+ class ResponsiveMenuSelect{
19
+
20
+ private $enabled;
21
+ private $enabled_determined;
22
+
23
+ function __construct(){
24
+
25
+ $this->settings = $this->optionsMenu();
26
+ $this->enabled_determined = false;
27
+
28
+ if( is_admin() ){
29
+
30
+ }
31
+ else{
32
+ add_action( 'plugins_loaded' , array( $this , 'init' ) );
33
+ }
34
+ }
35
+
36
+ function init(){
37
+
38
+ $this->loadAssets();
39
+
40
+ //Filters
41
+ add_filter( 'wp_nav_menu_args' , array( $this , 'responsiveSelectAddFilter' ), 2100 ); //filters arguments passed to wp_nav_menu
42
+
43
+ add_filter( 'wp_nav_menu_args' , array( $this , 'responsiveSelectFilter' ), 2200 );
44
+
45
+ }
46
+
47
+ /**
48
+ * Determine whether we should load the responsive select on these pages
49
+ * and cache the result.
50
+ */
51
+ function isEnabled(){
52
+
53
+ if( $this->enabled_determined ) return $this->enabled;
54
+
55
+ $this->enabled_determined = true;
56
+ $this->enabled = false;
57
+
58
+ if( !$this->settings->op( 'display_only' ) ){
59
+ $this->enabled = true;
60
+ }
61
+ else{
62
+ $list = $this->settings->op( 'display_only' );
63
+ $list = str_replace( ' ', '', $list );
64
+ $ids = explode( ',' , $list );
65
+
66
+ global $post;
67
+ if( $post && in_array( $post->ID , $ids ) ) $this->enabled = true;
68
+ else $this->enabled = false;
69
+ }
70
+ return $this->enabled;
71
+ }
72
+
73
+
74
+ function loadAssets(){
75
+
76
+ if( !is_admin() ){
77
+ add_action( 'wp_print_styles' , array( $this , 'loadCSS' ) );
78
+ add_action( 'wp_head', array( $this , 'insertHeaderCode' ), 110 );
79
+ }
80
+
81
+ }
82
+
83
+ function loadCSS(){
84
+ if( $this->isEnabled() ) wp_enqueue_script( 'jquery' );
85
+ }
86
+
87
+ function insertHeaderCode(){
88
+ if( $this->isEnabled() ){
89
+ ?>
90
+
91
+ <!-- Responsive Select CSS
92
+ ================================================================ -->
93
+ <style type="text/css" id="responsive-select-css">
94
+ .responsiveSelectContainer select.responsiveMenuSelect{
95
+ display:none;
96
+ }
97
+
98
+ @media (max-width: <?php echo $this->settings->op( 'max-menu-width' ); ?>px) {
99
+ .responsiveSelectContainer{
100
+ border:none !important;
101
+ background:none !important;
102
+ box-shadow:none !important;
103
+ }
104
+ .responsiveSelectContainer ul{
105
+ display: none !important;
106
+ }
107
+ .responsiveSelectContainer select.responsiveMenuSelect {
108
+ display: inline-block;
109
+ width:100%;
110
+ }
111
+ }
112
+ </style>
113
+ <!-- end Responsive Select CSS -->
114
+
115
+ <!-- Responsive Select JS
116
+ ================================================================ -->
117
+ <script type="text/javascript">
118
+ jQuery(document).ready( function($){
119
+ $( '.responsiveMenuSelect' ).change(function() {
120
+ window.location = $(this).find( 'option:selected' ).val();
121
+ });
122
+ });
123
+ </script>
124
+ <!-- end Responsive Select JS -->
125
+
126
+ <?php
127
+ }
128
+ }
129
+
130
+ function responsiveSelectAddFilter( $args ){
131
+
132
+ if( $this->isEnabled() ){
133
+
134
+ //Don't add it twice (when it gets called again by selectNavMenu() )
135
+ if( isset( $args['responsiveMenuSelect'] ) && $args['responsiveMenuSelect'] == true ) {
136
+ return $args;
137
+ }
138
+
139
+ $selectNav = $this->selectNavMenu( $args );
140
+
141
+ $args['container_class'].= ' responsiveSelectContainer';
142
+
143
+ $args['items_wrap'] = '<ul id="%1$s" class="%2$s">%3$s</ul>'.$selectNav;
144
+
145
+ }
146
+
147
+ return $args;
148
+
149
+ }
150
+
151
+ function selectNavMenu( $args ){
152
+
153
+ $args['responsiveMenuSelect'] = true;
154
+
155
+ $select = wp_nav_menu( $args );
156
+
157
+ return $select;
158
+ }
159
+
160
+ function responsiveSelectFilter( $args ){
161
+
162
+ if( $this->isEnabled() ){
163
+
164
+ if( !isset( $args['responsiveMenuSelect'] ) ) return $args;
165
+
166
+ $itemName = $this->settings->op( 'first_item' );
167
+ $selected = $this->settings->op( 'current_selected' ) ? '' : 'selected="selected"';
168
+ $firstOp = '<option value="" '.$selected.'>'.$itemName.'</option>';
169
+
170
+ $args['container'] = false;
171
+ $args['menu_class'] = 'responsiveMenuSelect';
172
+ $args['menu_id'] = '';
173
+ $args['walker'] = new ResponsiveSelectWalker();
174
+ $args['echo'] = false;
175
+ $args['items_wrap'] = '<select class="%2$s">'.$firstOp.'%3$s</select>';
176
+
177
+ $args['depth'] = $this->settings->op( 'max-menu-depth' );
178
+
179
+ }
180
+
181
+ return $args;
182
+
183
+ }
184
+
185
+ /*
186
+ * Create the UberMenu SparkOptions Panel and Settings object
187
+ */
188
+ function optionsMenu(){
189
+
190
+ $sparkOps = new ResponsiveMenuSelectOptions(
191
+ RESPONSIVE_SELECT_MENU_SETTINGS,
192
+
193
+ //Menu Page
194
+ array(
195
+ 'parent_slug' => 'themes.php',
196
+ 'page_title' => 'Responsive Select Menu',
197
+ 'menu_title' => 'Responsive Select',
198
+ 'menu_slug' => 'responsive-select',
199
+ ),
200
+
201
+ //Links
202
+ array()
203
+
204
+ );
205
+
206
+
207
+
208
+ /*
209
+ * Basic Config Panel
210
+ */
211
+ $basic = 'basic-config';
212
+ $sparkOps->registerPanel( $basic, 'Basic Configuration' );
213
+
214
+ $sparkOps->addHidden( $basic , 'current-panel-id' , $basic );
215
+
216
+
217
+ $sparkOps->addTextInput( $basic,
218
+ 'max-menu-width',
219
+ 'Maximum Menu Width',
220
+ 'Show the select box when the viewport is less than this width',
221
+ 960,
222
+ 'spark-minitext',
223
+ 'px'
224
+ );
225
+
226
+ $sparkOps->addTextInput( $basic,
227
+ 'max-menu-depth',
228
+ 'Menu Depth Limit',
229
+ 'The maximum number of levels of menu items to include in the select menu. Set to 0 for no limit.',
230
+ 0,
231
+ 'spark-minitext',
232
+ ''
233
+ );
234
+
235
+ $sparkOps->addTextInput( $basic,
236
+ 'spacer',
237
+ 'Sub Item Spacer',
238
+ 'The character to use to indent sub items.',
239
+ '&ndash; ',
240
+ 'spark-minitext',
241
+ ''
242
+ );
243
+
244
+ $sparkOps->addCheckbox( $basic,
245
+ 'exclude-hashes',
246
+ 'Exclude Items Without Links',
247
+ 'Exclude any items where the URL is set to "#"',
248
+ 'on'
249
+ );
250
+
251
+ $sparkOps->addTextInput( $basic,
252
+ 'first_item',
253
+ 'First Item Name',
254
+ 'Text to display for the first "dummy" item.',
255
+ '&rArr; Navigate',
256
+ '',
257
+ ''
258
+ );
259
+
260
+ $sparkOps->addCheckbox( $basic,
261
+ 'current_selected',
262
+ 'Show currently selected item',
263
+ 'Enable to show the currently selected item, rather than the first "dummy" item, when the page loads.',
264
+ 'off'
265
+ );
266
+
267
+
268
+
269
+
270
+ $advanced = 'advanced-config';
271
+ $sparkOps->registerPanel( $advanced, 'Advanced Settings' );
272
+
273
+ $sparkOps->addTextInput( $advanced,
274
+ 'display_only',
275
+ 'Enable only on',
276
+ 'IDs of pages to enable responsive select menu on. Other pages will use the standard theme menu. Enter as a comma-separated list.',
277
+ '',
278
+ '',
279
+ ''
280
+ );
281
+
282
+
283
+
284
+ $uber = 'uber-config';
285
+ $sparkOps->registerPanel( $uber, 'UberMenu Configuration' );
286
+
287
+ $sparkOps->addInfobox( $uber,
288
+ 'uber-info',
289
+ 'UberMenu is NOT required in order to use this plugin',
290
+
291
+ '<p class="cf">UberMenu is a user-friendly, highly customizable responsive Mega Menu WordPress plugin. '.
292
+ 'It works out of the box with the WordPress 3 Menu System, making it simple to get started '.
293
+ 'but powerful enough to create highly customized and creative mega menu configurations.<br/><br/>' .
294
+ 'If you are not using UberMenu, you can ignore these settings. '.
295
+ '<a href="http://wpmegamenu.com" class="button save-button" target="_blank">More about UberMenu &rarr;</a></p>'
296
+
297
+ );
298
+
299
+ $sparkOps->addCheckbox( $uber,
300
+ 'uber-enabled',
301
+ 'Activate UberMenu Options',
302
+ 'If you are using UberMenu, enable this setting to make use of the UberMenu-specific options.',
303
+ 'off'
304
+ );
305
+
306
+ $sparkOps->addCheckbox( $uber,
307
+ 'uber-exclude-nonlinks',
308
+ 'Exclude Non-links',
309
+ 'Exclude any items where the link is disabled',
310
+ 'on'
311
+ );
312
+
313
+ $sparkOps->addCheckbox( $uber,
314
+ 'uber-exclude-notext',
315
+ 'Exclude No-text',
316
+ 'Exclude any items where the text is disabled',
317
+ 'on'
318
+ );
319
+
320
+ $sparkOps->addCheckbox( $uber,
321
+ 'uber-exclude-sidebar',
322
+ 'Exclude Widgets',
323
+ 'Exclude any items with attached widgets',
324
+ 'on'
325
+ );
326
+
327
+ $sparkOps->addCheckbox( $uber,
328
+ 'uber-exclude-content-overrides',
329
+ 'Exclude Content Overrides',
330
+ 'Exclude any items with content overrides',
331
+ 'on'
332
+ );
333
+
334
+ $ss = 'ss-config';
335
+ $sparkOps->registerPanel( $ss, 'More from SevenSpark' );
336
+
337
+ $sparkOps->addCustom( $ss, 'ss_products' , 'ResponsiveMenuSelect::sevenspark_showcase' );
338
+
339
+
340
+ return $sparkOps;
341
+ }
342
+
343
+
344
+ function getSettings(){
345
+ return $this->settings;
346
+ }
347
+
348
+ static function sevenspark_showcase(){
349
+
350
+ $html = '
351
+ <div class="social_media">
352
+ <a target="_blank" href="https://twitter.com/#!/sevenspark" class="ss-twitter"></a>
353
+ <a target="_blank" href="http://www.facebook.com/sevensparklabs" class="ss-facebook"></a>
354
+ <a target="_blank" href="http://dribbble.com/sevenspark" class="ss-dribbble"></a>
355
+ </div>
356
+
357
+ <div class="ss-infobox spark-infobox">
358
+ Like this plugin? Check out even more from SevenSpark
359
+ </div>
360
+
361
+ <div class="cf">
362
+ <h4>Contact Form 7 - Dynamic Text Extension</h4>
363
+ <p>Contact Form 7 DTX allows you to pre-populate your Contact Form 7 fields with dynamic values</p>
364
+
365
+ <a href="http://wordpress.org/extend/plugins/contact-form-7-dynamic-text-extension/" target="_blank" class="button save-button">Download
366
+ CF7 DTX for Free &rarr;</a>
367
+ </div>
368
+
369
+
370
+ <div class="cf">
371
+ <h4>UberMenu - Responsive WordPress Mega Menu Plugin</h4>
372
+
373
+ <a href="http://wpmegamenu.com"><img src="http://3.s3.envato.com/files/18012678/UberMenu_packaging_main.jpg" alt="UberMenu" /></a>
374
+
375
+ <p>UberMenu is a user-friendly, highly customizable responsive Mega Menu WordPress plugin.
376
+ It works out of the box with the WordPress 3 Menu System, making it simple to get started
377
+ but powerful enough to create highly customized and creative mega menu configurations.</p>
378
+
379
+ <a href="http://wpmegamenu.com" class="button save-button" target="_blank">Check out the UberMenu demo &rarr;</a>
380
+
381
+ </div>
382
+
383
+ <div class="cf">
384
+ <h4>Agility - Responsive HTML5 WordPress Theme</h4>
385
+
386
+ <img src="http://3.s3.envato.com/files/12296998/Preview/01_Agility_-_Responsive_Minimal_HTML5.__large_preview.jpg" alt="Agility" />
387
+
388
+ <a href="http://agility.sevenspark.com" class="button save-button" target="_blank">Coming Soon! [View the demo] &rarr;</a>
389
+
390
+
391
+ ';
392
+
393
+ return $html;
394
+
395
+ }
396
+
397
+
398
+ }
399
+
400
+ $responsiveMenuSelect = new ResponsiveMenuSelect();
401
+
402
+
403
+
404
+
405
+
406
+ class ResponsiveSelectWalker extends Walker_Nav_Menu{
407
+
408
+ private $index = 0;
409
+
410
+ function start_lvl( &$output, $depth ) {
411
+ $indent = str_repeat( "\t", $depth );
412
+ //$output .= "\n$indent<ul class=\"sub-menu sub-menu-".($depth+1)."\">\n";
413
+ }
414
+
415
+ function end_lvl(&$output, $depth) {
416
+ $indent = str_repeat("\t", $depth);
417
+ //$output .= "$indent</ul>\n";
418
+ }
419
+
420
+ function start_el( &$output, $item, $depth, $args ){
421
+
422
+ global $responsiveMenuSelect;
423
+ global $wp_query;
424
+ $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
425
+ $dashes = ( $depth ) ? str_repeat( $responsiveMenuSelect->getSettings()->op( 'spacer' ), $depth ) : ''; //"&ndash; "
426
+
427
+ $class_names = $value = '';
428
+
429
+ $classes = empty( $item->classes ) ? array() : (array) $item->classes;
430
+ $classes[] = 'menu-item-' . $item->ID;
431
+
432
+ $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
433
+ $class_names = ' class="' . esc_attr( $class_names ) . '"';
434
+
435
+ $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
436
+ $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
437
+
438
+ if( $item->url == '#' && $responsiveMenuSelect->getSettings()->op( 'exclude-hashes' ) ){
439
+ return;
440
+ }
441
+
442
+ //IF UBERMENU
443
+ if( $responsiveMenuSelect->getSettings()->op( 'uber-enabled' ) ){
444
+
445
+ global $uberMenu;
446
+ $settings = $uberMenu->getSettings();
447
+
448
+ //Test override settings
449
+ $override = get_post_meta( $item->ID, '_menu_item_shortcode', true);
450
+ $overrideOn = /*$depth > 0 && */ $settings->op( 'wpmega-shortcodes' ) && !empty( $override ) ? true : false;
451
+
452
+ //Test sidebar settings
453
+ $sidebar = get_post_meta( $item->ID, '_menu_item_sidebars', true);
454
+ $sidebarOn = ( $settings->op( 'wpmega-top-level-widgets' ) || $depth > 0 ) && $settings->op( 'wpmega-sidebars' ) && !empty( $sidebar ) ? true : false;
455
+
456
+ $notext = get_post_meta( $item->ID, '_menu_item_notext', true ) == 'on' || $item->title == UBERMENU_NOTEXT ? true : false;
457
+ $nolink = get_post_meta( $item->ID, '_menu_item_nolink', true ) == 'on' ? true : false;
458
+
459
+ if( $nolink && $responsiveMenuSelect->getSettings()->op( 'uber-exclude-nonlinks' ) ){
460
+ return;
461
+ }
462
+ if( $notext && $responsiveMenuSelect->getSettings()->op( 'uber-exclude-notext' ) ){
463
+ return;
464
+ }
465
+ if( $sidebarOn && $responsiveMenuSelect->getSettings()->op( 'uber-exclude-sidebar' ) ){
466
+ return;
467
+ }
468
+ if( $overrideOn && $responsiveMenuSelect->getSettings()->op( 'uber-exclude-content-overrides' ) ){
469
+ return;
470
+ }
471
+
472
+ }
473
+
474
+ $attributes = ! empty( $item->url ) ? ' value="' . esc_attr( $item->url ) .'"' : '';
475
+
476
+ if( $responsiveMenuSelect->getSettings()->op( 'current_selected' ) && strpos( $class_names , 'current-menu-item' ) > 0 ){
477
+ $attributes.= ' selected="selected"';
478
+ }
479
+
480
+ $output .= $indent . '<option ' . $id . $attributes . '>';
481
+
482
+ $item_output = $args->before;
483
+ $item_output .= $dashes . $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
484
+ $item_output .= $args->after;
485
+
486
+ $output.= $item_output;
487
+ }
488
+
489
+ function end_el(&$output, $item, $depth) {
490
+ global $responsiveMenuSelect;
491
+ if( $item->url == '#' && $responsiveMenuSelect->getSettings()->op( 'exclude-hashes' ) ){
492
+ return;
493
+ }
494
+ //IF UBERMENU
495
+ if( $responsiveMenuSelect->getSettings()->op( 'uber-enabled' ) ){
496
+
497
+ global $uberMenu;
498
+ $settings = $uberMenu->getSettings();
499
+
500
+ //Test override settings
501
+ $override = get_post_meta( $item->ID, '_menu_item_shortcode', true);
502
+ $overrideOn = /*$depth > 0 && */ $settings->op( 'wpmega-shortcodes' ) && !empty( $override ) ? true : false;
503
+
504
+ //Test sidebar settings
505
+ $sidebar = get_post_meta( $item->ID, '_menu_item_sidebars', true);
506
+ $sidebarOn = ( $settings->op( 'wpmega-top-level-widgets' ) || $depth > 0 ) && $settings->op( 'wpmega-sidebars' ) && !empty( $sidebar ) ? true : false;
507
+
508
+ $notext = get_post_meta( $item->ID, '_menu_item_notext', true ) == 'on' || $item->title == UBERMENU_NOTEXT ? true : false;
509
+ $nolink = get_post_meta( $item->ID, '_menu_item_nolink', true ) == 'on' ? true : false;
510
+
511
+ if( $nolink && $responsiveMenuSelect->getSettings()->op( 'uber-exclude-nonlinks' ) ){
512
+ return;
513
+ }
514
+ if( $notext && $responsiveMenuSelect->getSettings()->op( 'uber-exclude-notext' ) ){
515
+ return;
516
+ }
517
+ if( $sidebarOn && $responsiveMenuSelect->getSettings()->op( 'uber-exclude-sidebar' ) ){
518
+ return;
519
+ }
520
+ if( $overrideOn && $responsiveMenuSelect->getSettings()->op( 'uber-exclude-content-overrides' ) ){
521
+ return;
522
+ }
523
+
524
+ }
525
+ $output .= "</option>\n";
526
+ }
527
+ }
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
sparkoptions/SparkOptions.class.php ADDED
@@ -0,0 +1,758 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * SevenSpark Options Framework
4
+ *
5
+ * Copyright Chris Mavricos, SevenSpark
6
+ * http://sevenspark.com
7
+ *
8
+ * Version 1.0.1
9
+ */
10
+ class ResponsiveMenuSelectOptions{
11
+
12
+ public $id;
13
+ public $title;
14
+ public $menu_page;
15
+ public $menu_type;
16
+ public $parent_slug;
17
+ public $page_title;
18
+ public $menu_title;
19
+ public $capability;
20
+ public $menu_slug;
21
+
22
+ public $panels; //array
23
+ public $ops; //array
24
+
25
+
26
+ public $settings;
27
+ public $updated;
28
+ public $options_key;
29
+
30
+ public $notification;
31
+ public $warning;
32
+
33
+ public $config;
34
+
35
+ public $tour;
36
+
37
+
38
+ function __construct( $id, $config = array() , $links = array() ){
39
+
40
+ $this->id = $id;
41
+ $this->config = $config;
42
+
43
+ if( is_admin() ){
44
+ //$this->initializeMenuPage( $id, $config );
45
+ add_action( 'admin_menu' , array( $this , 'updateSettings' ) , 100 );
46
+ add_action( 'admin_menu' , array( $this , 'initializeMenuPage' ) , 101 );
47
+
48
+ }
49
+
50
+ $this->panels = array();
51
+ $this->ops = array();
52
+
53
+ $this->options_key = self::generateOptionsKey( $this->id );
54
+
55
+ $this->links = $links;
56
+
57
+ }
58
+
59
+ function initializeMenuPage(){
60
+
61
+ extract( wp_parse_args( $this->config, array(
62
+
63
+ 'type' => 'submenu_page',
64
+ 'parent_slug' => 'options-general.php',
65
+ 'page_title' => 'Spark Panel Options',
66
+ 'menu_title' => 'Spark Panel',
67
+ 'capability' => 'manage_options',
68
+ 'menu_slug' => $this->id,
69
+
70
+ )));
71
+
72
+ $this->title = $menu_title;
73
+ $this->menu_type = $type;
74
+ $this->parent_slug = $parent_slug;
75
+ $this->page_title = $page_title;
76
+ $this->menu_title = $menu_title;
77
+ $this->menu_slug = $menu_slug;
78
+ $this->capability = $capability;
79
+
80
+ switch( $this->menu_type ){
81
+
82
+ case 'submenu_page':
83
+
84
+ $this->menu_page = add_submenu_page(
85
+ $this->parent_slug,
86
+ $this->page_title , //'sparkoptions',
87
+ $this->menu_title , //'sparkoptions',
88
+ $this->capability,
89
+ $this->menu_slug,
90
+ array( $this, 'show' ) );
91
+
92
+ break;
93
+
94
+ }
95
+
96
+ $this->loadAssets();
97
+
98
+ }
99
+
100
+ function loadAssets(){
101
+ add_action("admin_print_styles-{$this->menu_page}", array( $this , 'loadCSS' ) );
102
+ add_action("admin_print_styles-{$this->menu_page}", array( $this , 'loadJS' ) );
103
+ }
104
+
105
+ function loadCSS(){
106
+ $tmp = plugins_url().'/'.str_replace( basename( __FILE__ ),"",plugin_basename( __FILE__ ));
107
+ wp_enqueue_style('sparkoptions-css', $tmp.'/sparkoptions.css', false, '1.1', 'all');
108
+
109
+ do_action( 'sparkoptions_load_css_'.$this->id );
110
+
111
+ }
112
+ function loadJS(){
113
+ $tmp = plugins_url().'/'.str_replace( basename( __FILE__ ),"",plugin_basename( __FILE__ ));
114
+ wp_enqueue_script( 'jquery' ); // Load jQuery
115
+ wp_enqueue_script( 'sparkoptions-js', $tmp.'/sparkoptions.js', false, '1.1', 'all');
116
+
117
+ do_action( 'sparkoptions_load_js_'.$this->id );
118
+ }
119
+
120
+
121
+ function show(){
122
+
123
+ if ( !current_user_can( $this->capability ) ) {
124
+ wp_die( __('You do not have sufficient permissions to access this page.') );
125
+ }
126
+
127
+ ?>
128
+ <div class="wrap spark-controlPanel">
129
+
130
+ <?php do_action( 'sparkoptions_before_settings_panel_'.$this->id ); ?>
131
+
132
+ <div class="spark-settings-panel">
133
+ <div class="spark-nav">
134
+
135
+ <h2><?php echo $this->title; ?></h2>
136
+ <h5>Control Panel</h5>
137
+
138
+ <ul>
139
+ <?php
140
+ foreach($this->panels as $panel_id => $config){
141
+ ?>
142
+ <li><a href="#spark-<?php echo $panel_id; ?>"><?php echo $config['name']; ?></a></li>
143
+ <?php
144
+ }
145
+ ?>
146
+ </ul>
147
+
148
+ <br/>
149
+ <div class="spark-nav-footer">
150
+
151
+ <?php
152
+ foreach( $this->links as $l ):?>
153
+
154
+ <a href="<?php echo $l['href']; ?>"
155
+ class="<?php echo $l['class']; ?>"
156
+ title="<?php echo $l['title']; ?>"
157
+ target="_blank" ><?php echo $l['text']; ?></a>
158
+
159
+ <?php
160
+ endforeach;
161
+ if( $this->tour ){
162
+ echo $this->tour->resetTourButton();
163
+ }
164
+ ?>
165
+
166
+ <a href="http://sevenspark.com" class="spark-attribution" target="_blank">by SevenSpark</a>
167
+ </div>
168
+
169
+ </div>
170
+ <div class="spark-panels">
171
+ <form method="post" id="spark-options">
172
+ <?php
173
+
174
+ $class = '';
175
+ $start_panel = isset( $this->settings['current-panel-id'] ) ? $this->op('current-panel-id') : 'basic-config';
176
+
177
+ foreach($this->panels as $panel_id => $config){
178
+ ?>
179
+
180
+ <div id="spark-<?php echo $panel_id; ?>" class="spark-panel">
181
+
182
+ <?php if( $this->notification && $panel_id == $start_panel ): ?>
183
+ <div class="spark-infobox"><?php echo $this->notification; ?></div>
184
+ <?php endif; ?>
185
+
186
+ <?php if( $this->warning && $panel_id == $start_panel ): ?>
187
+ <br/>
188
+ <div class="spark-infobox spark-infobox-warning"><?php echo $this->warning; ?></div>
189
+ <?php endif; ?>
190
+
191
+ <h3><?php echo $config['name']; ?></h3>
192
+
193
+ <?php
194
+ $reset = false;
195
+ foreach( $config['ops'] as $id ){
196
+
197
+ $op = $this->ops[$id];
198
+
199
+ if( $op['type'] == 'reset' ){
200
+ $reset = array( 'id' => $id, 'op' => $op );
201
+ continue;
202
+ }
203
+
204
+ if($op['type'] == 'header-2') $class = 'wpmega-config-section'; //TODO
205
+ echo $this->showAdminOption( $id, $op, $class );
206
+ if($op['type'] == 'header-2') $class = 'sub-container sub-container-'.$id;
207
+ }
208
+ ?>
209
+
210
+ <input type="submit" name="<?php echo $this->id; ?>-sparkops_submit" value="Save All Settings" class="button save-button"/>
211
+
212
+ <?php
213
+ if( $reset ){
214
+ echo $this->showAdminOption( $reset['id'], $reset['op'], '' );
215
+ }
216
+ ?>
217
+ </div>
218
+ <?php
219
+ }
220
+
221
+ ?>
222
+
223
+ <?php wp_nonce_field( $this->options_key , '_sparkoptions-nonce' ); ?>
224
+
225
+ </form>
226
+
227
+ </div>
228
+
229
+
230
+ </div> <!-- end spark-settings-panel -->
231
+ </div> <!-- end spark-controlPanel -->
232
+
233
+ <?php
234
+
235
+
236
+ }
237
+
238
+ function showAdminOption($id, $config, $class=''){
239
+
240
+ extract( wp_parse_args( $config, array(
241
+ 'title' => '',
242
+ 'type' => 'text',
243
+ 'desc' => '',
244
+ 'units' => '',
245
+ 'ops' => null,
246
+ 'default'=> '',
247
+ 'special_class' => '',
248
+ 'gradient' => false,
249
+ )));
250
+
251
+ $settings = $this->getSettings();
252
+
253
+ $class.= ' '.$special_class;
254
+
255
+ $html = '<div id="container-'.$id.'" class="spark-admin-op container-type-'.$type.' '.$class.'">';
256
+ if(!empty($before)) $html.= $before;
257
+
258
+ $val = isset( $settings[$id] ) ? $settings[$id] : '';
259
+ if(!is_numeric($val) && empty($val)) $val = $default; //must check numeric otherwise we can't use 0
260
+
261
+ $title = '<label class="spark-admin-op-title" for="'.$id.'">'.$title.'</label>';
262
+ $desc = empty($desc) ? '' : '<span class="spark-admin-op-desc">'.$desc.'</span>';
263
+ $units = '<span class="spark-admin-op-units">'.$units.'</span>';
264
+
265
+ switch($type){
266
+
267
+ case 'text':
268
+ $html.= $title;
269
+ $html.= '<input type="text" id="'.$id.'" name="'.$id.'" value="'.stripslashes( $val ).'"/>';
270
+ $html.= $units;
271
+ $html.= $desc;
272
+
273
+ break;
274
+
275
+ case 'textarea':
276
+ $html.= $title;
277
+ $html.= $desc;
278
+ $html.= '<textarea type="text" id="'.$id.'" name="'.$id.'" >'.stripslashes( $val ).'</textarea>';
279
+
280
+
281
+ break;
282
+
283
+ case 'checkbox':
284
+
285
+ if(empty($val)) $ischecked = $default == 'on' ? true : false;
286
+ else $ischecked = $val == 'on' ? true : false;
287
+
288
+ $html.= $title;
289
+ $html.= '<input type="checkbox" id="'.$id.'" name="'.$id.'" '.checked($ischecked, true, false).'/>';
290
+ $html.= $desc;
291
+ $html.= '<div class="clear"></div>';
292
+
293
+ break;
294
+
295
+ case 'select':
296
+
297
+ $html.= '<label class="spark-admin-op-title">'.$title.'</label>'; //$title;
298
+ $html.= '<select id="'.$id.'" name="'.$id.'" >';
299
+
300
+ if(!is_array($ops)) $ops = $ops(); //if it's not an array it's a function that produces an array
301
+
302
+ if(is_array($ops)){
303
+ foreach($ops as $opVal => $op){
304
+ $selected = $opVal == $val ? 'selected="selected"' : '';
305
+
306
+ $html.= '<option value="'.$opVal.'" '.$selected.' >'.$op.'</option>';
307
+ }
308
+ }
309
+
310
+ $html.= '</select>';
311
+
312
+ break;
313
+
314
+ case 'radio':
315
+
316
+ $html.= $title;
317
+ if(is_array($ops)){
318
+ foreach($ops as $opVal => $op){
319
+
320
+ $ischecked = $val == $opVal ? true : false;
321
+
322
+ $html.= '<div class="spark-admin-op-radio">';
323
+ $html.= '<input type="radio" id="'.$id.'_'.$opVal.'" name="'.$id.'" value="'.$opVal.'" '.checked($ischecked, true, false).' />';
324
+ $html.= '<label for="'.$id.'_'.$opVal.'">'.$op.'</label>';
325
+ $html.= '</div>';
326
+ }
327
+ }
328
+ break;
329
+
330
+ case 'color':
331
+ $html.= $title;
332
+ $html.= '<input class="colorPicker-color" type="text" id="'.$id.'" name="'.$id.'" value="'.$val.'" />';
333
+
334
+ if( $gradient ){
335
+ $c2 = isset( $settings[$id.'-color2'] ) ? $settings[$id.'-color2'] : '';
336
+ $html.= '<input class="colorPicker-color colorPicker-color2" type="text" id="'.$id.'-color2" name="'.$id.'-color2" value="'.$c2.'" />';
337
+ }
338
+
339
+ $html.= '<span class="clearColor" title="Clear" >&nbsp;</span>';
340
+
341
+ $html.= '<span class="ss-admin-op-desc">'.$desc.'</span>';
342
+ break;
343
+
344
+ case 'header':
345
+ $html.= '<h3>'.$title.'</h3>';
346
+ break;
347
+
348
+ case 'header-2':
349
+ $html.= '<h4>'.$title.'</h4>';
350
+ break;
351
+
352
+ case 'infobox':
353
+ $html.= '<div class="spark-infobox '.$special_class.'">';
354
+ if($config['title'] != '') $html.= '<h4>'.$title.'</h4>';
355
+ $html.= $desc.'</div>';
356
+
357
+ break;
358
+
359
+ case 'reset':
360
+ $html.= $title;
361
+ $html.= '<input type="submit" id="'.$id.'" name="'.$this->id.'-reset-options" value="Reset" class="button reset-button"
362
+ onClick="return confirm(\'WARNING: Are you sure you want to reset all UberMenu options?\');" />';
363
+ $html.= $desc;
364
+
365
+ break;
366
+
367
+ case 'flush-rewrite':
368
+ $html.= $title;
369
+ $html.= '<input type="submit" id="'.$id.'" name="'.$this->id.'-flush-rewrite" value="Flush Rewrite Rules" class="button reset-button"
370
+ />';
371
+ $html.= $desc;
372
+
373
+ break;
374
+
375
+ case 'custom':
376
+ $html.= call_user_func( array( $this, $config['func'] ) );
377
+ break;
378
+
379
+ case '_custom':
380
+ $html.= call_user_func( $config['func'] );
381
+ break;
382
+
383
+ case 'hidden':
384
+ $html.= '<input type="hidden" id="'.$id.'" name="'.$id.'" value="'.stripslashes( $val ).'"/>';
385
+ break;
386
+
387
+
388
+
389
+ }
390
+ $html.= '</div>';
391
+
392
+ return $html;
393
+ }
394
+
395
+
396
+
397
+ /* INPUT TYPES */
398
+
399
+ /**
400
+ * Add a text input
401
+ *
402
+ * @param panel_id String - the ID of the panel to add the option to
403
+ * @param id String - the ID of this option
404
+ * @param title String - the label for the text input
405
+ * @param desc String - the description of the option
406
+ * @param special_class String - the class to add to the dialog, like 'spark-infobox-warning'
407
+ */
408
+ function addTextInput( $panel_id, $id, $title , $desc = '' , $default = '' , $special_class = '' , $units = '' ){
409
+
410
+ $this->ops[$id] = array(
411
+ 'title' => $title,
412
+ 'desc' => $desc,
413
+ 'default' => $default,
414
+ 'special_class' => $special_class,
415
+ 'units' => $units,
416
+
417
+ 'type' => 'text',
418
+ );
419
+
420
+ $this->addToPanel( $panel_id , $id );
421
+ }
422
+
423
+ function addTextArea( $panel_id, $id, $title , $desc = '' , $default = '' , $special_class = '' ){
424
+
425
+ $this->ops[$id] = array(
426
+ 'title' => $title,
427
+ 'desc' => $desc,
428
+ 'default' => $default,
429
+ 'special_class' => $special_class,
430
+
431
+ 'type' => 'textarea',
432
+ );
433
+
434
+ $this->addToPanel( $panel_id , $id );
435
+ }
436
+
437
+ function addCheckbox( $panel_id , $id , $title , $desc = '' , $default = 'off' , $special_class = '' ){
438
+
439
+ $this->ops[$id] = array(
440
+ 'title' => $title,
441
+ 'desc' => $desc,
442
+ 'default' => $default,
443
+ 'special_class' => $special_class,
444
+
445
+ 'type' => 'checkbox',
446
+ );
447
+
448
+ $this->addToPanel( $panel_id , $id );
449
+
450
+ }
451
+
452
+ function addRadio( $panel_id , $id , $title , $desc = '' , $ops = array() , $default = '' , $special_class = '' ){
453
+
454
+ $this->ops[$id] = array(
455
+ 'title' => $title,
456
+ 'desc' => $desc,
457
+ 'ops' => $ops,
458
+ 'default' => $default,
459
+ 'special_class' => $special_class,
460
+
461
+ 'type' => 'radio',
462
+ );
463
+
464
+ $this->addToPanel( $panel_id , $id );
465
+
466
+ }
467
+
468
+ function addSelect( $panel_id , $id , $title , $desc = '' , $ops = array() , $default = '' , $special_class = '' ){
469
+
470
+ $this->ops[$id] = array(
471
+ 'title' => $title,
472
+ 'desc' => $desc,
473
+ 'ops' => $ops,
474
+ 'default' => $default,
475
+ 'special_class' => $special_class,
476
+
477
+ 'type' => 'select',
478
+ );
479
+
480
+ $this->addToPanel( $panel_id , $id );
481
+
482
+ }
483
+
484
+ function addColorPicker( $panel_id , $id , $title , $desc = '' , $gradient = true ){
485
+
486
+ $this->ops[$id] = array(
487
+ 'title' => $title,
488
+ 'desc' => $desc,
489
+ 'gradient' => $gradient,
490
+
491
+ 'type' => 'color',
492
+ );
493
+
494
+ $this->addToPanel( $panel_id , $id );
495
+
496
+ }
497
+
498
+ function addSubHeader( $panel_id, $id, $title, $desc = '', $special_class = '' ){
499
+
500
+ $this->ops[$id] = array(
501
+ 'title' => $title,
502
+ 'desc' => $desc,
503
+ 'special_class' => $special_class,
504
+
505
+ 'type' => 'header-2',
506
+ );
507
+
508
+ $this->addToPanel( $panel_id , $id );
509
+ }
510
+
511
+ /**
512
+ * Add an information box
513
+ *
514
+ * @param panel_id string - the ID of the panel to add the option to
515
+ * @param id string - the ID of this option
516
+ * @param title string - the title of the dialog
517
+ * @param desc string - the text of the dialog
518
+ * @param special_class - the class to add to the dialog, like 'spark-infobox-warning'
519
+ */
520
+ function addInfobox( $panel_id , $id , $title , $desc = '' , $special_class = '' ){
521
+
522
+ $this->ops[$id] = array(
523
+ 'title' => $title,
524
+ 'desc' => $desc,
525
+ 'special_class' => $special_class,
526
+
527
+ 'type' => 'infobox',
528
+ );
529
+
530
+ $this->addToPanel( $panel_id , $id );
531
+
532
+ }
533
+
534
+ function addResetButton( $panel_id , $id , $title , $desc = '' , $special_class = '' ){
535
+
536
+ $this->ops[$id] = array(
537
+ 'title' => $title,
538
+ 'desc' => $desc,
539
+ 'special_class' => $special_class,
540
+
541
+ 'type' => 'reset',
542
+ );
543
+
544
+ $this->addToPanel( $panel_id , $id );
545
+
546
+ }
547
+
548
+ function addFlushRewriteButton( $panel_id , $id , $title , $desc = '' , $special_class = '' ){
549
+
550
+ $this->ops[$id] = array(
551
+ 'title' => $title,
552
+ 'desc' => $desc,
553
+ 'special_class' => $special_class,
554
+
555
+ 'type' => 'flush-rewrite',
556
+ );
557
+
558
+ $this->addToPanel( $panel_id , $id );
559
+
560
+ }
561
+
562
+ function addCustomField( $panel_id , $id , $func ){
563
+
564
+ $this->ops[$id] = array(
565
+ 'func' => $func,
566
+ 'type' => 'custom',
567
+ );
568
+
569
+ $this->addToPanel( $panel_id , $id );
570
+
571
+ }
572
+
573
+ function addCustom( $panel_id , $id , $func ){
574
+
575
+ $this->ops[$id] = array(
576
+ 'func' => $func,
577
+ 'type' => '_custom',
578
+ );
579
+
580
+ $this->addToPanel( $panel_id , $id );
581
+
582
+ }
583
+
584
+ function addHidden( $panel_id , $id , $value ){
585
+
586
+ $this->ops[$id] = array(
587
+ 'type' => 'hidden',
588
+ 'default' => $value
589
+ );
590
+
591
+ $this->addToPanel( $panel_id , $id );
592
+ }
593
+
594
+
595
+ function addToPanel( $panel_id , $option_id ){
596
+
597
+ if( !isset( $this->panels[$panel_id] ) ){
598
+ //echo "panel $panel_id not registered";
599
+ return;
600
+ }
601
+
602
+ $this->panels[$panel_id]['ops'][] = $option_id;
603
+
604
+ }
605
+
606
+ function registerPanel( $panel_id , $name ){
607
+
608
+ $this->panels[$panel_id] = array();
609
+ $this->panels[$panel_id]['name'] = $name;
610
+ $this->panels[$panel_id]['ops'] = array();
611
+
612
+ }
613
+
614
+ function getSettings(){
615
+
616
+ if( !$this->settings ){
617
+ $this->settings = get_option( $this->options_key );
618
+ $this->settings = apply_filters( $this->id.'_settings_filter' , $this->settings );
619
+ }
620
+
621
+ return $this->settings;
622
+ }
623
+
624
+ function op( $id ){
625
+
626
+ $this->getSettings();
627
+
628
+ //return the value or the default
629
+ $val;
630
+ if( isset( $this->settings[$id] ) ){
631
+ $val = $this->settings[$id];
632
+ }
633
+ else if( isset( $this->ops[$id]['default'] ) ){
634
+ $val = $this->ops[$id]['default'];
635
+ }
636
+ //this option doesn't exist, or doesn't have a default
637
+ else{
638
+ return '';
639
+ }
640
+
641
+ //translate to true/false for checkboxes
642
+
643
+ switch( $this->ops[$id]['type'] ){
644
+ case 'checkbox':
645
+ return $val == 'on' ? true : false;
646
+ break;
647
+
648
+ case 'hidden':
649
+ if( $val == 'on') return true;
650
+ else if( $val == 'off' ) return false;
651
+ return $val;
652
+
653
+ case 'textarea':
654
+ return stripslashes( $val );
655
+ break;
656
+
657
+ case 'text':
658
+ return stripslashes( $val );
659
+ break;
660
+ }
661
+
662
+ return $val;
663
+
664
+ }
665
+
666
+
667
+
668
+
669
+ function updateSettings(){
670
+
671
+ //Resetting Options
672
+ if( isset( $_POST[$this->id.'-reset-options'] ) ){
673
+
674
+ if( check_admin_referer( $this->options_key , '_sparkoptions-nonce' ) ){
675
+
676
+ delete_option( $this->options_key );
677
+ $this->settings = array(); //reset the local settings
678
+ $this->notification = "Settings reset to factory defaults!";
679
+
680
+ }
681
+
682
+ }
683
+
684
+ //Flush rewrite rules
685
+ if( isset( $_POST[$this->id.'-flush-rewrite'] ) ){
686
+
687
+ if( check_admin_referer( $this->options_key , '_sparkoptions-nonce' ) ){
688
+
689
+ flush_rewrite_rules( true );
690
+ $this->notification = "Rewrite rules flushed!";
691
+
692
+ }
693
+
694
+ }
695
+
696
+
697
+ //Only do this on form submission
698
+ if( !isset( $_POST[$this->id.'-sparkops_submit'] ) ) return false;
699
+
700
+ if( !check_admin_referer( $this->options_key , '_sparkoptions-nonce' ) ){
701
+ //Can't ever actually reach here, as function will die above if nonce is invalid
702
+ die( 'No can dosville, baby' );
703
+ return false;
704
+ }
705
+
706
+
707
+ // go through settings, if checkbox and not set, set to 'off'
708
+ $saveOps = array();
709
+
710
+ foreach( $this->ops as $key => $o ){
711
+
712
+ $val = isset( $_POST[$key] ) ? $_POST[$key] : '';
713
+
714
+ switch( $o['type'] ){
715
+ case 'checkbox':
716
+ if(empty($val)) $val = 'off'; // empty($o['default']) ? 'off' : $o['default']; Don't set to default or we can never have 'off'
717
+ break;
718
+ case 'header':
719
+ case 'header-2':
720
+ case 'infobox':
721
+ continue;
722
+ break;
723
+ case 'color':
724
+ if( isset( $_POST[$key.'-color2'] ) ){
725
+ $saveOps[$key.'-color2'] = $_POST[$key.'-color2'];
726
+ }
727
+ break;
728
+ }
729
+
730
+ $saveOps[$key] = $val;
731
+
732
+ }
733
+
734
+
735
+ $this->settings = $saveOps; //setup new settings, in case getSettings() has already been run
736
+
737
+ //Give the plugin a go to do something extra special
738
+ do_action( 'sparkoptions_update_settings_'.$this->id , $saveOps );
739
+
740
+ //Here is where we actually update all the Settings
741
+ update_option( $this->options_key , $this->settings );
742
+
743
+ //Notify user of great success!
744
+ $this->notification = "Settings saved!";
745
+
746
+ return true;
747
+
748
+ }
749
+
750
+ public static function generateOptionsKey( $id ){
751
+ return 'sparkops_'.$id;
752
+ }
753
+
754
+ function addTour( $tour ){
755
+ $this->tour = $tour;
756
+ }
757
+
758
+ }
sparkoptions/images/cross.png ADDED
Binary file
sparkoptions/images/nav_bkg.jpg ADDED
Binary file
sparkoptions/images/panel_bkg.jpg ADDED
Binary file
sparkoptions/images/social_media_icons/dribbble.png ADDED
Binary file
sparkoptions/images/social_media_icons/facebook.png ADDED
Binary file
sparkoptions/images/social_media_icons/twitter_2.png ADDED
Binary file
sparkoptions/images/sslogo.png ADDED
Binary file
sparkoptions/images/sslogo_favicon.png ADDED
Binary file
sparkoptions/images/toolbox.png ADDED
Binary file
sparkoptions/sparkoptions.css ADDED
@@ -0,0 +1,672 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPARK OPTIONS PANEL */
2
+ .spark-controlPanel{
3
+ font-family:Arial, Helvetica, sans-serif;
4
+ }
5
+
6
+ .spark-settings-panel{
7
+ width:800px;
8
+ background:#444 url(images/nav_bkg.jpg) top left repeat;
9
+ margin:2em 0;
10
+
11
+ border-radius:3px;
12
+ border-left:1px solid #222;
13
+ overflow:hidden;
14
+ position:relative;
15
+ }
16
+
17
+ .spark-nav{
18
+ float:left;
19
+ width:180px;
20
+ height:100%;
21
+ min-height:350px;
22
+
23
+ border-top:1px solid #222;
24
+ box-shadow:inset 0px 1px 1px rgba(255,255,255,.2);
25
+ /*position:fixed;*/
26
+ }
27
+ .spark-nav h2{
28
+ color:#fefefe;
29
+ text-shadow:0px 1px 1px #000;
30
+ padding:10px 10px 0px 10px;
31
+ /*background:transparent url(images/sslogo.png) 140px 8px no-repeat;
32
+ background:transparent url(images/sslogo_favicon.png) 10px 16px no-repeat;*/
33
+ background:transparent url(images/toolbox.png) 150px 16px no-repeat;
34
+ margin:0;
35
+ font-size:20px;
36
+ font-weight:bold;
37
+ }
38
+ .spark-nav h5{
39
+ color:#4D90FE;
40
+ padding:0 10px;
41
+ margin:0 0 20px 0;
42
+ text-shadow:0px -1px 0px #000; /*rgba(255,255,255,.2);*/
43
+ font-size:12px;
44
+ font-weight:bold;
45
+ font-style:italic;
46
+ }
47
+ .spark-nav ul{
48
+ margin-top:.4em;
49
+ border-top:1px solid #333;
50
+ }
51
+ .spark-nav ul li{
52
+ margin:0;
53
+ }
54
+ .spark-nav ul li a,
55
+ .spark-nav a{
56
+ display:block;
57
+ font-weight:bold;
58
+ color:#efefef;
59
+ font-size:13px;
60
+ padding:8px 10px;
61
+ text-decoration:none;
62
+
63
+ border-bottom:1px solid #333;
64
+ border-top:1px solid #555;
65
+
66
+ text-shadow:0px -1px 1px #111;
67
+ position:relative;
68
+ }
69
+ .spark-nav ul li a:hover{
70
+ color:#fff;
71
+
72
+ }
73
+ .spark-nav ul li a.current{
74
+ color:#D83F28;
75
+ }
76
+ .spark-nav ul li a:after{
77
+ content: ' ';
78
+ position:absolute;
79
+
80
+ top:50%;
81
+ margin-top:-6px;
82
+
83
+ display:none;
84
+ left:100%;
85
+
86
+ width: 0;
87
+ height: 0;
88
+ border-top: 7px solid transparent;
89
+ border-bottom: 7px solid transparent;
90
+
91
+ border-left: 7px solid #333;
92
+
93
+ -webkit-transition:all 1s ease-in-out;
94
+
95
+ }
96
+
97
+ .spark-nav ul li a.current:after,
98
+ .spark-nav ul li a:hover:after{
99
+
100
+ display:block;
101
+
102
+ }
103
+
104
+ .spark-nav-footer{
105
+ position:absolute;
106
+ bottom:0;
107
+ width:180px;
108
+ }
109
+ a.spark-attribution {
110
+ padding-left: 33px;
111
+ background: transparent url(images/sslogo_favicon.png) 10px 10px no-repeat;
112
+ font-weight: normal;
113
+ }
114
+ a.spark-outlink-hl{
115
+ background: #eee; /* Old browsers */
116
+ background: #eee -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.1) 100%); /* FF3.6+ */
117
+ background: #eee -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.2)), color-stop(100%,rgba(0,0,0,.1))); /* Chrome,Safari4+ */
118
+ background: #eee -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* Chrome10+,Safari5.1+ */
119
+ background: #eee -o-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* Opera11.10+ */
120
+ background: #eee -ms-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* IE10+ */
121
+ background: #eee linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* W3C */
122
+
123
+ border: 1px solid #aaa;
124
+ border-top: 1px solid #ccc;
125
+ border-left: 1px solid #ccc;
126
+
127
+ color: #444;
128
+ display: inline-block;
129
+ font-size: 11px;
130
+ font-weight: bold;
131
+ text-decoration: none;
132
+ text-shadow: 0 1px rgba(255, 255, 255, .75);
133
+ cursor: pointer;
134
+
135
+
136
+ font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
137
+
138
+
139
+ display:block;
140
+ clear:both;
141
+ position:relative;
142
+
143
+ background-color:#ef452c;
144
+ color:#f9f9f9 !important;
145
+ text-shadow:0px -1px 1px rgba(0,0,0,.3) !important;
146
+ border:1px solid #901B09;
147
+ border-top-color:#B23D2B;
148
+ border-left-color:#B23D2B;
149
+ border-width:1px 0px;
150
+
151
+ text-shadow: 0 1px rgba(255, 255, 255, .2);
152
+ box-shadow:inset 0px 1px 1px rgba(255,255,255,.3);
153
+
154
+ }
155
+
156
+ .reset-tour input,
157
+ a.spark-outlink{
158
+ background: #eee; /* Old browsers */
159
+ background: #eee -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.1) 100%); /* FF3.6+ */
160
+ background: #eee -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.1)), color-stop(100%,rgba(0,0,0,.1))); /* Chrome,Safari4+ */
161
+ background: #eee -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* Chrome10+,Safari5.1+ */
162
+ background: #eee -o-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* Opera11.10+ */
163
+ background: #eee -ms-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* IE10+ */
164
+ background: #eee linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* W3C */
165
+
166
+ border: 1px solid #aaa;
167
+ border-top: 1px solid #ccc;
168
+ border-left: 1px solid #ccc;
169
+
170
+ color: #444;
171
+ display: inline-block;
172
+ font-size: 11px;
173
+ font-weight: bold;
174
+ text-decoration: none;
175
+ text-shadow: 0 1px rgba(255, 255, 255, .75);
176
+ cursor: pointer;
177
+
178
+
179
+ font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
180
+
181
+
182
+ display:block;
183
+ clear:both;
184
+ position:relative;
185
+
186
+ background-color:#4D90FE; /*#2B70DC;*/
187
+ color:#f9f9f9 !important;
188
+ text-shadow:0px -1px 1px rgba(0,0,0,.3) !important;
189
+ border:none;
190
+
191
+ text-shadow: 0 1px rgba(255, 255, 255, .2);
192
+ box-shadow:inset 0px 1px 1px rgba(255,255,255,.3);
193
+
194
+ }
195
+
196
+ .reset-tour input[type="submit"]{
197
+ background-color:#333;
198
+ border-radius:0;
199
+ display:block;
200
+ float:none;
201
+ width:178px;
202
+ }
203
+
204
+ .spark-panels{
205
+ padding-left:180px;
206
+ border-radius:3px;
207
+
208
+ }
209
+
210
+ .spark-panels form{
211
+ margin:0;
212
+ }
213
+
214
+ .spark-panel{
215
+ padding:10px 20px 20px 20px;
216
+ float:left;
217
+ width:578px;
218
+
219
+ background:#f5f5f5 url(images/panel_bkg.jpg) top left repeat;
220
+ border:1px solid #e9e9e9;
221
+ border-left:1px solid #fcfcfc;
222
+
223
+
224
+ box-shadow:-5px 0px 12px #333, inset 0px 1px 1px #fefefe;
225
+
226
+ min-height:320px;
227
+ }
228
+
229
+ .spark-panel h3{
230
+ font-size:18px;
231
+ }
232
+ .spark-panel h3 + .container-type-header-2 h4{
233
+ margin-top:0;
234
+ }
235
+
236
+ .spark-panel h4{
237
+ margin:2.5em 0 .5em 0;
238
+ color:#2B70DC;
239
+ color:#D83F28;
240
+ font-size:14px;
241
+ }
242
+
243
+
244
+
245
+
246
+ .spark-admin-op{
247
+ display:block;
248
+ padding:10px 0;
249
+ clear:both;
250
+ }
251
+
252
+ .spark-admin-op.container-type-hidden{
253
+ padding:0;
254
+ }
255
+
256
+ label.spark-admin-op-title{
257
+ font-weight:bold;
258
+ padding-top:4px;
259
+ }
260
+
261
+ .spark-admin-op-desc{
262
+ display:block;
263
+ color:#999;
264
+ clear: both;
265
+ margin-top: .2em;
266
+ }
267
+
268
+ .spark-admin-op-units{
269
+ color:#999;
270
+ vertical-align:text-bottom;
271
+ }
272
+
273
+
274
+ /* Text */
275
+ .spark-admin-op.container-type-text label.spark-admin-op-title{
276
+ float:left;
277
+ width:200px;
278
+ }
279
+ .spark-admin-op.container-type-text input{
280
+ border-radius:0;
281
+ width:200px;
282
+ padding:5px 8px;
283
+ }
284
+
285
+ .spark-minitext input[type="text"]{
286
+ width:60px;
287
+ }
288
+
289
+ /* Textarea */
290
+
291
+ .container-type-textarea label.spark-admin-op-title{
292
+ display:block;
293
+ }
294
+ #wpmega-style-cspark textarea,
295
+ .container-type-textarea textarea{
296
+ clear:both;
297
+ width:100%;
298
+ padding:10px;
299
+ margin-top:10px;
300
+ border-radius:0;
301
+
302
+ -webkit-transition: height .2s ease-in-out;
303
+ -moz-transition: height .2s ease-in-out;
304
+ transition: height .2s ease-in-out;
305
+
306
+ font-family:monospace;
307
+ }
308
+ .container-type-textarea textarea:focus{
309
+ height:200px;
310
+ }
311
+ #wpmega-style-css textarea[readonly]{
312
+ height:200px;
313
+ opacity:.6;
314
+ }
315
+
316
+ /* Radio */
317
+ .spark-admin-op-radio label{
318
+ padding-left:5px;
319
+ }
320
+ .spark-admin-op.container-type-radio label.spark-admin-op-title{
321
+ float:left;
322
+ width:200px;
323
+ }
324
+ .spark-admin-op-radio{
325
+ padding-left:200px;
326
+ }
327
+
328
+ /* Checkbox */
329
+ .spark-admin-op.container-type-checkbox label.spark-admin-op-title{
330
+ float:left;
331
+ width:200px;
332
+ }
333
+
334
+ /* Select */
335
+ .spark-admin-op.container-type-select label.spark-admin-op-title{
336
+ float:left;
337
+ width:200px;
338
+ }
339
+
340
+ .spark-admin-op.container-type-select select{
341
+ background: #eee; /* Old browsers */
342
+ background: #eee -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.1) 100%); /* FF3.6+ */
343
+ background: #eee -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.1)), color-stop(100%,rgba(0,0,0,.1))); /* Chrome,Safari4+ */
344
+ background: #eee -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* Chrome10+,Safari5.1+ */
345
+ background: #eee -o-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* Opera11.10+ */
346
+ background: #eee -ms-linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* IE10+ */
347
+ background: #eee linear-gradient(top, rgba(255,255,255,.1) 0%,rgba(0,0,0,.1) 100%); /* W3C */
348
+
349
+ box-shadow:0px 1px 1px #fff;
350
+ text-shadow:0px 1px 1px #fff;
351
+ border-radius:0;
352
+ border:1px solid #DDDDDD;
353
+
354
+ }
355
+
356
+ /* Radio */
357
+ #container-wpmega-style .spark-admin-op-radio label{
358
+ font-weight:bold;
359
+ padding-left:5px;
360
+ }
361
+ #container-wpmega-style .spark-admin-op-radio label .spark-admin-op-radio-desc{
362
+ font-weight:normal;
363
+ clear:both;
364
+ display:block;
365
+ color:#999;
366
+ padding-left:20px;
367
+ }
368
+
369
+ /* Color */
370
+ .spark-admin-op.container-type-color label.spark-admin-op-title{
371
+ float:left;
372
+ width:200px;
373
+ }
374
+ .spark-admin-op.container-type-color input[type="text"].colorPicker-color{
375
+ width:55px;
376
+ height:35px;
377
+ padding:10px 5px;
378
+ display:inline-block;
379
+ border:1px solid #ddd;
380
+ border-radius:0;
381
+ cursor:pointer;
382
+ position:relative;
383
+ }
384
+ .spark-admin-op.container-type-color .spark-admin-op-color{
385
+ position:relative;
386
+ }
387
+
388
+ .spark-admin-op.container-type-color .clearColor{
389
+ display:inline-block;
390
+ background: transparent url(images/cross.png) top left no-repeat;
391
+ height:16px;
392
+ width:16px;
393
+ margin-left:6px;
394
+ cursor:pointer;
395
+ }
396
+
397
+ /* Buttons */
398
+ .button.save-button,
399
+ .button.reset-button{
400
+ margin-top:2em;
401
+ margin-right:1em;
402
+ float:right;
403
+ padding:6px 22px;
404
+ border-radius:2px;
405
+ font-weight:bold;
406
+ box-shadow:0px 3px 0px #e2e2e2;
407
+ border:1px solid #ddd;
408
+ }
409
+ .button.save-button:hover,
410
+ .button.reset-button:hover{
411
+ border:1px solid #aaa;
412
+ box-shadow:0px 3px 0px #ccc;
413
+ }
414
+
415
+ .button.reset-button{
416
+ margin-left:0;
417
+ margin-top:0;
418
+ float:none;
419
+ }
420
+
421
+
422
+ /* Reset Button */
423
+ .spark-admin-op.container-type-reset label.spark-admin-op-title,
424
+ .spark-admin-op.container-type-flush-rewrite label.spark-admin-op-title{
425
+ float:left;
426
+ width:200px;
427
+ }
428
+ .spark-admin-op.container-type-reset .spark-admin-op-desc{
429
+ clear:both;
430
+ }
431
+
432
+
433
+ /* Infobox */
434
+ .spark-infobox{
435
+ padding:15px;
436
+ color: #4F8A10;
437
+ background: #DFF2BF;
438
+ border: 1px solid #4F8A10;
439
+ }
440
+ .spark-infobox h4{
441
+ color:inherit;
442
+ margin:0 0 0px 0;
443
+ font-weight:bold;
444
+ text-transform: uppercase;
445
+ font-size:12px;
446
+ }
447
+ .spark-infobox .spark-admin-op-desc{
448
+ color: #4F8A10;
449
+ }
450
+ .spark-infobox h4 + .spark-admin-op-desc{
451
+ margin-top:10px;
452
+ }
453
+
454
+ .spark-infobox.spark-infobox-warning{
455
+ border:1px solid #DDB723;
456
+ background: #FFEA73;
457
+ color: #A63C00;
458
+ }
459
+ .spark-infobox.spark-infobox-warning .spark-admin-op-desc{
460
+ color: #A63C00;
461
+ }
462
+
463
+ .spark-admin-op-desc .spark-infobox{
464
+ display:block;
465
+ padding:5px;
466
+ opacity:.8;
467
+ }
468
+
469
+
470
+ /** SS-TOGGLE **/
471
+ .spark-toggle-onoff{
472
+ /*float:left;
473
+ clear:left;*/
474
+
475
+ font-size:10px;
476
+
477
+ width:79px; /*81px;*/
478
+ height:20px;
479
+ box-shadow: inset 1px 1px 3px #666;
480
+ -moz-box-shadow: inset 1px 1px 3px #666;
481
+ -webkit-box-shadow: inset 1px 1px 3px #666;
482
+
483
+ border-radius: 2px;
484
+ -moz-border-radius: 2px;
485
+ -webkit-border-radius: 2px;
486
+
487
+ border:1px solid #ddd;
488
+ border-color:#ddd #aaa #ddd #ddd;
489
+ overflow:hidden;
490
+ display:block;
491
+ position:relative;
492
+ }
493
+ .spark-toggle-onoff span.spark-toggle-inner{
494
+ width:130px;
495
+ height:20px;
496
+ position:relative;
497
+ display:block;
498
+ }
499
+ .spark-toggle-onoff.off span.spark-toggle-inner{
500
+ margin-left:-51px;
501
+ }
502
+ .spark-toggle-onoff span{
503
+ height:20px;
504
+ line-height:20px;
505
+ position:absolute;
506
+ top:0px;
507
+ display:inline-block;
508
+ text-align:center;
509
+ color:#fff;
510
+ text-shadow:0px -1px 1px #222;
511
+ text-transform:uppercase;
512
+ font-weight:bold;
513
+ float:left; /* important for RTL */
514
+ }
515
+ .spark-toggle-onoff span.spark-toggle-on{
516
+ width:45px;
517
+ left:0px;
518
+ padding-right:5px;
519
+
520
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4D90FE', endColorstr='#2B70DC'); /* for IE */
521
+ -ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr='#4D90FE', endColorstr='#2B70DC')"; /* for IE */
522
+ background: -webkit-gradient(linear, left top, left bottom, from(#6FB2FF), to(#4D90FE)); /* for webkit browsers */
523
+ background: -moz-linear-gradient(top, #4D90FE, #2B70DC);
524
+
525
+
526
+ box-shadow: inset 1px 1px 3px #2B70DC;
527
+ -moz-box-shadow: inset 1px 1px 3px #2B70DC;
528
+ -webkit-box-shadow: inset 1px 1px 3px #2B70DC; /*3061a8;*/
529
+
530
+ border-radius: 2px 0px 0px 2px;
531
+ -moz-border-radius: 2px 0px 0px 2px;
532
+ -webkit-border-radius: 2px 0px 0px 2px;
533
+
534
+ text-shadow:0px -1px 1px #2B70DC;
535
+
536
+ padding-right:5px;
537
+ }
538
+ .spark-toggle-mid{
539
+ width:30px;
540
+ height:18px;
541
+ left:50px;
542
+ top:-1px;
543
+ border:1px solid #999;
544
+ border-color:#eee #aaa;
545
+ border-width:1px 1px 1px 1px;
546
+ z-index:20;
547
+
548
+
549
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4e4e4', endColorstr='#f9f9f9'); /* for IE */
550
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4e4e4', endColorstr='#f9f9f9')"; /* for IE */
551
+ background: -webkit-gradient(linear, left top, left bottom, from(#e4e4e4), to(#f9f9f9)); /* for webkit browsers */
552
+ background: -moz-linear-gradient(top, #e4e4e4, #f9f9f9);
553
+
554
+ border-radius:2px;
555
+ -moz-border-radius:2px;
556
+ -webkit-border-radius:2px;
557
+
558
+ -moz-box-shadow:0px 0px 3px rgba(0,0,0,.5);
559
+ -webkit-box-shadow:0px 0px 3px rgba(0,0,0,.5);
560
+ box-shadow:0px 0px 3px rgba(0,0,0,.5);
561
+
562
+ position:relative;
563
+ }
564
+ .spark-toggle-mid:after{
565
+ content:' ';
566
+ position:absolute;
567
+ width:12px;
568
+ height:8px;
569
+ display:block;
570
+ top:5px;
571
+ left:9px;
572
+ border: 1px #ccc;
573
+
574
+ background:
575
+ -webkit-repeating-linear-gradient(
576
+ left,
577
+ #ddd 1px,
578
+ #ddd 2px,
579
+ transparent 2px,
580
+ transparent 5px
581
+ );
582
+ background:
583
+ -moz-repeating-linear-gradient(
584
+ left,
585
+ #ddd 1px,
586
+ #ddd 2px,
587
+ transparent 2px,
588
+ transparent 5px
589
+ );
590
+ background:
591
+ repeating-linear-gradient(
592
+ left,
593
+ #ddd 1px,
594
+ #ddd 2px,
595
+ transparent 2px,
596
+ transparent 5px
597
+ );
598
+ }
599
+ .spark-toggle-onoff span.spark-toggle-off{
600
+ width:50px;
601
+ padding-left:5px;
602
+ left:75px;
603
+ z-index:10;
604
+ color:#666;
605
+ text-shadow:0px 1px 1px #fff;
606
+
607
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#fcfcfc'); /* for IE */
608
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#fcfcfc')"; /* for IE */
609
+ background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#fcfcfc)); /* for webkit browsers */
610
+ background: -moz-linear-gradient(top, #eee, #fcfcfc);
611
+ }
612
+
613
+ .spark-tog-label{
614
+ line-height:20px;
615
+ padding-left:90px;
616
+ display:block;
617
+ font-weight:bold;
618
+ font-size:11px;
619
+
620
+ margin-bottom:5px;
621
+ }
622
+
623
+ .spark-nav #message{
624
+ display:none;
625
+ }
626
+
627
+ .cf:before,
628
+ .cf:after {
629
+ content:"";
630
+ display:table;
631
+ }
632
+ .cf:after {
633
+ clear:both;
634
+ }
635
+ .cf {
636
+ zoom:1; /* For IE 6/7 (trigger hasLayout) */
637
+ }
638
+
639
+ #spark-ss-config input[type="submit"]{
640
+ display:none;
641
+ }
642
+
643
+ .social_media{
644
+ position:absolute;
645
+ top:20px;
646
+ right:20px;
647
+ }
648
+
649
+ .ss-twitter,
650
+ .ss-facebook,
651
+ .ss-dribbble{
652
+ display:inline-block;
653
+ height:16px;
654
+ width:16px;
655
+ float:left;
656
+ margin-right:10px;
657
+ opacity:.7;
658
+ }
659
+ .ss-twitter:hover,
660
+ .ss-facebook:hover,
661
+ .ss-dribbble:hover{
662
+ opacity:1;
663
+ }
664
+ .ss-twitter{
665
+ background:transparent url(images/social_media_icons/twitter_2.png) top left no-repeat;
666
+ }
667
+ .ss-facebook{
668
+ background:transparent url(images/social_media_icons/facebook.png) top left no-repeat;
669
+ }
670
+ .ss-dribbble{
671
+ background:transparent url(images/social_media_icons/dribbble.png) top left no-repeat;
672
+ }
sparkoptions/sparkoptions.js ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***********************************************
2
+ * SparkOptions Javascript
3
+ *
4
+ * @author Chris Mavricos, Sevenspark http://sevenspark.com
5
+ * @version 1.0
6
+ * Last modified 2012-02-08
7
+ *
8
+ ***********************************************/
9
+
10
+ jQuery(document).ready(function($){
11
+
12
+ var DEBUG = false;
13
+
14
+ $('.spark-panel').hide().first().show();
15
+
16
+ $('.spark-nav ul li a').click(function(e){
17
+ e.preventDefault();
18
+
19
+ $('#current-panel-id').val( $(this).attr('href').substr(7) ); //chop off #spark-
20
+
21
+ $('.spark-nav ul li a.current').removeClass('current');
22
+ $(this).addClass('current');
23
+
24
+ var $target = $( $(this).attr('href') );
25
+ $('.spark-panel').css('minHeight', 0).stop().slideUp(function(){
26
+ $(this).css('minHeight', '');
27
+ });
28
+ $target.stop().css('minHeight', 0).slideDown(function(){
29
+ $(this).css( { height : '', padding: '', minHeight : '' } );
30
+ });
31
+
32
+ });
33
+ $('.spark-nav ul li a[href="#spark-'+$('#current-panel-id').val()+'"]').click();
34
+
35
+ /* Input Sliding Interface */
36
+ $('.spark-admin-op input[type="checkbox"], #wpmega-demo .spark-admin-op input[type="radio"]')
37
+ .each(function(k, el){
38
+ var tog = $(el).is(':checked') ? 'on' : 'off';
39
+ var $toggle = $('<label class="spark-toggle-onoff '+tog+'" for="'+$(el).attr('id')+
40
+ '"><span class="spark-toggle-inner"><span class="spark-toggle-on">On</span><span class="spark-toggle-mid"></span><span class="spark-toggle-off">Off</span></span></label>');
41
+
42
+ switch($(el).attr('type')){
43
+
44
+ case 'checkbox':
45
+
46
+ $(el).after($toggle);
47
+ $(el).hide();
48
+
49
+ $toggle.click(function(){
50
+
51
+ //console.log($(el).is(':checked') ? 'checked' : 'not checked');
52
+
53
+ if($(el).is(':checked')){
54
+ //console.log('checked');
55
+ var $this = $(this);
56
+ $this.find('.spark-toggle-inner').animate({
57
+ 'margin-left' : '-51px'
58
+ }, 'normal', function(){
59
+ $this.removeClass('on').addClass('off');
60
+ });
61
+ $(el).attr('checked', false);
62
+ }
63
+ else{
64
+ //console.log('not checked');
65
+ var $this = $(this);
66
+ $this.find('.spark-toggle-inner').animate({
67
+ 'margin-left' : '0px'
68
+ }, 'normal', function(){
69
+ $this.removeClass('off').addClass('on');
70
+ });
71
+ $(el).attr('checked', true);
72
+ }
73
+
74
+ return false; //stops the label click from reversing the check, which is necessary in IE
75
+ });
76
+ break;
77
+
78
+ case 'radio' :
79
+ var $label = $(el).next('label');
80
+ var labelText = $label.text();
81
+ $label.hide();
82
+ //console.log(labelText);
83
+
84
+ $(el).after('<span class="spark-tog-label">'+labelText+'</span>');
85
+ $(el).after($toggle);
86
+ $(el).hide();
87
+
88
+ $toggle.click(function(){
89
+ if($(this).prev().is(':checked')){
90
+ //Do nothing, it's double clicking a radio button
91
+ }
92
+ else{
93
+
94
+ var oldID = $('input[name="'+$(el).attr('name')+'"]:checked').attr('id');
95
+
96
+ //turn on
97
+ var $this = $(this);
98
+ $this.find('.spark-toggle-inner').animate({
99
+ 'margin-left' : '0px'
100
+ }, 'normal', function(){
101
+ $this.removeClass('off').addClass('on');
102
+ });
103
+ //$this.prev().attr('checked', true);
104
+ $(el).attr('checked', true);
105
+
106
+ //turn off the old
107
+ $('label[for="'+oldID+'"] .spark-toggle-inner').animate({
108
+ 'margin-left' : '-51px'
109
+ }, 'normal', function(){
110
+ $(this).parent('label').removeClass('on').addClass('off');
111
+ })
112
+ .siblings('input[type="radio"]').attr('checked', false);
113
+ }
114
+ return false;
115
+ });
116
+ break;
117
+ }
118
+ });
119
+
120
+
121
+ });
122
+
123
+