$value) { foreach ($value as $key2 => $value2) { if ($key2 === $args['name'] && $pageName === $key) { $fieldValue = $value2; } } } } break; default: $field = $args[0] ? $args[0] : ''; $metaboxName = $args[1]['name'] ? $args[1]['name'] : ''; $prefix = 'abMB_'.$metaboxName.$field['name']; $post = $args[2] ? $args[2] : ''; break; } //-- //end switch //-- $fieldName = esc_attr($prefix); $type = $field['type'] ? $field['type'] : null; if (isset($field['post_status'])) { $post_status = $field['post_status'] ? $field['post_status'] : ''; } else { $post_status = ''; } if (isset($post->ID)) { $fieldValue = get_post_meta($post->ID, $fieldName, true); } $label = $field['label']; $description = $field['description']; $fieldHTML = ''; switch ($type) { case 'textbox': $fieldHTML = ''; break; case 'textarea': $fieldHTML = ''; break; case 'checkbox': $extraText = $field['extraText'] ? $field['extraText'] : ''; $fieldHTML = ' '.$extraText.''; break; case 'select': $customList = $field['oArr'] ? $field['oArr'] : array('label' => '0', 'value' => 'Empty'); //lines into array $fieldHTML = ''; break; case 'categories': $customList = get_categories( array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, ) ); //lines into array foreach ($customList as $option) { //comma separated string into array $selected = selected($option->slug, $fieldValue, false) ? selected($option->slug, $fieldValue, false) : ''; //set the options $fieldHTML .= ''; } break; case 'tags': $customList = get_tags( array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, ) ); //lines into array foreach ($customList as $option) { $optionSlug = ''; if (isset($option->slug)) { $optionSlug = $option->slug; } if (isset($option->name)) { $optionName = $option->name; } //comma separated string into array $selected = selected($optionSlug, $fieldValue, false) ? selected($optionSlug, $fieldValue, false) : ''; //set the options $fieldHTML .= ''; } break; case 'pages': $customList = get_posts( array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'post_type' => 'page', 'post_status' => $post_status, ) ); //lines into array foreach ($customList as $page) { $pageID = 0; if (isset($page->ID)) { $pageID = $page->ID; } $pageTitle = 0; if (isset($page->post_title)) { $pageTitle = $page->post_title; } //comma separated string into array $selected = selected($pageID, $fieldValue, false) ? selected($pageID, $fieldValue, false) : ''; //set the options $fieldHTML .= ''; } $fieldHTML .= ''; break; case 'posts': $customList = get_posts( array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'post_type' => 'post', 'post_status' => $post_status, ) ); //lines into array foreach ($customList as $post) { //comma separated string into array $selected = selected($post->ID, $fieldValue, false) ? selected($post->ID, $fieldValue, false) : ''; //set the options $fieldHTML .= ''; } break; case 'users': $argsx = array(); $customList = get_users($argsx); //lines into array foreach ($customList as $usr) { //comma separated string into array $selected = selected($usr->ID, $fieldValue, false) ? selected($usr->ID, $fieldValue, false) : ''; //set the options $fieldHTML .= ''; } break; } // //END of select types switch // $fieldHTML .= ''; break; case 'datepicker': $fieldHTML = ''; break; case 'timepicker': $fieldHTML = ''; break; case 'colorpicker': $fieldHTML = ''; break; case 'radio': if (isset($field['radioType']) && $field['radioType'] === 'custom') { $fieldHTML = ''; foreach ($field['oArr'] as $radio) { $radioValue = ''; if (isset($radio->value)) { $radioValue = $radio->value; } $radioLabel = ''; if (isset($radio->label)) { $radioLabel = $radio->label; } $tempChecked = checked($radioValue, $fieldValue, false); $checked = $tempChecked ? $tempChecked : ''; $fieldHTML .= ' '.$radioLabel.' '; if ($field['orientation'] === 'v') { //add new line if orientation is set to vertical $fieldHTML .= '
'; } } } break; case 'upload': $buttonString = 'Upload'; $imgAlt = ''; if (!empty($fieldValue)) { $buttonString = 'Remove'; $imgAlt = 'No Image Uploaded'; } $fieldHTML .= '

'.$imgAlt.'

'; $fieldHTML .= '

'; $fieldHTML .= ''; break; case 'bootstrapIcons': $buttonString = 'Select an Icon'; $imgAlt = ''; if (!empty($fieldValue)) { $buttonString = ''; $imgAlt = 'No Image Uploaded'; } $fieldHTML .= '

'; $fieldHTML .= ''; break; case 'textboxesDynamic': // $sGeneral->showArr($fieldValue); $oArr = (isset($field['oArr'])) ? $field['oArr'] : array(); $fieldHTML .= ''; $imgAlt = ''; $fieldHTML .= '
'; // $sGeneral->showArr($fieldValue); if (is_array($fieldValue)) { // $i = 0; foreach ($fieldValue as $fv) { $fieldHTML .= '
'; $fieldHTML .= ''; foreach ($oArr as $key => $val) { $fieldValue = (isset($fv[$val->value])) ? $fv[$val->value] : ''; $fieldHTML .= $this->dtGenerate($val->label, $fieldName, $fv[$val->value], $i, $val->value); } $fieldHTML .= '
'; ++$i; } } $fieldHTML .= '
'; $fieldHTML .= '


'; break; } ?>
'; $fieldHTML .= ''; $fieldHTML .= ''; $fieldHTML .= ''; return $fieldHTML; } } }