options_themeoptions as $kay => $x) $options[$kay] = $x; foreach($best_magazine_general_settings_page->options_generalsettings as $kay => $x) $options[$kay] = $x; foreach($best_magazine_home_page->options_homepage as $kay => $x) $options[$kay] = $x; foreach($best_magazine_typography_page->options_typography as $kay => $x) $options[$kay] = $x; foreach($best_magazine_slider_page->options_slider as $kay => $x){ if($kay == "imgs_url"){ foreach($x["option"] as $kays => $y) $options[$kays] = $y; } $options[$kay] = $x; } return apply_filters( 'best_magazine_get_option_parameters', $options ); } function best_magazine_get_settings_page_tabs() { $tabs = array( 'layout_editor' => array( 'name' => 'layout_editor', 'title' => __( 'Layout Editor', 'best-magazine' ), 'sections' => array( 'layout_editor' => array( 'name' => 'layout_editor', 'title' => __( 'Layout Editor', 'best-magazine' ), 'description' => '' ) ), 'description' => best_magazine_text() ), 'general' => array( 'name' => 'general', 'title' => __( 'General', 'best-magazine' ), 'sections' => array( 'general' => array( 'name' => 'general', 'title' => __( 'General', 'best-magazine' ), 'description' => '' ) ), 'description' => best_magazine_text() ), 'homepage' => array( 'name' => 'homepage', 'title' => __( 'Homepage', 'best-magazine' ), 'sections' => array( 'homepage' => array( 'name' => 'homepage', 'title' => __( 'Homepage', 'best-magazine' ), 'description' => '' ) ), 'description' => best_magazine_text() ), 'color_control' => array( 'name' => 'color_control', 'title' => __( 'Color Control', 'best-magazine' ), 'sections' => array( 'color_control' => array( 'name' => 'color_control', 'title' => __( 'Color Control', 'best-magazine' ), 'description' => '' ) ), 'description' => best_magazine_text() ), 'typography' => array( 'name' => 'typography', 'title' => __( 'Typography', 'best-magazine' ), 'sections' => array( 'text_headers' => array( 'name' => 'text_headers', 'title' => __( 'Typography - Text Headers', 'best-magazine' ), 'description' => '' ), 'primary_font' => array( 'name' => 'primary_font', 'title' => __( 'Typography - Primary Font' , 'best-magazine'), 'description' => '' ), 'secondary_font' => array( 'name' => 'secondary_font', 'title' => __( 'Typography - Secondary Font' , 'best-magazine'), 'description' => '' ), 'inputs_textareas' => array( 'name' => 'inputs_textareas', 'title' => __( 'Typography - Inputs and Text Areas', 'best-magazine' ), 'description' => '' ) ), 'description' => best_magazine_text() ), 'slider' => array( 'name' => 'slider', 'title' => __( 'Slider', 'best-magazine' ), 'sections' => array( 'slider' => array( 'name' => 'slider', 'title' => __( 'Slider', 'best-magazine' ), 'description' => '' ) ), 'description' => best_magazine_text() ), 'licensing' => array( 'name' => 'licensing', 'title' => __( 'Licensing', 'best-magazine' ), 'sections' => array( 'licensing' => array( 'name' => 'licensing', 'title' => __( 'Licensing', 'best-magazine' ), 'description' => '' ) ), 'description' => '' ) ); return apply_filters( 'best_magazine_get_settings_page_tabs', $tabs ); } function register_my_setting() { global $best_magazine_tabs,$option_parameters; $best_magazine_tabs = best_magazine_get_settings_page_tabs(); $option_parameters = best_magazine_get_option_parameters(); register_setting( 'theme_best_magazine_options', 'theme_best_magazine_options', 'best_magazine_options_validate' ); foreach ( $best_magazine_tabs as $tab ) { $tabname = $tab['name']; $tabsections = $tab['sections']; foreach ( $tabsections as $section ) { $sectionname = $section['name']; $sectiontitle = $section['title']; add_settings_section( // $sectionid 'best_magazine_' . $sectionname . '_section', // $title $sectiontitle, // $callback 'best_magazine_sections_callback', // $pageid 'best_magazine_' . $tabname . '_tab' ); } } foreach ( $option_parameters as $option ) { if(isset($option['name']) && isset($option['title']) && isset($option['tab']) && isset($option['section']) && isset($option['type'])){ $optionname = $option['name']; $optiontitle = $option['title']; $optiontab = $option['tab']; $optionsection = $option['section']; $optiontype = $option['type']; if ( 'custom' != $optiontype ) { add_settings_field( /* $setting id */ 'best_magazine_setting_' . $optionname, /* $title */ $optiontitle, /* $callback */ 'best_magazine_setting_callback', /* $page id */ 'best_magazine_' . $optiontab . '_tab', /* $section id */ 'best_magazine_' . $optionsection . '_section', /* $args */ $option ); } if ( 'custom' == $optiontype ) { add_settings_field( /* $setting id */ 'best_magazine_setting_' . $optionname, /* $title */ $optiontitle, /* $callback */ 'best_magazine_setting_' . $optionname, /* $page id */ 'best_magazine_' . $optiontab . '_tab', /* $section id */ 'best_magazine_' . $optionsection . '_section' ); } } } } add_action( 'admin_init', 'register_my_setting' ); function best_magazine_sections_callback( $section_passed ) { global $best_magazine_tabs; $best_magazine_tabs = best_magazine_get_settings_page_tabs(); foreach ( $best_magazine_tabs as $tabname => $tab ) { $tabsections = $tab['sections']; foreach ( $tabsections as $sectionname => $section ) { if ( 'best_magazine_' . $sectionname . '_section' == $section_passed['id'] ) { ?>

dorado_theme_admin_licensing(); return $desr; } function best_magazine_color_text() { global $best_magazine_color_control_page; $desr = $best_magazine_color_control_page -> dorado_theme_admin_color_control(); return $desr; } function best_magazine_text() { global $best_magazine_web_dor; $best_magazine_tab = (isset($_GET['tab'])) ? $_GET['tab'] : 'layout_editor'; switch($best_magazine_tab){ case 'layout_editor':{ $tab = '2'; $text = __('This section allows you to make changes in default layout of the theme.', 'best-magazine' ); break; } case 'general':{ $tab = '3'; $text = __('This section allows you to make changes in overall content of the site.', 'best-magazine' ); break; } case 'homepage':{ $tab = '4'; $text = __('This section allows you to customize the homepage. ', 'best-magazine' ); break; } case 'color_control':{ $tab = '6'; $text = __('This section allows you customize the color features. ', 'best-magazine' ); break; } case 'typography':{ $tab = '7'; $text = __('This section allows you to change the font styles.', 'best-magazine' ); break; } case 'slider':{ $tab = '8'; $text = __('This section allows you customize the slider.', 'best-magazine' ); break; } default :{ $tab = ''; $text = ''; } } $text = '
'.__("User Manual", "best-magazine" ).'
'.$text .' '.__("More...", "best-magazine" ).'
'; return $text; } function best_magazine_options_validate( $input ) { $valid_input = best_magazine_get_options(); $settingsbytab = best_magazine_get_settings_by_tab(); $option_parameters = best_magazine_get_option_parameters(); $option_defaults = best_magazine_get_option_defaults(); $tabs = best_magazine_get_settings_page_tabs(); $submittype = 'submit'; foreach ( $tabs as $tab ) { $resetname = 'reset-' . $tab['name']; if ( ! empty( $input[$resetname] ) ) { $submittype = 'reset'; } } $submittab = 'layout_editor'; foreach ( $tabs as $tab ) { $submitname = 'submit-' . $tab['name']; $resetname = 'reset-' . $tab['name']; if ( ! empty( $input[$submitname] ) || ! empty($input[$resetname] ) ) { $submittab = $tab['name']; } } global $wp_customize; $tabsettings = ( isset ( $wp_customize ) ? $settingsbytab['all'] : $settingsbytab[$submittab] ); foreach ( $tabsettings as $setting ) { if ( 'submit' == $submittype ) { $optiondetails = $option_parameters[$setting]; $valid_options = ( isset( $optiondetails['valid_options'] ) ? $optiondetails['valid_options'] : false ); if ( 'checkbox' == $optiondetails['type'] || 'checkbox_open' == $optiondetails['type'] ) { $valid_input[$setting] = ( ( isset( $input[$setting] ) && true == $input[$setting] ) ? true : false ); } else if ( 'checkboxes' == $optiondetails['type'] ) { $valid_input[$setting] = ( array_key_exists( $input[$setting], $valid_options ) ? $input[$setting] : $valid_input[$setting] ); } else if ( 'radio' == $optiondetails['type'] ) { $valid_input[$setting] = ( array_key_exists( $input[$setting], $valid_options ) ? $input[$setting] : $valid_input[$setting] ); } else if ( 'select' == $optiondetails['type'] ) { $valid_input[$setting] = ( array_key_exists( $input[$setting], $valid_options ) ? $input[$setting] : $valid_input[$setting] ); } else if ( ( 'text' == $optiondetails['type'] || 'textarea' == $optiondetails['type']) ) { if ( 'sanitize_text_field' == $optiondetails['sanitize_type'] ) { $valid_input[$setting] = wp_filter_nohtml_kses( $input[$setting] ); } if ( 'sanitize_html_field' == $optiondetails['sanitize_type'] ) { $valid_input[$setting] = wp_filter_kses( $input[$setting] ); } if ( 'esc_url_raw' == $optiondetails['sanitize_type'] ) { $valid_input[$setting] = esc_url_raw( $input[$setting] ); } if ( 'css' == $optiondetails['sanitize_type'] ) { $valid_input[$setting] = esc_js( str_replace("\n", "",$input[$setting]) ); } } else if ( 'textarea_slider' == $optiondetails['type'] || 'text_slider' == $optiondetails['type'] || 'file_upload' == $optiondetails['type'] ) { $valid_input[$setting] = array(); for($i=0; $i
'; echo ''; echo $tabs[$current]['description']; } function best_magazine_get_options() { $option_defaults = best_magazine_get_option_defaults(); global $best_magazine_options; $best_magazine_options = wp_parse_args( get_option( 'theme_best_magazine_options', array() ), $option_defaults ); return $best_magazine_options; } function best_magazine_admin_options_page() { $currenttab = best_magazine_get_current_tab(); $tabs = best_magazine_get_settings_page_tabs(); $settings_section = 'best_magazine_' . $currenttab . '_tab'; ?>

".__('Theme settings updated successfully.', 'best-magazine' )."

"; } ?>