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,77 @@
|
|
|
1
|
+
<div class="wrap" id="of_container">
|
|
2
|
+
|
|
3
|
+
<div id="of-popup-save" class="of-save-popup">
|
|
4
|
+
<div class="of-save-save">Options Updated</div>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div id="of-popup-reset" class="of-save-popup">
|
|
8
|
+
<div class="of-save-reset">Options Reset</div>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div id="of-popup-fail" class="of-save-popup">
|
|
12
|
+
<div class="of-save-fail">Error!</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<span style="display: none;" id="hooks"><?php echo json_encode( of_get_header_classes_array() ); ?></span>
|
|
16
|
+
<input type="hidden" id="reset" value="<?php if ( isset( $_REQUEST['reset'] ) ) echo $_REQUEST['reset']; ?>" />
|
|
17
|
+
<input type="hidden" id="security" name="security" value="<?php echo wp_create_nonce( 'of_ajax_nonce' ); ?>" />
|
|
18
|
+
|
|
19
|
+
<form id="of_form" method="post" action="<?php echo esc_attr( $_SERVER['REQUEST_URI'] ) ?>" enctype="multipart/form-data" >
|
|
20
|
+
|
|
21
|
+
<div id="header">
|
|
22
|
+
|
|
23
|
+
<div class="logo">
|
|
24
|
+
<h2><?php echo THEMENAME; ?></h2>
|
|
25
|
+
<span><?php echo 'v'. THEMEVERSION; ?></span>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div id="js-warning">Warning- This options panel will not work properly without javascript!</div>
|
|
29
|
+
<div class="icon-option"></div>
|
|
30
|
+
<div class="clear"></div>
|
|
31
|
+
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div id="info_bar">
|
|
35
|
+
|
|
36
|
+
<a>
|
|
37
|
+
<div id="expand_options" class="expand">Expand</div>
|
|
38
|
+
</a>
|
|
39
|
+
|
|
40
|
+
<img style="display:none" src="<?php echo ADMIN_DIR; ?>assets/images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." />
|
|
41
|
+
|
|
42
|
+
<button id="of_save" type="button" class="button-primary">
|
|
43
|
+
<?php _e( 'Save All Changes' );?>
|
|
44
|
+
</button>
|
|
45
|
+
|
|
46
|
+
</div><!--.info_bar-->
|
|
47
|
+
|
|
48
|
+
<div id="main">
|
|
49
|
+
|
|
50
|
+
<div id="of-nav">
|
|
51
|
+
<ul>
|
|
52
|
+
<?php echo $options_machine->Menu ?>
|
|
53
|
+
</ul>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div id="content">
|
|
57
|
+
<?php echo $options_machine->Inputs /* Settings */ ?>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div class="clear"></div>
|
|
61
|
+
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div class="save_bar">
|
|
65
|
+
|
|
66
|
+
<img style="display:none" src="<?php echo ADMIN_DIR; ?>assets/images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." />
|
|
67
|
+
<button id ="of_save" type="button" class="button-primary"><?php _e( 'Save All Changes' );?></button>
|
|
68
|
+
<button id ="of_reset" type="button" class="button submit-button reset-button" ><?php _e( 'Options Reset' );?></button>
|
|
69
|
+
<img style="display:none" src="<?php echo ADMIN_DIR; ?>assets/images/loading-bottom.gif" class="ajax-reset-loading-img ajax-loading-img-bottom" alt="Working..." />
|
|
70
|
+
|
|
71
|
+
</div><!--.save_bar-->
|
|
72
|
+
|
|
73
|
+
</form>
|
|
74
|
+
|
|
75
|
+
<div style="clear:both;"></div>
|
|
76
|
+
|
|
77
|
+
</div><!--wrap-->
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* SMOF Admin
|
|
4
|
+
*
|
|
5
|
+
* @package WordPress
|
|
6
|
+
* @subpackage SMOF
|
|
7
|
+
* @since 1.4.0
|
|
8
|
+
* @author Syamil MJ
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Head Hook
|
|
14
|
+
*
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
function of_head() { do_action( 'of_head' ); }
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Add default options upon activation else DB does not exist
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
*/
|
|
24
|
+
function of_option_setup() {
|
|
25
|
+
global $of_options, $options_machine;
|
|
26
|
+
$options_machine = new Options_Machine( $of_options );
|
|
27
|
+
|
|
28
|
+
if ( !get_option( OPTIONS ) ) {
|
|
29
|
+
update_option( OPTIONS, $options_machine->Defaults );
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Change activation message
|
|
35
|
+
*
|
|
36
|
+
* @since 1.0.0
|
|
37
|
+
*/
|
|
38
|
+
function optionsframework_admin_message() {
|
|
39
|
+
|
|
40
|
+
//Tweaked the message on theme activate
|
|
41
|
+
?>
|
|
42
|
+
<script type="text/javascript">
|
|
43
|
+
jQuery(function(){
|
|
44
|
+
|
|
45
|
+
var message = '<p>This theme comes with an <a href="<?php echo admin_url( 'admin.php?page=optionsframework' ); ?>">options panel</a> to configure settings. This theme also supports widgets, please visit the <a href="<?php echo admin_url( 'widgets.php' ); ?>">widgets settings page</a> to configure them.</p>';
|
|
46
|
+
jQuery('.themes-php #message2').html(message);
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
<?php
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get header classes
|
|
56
|
+
*
|
|
57
|
+
* @since 1.0.0
|
|
58
|
+
*/
|
|
59
|
+
function of_get_header_classes_array() {
|
|
60
|
+
global $of_options;
|
|
61
|
+
|
|
62
|
+
foreach ( $of_options as $value ) {
|
|
63
|
+
if ( $value['type'] == 'heading' )
|
|
64
|
+
$hooks[] = str_replace( ' ', '', strtolower( $value['name'] ) );
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return $hooks;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* For use in themes
|
|
73
|
+
*
|
|
74
|
+
* @since forever
|
|
75
|
+
*/
|
|
76
|
+
$data = get_option( OPTIONS );
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* SMOF Interface
|
|
4
|
+
*
|
|
5
|
+
* @package WordPress
|
|
6
|
+
* @subpackage SMOF
|
|
7
|
+
* @since 1.4.0
|
|
8
|
+
* @author Syamil MJ
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Admin Init
|
|
14
|
+
*
|
|
15
|
+
* @uses wp_verify_nonce()
|
|
16
|
+
* @uses header()
|
|
17
|
+
* @uses update_option()
|
|
18
|
+
*
|
|
19
|
+
* @since 1.0.0
|
|
20
|
+
*/
|
|
21
|
+
function optionsframework_admin_init() {
|
|
22
|
+
// Rev up the Options Machine
|
|
23
|
+
global $of_options, $options_machine;
|
|
24
|
+
$options_machine = new Options_Machine( $of_options );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Create Options page
|
|
29
|
+
*
|
|
30
|
+
* @uses add_theme_page()
|
|
31
|
+
* @uses add_action()
|
|
32
|
+
*
|
|
33
|
+
* @since 1.0.0
|
|
34
|
+
*/
|
|
35
|
+
function optionsframework_add_admin() {
|
|
36
|
+
|
|
37
|
+
$of_page = add_theme_page( THEMENAME, 'Theme Options', 'edit_theme_options', 'optionsframework', 'optionsframework_options_page' );
|
|
38
|
+
|
|
39
|
+
// Add framework functionaily to the head individually
|
|
40
|
+
add_action( "admin_print_scripts-$of_page", 'of_load_only' );
|
|
41
|
+
add_action( "admin_print_styles-$of_page", 'of_style_only' );
|
|
42
|
+
add_action( "admin_print_styles-$of_page", 'optionsframework_mlu_css', 0 );
|
|
43
|
+
add_action( "admin_print_scripts-$of_page", 'optionsframework_mlu_js', 0 );
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Build Options page
|
|
50
|
+
*
|
|
51
|
+
* @since 1.0.0
|
|
52
|
+
*/
|
|
53
|
+
function optionsframework_options_page() {
|
|
54
|
+
|
|
55
|
+
global $options_machine;
|
|
56
|
+
/*
|
|
57
|
+
//for debugging
|
|
58
|
+
$data = get_option(OPTIONS);
|
|
59
|
+
print_r($data);
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
include_once ADMIN_PATH . 'front-end/options.php';
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Create Options page
|
|
68
|
+
*
|
|
69
|
+
* @uses wp_enqueue_style()
|
|
70
|
+
*
|
|
71
|
+
* @since 1.0.0
|
|
72
|
+
*/
|
|
73
|
+
function of_style_only() {
|
|
74
|
+
wp_enqueue_style( 'admin-style', ADMIN_DIR . 'assets/css/admin-style.css' );
|
|
75
|
+
wp_enqueue_style( 'color-picker', ADMIN_DIR . 'assets/css/colorpicker.css' );
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Create Options page
|
|
80
|
+
*
|
|
81
|
+
* @uses add_action()
|
|
82
|
+
* @uses wp_enqueue_script()
|
|
83
|
+
*
|
|
84
|
+
* @since 1.0.0
|
|
85
|
+
*/
|
|
86
|
+
function of_load_only() {
|
|
87
|
+
add_action( 'admin_head', 'of_admin_head' );
|
|
88
|
+
|
|
89
|
+
wp_enqueue_script( 'jquery-ui-core' );
|
|
90
|
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
|
91
|
+
wp_enqueue_script( 'jquery-input-mask', ADMIN_DIR .'assets/js/jquery.maskedinput-1.2.2.js', array( 'jquery' ) );
|
|
92
|
+
wp_enqueue_script( 'tipsy', ADMIN_DIR .'assets/js/jquery.tipsy.js', array( 'jquery' ) );
|
|
93
|
+
wp_enqueue_script( 'color-picker', ADMIN_DIR .'assets/js/colorpicker.js', array( 'jquery' ) );
|
|
94
|
+
wp_enqueue_script( 'ajaxupload', ADMIN_DIR .'assets/js/ajaxupload.js', array( 'jquery' ) );
|
|
95
|
+
wp_enqueue_script( 'cookie', ADMIN_DIR . 'assets/js/cookie.js', 'jquery' );
|
|
96
|
+
wp_enqueue_script( 'smof', ADMIN_DIR .'assets/js/smof.js', array( 'jquery' ) );
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Front end inline jquery scripts
|
|
101
|
+
*
|
|
102
|
+
* @since 1.0.0
|
|
103
|
+
*/
|
|
104
|
+
function of_admin_head() { ?>
|
|
105
|
+
|
|
106
|
+
<script type="text/javascript" language="javascript">
|
|
107
|
+
|
|
108
|
+
jQuery.noConflict();
|
|
109
|
+
jQuery(document).ready(function($){
|
|
110
|
+
|
|
111
|
+
// COLOR Picker
|
|
112
|
+
$('.colorSelector').each(function(){
|
|
113
|
+
var Othis = this; //cache a copy of the this variable for use inside nested function
|
|
114
|
+
|
|
115
|
+
$(this).ColorPicker({
|
|
116
|
+
color: '<?php if ( isset( $color ) ) echo $color; ?>',
|
|
117
|
+
onShow: function (colpkr) {
|
|
118
|
+
$(colpkr).fadeIn(500);
|
|
119
|
+
return false;
|
|
120
|
+
},
|
|
121
|
+
onHide: function (colpkr) {
|
|
122
|
+
$(colpkr).fadeOut(500);
|
|
123
|
+
return false;
|
|
124
|
+
},
|
|
125
|
+
onChange: function (hsb, hex, rgb) {
|
|
126
|
+
$(Othis).children('div').css('backgroundColor', '#' + hex);
|
|
127
|
+
$(Othis).next('input').attr('value','#' + hex);
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
}); //end color picker
|
|
133
|
+
|
|
134
|
+
}); //end doc ready
|
|
135
|
+
|
|
136
|
+
</script>
|
|
137
|
+
<?php
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Ajax Save Options
|
|
142
|
+
*
|
|
143
|
+
* @uses get_option()
|
|
144
|
+
* @uses update_option()
|
|
145
|
+
*
|
|
146
|
+
* @since 1.0.0
|
|
147
|
+
*/
|
|
148
|
+
function of_ajax_callback() {
|
|
149
|
+
global $options_machine, $of_options;
|
|
150
|
+
|
|
151
|
+
$nonce = $_POST['security'];
|
|
152
|
+
|
|
153
|
+
if ( ! wp_verify_nonce( $nonce, 'of_ajax_nonce' ) )
|
|
154
|
+
die( '-1' );
|
|
155
|
+
|
|
156
|
+
//get options array from db
|
|
157
|
+
$all = get_option( OPTIONS );
|
|
158
|
+
|
|
159
|
+
$save_type = $_POST['type'];
|
|
160
|
+
|
|
161
|
+
//echo $_POST['data'];
|
|
162
|
+
|
|
163
|
+
//Uploads
|
|
164
|
+
if ( $save_type == 'upload' ) {
|
|
165
|
+
$clickedID = $_POST['data']; // Acts as the name
|
|
166
|
+
$filename = $_FILES[$clickedID];
|
|
167
|
+
$filename['name'] = preg_replace( '/[^a-zA-Z0-9._\-]/', '', $filename['name'] );
|
|
168
|
+
|
|
169
|
+
$override['test_form'] = false;
|
|
170
|
+
$override['action'] = 'wp_handle_upload';
|
|
171
|
+
$uploaded_file = wp_handle_upload( $filename, $override );
|
|
172
|
+
|
|
173
|
+
$upload_tracking[] = $clickedID;
|
|
174
|
+
|
|
175
|
+
//update $options array w/ image URL
|
|
176
|
+
$upload_image = $all; //preserve current data
|
|
177
|
+
|
|
178
|
+
$upload_image[$clickedID] = $uploaded_file['url'];
|
|
179
|
+
|
|
180
|
+
update_option( OPTIONS, $upload_image );
|
|
181
|
+
|
|
182
|
+
if ( ! empty( $uploaded_file['error'] ) ) {
|
|
183
|
+
echo 'Upload Error: ' . $uploaded_file['error'];
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
echo $uploaded_file['url'];
|
|
187
|
+
} // Is the Response
|
|
188
|
+
}
|
|
189
|
+
elseif ( $save_type == 'image_reset' ) {
|
|
190
|
+
$id = $_POST['data']; // Acts as the name
|
|
191
|
+
|
|
192
|
+
$delete_image = $all; //preserve rest of data
|
|
193
|
+
$delete_image[$id] = ''; //update array key with empty value
|
|
194
|
+
update_option( OPTIONS, $delete_image );
|
|
195
|
+
}
|
|
196
|
+
elseif ( $save_type == 'backup_options' ) {
|
|
197
|
+
$backup = $all;
|
|
198
|
+
$backup['backup_log'] = date( 'r' );
|
|
199
|
+
|
|
200
|
+
update_option( BACKUPS, $backup );
|
|
201
|
+
|
|
202
|
+
die( '1' );
|
|
203
|
+
} elseif ( $save_type == 'restore_options' ) {
|
|
204
|
+
$data = get_option( BACKUPS );
|
|
205
|
+
|
|
206
|
+
update_option( OPTIONS, $data );
|
|
207
|
+
|
|
208
|
+
die( '1' );
|
|
209
|
+
}
|
|
210
|
+
elseif ( $save_type == 'import_options' ) {
|
|
211
|
+
$data = $_POST['data'];
|
|
212
|
+
$data = unserialize( base64_decode( $data ) ); //100% safe - ignore theme check nag
|
|
213
|
+
update_option( OPTIONS, $data );
|
|
214
|
+
|
|
215
|
+
die( '1' );
|
|
216
|
+
}
|
|
217
|
+
elseif ( $save_type == 'save' ) {
|
|
218
|
+
wp_parse_str( stripslashes( $_POST['data'] ), $data );
|
|
219
|
+
unset( $data['security'] );
|
|
220
|
+
unset( $data['of_save'] );
|
|
221
|
+
update_option( OPTIONS, $data );
|
|
222
|
+
|
|
223
|
+
die( '1' );
|
|
224
|
+
}
|
|
225
|
+
elseif ( $save_type == 'reset' ) {
|
|
226
|
+
update_option( OPTIONS, $options_machine->Defaults );
|
|
227
|
+
|
|
228
|
+
die( '1' ); //options reset
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
die();
|
|
232
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Functions Load
|
|
4
|
+
*
|
|
5
|
+
* @package WordPress
|
|
6
|
+
* @subpackage SMOF
|
|
7
|
+
* @since 1.4.0
|
|
8
|
+
* @author Syamil MJ
|
|
9
|
+
*/
|
|
10
|
+
require_once( ADMIN_PATH . 'functions/functions.php' );
|
|
11
|
+
require_once( ADMIN_PATH . 'functions/functions.interface.php' );
|
|
12
|
+
require_once( ADMIN_PATH . 'functions/functions.options.php' );
|
|
13
|
+
require_once( ADMIN_PATH . 'functions/functions.admin.php' );
|
|
14
|
+
require_once( ADMIN_PATH . 'functions/functions.mediauploader.php' );
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WooThemes Media Library-driven AJAX File Uploader Module (2010-11-05)
|
|
5
|
+
*
|
|
6
|
+
* Slightly modified for use in the Options Framework.
|
|
7
|
+
*
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Sets up a custom post type to attach image to. This allows us to have
|
|
13
|
+
* individual galleries for different uploaders.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
if ( ! function_exists( 'optionsframework_mlu_init' ) ) {
|
|
17
|
+
function optionsframework_mlu_init() {
|
|
18
|
+
register_post_type(
|
|
19
|
+
'options', array(
|
|
20
|
+
'labels' => array(
|
|
21
|
+
'name' => __( 'Options' ),
|
|
22
|
+
),
|
|
23
|
+
'public' => true,
|
|
24
|
+
'show_ui' => false,
|
|
25
|
+
'capability_type' => 'post',
|
|
26
|
+
'hierarchical' => false,
|
|
27
|
+
'rewrite' => false,
|
|
28
|
+
'supports' => array( 'title', 'editor' ),
|
|
29
|
+
'query_var' => false,
|
|
30
|
+
'can_export' => true,
|
|
31
|
+
'show_in_nav_menus' => false,
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Forces insert into post
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
add_filter( 'get_media_item_args', 'force_send' );
|
|
42
|
+
function force_send( $args ) {
|
|
43
|
+
$args['send'] = true;
|
|
44
|
+
return $args;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Adds the Thickbox CSS file and specific loading and button images to the header
|
|
49
|
+
* on the pages where this function is called.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
if ( ! function_exists( 'optionsframework_mlu_css' ) ) {
|
|
53
|
+
function optionsframework_mlu_css() {
|
|
54
|
+
$_html = '';
|
|
55
|
+
$_html .= '<link rel="stylesheet" href="' . get_option( 'siteurl' ) . '/' . WPINC . '/js/thickbox/thickbox.css" type="text/css" media="screen" />' . "\n";
|
|
56
|
+
$_html .= '<script type="text/javascript">
|
|
57
|
+
var tb_pathToImage = "' . get_option( 'siteurl' ) . '/' . WPINC . '/js/thickbox/loadingAnimation.gif";
|
|
58
|
+
var tb_closeImage = "' . get_option( 'siteurl' ) . '/' . WPINC . '/js/thickbox/tb-close.png";
|
|
59
|
+
</script>' . "\n";
|
|
60
|
+
|
|
61
|
+
echo $_html;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Registers and enqueues (loads) the necessary JavaScript file for working with the
|
|
67
|
+
* Media Library-driven AJAX File Uploader Module.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
if ( ! function_exists( 'optionsframework_mlu_js' ) ) {
|
|
71
|
+
function optionsframework_mlu_js() {
|
|
72
|
+
// Registers custom scripts for the Media Library AJAX uploader.
|
|
73
|
+
wp_register_script( 'of-medialibrary-uploader', ADMIN_DIR .'assets/js/of-medialibrary-uploader.js', array( 'jquery', 'thickbox' ) );
|
|
74
|
+
wp_enqueue_script( 'of-medialibrary-uploader' );
|
|
75
|
+
wp_enqueue_script( 'media-upload' );
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Uses "silent" posts in the database to store relationships for images.
|
|
81
|
+
* This also creates the facility to collect galleries of, for example, logo images.
|
|
82
|
+
*
|
|
83
|
+
* Return: $_postid.
|
|
84
|
+
*
|
|
85
|
+
* If no "silent" post is present, one will be created with the type "optionsframework"
|
|
86
|
+
* and the post_name of "of-$_token".
|
|
87
|
+
*
|
|
88
|
+
* Example Usage:
|
|
89
|
+
* optionsframework_mlu_get_silentpost ( 'of_logo' );
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
if ( ! function_exists( 'optionsframework_mlu_get_silentpost' ) ) {
|
|
93
|
+
function optionsframework_mlu_get_silentpost( $_token ) {
|
|
94
|
+
global $wpdb;
|
|
95
|
+
$_id = 0;
|
|
96
|
+
|
|
97
|
+
// Check if the token is valid against a whitelist.
|
|
98
|
+
// $_whitelist = array( 'of_logo', 'of_custom_favicon', 'of_ad_top_image' );
|
|
99
|
+
// Sanitise the token.
|
|
100
|
+
|
|
101
|
+
$_token = strtolower( str_replace( ' ', '_', $_token ) );
|
|
102
|
+
|
|
103
|
+
// if ( in_array( $_token, $_whitelist ) ) {
|
|
104
|
+
if ( $_token ) {
|
|
105
|
+
// Tell the function what to look for in a post.
|
|
106
|
+
$_args = array( 'post_type' => 'options', 'post_name' => 'of-' . $_token, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed' );
|
|
107
|
+
|
|
108
|
+
// Look in the database for a "silent" post that meets our criteria.
|
|
109
|
+
$query = 'SELECT ID FROM ' . $wpdb->posts . ' WHERE post_parent = 0';
|
|
110
|
+
foreach ( $_args as $k => $v ) {
|
|
111
|
+
$query .= ' AND ' . $k . ' = "' . $v . '"';
|
|
112
|
+
} // End FOREACH Loop
|
|
113
|
+
|
|
114
|
+
$query .= ' LIMIT 1';
|
|
115
|
+
$_posts = $wpdb->get_row( $query );
|
|
116
|
+
|
|
117
|
+
// If we've got a post, loop through and get it's ID.
|
|
118
|
+
if ( count( $_posts ) ) {
|
|
119
|
+
$_id = $_posts->ID;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// If no post is present, insert one.
|
|
123
|
+
// Prepare some additional data to go with the post insertion.
|
|
124
|
+
$_words = explode( '_', $_token );
|
|
125
|
+
$_title = join( ' ', $_words );
|
|
126
|
+
$_title = ucwords( $_title );
|
|
127
|
+
$_post_data = array( 'post_title' => $_title );
|
|
128
|
+
$_post_data = array_merge( $_post_data, $_args );
|
|
129
|
+
$_id = wp_insert_post( $_post_data );
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return $_id;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Trigger code inside the Media Library popup.
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
if ( ! function_exists( 'optionsframework_mlu_insidepopup' ) ) {
|
|
141
|
+
function optionsframework_mlu_insidepopup() {
|
|
142
|
+
if ( isset( $_REQUEST['is_optionsframework'] ) && $_REQUEST['is_optionsframework'] == 'yes' ) {
|
|
143
|
+
add_action( 'admin_head', 'optionsframework_mlu_js_popup' );
|
|
144
|
+
add_filter( 'media_upload_tabs', 'optionsframework_mlu_modify_tabs' );
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if ( ! function_exists( 'optionsframework_mlu_js_popup' ) ) {
|
|
150
|
+
function optionsframework_mlu_js_popup() {
|
|
151
|
+
$_of_title = $_REQUEST['of_title'];
|
|
152
|
+
if ( ! $_of_title ) {
|
|
153
|
+
$_of_title = 'file';
|
|
154
|
+
} // End IF Statement
|
|
155
|
+
?>
|
|
156
|
+
<script type="text/javascript">
|
|
157
|
+
jQuery(function($) {
|
|
158
|
+
jQuery.noConflict();
|
|
159
|
+
|
|
160
|
+
// Change the title of each tab to use the custom title text instead of "Media File".
|
|
161
|
+
$( 'h3.media-title' ).each (function () {
|
|
162
|
+
var current_title = $(this).html();
|
|
163
|
+
var new_title = current_title.replace( 'media file', '<?php echo $_of_title; ?>' );
|
|
164
|
+
$(this).html(new_title);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Change the text of the "Insert into Post" buttons to read "Use this File".
|
|
168
|
+
$( '.savesend input.button[value*="Insert into Post"], .media-item #go_button' ).attr( 'value', 'Use this File' );
|
|
169
|
+
|
|
170
|
+
// Hide the "Insert Gallery" settings box on the "Gallery" tab.
|
|
171
|
+
$( 'div#gallery-settings' ).hide();
|
|
172
|
+
|
|
173
|
+
// Preserve the "is_optionsframework" parameter on the "delete" confirmation button.
|
|
174
|
+
$( '.savesend a.del-link' ).click (function () {
|
|
175
|
+
var continueButton = $(this).next( '.del-attachment' ).children( 'a.button[id*="del"]' );
|
|
176
|
+
var continueHref = continueButton.attr( 'href' );
|
|
177
|
+
continueHref = continueHref + '&is_optionsframework=yes';
|
|
178
|
+
continueButton.attr( 'href', continueHref );
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
</script>
|
|
182
|
+
<?php
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Triggered inside the Media Library popup to modify the title of the "Gallery" tab.
|
|
188
|
+
*/
|
|
189
|
+
if ( ! function_exists( 'optionsframework_mlu_modify_tabs' ) ) {
|
|
190
|
+
function optionsframework_mlu_modify_tabs( $tabs ) {
|
|
191
|
+
$tabs['gallery'] = str_replace( __( 'Gallery', 'starter' ), __( 'Previously Uploaded', 'starter' ), $tabs['gallery'] );
|
|
192
|
+
return $tabs;
|
|
193
|
+
}
|
|
194
|
+
}
|