$help "; // Print the generated part of table echo $out; } /** * Generator of the fields for saving settings data to database */ function spacexchimp_p005_control_field( $name, $label, $help=null, $placeholder=null ) { // Read options from database and declare variables $options = get_option( SPACEXCHIMP_P005_SETTINGS . '_settings' ); $value = !empty( $options[$name] ) ? esc_textarea( $options[$name] ) : ''; // Generate a part of table $out = " $label "; // Print the generated part of table echo $out; // Print a help text spacexchimp_p005_control_help( $help ); } /** * Generator of the switches for saving plugin settings to database */ function spacexchimp_p005_control_switch( $name, $label, $help=null ) { // Read options from database and declare variables $options = get_option( SPACEXCHIMP_P005_SETTINGS . '_settings' ); $checked = !empty( $options[$name] ) ? "checked='checked'" : ''; // Generate a part of table $out = " $label "; // Print the generated part of table echo $out; // Print a help text spacexchimp_p005_control_help( $help ); } /** * Generator of the number fields with minus and plus buttons for saving plugin settings to database */ function spacexchimp_p005_control_number( $name, $label, $help=null, $default=null ) { // Read options from database and declare variables $options = get_option( SPACEXCHIMP_P005_SETTINGS . '_settings' ); $value = !empty( $options[$name] ) ? esc_attr( $options[$name] ) : $default; // Generate a part of table $out = " $label
"; // Print the generated part of table echo $out; // Print a help text spacexchimp_p005_control_help( $help ); } /** * Generator of the media options for saving plugin settings to database */ function spacexchimp_p005_control_link( $name, $label, $placeholder, $help, $link=null ) { // Read options from database and declare variables $options = get_option( SPACEXCHIMP_P005_SETTINGS . '_settings' ); $value = !empty( $options["media"][$name]["content"] ) ? esc_textarea( $options["media"][$name]["content"] ) : ''; // Generate a part of table $link_out = !empty( $link ) ? "$label" : "$label"; $out = " $link_out "; // Print the generated part of table echo $out; // Print a help text spacexchimp_p005_control_help( $help ); } /** * Generator of the switches for saving plugin settings to database */ function spacexchimp_p005_control_choice( $name, $items, $label, $help, $default ) { // Read options from database and declare variables $options = get_option( SPACEXCHIMP_P005_SETTINGS . '_settings' ); $option = !empty( $options[$name] ) ? $options[$name] : ''; $list_item = ''; foreach ( $items as $item_key => $item_value ) { if ( empty( $option ) AND $item_key == $default ) { $selected = "checked='checked'"; } elseif ( $option == $item_key ) { $selected = "checked='checked'"; } else { $selected = ""; } $list_item .= "
  • $item_value
  • "; } // Generate a part of table $out = " $label "; // Print the generated part of table echo $out; // Print a help text spacexchimp_p005_control_help( $help ); }