unique_prefix = $unique_prefix; } /** * Returns a valid xHTML element ID * * @param object $option */ static public function get_valid_id($option) { if(is_numeric($option[0])) { return 'p' . $option; } else { return $option; } } /** * This will output a well formed hidden option * * @param string $option */ public function input_hidden(setting $option) { $opt_id = form::get_valid_id($option->get_name()); $opt_name = $this->unique_prefix . '_options[' . $option->get_opt_name(). ']'; printf('', esc_attr($opt_name), esc_attr($opt_id), esc_attr($option->get_value())); } /** * This will output a well formed option label * * @param string $opt_id * @param string $label */ public function label($opt_id, $label) { printf('', esc_attr($opt_id), esc_html($label)); } /** * This will output a well formed table row for a text input * * @param setting $option * @param string $class (optional) * @param bool $disable (optional) * @param string $description (optional) * * FIXME: Parameter list non-consistent with others */ public function input_text(setting $option, $class = 'regular-text', $disable = false, $description = '') { $opt_id = form::get_valid_id($option->get_name()); $opt_name = $this->unique_prefix . '_options[' . $option->get_opt_name(). ']';?> label($opt_id, $option->get_title());?> input_hidden($option); $class .= ' disabled'; } printf('
', esc_attr($opt_name), esc_attr($opt_id), esc_attr($option->get_value()), esc_attr($class), disabled($disable, true, false)); if($description !== '') { printf('

%s

', esc_html($description)); }?> get_name()); $opt_name = $this->unique_prefix . '_options[' . $option->get_opt_name(). ']'; $extras_escaped = ''; if($min !== '') { $extras_escaped.= 'min="' . esc_attr($min) . '" '; } if($max !== '') { $extras_escaped.= 'max="' . esc_attr($max) . '" '; } if($step !== '') { $extras_escaped.= 'step="' . esc_attr($step) . '" '; }?> label($opt_id, $option->get_title());?> input_hidden($option); $class .= ' disabled'; } printf('
', esc_attr($opt_name), esc_attr($opt_id), esc_attr($option->get_value()), esc_attr($class), disabled($disable, true, false), $extras_escaped); if($description !== '') { printf('

%s

', esc_html($description)); }?> get_name()); $opt_name = $this->unique_prefix . '_options[' . $option->get_opt_name(). ']'; $class .= ' large-text';?> label($opt_id, $option->get_title());?> input_hidden($option); $class .= ' disabled'; } printf('
', esc_attr($opt_name), esc_attr($opt_id), esc_textarea($option->get_value()), esc_attr($class), disabled($disable, true, false), esc_attr($height)); if($description !== '') { printf('

%s

', esc_html($description)); }?> get_name()); $opt_name = $this->unique_prefix . '_options[' . $option->get_opt_name(). ']'; $class = 'mtekk_mce';?> label($opt_id, $option->get_title());?> input_hidden($option); $class .= ' disabled'; } printf('
', esc_attr($opt_name), esc_attr($opt_id), esc_textarea($option->get_value()), esc_attr($class), disabled($disable, true, false), esc_attr($height)); if($description !== '') { printf('

%s

', esc_html($description)); }?> get_name()); $opt_name = $this->unique_prefix . '_options[' . $option->get_opt_name(). ']';?> get_title()); ?>
%s

', esc_html($description)); }?> get_name()); $opt_name = $this->unique_prefix . '_options[' . $option->get_opt_name(). ']'; $class .= ' togx';?>
get_name()); $opt_name = $this->unique_prefix . '_options[' . $option->get_opt_name(). ']';?> label($opt_id, $option->get_title());?> input_hidden($option); $class .= ' disabled'; } printf('
', esc_attr($opt_name), esc_attr($opt_id), $this->select_options($option->get_value(), $titles, $values), esc_attr($class), disabled($disable, true, false)); if($description !== '') { printf('

%s

', esc_html($description)); }?> block based off of passed in options array * * @param string $current_value current value of option * @param array $options array of names of options that can be selected * @param array $values array of the values of the options that can be selected * @param array $exclude(optional) array of names in $options array to be excluded * * @return string The assembled HTML for the select options */ public function select_options($current_value, $options, $values, $exclude = array()) { $options_html = ''; //Now do the rest foreach($options as $key => $option) { if(!in_array($option, $exclude)) { $options_html .= sprintf('', esc_attr($values[$key]), selected($current_value, $values[$key], false), esc_html($option)); } } return $options_html; } }