Code Duplication    Length = 25-25 lines in 2 locations

geodirectory-functions/cat-meta-functions/Tax-meta-class.php 2 locations

@@ 1071-1095 (lines=25) @@
1068
         * @since 1.0
1069
         * @access public
1070
         */
1071
        public function show_field_posts($field, $meta)
1072
        {
1073
            global $post;
1074
1075
            if (!is_array($meta)) $meta = (array)$meta;
1076
            $this->show_field_begin($field, $meta);
1077
            $options = $field['options'];
1078
            $posts = get_posts($options['args']);
1079
1080
            // checkbox_list
1081
            if ('checkbox_list' == $options['type']) {
1082
                foreach ($posts as $p) {
1083
                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1084
                }
1085
            } // select
1086
            else {
1087
                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1088
                foreach ($posts as $p) {
1089
                    echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1090
                }
1091
                echo "</select>";
1092
            }
1093
1094
            $this->show_field_end($field, $meta);
1095
        }
1096
1097
        /**
1098
         * Show Taxonomy field.
@@ 1109-1133 (lines=25) @@
1106
         *
1107
         * @uses get_terms()
1108
         */
1109
        public function show_field_taxonomy($field, $meta)
1110
        {
1111
            global $post;
1112
1113
            if (!is_array($meta)) $meta = (array)$meta;
1114
            $this->show_field_begin($field, $meta);
1115
            $options = $field['options'];
1116
            $terms = get_terms($options['taxonomy'], $options['args']);
1117
1118
            // checkbox_list
1119
            if ('checkbox_list' == $options['type']) {
1120
                foreach ($terms as $term) {
1121
                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1122
                }
1123
            } // select
1124
            else {
1125
                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1126
                foreach ($terms as $term) {
1127
                    echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1128
                }
1129
                echo "</select>";
1130
            }
1131
1132
            $this->show_field_end($field, $meta);
1133
        }
1134
1135
        /**
1136
         * Save Data from Metabox