form_args = $args; } /************************************** * DISPLAY FORM **************************************/ public function display() { !isset( $this->form_args['form_properties']['type'] ) ? $this->form_args['form_properties']['type'] = 'table' : FALSE; if ( 'table' == $this->form_args['form_properties']['type'] ) { ob_start(); ?> form_args['form_fields'] as $section => $section_args ) { ?>
$field_args) { echo $this->set_field( $field_args ); } ?>
form_args['form_properties']['type'] ) { ob_start(); foreach ( $this->form_args['form_fields'] as $section => $section_args ) { ?>

$field_args) { echo $this->set_field( $field_args ); } ?>

form_args['form_fields'] as $section => $section_args ) { _e( '' . $section_args['head'] . '      ', 'amen_domain' ); } echo ob_get_clean(); } /************************************** * ASSEMBLE FIELDS **************************************/ public function set_field( $args, $amen_WPID = NULL ) { $defaults = array( 'displayType' => 0, // All:Required 'label' => '', // All:Required 'id' => '', // All:Required 'value' => '', // All (except Multi-Select):Required 'description' => '', // All 'class' => '', 'readonly' => FALSE, // All 'disabled' => FALSE, // All 'order' => '%F%L%D%N', // All 'width' => '20em', // Text 'options' => '', // Single-Select & Multi-Select 'selected' => '', // Single-Select 'checked' => '', // Multi-Select & Checkbox 'rows' => '12', // Textarea 'columns' => '80', // Textarea ); $args = wp_parse_args( $args, $defaults ); extract( $args, EXTR_SKIP ); $readonly = $readonly ? ' readonly="readonly"' : ''; $disabled = $disabled ? ' disabled="disabled"' : ''; $width = $width ? ' style="width:' . $width . ';"' : ''; switch ( $displayType ) { case 'text': // define text field content case 'password': case 'submit': case 'hidden': $show_field = ''; $show_label = '' != $label ? '' : ''; $show_description = '' != $description ? '' . $description . '' : ''; break; case 'single-select': // define single-select dropdown field content ob_start(); ?> $display ): if ( $selected == $possibleValue ) { echo '' != $disabled ? '' : ''; } endforeach; $show_field = ob_get_clean(); $show_label = '' != $label ? '' : ''; $show_description = '' != $description ? '' . $description . '' : ''; break; case 'multi-select': // define multi-select checkbox field content ob_start(); $count_options = count( $options ); ?> $display ) { if( isset( $value[ $possibleValue ]['checked'] ) ) { $amen_checked = 'checked="checked"'; } else { $amen_checked = ''; } ?> />
$display ) { if ( isset( $value[ $possibleValue ]['checked'] ) ) { $amen_checked = 'checked="checked"'; } else { $amen_checked = ''; } if ( 1 == $f % $split_count ) { ?>
/>
' . $label . '' : ''; $show_description = '' != $description ? '' . $description . '' : ''; break; case 'textarea': // define textarea field content $show_field = ''; $show_label = '' != $label ? '' : ''; $show_description = '' != $description ? '' . $description . '' : ''; break; case 'checkbox': // define checkbox field content $checked = $value ? 'checked="checked"' : ''; $show_field = ''; $show_label = '' != $label ? '' : ''; $show_description = '' != $description ? '' . $description . '' : ''; break; case 'editor': // define editor field content ob_start(); wp_editor( $value, $id ); $show_field = ob_get_clean(); $show_label = '' != $label ? '' : ''; $show_description = '' != $description ? '' . $description . '' : ''; default: break; } $searchArray = array( '%F', '%L', '%D', '%N', '%S', '%B' ); $replaceArray = array( $show_field . ' ', $show_label . ' ', $show_description . ' ', '
', '   ', '  •  ' ); $order = str_replace( $searchArray, $replaceArray, $order ); // set order of content return $order; } }