'; public $after_option_title='

'; public $before_option='
'; public $after_option='
'; public $pexeto_images_url=''; public $pexeto_version=''; public $themename=''; public $first_save=''; /** * The main constructor for the PexetoOptionsManager class * @param $themename the name of the the theme * @param $options_url the URL of the options directory * @param $images_url the URL of the functions directory * @param $uploads_url the URL of the uploads directory */ function __construct($themename, $images_url, $version){ $this->themename=$themename; $this->pexeto_images_url=$images_url; $this->pexeto_version=$version; $this->first_save=get_option(PEXETO_SHORTNAME.'_first_save'); } /** * Returns the options array. */ public function get_options(){ return $this->options; } /** * Sets the options array. */ public function set_options($options){ $this->options=$options; } /** * Adds an array of options to the current options array. * @param $option_arr the array of options to be added */ public function add_options($option_arr){ foreach($option_arr as $option){ $this->options[]=$option; } } /** * Prints the heading of the options panel. */ public function print_heading(){ if(isset($_GET['activated'])&&$_GET['activated']=='true'){ echo '
Welcome to '.$this->themename.' theme! On this page you can set the main options of the theme. For more information about the theme setup, please refer to the documentation included, which is located within the "documentation" folder of the downloaded zip file. We hope you will enjoy working with the theme!
'; } echo '
'; if ( function_exists('wp_nonce_field') ){ wp_nonce_field('pexeto-theme-update-options','pexeto-theme-options'); } echo '
'; } /** * Prints the footer of the options panel. */ public function print_footer(){ echo '
'; } /** * Checks the type of the option to be printed and calls the relevant printing function. */ public function print_options(){ $i=0; foreach ($this->options as $value) { switch ( $value['type'] ) { case 'open': $this->print_subnavigation($value, $i); break; case 'subtitle': $this->print_subtitle($value, $i); break; case 'close': $this->print_close(); break; case 'title': $i++; break; case 'text': $this->print_text_field($value); break; case 'textarea': $this->print_textarea($value); break; case 'select': $this->print_select($value); break; case 'multicheck': $this->print_multicheck($value); break; case 'color': $this->print_color($value); break; case 'upload': $this->print_upload($value); break; case 'checkbox': $this->print_checkbox($value); break; case 'custom': $this->print_custom($value); break; case 'pattern': $this->print_stylebox($value, 'pattern'); break; case 'stylecolor': $this->print_stylebox($value, 'color'); break; case 'documentation': $this->print_text($value); break; } } } /** * Prints the subnavigation tabs for each of the main navigation blocks. * @param $value the option that contains the data that needs to be printed * @param $i the index of the main navigation block to which the subnavigation belongs to */ public function print_subnavigation($value, $i){ echo ''; $field_ids[]=$field['id']; $field_names[]=$field['name']; } //print the add button echo ''.$value['button_text'].''; //print the list that will contain the added items echo ''; $idsString=implode('","', $field_ids); $namesString=implode('","', $field_names); $textareaString=implode(',', $is_textarea); $preview = isset($value['preview'])?$value['preview']:""; //call the script that enables the functionality for adding custom fields echo ''; $this->close_option($value); } /** * Gets the saved value for a field * @param $id the ID of the field * @param $std the default value for the field * @return string if there is a saved value, it returns the saved value, * if not - it returns the default value */ public function get_field_value($id, $std){ if ( get_option( $id ) != "" || $this->first_save) { return stripslashes(get_option( $id )); } else { return stripslashes($std); } } public function print_text($value){ echo $this->before_option; echo $value['text']; $this->close_option($value); } /** * Prints the message that is displayed when the options have been saved */ public function print_saved_message(){ echo '
'.$this->themename.' settings saved.
'; } /** * Prints the message that is displayed when the options have been reset */ public function print_reset_message(){ echo '

'.$this->themename.' settings reset.

'; } }