";
/*help text*/
echo"".__('Note: Some options will have more details in the help screen','wppizza-admin')."";
echo"
";
/**update info / errors etc*/
settings_errors();
echo'';
echo'
';
}
/*********************************************************
*
* [add settings section(s) and fields]
*
* @since 3.0
* @return void
*
*********************************************************/
function wppizza_admin_settings_sections(){
global $current_screen;
if($current_screen->id == ''.WPPIZZA_POST_TYPE.'_page_'.$this->class_key.'' && $current_screen->post_type == WPPIZZA_POST_TYPE){
/** get settings sections and fields **/
$settings=$this->wppizza_get_settings(true, true);
/**iterate through sections*/
foreach($settings['sections'] as $sections_key=>$sections_label){
/**add section, emptiying label if no fields (if only help is defined for example)**/
$sections_label = !empty($settings['fields'][$sections_key]) ? $sections_label : '' ;
add_settings_section($sections_key, $sections_label, array( $this, 'wppizza_admin_settings_section_header'), $sections_key);
/**add section fields**/
if(!empty($settings['fields'][$sections_key])){
foreach($settings['fields'][$sections_key] as $fields_key=>$field_values){
add_settings_field($fields_key, $field_values[0], array( $this, 'wppizza_admin_settings_section_fields'), $sections_key, $sections_key, $field_values[1]);
}}
}
}
}
/*********************************************************
*
* [add contextual help to submenu page]
* @since 3.0
*
*********************************************************/
function wppizza_submenu_page_contextual_help(){
$screen = get_current_screen();
/** get settings sections and fields **/
$settings=$this->wppizza_get_settings(true, false, false, true);
foreach($settings['sections'] as $section_key=>$section_label){
/**only add tab if there is actually any help to display**/
if(!empty($settings['help'][$section_key])){
/**initialize content for this tab**/
$help_content='';
foreach($settings['help'][$section_key] as $help_info){
/*add label*/
if(!empty($help_info['label'])){
$help_content.='
";
}else{
/**
output input field, label and description
**/
echo '';
}
/********************************
* [add action for modules to hook into, also providing full args list if needed somewhere]
********************************/
//do_action('wppizza_admin_settings_section_fields_'.$this->class_key.'', $wppizza_options, $options_key, $field, $label, $description, $args);
}
/****************************************************************
*
* [validate options on save/update]
* unlike other modules, this is in th emain subpage class
* for easy validation across submodules
* @since 3.0
* @return array()
*
****************************************************************/
function options_validate($options, $input){
/**
make sure we get the full array on install/update
**/
if ( empty( $_POST['_wp_http_referer'] ) ) {
return $input;
}
if(isset($_POST[''.WPPIZZA_SLUG.'_'.$this->class_key.''])){
/*
keys that are validated/allowed to have html
*/
$allowHtml = apply_filters('wppizza_filter_localization_html', array());
/*
array of localization variables to validate
*/
$options[$this->class_key] = array();//initialize as empty array
/*
validate
*/
foreach($input[$this->class_key] as $key=>$string){
/*add new value , but keep desciption (as its not editable on frontend)*/
if(in_array($key, $allowHtml)){$html=1;}else{$html=false;}
$options[$this->class_key][$key] = wppizza_validate_string($string, $html);
}
}
return $options;
}
/*********************************************************
*
* [define caps]
* @since 3.0
*
*********************************************************/
function wppizza_filter_define_caps($caps){
/**add editing capability for this page**/
$caps[$this->class_key]=array('name'=>$this->submenu_caps_title ,'cap'=>'wppizza_cap_'.$this->class_key.'');
return $caps;
}
/*********************************************************
*
* [set required capability for this page]
* @since 3.0
*
*********************************************************/
function admin_option_page_capability($capability) {
$capability = 'wppizza_cap_'.$this->class_key.'';
return $capability;
}
}
/***************************************************************
*
* [ini class]
*
***************************************************************/
$WPPIZZA_LOCALIZATION = new WPPIZZA_LOCALIZATION();
?>