8889841cplugins/wp-job-board-pro/libraries/cmb2/cmb_field_taxonomy_location/cmb-field-taxonomy-location.php 0000644 00000021555 15052253226 0037066 0 ustar 00 home/clixcotz/gj.clix.co.tz/wp-content setup_admin_scripts();
if ( version_compare( CMB2_VERSION, '2.2.2', '>=' ) ) {
$field_type_object->type = new CMB2_Type_Select( $field_type_object );
}
$nb_fields = apply_filters('wp_job_board_pro_cmb2_field_taxonomy_location_number', 4);
$parent = 0;
echo '
';
for ($i=1; $i <= $nb_fields; $i++) {
$taxonomy_options = $this->get_taxonomy_options( $field_escaped_value, $field_type_object, $parent );
$parent = !empty($taxonomy_options['parent']) ? $taxonomy_options['parent'] : 'no';
$label = '';
if ( $i == 1 ) {
$label = esc_html__('Country', 'wp-job-board-pro');
} elseif ( $i == 2 ) {
$label = esc_html__('State', 'wp-job-board-pro');
} elseif ( $i == 3 ) {
$label = esc_html__('City', 'wp-job-board-pro');
} elseif ( $i == 4 ) {
$label = esc_html__('District', 'wp-job-board-pro');
}
$field_name = apply_filters('wp_job_board_pro_cmb2_field_taxonomy_location_field_name_'.$i, $label);
$placeholder = $field->args( 'attributes', 'placeholder' ) ? $field->args( 'attributes', 'placeholder' ) : $field_name;
$placeholder = sprintf($placeholder, $field_name);
$a = $field_type_object->parse_args( 'wpjb_taxonomy_location', array(
'style' => 'width: 99%',
'class' => 'wpjb_taxonomy_location wpjb_taxonomy_location'.$i,
'name' => $field_type_object->_name() . '[]',
'id' => $field_type_object->_id().$i,
'desc' => $field_type_object->_desc( true ),
'options' => $taxonomy_options['option'],
'data-placeholder' => $placeholder,
'data-next' => ($i + 1),
'data-taxonomy' => $field_type_object->field->args( 'taxonomy' ),
'data-allowclear' => true
) );
$attrs = $field_type_object->concat_attrs( $a, array( 'desc', 'options' ) );
echo sprintf( '
', $i, $attrs, $a['options'] );
}
echo '
';
if ( !empty($a['desc']) ) {
echo $a['desc'];
}
}
public function get_taxonomy_options( $field_escaped_value, $field_type_object, $parent ) {
$options = (array) $this->get_terms($field_type_object->field->args( 'taxonomy' ), array('parent' => $parent));
$field_escaped_value = $this->options_terms($field_type_object->field);
// if ( ! empty( $field_escaped_value ) ) {
// if ( !is_array($field_escaped_value) ) {
// $field_escaped_value = array($field_escaped_value);
// }
// $options = $this->sort_array_by_array( $options, $field_escaped_value );
// }
$return = array();
$selected_items = '';
$other_items = '