/** * Register theme and modules Customizer portability. * * @since 2.7.0 * * @return bool Always return true. */ function et_divi_register_customizer_portability() { global $options; // Make sure the Portability is loaded. et_core_load_component('portability'); // Load ePanel options. et_load_core_options(); // Exclude ePanel options. $exclude = array(); foreach ($options as $option) { if (isset($option['id'])) { $exclude[$option['id']] = true; } } // Register the portability. et_core_portability_register('et_divi_mods', array('name' => esc_html__('Divi Customizer Settings', 'Divi'), 'type' => 'options', 'target' => 'et_divi', 'exclude' => $exclude, 'view' => is_customize_preview())); }
/** * Register ePanel portability. * * @since To define * * @return bool Always return true. */ function et_epanel_register_portability() { global $shortname, $themename, $options; // Make sure the Portability is loaded. et_core_load_component('portability'); // Load ePanel options. et_load_core_options(); // Include only ePanel options. $include = array(); foreach ($options as $option) { if (isset($option['id'])) { $include[$option['id']] = true; } } // Register the portability. et_core_portability_register('epanel', array('name' => sprintf(esc_html__('%s Theme Options', $themename), $themename), 'type' => 'options', 'target' => "et_{$shortname}", 'include' => $include, 'view' => isset($_GET['page']) && $_GET['page'] == "et_{$shortname}_options")); }
function epanel_save_data($source) { global $options, $shortname; if (!current_user_can('switch_themes')) { die('-1'); } // load theme settings array et_load_core_options(); $epanel = basename(__FILE__); if (isset($_POST['action'])) { do_action('et_epanel_changing_options'); if ('save_epanel' == $_POST['action']) { if ('ajax' != $source) { check_admin_referer('epanel_nonce'); } foreach ($options as $value) { if (isset($value['id'])) { if (isset($_POST[$value['id']])) { if (in_array($value['type'], array('text', 'textlimit'))) { if (isset($value['validation_type'])) { // saves the value as integer if ('number' == $value['validation_type']) { et_update_option($value['id'], intval(stripslashes($_POST[$value['id']]))); } // makes sure the option is a url if ('url' == $value['validation_type']) { et_update_option($value['id'], esc_url_raw(stripslashes($_POST[$value['id']]))); } /* * html is not allowed * 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 ) */ if ('nohtml' == $value['validation_type']) { et_update_option($value['id'], stripslashes(wp_filter_nohtml_kses($_POST[$value['id']]))); } } else { // use html allowed for posts if the validation type isn't provided et_update_option($value['id'], wp_kses_post(stripslashes($_POST[$value['id']]))); } } elseif ('select' == $value['type']) { // select boxes that list pages / categories should save page/category ID ( as integer ) if (isset($value['et_array_for']) && in_array($value['et_array_for'], array('pages', 'categories'))) { et_update_option($value['id'], intval(stripslashes($_POST[$value['id']]))); } else { // html is not allowed in select boxes et_update_option($value['id'], sanitize_text_field(stripslashes($_POST[$value['id']]))); } } elseif (in_array($value['type'], array('checkbox', 'checkbox2'))) { // saves 'on' value to the database, if the option is enabled et_update_option($value['id'], 'on'); } elseif ('upload' == $value['type']) { // makes sure the option is a url et_update_option($value['id'], esc_url_raw(stripslashes($_POST[$value['id']]))); } elseif ('textcolorpopup' == $value['type']) { // the color value et_update_option($value['id'], sanitize_text_field(stripslashes($_POST[$value['id']]))); } elseif ('textarea' == $value['type']) { if (isset($value['validation_type'])) { // html is not allowed if ('nohtml' == $value['validation_type']) { if ($value['id'] === $shortname . '_custom_css') { // don't strip slashes from custom css, it should be possible to use \ for icon fonts et_update_option($value['id'], wp_strip_all_tags($_POST[$value['id']])); } else { et_update_option($value['id'], wp_strip_all_tags(stripslashes($_POST[$value['id']]))); } } } else { if (current_user_can('unfiltered_html')) { et_update_option($value['id'], stripslashes($_POST[$value['id']])); } else { et_update_option($value['id'], stripslashes(wp_filter_post_kses(addslashes($_POST[$value['id']])))); } // wp_filter_post_kses() expects slashed } } elseif ('checkboxes' == $value['type']) { // saves categories / pages IDs, et_update_option($value['id'], array_map('intval', stripslashes_deep($_POST[$value['id']]))); } elseif ('different_checkboxes' == $value['type']) { // saves 'author/date/categories/comments' options et_update_option($value['id'], array_map('wp_strip_all_tags', stripslashes_deep($_POST[$value['id']]))); } } else { if (in_array($value['type'], array('checkbox', 'checkbox2'))) { et_update_option($value['id'], 'false'); } elseif ('different_checkboxes' == $value['type']) { et_update_option($value['id'], array()); } else { et_delete_option($value['id']); } } } } if ('js_disabled' == $source) { header("Location: themes.php?page={$epanel}&saved=true"); } die('1'); } else { if ('reset' == $_POST['action']) { check_admin_referer('et-nojs-reset_epanel', '_wpnonce_reset'); foreach ($options as $value) { if (isset($value['id'])) { et_delete_option($value['id']); if (isset($value['std'])) { et_update_option($value['id'], $value['std']); } } } header("Location: themes.php?page={$epanel}&reset=true"); die('1'); } } } }