Code Duplication    Length = 19-29 lines in 2 locations

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

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