* @package WordPress */ if ( !class_exists( 'WooCommerce_Quick_Donation_Format_Options' ) ) { class WooCommerce_Quick_Donation_Format_Options extends WooCommerce_Quick_Donation_Settings_API { /** * Format an option array into HTML * * * @access public * * @param unknown $setting * * @return string HTML. */ public function settings_options_format( $setting ) { if ( empty( $setting ) ) return false; $defaults = apply_filters( $this->id . '_options_defaults', array( 'name' => '', 'desc' => '', 'placeholder' => '', 'class' => '', 'tip' => '', 'id' => '', 'css' => '', 'type' => 'text', 'std' => '', 'select2' => false, 'multiple' => false, 'options' => array(), 'restrict' => array(), 'settings' => array() ) ); // Each to it's own variable for slim-ness' sakes. $setting = shortcode_atts( $defaults, $setting ); $restrict_defaults = array( 'min' => 0, 'max' => '', 'step' => 'any', ); $setting[ 'restrict' ] = shortcode_atts( $restrict_defaults, $setting[ 'restrict' ] ); $setting[ 'value' ] = $this->get_option( $setting[ 'id' ] ); $setting[ 'value' ] = $setting[ 'value' ] !== false ? maybe_unserialize( $setting[ 'value' ] ) : false; $setting[ 'value' ] = WooCommerce_Quick_Donation_Format_Options::sanitize_value( $setting[ 'value' ], $setting ); $setting[ 'title' ] = $setting[ 'name' ]; $setting[ 'name' ] = $this->id . "_options[{$setting['id']}]"; $setting[ 'grouped' ] = !$setting[ 'title' ] ? ' style="padding-top:0px;"' : ''; $setting[ 'tip' ] = WooCommerce_Quick_Donation_Format_Options::get_formatted_tip( $setting[ 'tip' ] ); $header_types = apply_filters( $this->id . '_options_header_types', array( 'heading', 'title' ) ); extract( $setting ); $description = $desc && !$grouped && $type != 'checkbox' ? ' ' . $desc . '' : ''; $description = ( ( in_array( $type, $header_types ) || $type == 'radio' ) && !empty( $desc ) ) ? '
' . $desc . '
' : $description; ?>