Code Duplication    Length = 19-29 lines in 2 locations

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

@@ 2056-2084 (lines=29) @@
2053
        }
2054
2055
        //update meta
2056
        public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057
        {
2058
2059
            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2060
                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2061
                $post_type = $taxObject->object_type[0];
2062
            }
2063
2064
            if($post_type=='post'){$post_type='';}
2065
            if($post_type){$post_type = $post_type.'_';}
2066
2067
            $m = get_option('tax_meta_' . $post_type  . $term_id);
2068
2069
            $m[$key] = $value;
2070
            update_option('tax_meta_' . $post_type  . $term_id, $m);
2071
2072
            /**
2073
             * Called after the tax meta is updated.
2074
             *
2075
             * Used to update things after a GD category is saved.
2076
             *
2077
             * @since 1.0.0
2078
             * @param bool $false False.
2079
             * @param bool $true True.
2080
             * @param int $term_id The term id being updated.
2081
             * @param string $post_type The post type of the cat being updated.
2082
             */
2083
            do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2084
        }
2085
2086
2087
    } // End Class
@@ 2141-2159 (lines=19) @@
2138
2139
//update meta
2140
if (!function_exists('update_tax_meta')) {
2141
    function update_tax_meta($term_id, $key, $value, $post_type = '')
2142
    {
2143
2144
        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2145
            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2146
            $post_type = $taxObject->object_type[0];
2147
        }
2148
2149
        if($post_type=='post'){$post_type='';}
2150
        if($post_type){$post_type = $post_type.'_';}
2151
2152
        $m = get_option('tax_meta_' . $post_type  . $term_id);
2153
2154
        $m[$key] = $value;
2155
        update_option('tax_meta_' . $post_type . $term_id, $m);
2156
2157
        /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2158
        do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2159
    }
2160
}