Code Duplication    Length = 25-25 lines in 2 locations

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

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