SHOW:
|
|
- or go back to the newest paste.
| 1 | - | <?php get_header(); ?> |
| 1 | + | <?php |
| 2 | ||
| 3 | - | <?php if (have_posts()) : while (have_posts()) : the_post(); ?> |
| 3 | + | /********* ePanel v.3.2 ************/ |
| 4 | ||
| 5 | - | <?php include(TEMPLATEPATH.'/includes/entry.php'); ?> |
| 5 | + | /* Adds jquery script */ |
| 6 | add_action( 'wp_print_scripts', 'et_jquery_script', 8 ); | |
| 7 | - | <?php endwhile; ?> |
| 7 | + | function et_jquery_script(){
|
| 8 | wp_enqueue_script('jquery');
| |
| 9 | - | <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
|
| 9 | + | } |
| 10 | - | else { ?>
|
| 10 | + | |
| 11 | - | <?php get_template_part('includes/navigation'); ?>
|
| 11 | + | /* Admin scripts + ajax jquery code */ |
| 12 | - | <?php } ?> |
| 12 | + | if ( ! function_exists( 'et_epanel_admin_js' ) ){
|
| 13 | function et_epanel_admin_js(){
| |
| 14 | - | <?php else : ?> |
| 14 | + | global $themename; |
| 15 | - | <?php get_template_part('includes/no-results'); ?>
|
| 15 | + | |
| 16 | - | <?php endif; ?> |
| 16 | + | $epanel_jsfolder = get_template_directory_uri() . '/epanel/js'; |
| 17 | wp_enqueue_script('jquery-ui-tabs');
| |
| 18 | - | </div> <!-- end #main-area --> |
| 18 | + | wp_enqueue_script('jquery-form');
|
| 19 | wp_enqueue_script('epanel_checkbox',$epanel_jsfolder . '/checkbox.js');
| |
| 20 | - | <?php get_sidebar(); ?> |
| 20 | + | wp_enqueue_script('epanel_functions_init',$epanel_jsfolder . '/functions-init.js');
|
| 21 | wp_localize_script( 'epanel_functions_init', 'ePanelSettings', array( | |
| 22 | - | <?php get_footer(); ?> |
| 22 | + | 'clearpath' => get_template_directory_uri() . '/epanel/images/empty.png', |
| 23 | 'et_saving_text' => esc_html__( 'Saving...', $themename ), | |
| 24 | 'et_options_saved_text' => esc_html__( 'Options Saved.', $themename ), | |
| 25 | 'epanel_nonce' => wp_create_nonce('epanel_nonce')
| |
| 26 | )); | |
| 27 | wp_enqueue_script('epanel_colorpicker',$epanel_jsfolder . '/colorpicker.js');
| |
| 28 | wp_enqueue_script('epanel_eye',$epanel_jsfolder . '/eye.js');
| |
| 29 | } | |
| 30 | } | |
| 31 | /* --------------------------------------------- */ | |
| 32 | ||
| 33 | /* Adds additional ePanel css */ | |
| 34 | if ( ! function_exists( 'et_epanel_css_admin' ) ){
| |
| 35 | function et_epanel_css_admin() { ?>
| |
| 36 | <link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() . '/epanel/css/panel.css' ); ?>" type="text/css" /> | |
| 37 | <style type="text/css"> | |
| 38 | .lightboxclose { background: url("<?php echo esc_url( get_template_directory_uri() . '/epanel/images/description-close.png' ); ?>") no-repeat; width: 19px; height: 20px; }
| |
| 39 | </style> | |
| 40 | <!--[if IE 7]> | |
| 41 | <style type="text/css"> | |
| 42 | #epanel-save, #epanel-reset { font-size: 0px; display:block; line-height: 0px; bottom: 18px;}
| |
| 43 | .box-desc { width: 414px; }
| |
| 44 | .box-desc-content { width: 340px; }
| |
| 45 | .box-desc-bottom { height: 26px; }
| |
| 46 | #epanel-content .epanel-box input, #epanel-content .epanel-box select, .epanel-box textarea { width: 395px; }
| |
| 47 | #epanel-content .epanel-box select { width:434px !important;}
| |
| 48 | #epanel-content .epanel-box .box-content { padding: 8px 17px 15px 16px; }
| |
| 49 | </style> | |
| 50 | <![endif]--> | |
| 51 | <!--[if IE 8]> | |
| 52 | <style type="text/css"> | |
| 53 | #epanel-save, #epanel-reset { font-size: 0px; display:block; line-height: 0px; bottom: 18px;}
| |
| 54 | </style> | |
| 55 | <![endif]--> | |
| 56 | <?php } | |
| 57 | } | |
| 58 | /* --------------------------------------------- */ | |
| 59 | ||
| 60 | /* Save/Reset actions | Adds theme options to WP-Admin menu */ | |
| 61 | add_action('admin_menu', 'et_add_epanel');
| |
| 62 | function et_add_epanel() {
| |
| 63 | global $themename, $shortname, $options; | |
| 64 | $epanel = basename(__FILE__); | |
| 65 | ||
| 66 | if ( isset( $_GET['page'] ) && $_GET['page'] == $epanel && isset( $_POST['action'] ) ) {
| |
| 67 | epanel_save_data( 'js_disabled' ); //saves data when javascript is disabled | |
| 68 | } | |
| 69 | ||
| 70 | $core_page = add_theme_page( $themename . ' ' . esc_html__( 'Options', $themename ), $themename . ' ' . esc_html__( 'Theme Options', $themename ), 'switch_themes', basename(__FILE__), 'et_build_epanel' ); | |
| 71 | ||
| 72 | add_action( "admin_print_scripts-{$core_page}", 'et_epanel_admin_js' );
| |
| 73 | add_action("admin_head-{$core_page}", 'et_epanel_css_admin');
| |
| 74 | } | |
| 75 | /* --------------------------------------------- */ | |
| 76 | ||
| 77 | /* Displays ePanel */ | |
| 78 | if ( ! function_exists( 'et_build_epanel' ) ){
| |
| 79 | function et_build_epanel() {
| |
| 80 | ||
| 81 | global $themename, $shortname, $options, $et_disabled_jquery; | |
| 82 | ||
| 83 | // load theme settings array | |
| 84 | et_load_core_options(); | |
| 85 | ||
| 86 | if ( isset($_GET['saved']) ) {
| |
| 87 | if ( $_GET['saved'] ) echo '<div id="message" class="updated fade"><p><strong>' . esc_html( $themename ) . ' ' . esc_html__( 'settings saved.', $themename ) . '</strong></p></div>'; | |
| 88 | } | |
| 89 | if ( isset($_GET['reset']) ) {
| |
| 90 | if ( $_GET['reset'] ) echo '<div id="message" class="updated fade"><p><strong>' . esc_html( $themename ) . ' ' . esc_html__( 'settings reset.', $themename ) . '</strong></p></div>'; | |
| 91 | } | |
| 92 | ?> | |
| 93 | ||
| 94 | <div id="wrapper"> | |
| 95 | <div id="panel-wrap"> | |
| 96 | <form method="post" id="main_options_form" enctype="multipart/form-data"> | |
| 97 | <div id="epanel-wrapper"> | |
| 98 | <div id="epanel"> | |
| 99 | <div id="epanel-content-wrap"> | |
| 100 | <div id="epanel-content"> | |
| 101 | <img src="<?php echo get_template_directory_uri() ?>/epanel/images/logo.png" alt="ePanel" class="pngfix" id="epanel-logo" /> | |
| 102 | <?php | |
| 103 | global $epanelMainTabs; | |
| 104 | $epanelMainTabs = apply_filters( 'epanel_page_maintabs', $epanelMainTabs ); | |
| 105 | ?> | |
| 106 | <ul id="epanel-mainmenu"> | |
| 107 | <?php if(in_array('general',$epanelMainTabs)) { ?>
| |
| 108 | <li><a href="#wrap-general"><img src="<?php echo get_template_directory_uri() ?>/epanel/images/general-icon.png" class="pngfix" alt="" /><?php esc_html_e( 'General Settings', $themename ); ?></a></li> | |
| 109 | <?php }; ?> | |
| 110 | <?php if(in_array('navigation',$epanelMainTabs)) { ?>
| |
| 111 | <li><a href="#wrap-navigation"><img src="<?php echo get_template_directory_uri() ?>/epanel/images/navigation-icon.png" class="pngfix" alt="" /><?php esc_html_e( 'Navigation', $themename ); ?></a></li> | |
| 112 | <?php }; ?> | |
| 113 | <?php if(in_array('layout',$epanelMainTabs)) { ?>
| |
| 114 | <li><a href="#wrap-layout"><img src="<?php echo get_template_directory_uri() ?>/epanel/images/layout-icon.png" class="pngfix" alt="" /><?php esc_html_e( 'Layout Settings', $themename ); ?></a></li> | |
| 115 | <?php }; ?> | |
| 116 | <?php if(in_array('ad',$epanelMainTabs)) { ?>
| |
| 117 | <li><a href="#wrap-advertisements"><img src="<?php echo get_template_directory_uri() ?>/epanel/images/ad-icon.png" class="pngfix" alt="" /><?php esc_html_e( 'Ad Management', $themename ); ?></a></li> | |
| 118 | <?php }; ?> | |
| 119 | <?php if(in_array('colorization',$epanelMainTabs)) { ?>
| |
| 120 | <li><a href="#wrap-colorization"><img src="<?php echo get_template_directory_uri() ?>/epanel/images/colorization-icon.png" class="pngfix" alt="" /><?php esc_html_e( 'Colorization', $themename ); ?></a></li> | |
| 121 | <?php }; ?> | |
| 122 | <?php if(in_array('seo',$epanelMainTabs)) { ?>
| |
| 123 | <li><a href="#wrap-seo"><img src="<?php echo get_template_directory_uri() ?>/epanel/images/seo-icon.png" class="pngfix" alt="" /><?php esc_html_e( 'SEO', $themename ); ?></a></li> | |
| 124 | <?php }; ?> | |
| 125 | <?php if(in_array('integration',$epanelMainTabs)) { ?>
| |
| 126 | <li><a href="#wrap-integration"><img src="<?php echo get_template_directory_uri() ?>/epanel/images/integration-icon.png" class="pngfix" alt="" /><?php esc_html_e( 'Integration', $themename ); ?></a></li> | |
| 127 | <?php }; ?> | |
| 128 | <?php if(in_array('support',$epanelMainTabs)) { ?>
| |
| 129 | <li><a href="#wrap-support"><img src="<?php echo get_template_directory_uri() ?>/epanel/images/support-icon.png" class="pngfix" alt="" /><?php esc_html_e( 'Support Docs', $themename ); ?></a></li> | |
| 130 | <?php }; ?> | |
| 131 | <?php do_action( 'epanel_render_maintabs',$epanelMainTabs ); ?> | |
| 132 | </ul><!-- end epanel mainmenu --> | |
| 133 | ||
| 134 | <?php | |
| 135 | foreach ($options as $value) {
| |
| 136 | if ( in_array( $value['type'], array( 'text', 'textlimit', 'textarea', 'select', 'checkboxes', 'different_checkboxes', 'colorpicker', 'textcolorpopup', 'upload' ) ) ) { ?>
| |
| 137 | <div class="epanel-box"> | |
| 138 | <div class="box-title"> | |
| 139 | <h3><?php echo esc_html( $value['name'] ); ?></h3> | |
| 140 | <img src="<?php echo get_template_directory_uri() ?>/epanel/images/help-image.png" alt="description" class="box-description" /> | |
| 141 | <div class="box-descr"> | |
| 142 | <p><?php echo wp_kses( $value['desc'], array( 'a' => array( | |
| 143 | 'href' => array(), | |
| 144 | 'title' => array(), | |
| 145 | 'target' => array() | |
| 146 | ) | |
| 147 | ) ); ?></p> | |
| 148 | </div> <!-- end box-desc-content div --> | |
| 149 | </div> <!-- end div box-title --> | |
| 150 | ||
| 151 | <div class="box-content"> | |
| 152 | ||
| 153 | <?php if ( 'text' == $value['type'] ) { ?>
| |
| 154 | ||
| 155 | <?php | |
| 156 | $et_input_value = ''; | |
| 157 | $et_input_value = ( '' != et_get_option( $value['id'] ) ) ? et_get_option( $value['id'] ) : $value['std']; | |
| 158 | $et_input_value = stripslashes( $et_input_value ); | |
| 159 | ?> | |
| 160 | ||
| 161 | <input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="<?php echo esc_attr( $value['type'] ); ?>" value="<?php echo esc_attr( $et_input_value ); ?>" /> | |
| 162 | ||
| 163 | <?php } elseif ( 'textlimit' == $value['type'] ) { ?>
| |
| 164 | ||
| 165 | <?php | |
| 166 | $et_input_value = ''; | |
| 167 | $et_input_value = ( '' != et_get_option( $value['id'] ) ) ? et_get_option( $value['id'] ) : $value['std']; | |
| 168 | $et_input_value = stripslashes( $et_input_value ); | |
| 169 | ?> | |
| 170 | ||
| 171 | <input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="text" maxlength="<?php echo esc_attr( $value['max'] ); ?>" size="<?php echo esc_attr( $value['max'] ); ?>" value="<?php echo esc_attr( $et_input_value ); ?>" /> | |
| 172 | ||
| 173 | <?php } elseif ( 'colorpicker' == $value['type'] ) { ?>
| |
| 174 | ||
| 175 | <div id="colorpickerHolder"></div> | |
| 176 | ||
| 177 | <?php } elseif ( 'textcolorpopup' == $value['type'] ) { ?>
| |
| 178 | ||
| 179 | <?php | |
| 180 | $et_input_value = ''; | |
| 181 | $et_input_value = ( '' != et_get_option( $value['id'] ) ) ? et_get_option( $value['id'] ) : $value['std']; | |
| 182 | ?> | |
| 183 | ||
| 184 | <input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" class="colorpopup" type="text" value="<?php echo esc_attr( $et_input_value ); ?>" /> | |
| 185 | ||
| 186 | <?php } elseif ( 'textarea' == $value['type'] ) { ?>
| |
| 187 | ||
| 188 | <?php | |
| 189 | $et_textarea_value = ''; | |
| 190 | $et_textarea_value = ( '' != et_get_option( $value['id'] ) ) ? et_get_option( $value['id'] ) : $value['std']; | |
| 191 | $et_textarea_value = stripslashes( $et_textarea_value ); | |
| 192 | ?> | |
| 193 | ||
| 194 | <textarea name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_textarea( $et_textarea_value ); ?></textarea> | |
| 195 | ||
| 196 | <?php } elseif ( 'upload' == $value['type'] ) { ?>
| |
| 197 | ||
| 198 | <input id="<?php echo esc_attr( $value['id'] ); ?>" class="uploadfield" type="text" size="90" name="<?php echo esc_attr( $value['id'] ); ?>" value="<?php echo esc_url( et_get_option($value['id']) ); ?>" /> | |
| 199 | <div class="upload_buttons"> | |
| 200 | <span class="upload_image_reset"><?php esc_html_e( 'Reset', $themename ); ?></span> | |
| 201 | <input class="upload_image_button" type="button" value="<?php esc_attr_e( 'Upload Image', $themename ); ?>" /> | |
| 202 | </div> | |
| 203 | ||
| 204 | <div class="clear"></div> | |
| 205 | ||
| 206 | <?php } elseif ( 'select' == $value['type'] ) { ?>
| |
| 207 | ||
| 208 | <select name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>"> | |
| 209 | <?php foreach ( $value['options'] as $option_key=>$option ) { ?>
| |
| 210 | <?php | |
| 211 | $et_select_active = ''; | |
| 212 | $et_use_option_values = isset( $value['et_array_for'] ) && in_array( $value['et_array_for'], array( 'pages', 'categories' ) ) ? true : false; | |
| 213 | ||
| 214 | $et_option_db_value = et_get_option($value['id']); | |
| 215 | ||
| 216 | if ( ( $et_use_option_values && is_numeric( $et_option_db_value ) && ( $et_option_db_value == $option_key ) ) || ( stripslashes( $et_option_db_value ) == trim( stripslashes( $option ) ) ) || ( ! $et_option_db_value && isset( $value['std'] ) && stripslashes( $option ) == stripslashes( $value['std'] ) ) ) | |
| 217 | $et_select_active = ' selected="selected"'; | |
| 218 | ?> | |
| 219 | <option<?php if ( $et_use_option_values ) echo ' value="' . esc_attr( $option_key ) . '"'; ?> <?php echo $et_select_active; ?>><?php echo esc_html( trim( $option ) ); ?></option> | |
| 220 | <?php } ?> | |
| 221 | </select> | |
| 222 | ||
| 223 | <?php } elseif ( 'checkboxes' == $value['type'] ) {
| |
| 224 | ||
| 225 | if ( empty( $value['options'] ) ) {
| |
| 226 | esc_html_e( "You don't have pages", $themename ); | |
| 227 | } else {
| |
| 228 | $i = 1; | |
| 229 | $className = 'inputs'; | |
| 230 | if ( isset( $value['excludeDefault'] ) && $value['excludeDefault'] == 'true' ) $className .= ' different'; | |
| 231 | ||
| 232 | foreach ( $value['options'] as $option ){
| |
| 233 | $checked = ""; | |
| 234 | $class_name_last = 0 == $i % 3 ? ' last' : ''; | |
| 235 | ||
| 236 | if ( et_get_option( $value['id'] ) ) {
| |
| 237 | if ( in_array( $option, et_get_option( $value['id'] ) ) ) $checked = "checked=\"checked\""; | |
| 238 | } | |
| 239 | ||
| 240 | $et_checkboxes_label = $value['id'] . '-' . $option; | |
| 241 | if ( 'custom' == $value['usefor'] ) {
| |
| 242 | $et_helper = (array) $value['helper']; | |
| 243 | $et_checkboxes_value = $et_helper[$option]; | |
| 244 | } else {
| |
| 245 | if ( 'taxonomy_terms' == $value['usefor'] && isset( $value['taxonomy_name'] ) ) {
| |
| 246 | $et_checkboxes_term = get_term_by( 'id', $option, $value['taxonomy_name'] ); | |
| 247 | $et_checkboxes_value = sanitize_text_field( $et_checkboxes_term->name ); | |
| 248 | } else {
| |
| 249 | $et_checkboxes_value = ( 'pages' == $value['usefor'] ) ? get_pagename( $option ) : get_categname( $option ); | |
| 250 | } | |
| 251 | } | |
| 252 | ?> | |
| 253 | ||
| 254 | <p class="<?php echo esc_attr( $className . $class_name_last ); ?>"> | |
| 255 | <input type="checkbox" class="usual-checkbox" name="<?php echo esc_attr( $value['id'] ); ?>[]" id="<?php echo esc_attr( $et_checkboxes_label ); ?>" value="<?php echo esc_attr( $option ); ?>" <?php echo esc_html( $checked ); ?> /> | |
| 256 | ||
| 257 | <label for="<?php echo esc_attr( $et_checkboxes_label ); ?>"><?php echo esc_html( $et_checkboxes_value ); ?></label> | |
| 258 | </p> | |
| 259 | ||
| 260 | <?php if ( $i%3 == 0 ) echo('<br class="clearfix"/>'); ?>
| |
| 261 | <?php $i++; | |
| 262 | } | |
| 263 | } ?> | |
| 264 | <br class="clearfix"/> | |
| 265 | ||
| 266 | <?php } elseif ( 'different_checkboxes' == $value['type'] ){
| |
| 267 | ||
| 268 | foreach ( $value['options'] as $option ){
| |
| 269 | $checked = ''; | |
| 270 | if ( et_get_option( $value['id']) !== false ) {
| |
| 271 | if ( in_array( $option, et_get_option( $value['id'] ) ) ) $checked = "checked=\"checked\""; | |
| 272 | } elseif ( isset( $value['std'] ) ) {
| |
| 273 | if ( in_array($option, $value['std']) ) $checked = "checked=\"checked\""; | |
| 274 | } ?> | |
| 275 | ||
| 276 | <p class="<?php echo esc_attr( 'postinfo-' . $option ); ?>"> | |
| 277 | <input type="checkbox" class="usual-checkbox" name="<?php echo esc_attr( $value['id'] ); ?>[]" id="<?php echo esc_attr( $value['id'] . '-' . $option ); ?>" value="<?php echo esc_attr( $option ); ?>" <?php echo esc_html( $checked ); ?> /> | |
| 278 | </p> | |
| 279 | <?php } ?> | |
| 280 | <br class="clearfix"/> | |
| 281 | ||
| 282 | <?php } ?> | |
| 283 | ||
| 284 | </div> <!-- end box-content div --> | |
| 285 | </div> <!-- end epanel-box div --> | |
| 286 | ||
| 287 | <?php } elseif ( 'checkbox' == $value['type'] || 'checkbox2' == $value['type'] ) { ?>
| |
| 288 | <?php | |
| 289 | $et_box_class = 'checkbox' == $value['type'] ? 'epanel-box-small-1' : 'epanel-box-small-2'; | |
| 290 | ?> | |
| 291 | <div class="<?php echo esc_attr( 'epanel-box ' . $et_box_class ); ?>"> | |
| 292 | <div class="box-title"><h3><?php echo esc_html( $value['name'] ); ?></h3> | |
| 293 | <img src="<?php echo esc_url( get_template_directory_uri() . '/epanel/images/help-image.png' ); ?>" alt="description" class="box-description" /> | |
| 294 | <div class="box-descr"> | |
| 295 | <p><?php echo wp_kses( $value['desc'], array( 'a' => array( | |
| 296 | 'href' => array(), | |
| 297 | 'title' => array(), | |
| 298 | 'target' => array() | |
| 299 | ) | |
| 300 | ) ); ?></p> | |
| 301 | </div> <!-- end box-desc-content div --> | |
| 302 | </div> <!-- end div box-title --> | |
| 303 | <div class="box-content"> | |
| 304 | <?php | |
| 305 | $checked = ''; | |
| 306 | if ( '' != et_get_option( $value['id'] ) ) {
| |
| 307 | if ( 'on' == et_get_option( $value['id'] ) ) { $checked = 'checked="checked"'; }
| |
| 308 | else { $checked = ''; }
| |
| 309 | } | |
| 310 | elseif ( 'on' == $value['std'] ) { $checked = 'checked="checked"'; }
| |
| 311 | ?> | |
| 312 | <input type="checkbox" class="checkbox" name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] );?>" <?php echo $checked; ?> /> | |
| 313 | </div> <!-- end box-content div --> | |
| 314 | </div> <!-- end epanel-box-small div --> | |
| 315 | ||
| 316 | <?php } elseif ( 'support' == $value['type'] ) { ?>
| |
| 317 | ||
| 318 | <div class="inner-content"> | |
| 319 | <?php include( TEMPLATEPATH . "/includes/functions/" . $value['name'] . ".php" ); ?> | |
| 320 | </div> | |
| 321 | ||
| 322 | <?php } elseif ( 'contenttab-wrapstart' == $value['type'] || 'subcontent-start' == $value['type'] ) { ?>
| |
| 323 | ||
| 324 | <?php $et_contenttab_class = 'contenttab-wrapstart' == $value['type'] ? 'content-div' : 'tab-content'; ?> | |
| 325 | ||
| 326 | <div id="<?php echo esc_attr( $value['name'] ); ?>" class="<?php echo esc_attr( $et_contenttab_class ); ?>"> | |
| 327 | ||
| 328 | <?php } elseif ( 'contenttab-wrapend' == $value['type'] || 'subcontent-end' == $value['type'] ) { ?>
| |
| 329 | ||
| 330 | </div> <!-- end <?php echo esc_html( $value['name'] ); ?> div --> | |
| 331 | ||
| 332 | <?php } elseif ( 'subnavtab-start' == $value['type'] ) { ?>
| |
| 333 | ||
| 334 | <ul class="idTabs"> | |
| 335 | ||
| 336 | <?php } elseif ( 'subnavtab-end' == $value['type'] ) { ?>
| |
| 337 | ||
| 338 | </ul> | |
| 339 | ||
| 340 | <?php } elseif ( 'subnav-tab' == $value['type'] ) { ?>
| |
| 341 | ||
| 342 | <li><a href="#<?php echo esc_attr( $value['name'] ); ?>"><span class="pngfix"><?php echo esc_html( $value['desc'] ); ?></span></a></li> | |
| 343 | ||
| 344 | <?php } elseif ($value['type'] == "clearfix") { ?>
| |
| 345 | ||
| 346 | <div class="clearfix"></div> | |
| 347 | ||
| 348 | <?php } ?> | |
| 349 | ||
| 350 | <?php } //end foreach ($options as $value) ?> | |
| 351 | ||
| 352 | </div> <!-- end epanel-content div --> | |
| 353 | </div> <!-- end epanel-content-wrap div --> | |
| 354 | </div> <!-- end epanel div --> | |
| 355 | </div> <!-- end epanel-wrapper div --> | |
| 356 | ||
| 357 | <div id="epanel-bottom"> | |
| 358 | <?php wp_nonce_field( 'epanel_nonce' ); ?> | |
| 359 | <input name="save" type="submit" value="<?php esc_html_e( 'Save changes', $themename ); ?>" id="epanel-save" /> | |
| 360 | <input type="hidden" name="action" value="save_epanel" /> | |
| 361 | ||
| 362 | <img src="<?php echo esc_url( get_template_directory_uri() . '/epanel/images/defaults.png' ); ?>" class="defaults-button" alt="no" /> | |
| 363 | </div><!-- end epanel-bottom div --> | |
| 364 | ||
| 365 | </form> | |
| 366 | ||
| 367 | <div style="clear: both;"></div> | |
| 368 | <div style="position: relative;"> | |
| 369 | <div class="defaults-hover"> | |
| 370 | <?php _e( 'This will return all of the settings throughout the options page to their default values. <strong>Are you sure you want to do this?', $themename ); ?></strong> | |
| 371 | <div class="clearfix"></div> | |
| 372 | <form method="post"> | |
| 373 | <?php wp_nonce_field( 'et-nojs-reset_epanel', '_wpnonce_reset' ); ?> | |
| 374 | <input name="reset" type="submit" value="<?php esc_html_e( 'Reset', $themename ); ?>" id="epanel-reset" /> | |
| 375 | <input type="hidden" name="action" value="reset" /> | |
| 376 | </form> | |
| 377 | <img src="<?php echo esc_url( get_template_directory_uri() . '/epanel/images/no.gif' ); ?>" class="no" alt="no" /> | |
| 378 | </div> | |
| 379 | </div> | |
| 380 | ||
| 381 | </div> <!-- end panel-wrap div --> | |
| 382 | </div> <!-- end wrapper div --> | |
| 383 | ||
| 384 | <div id="epanel-ajax-saving"> | |
| 385 | <img src="<?php echo esc_url( get_template_directory_uri() . '/epanel/images/saver.gif' ); ?>" alt="loading" id="loading" /> | |
| 386 | <span><?php esc_html_e( 'Saving...', $themename ); ?></span> | |
| 387 | </div> | |
| 388 | ||
| 389 | <?php | |
| 390 | } | |
| 391 | } | |
| 392 | /* --------------------------------------------- */ | |
| 393 | ||
| 394 | add_action('wp_ajax_save_epanel', 'et_epanel_save_callback');
| |
| 395 | function et_epanel_save_callback() {
| |
| 396 | check_ajax_referer( 'epanel_nonce' ); | |
| 397 | epanel_save_data( 'ajax' ); | |
| 398 | ||
| 399 | die(); | |
| 400 | } | |
| 401 | ||
| 402 | if ( ! function_exists( 'epanel_save_data' ) ){
| |
| 403 | function epanel_save_data( $source ){
| |
| 404 | global $options; | |
| 405 | ||
| 406 | if ( !current_user_can('switch_themes') )
| |
| 407 | die('-1');
| |
| 408 | ||
| 409 | // load theme settings array | |
| 410 | et_load_core_options(); | |
| 411 | ||
| 412 | $epanel = basename(__FILE__); | |
| 413 | ||
| 414 | if ( isset($_POST['action']) ) {
| |
| 415 | do_action( 'et_epanel_changing_options' ); | |
| 416 | ||
| 417 | if ( 'save_epanel' == $_POST['action'] ) {
| |
| 418 | if ( 'ajax' != $source ) check_admin_referer( 'epanel_nonce' ); | |
| 419 | ||
| 420 | foreach ( $options as $value ) {
| |
| 421 | if ( isset( $value['id'] ) ) {
| |
| 422 | if ( isset( $_POST[ $value['id'] ] ) ) {
| |
| 423 | if ( in_array( $value['type'], array( 'text', 'textlimit' ) ) ) {
| |
| 424 | ||
| 425 | if ( isset( $value['validation_type'] ) ) {
| |
| 426 | // saves the value as integer | |
| 427 | if ( 'number' == $value['validation_type'] ) | |
| 428 | et_update_option( $value['id'], intval( stripslashes( $_POST[$value['id']] ) ) ); | |
| 429 | ||
| 430 | // makes sure the option is a url | |
| 431 | if ( 'url' == $value['validation_type'] ) | |
| 432 | et_update_option( $value['id'], esc_url_raw( stripslashes( $_POST[$value['id']] ) ) ); | |
| 433 | ||
| 434 | /* | |
| 435 | * html is not allowed | |
| 436 | * wp_strip_all_tags can't be used here, because it returns trimmed text, some options need spaces ( e.g 'character to separate BlogName and Post title' option ) | |
| 437 | */ | |
| 438 | if ( 'nohtml' == $value['validation_type'] ) | |
| 439 | et_update_option( $value['id'], stripslashes( wp_filter_nohtml_kses( $_POST[$value['id']] ) ) ); | |
| 440 | } else {
| |
| 441 | // use html allowed for posts if the validation type isn't provided | |
| 442 | et_update_option( $value['id'], wp_kses_post( stripslashes( $_POST[$value['id']] ) ) ); | |
| 443 | } | |
| 444 | ||
| 445 | } elseif ( 'select' == $value['type'] ) {
| |
| 446 | ||
| 447 | // select boxes that list pages / categories should save page/category ID ( as integer ) | |
| 448 | if ( isset( $value['et_array_for'] ) && in_array( $value['et_array_for'], array( 'pages', 'categories' ) ) ) | |
| 449 | et_update_option( $value['id'], intval( stripslashes( $_POST[$value['id']] ) ) ); | |
| 450 | else // html is not allowed in select boxes | |
| 451 | et_update_option( $value['id'], sanitize_text_field( stripslashes( $_POST[$value['id']] ) ) ); | |
| 452 | ||
| 453 | } elseif ( in_array( $value['type'], array( 'checkbox', 'checkbox2' ) ) ) {
| |
| 454 | ||
| 455 | // saves 'on' value to the database, if the option is enabled | |
| 456 | et_update_option( $value['id'], 'on' ); | |
| 457 | ||
| 458 | } elseif ( 'upload' == $value['type'] ) {
| |
| 459 | ||
| 460 | // makes sure the option is a url | |
| 461 | et_update_option( $value['id'], esc_url_raw( stripslashes( $_POST[$value['id']] ) ) ); | |
| 462 | ||
| 463 | } elseif ( 'textcolorpopup' == $value['type'] ) {
| |
| 464 | ||
| 465 | // the color value | |
| 466 | et_update_option( $value['id'], sanitize_text_field( stripslashes( $_POST[$value['id']] ) ) ); | |
| 467 | ||
| 468 | } elseif ( 'textarea' == $value['type'] ) {
| |
| 469 | ||
| 470 | if ( isset( $value['validation_type'] ) ) {
| |
| 471 | // html is not allowed | |
| 472 | if ( 'nohtml' == $value['validation_type'] ) | |
| 473 | et_update_option( $value['id'], wp_strip_all_tags( stripslashes( $_POST[$value['id']] ) ) ); | |
| 474 | } else {
| |
| 475 | if ( current_user_can( 'unfiltered_html' ) ) | |
| 476 | et_update_option( $value['id'], stripslashes( $_POST[$value['id']] ) ); | |
| 477 | else | |
| 478 | et_update_option( $value['id'], stripslashes( wp_filter_post_kses( addslashes( $_POST[$value['id']] ) ) ) ); // wp_filter_post_kses() expects slashed | |
| 479 | } | |
| 480 | ||
| 481 | } elseif ( 'checkboxes' == $value['type'] ) {
| |
| 482 | ||
| 483 | // saves categories / pages IDs, | |
| 484 | et_update_option( $value['id'], array_map( 'intval', stripslashes_deep( $_POST[$value['id']] ) ) ); | |
| 485 | ||
| 486 | } elseif ( 'different_checkboxes' == $value['type'] ) {
| |
| 487 | ||
| 488 | // saves 'author/date/categories/comments' options | |
| 489 | et_update_option( $value['id'], array_map( 'wp_strip_all_tags', stripslashes_deep( $_POST[$value['id']] ) ) ); | |
| 490 | ||
| 491 | } | |
| 492 | } else {
| |
| 493 | if ( in_array( $value['type'], array( 'checkbox', 'checkbox2' ) ) ) | |
| 494 | et_update_option( $value['id'] , 'false' ); | |
| 495 | elseif ( 'different_checkboxes' == $value['type'] ) | |
| 496 | et_update_option( $value['id'] , array() ); | |
| 497 | else | |
| 498 | et_delete_option( $value['id'] ); | |
| 499 | } | |
| 500 | } | |
| 501 | } | |
| 502 | ||
| 503 | if ( 'js_disabled' == $source ) header("Location: themes.php?page=$epanel&saved=true");
| |
| 504 | die('1');
| |
| 505 | ||
| 506 | } else if( 'reset' == $_POST['action'] ) {
| |
| 507 | check_admin_referer( 'et-nojs-reset_epanel', '_wpnonce_reset' ); | |
| 508 | ||
| 509 | foreach ($options as $value) {
| |
| 510 | if ( isset($value['id']) ) {
| |
| 511 | et_delete_option( $value['id'] ); | |
| 512 | if ( isset($value['std']) ) et_update_option( $value['id'], $value['std'] ); | |
| 513 | } | |
| 514 | } | |
| 515 | ||
| 516 | header("Location: themes.php?page=$epanel&reset=true");
| |
| 517 | die('1');
| |
| 518 | } | |
| 519 | } | |
| 520 | } | |
| 521 | } | |
| 522 | ||
| 523 | function et_epanel_media_upload_scripts() {
| |
| 524 | wp_enqueue_script('media-upload');
| |
| 525 | wp_enqueue_script('thickbox');
| |
| 526 | wp_register_script('my-upload', get_template_directory_uri().'/epanel/js/custom_uploader.js', array('jquery','media-upload','thickbox'));
| |
| 527 | wp_enqueue_script('my-upload');
| |
| 528 | } | |
| 529 | ||
| 530 | function et_epanel_media_upload_styles() {
| |
| 531 | wp_enqueue_style('thickbox');
| |
| 532 | } | |
| 533 | ||
| 534 | global $pagenow; | |
| 535 | if ( 'themes.php' == $pagenow && isset( $_GET['page'] ) && ( $_GET['page'] == basename(__FILE__) ) ) {
| |
| 536 | add_action('admin_print_scripts', 'et_epanel_media_upload_scripts');
| |
| 537 | add_action('admin_print_styles', 'et_epanel_media_upload_styles');
| |
| 538 | } ?> |