/** * Retrieve terms for given post type. * * @since 1.4.6 * @package GeoDirectory * * @param string $post_type The post type. * @return array Array of terms data. */ function geodir_imex_get_terms($post_type) { $args = array('hide_empty' => 0, 'orderby' => 'id'); remove_all_filters('get_terms'); $taxonomy = $post_type . 'category'; $terms = get_terms($taxonomy, $args); $csv_rows = array(); if (!empty($terms)) { $csv_row = array(); $csv_row[] = 'cat_id'; $csv_row[] = 'cat_name'; $csv_row[] = 'cat_slug'; $csv_row[] = 'cat_posttype'; $csv_row[] = 'cat_parent'; $csv_row[] = 'cat_description'; $csv_row[] = 'cat_top_description'; $csv_row[] = 'cat_image'; $csv_row[] = 'cat_icon'; // WPML $is_wpml = geodir_is_wpml(); if ($is_wpml) { $csv_row[] = 'cat_language'; } // WPML $csv_rows[] = $csv_row; foreach ($terms as $term) { $cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type); $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; $cat_image = geodir_get_default_catimage($term->term_id, $post_type); $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; $cat_parent = ''; if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) { $parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy); $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : ''; } $csv_row = array(); $csv_row[] = $term->term_id; $csv_row[] = $term->name; $csv_row[] = $term->slug; $csv_row[] = $post_type; $csv_row[] = $cat_parent; $csv_row[] = $term->description; $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type); $csv_row[] = $cat_image; $csv_row[] = $cat_icon; // WPML if ($is_wpml) { $csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_' . $taxonomy); } // WPML $csv_rows[] = $csv_row; } } return $csv_rows; }
/** * Display notice on geodirectory permalink settings page to don't pages settings on a different language when wpml is active. * * @package GeoDirectory * @since 1.5.7 * * @global object $sitepress Sitepress WPML object. */ function geodir_wpml_permalink_setting_notice() { if (geodir_is_wpml()) { global $sitepress; $current_language = $sitepress->get_current_language(); $default_language = $sitepress->get_default_language(); if ($current_language != 'all' && $current_language != $default_language) { ?> <div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?> </strong></p></div> <?php } } }