backward.php
8 years ago
get_taxonomies_by_object_type.php
8 years ago
pmxe_filter.php
8 years ago
pmxe_functions.php
8 years ago
pmxe_render_xml_attributes.php
8 years ago
pmxe_render_xml_element.php
8 years ago
pmxe_render_xml_text.php
8 years ago
str_getcsv.php
8 years ago
wp_all_export_check_children_assign.php
8 years ago
wp_all_export_generate_export_file.php
8 years ago
wp_all_export_get_cpt_name.php
8 years ago
wp_all_export_get_export_format.php
8 years ago
wp_all_export_is_compatible.php
8 years ago
wp_all_export_parse_field_name.php
8 years ago
wp_all_export_posts_join.php
8 years ago
wp_all_export_posts_where.php
8 years ago
wp_all_export_prepare_template_csv.php
8 years ago
wp_all_export_prepare_template_xml.php
8 years ago
wp_all_export_rand_char.php
8 years ago
wp_all_export_remove_colons.php
8 years ago
wp_all_export_remove_source.php
8 years ago
wp_all_export_reverse_rules_html.php
8 years ago
wp_all_export_rmdir.php
8 years ago
wp_all_export_secure_file.php
8 years ago
wp_all_export_url_title.php
8 years ago
wp_all_export_write_article.php
8 years ago
wp_redirect_or_javascript.php
8 years ago
wp_all_export_get_cpt_name.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | function wp_all_export_get_cpt_name($cpt = array(), $count = 2, $post = array()) |
| 4 | { |
| 5 | $cptName = ''; |
| 6 | if ( ! empty($cpt)) |
| 7 | { |
| 8 | if (in_array('users', $cpt)) |
| 9 | { |
| 10 | $cptName = ($count > 1) ? __('Users', 'wp_all_export_plugin') : __('User', 'wp_all_export_plugin'); |
| 11 | } |
| 12 | elseif (in_array('shop_customer', $cpt)) |
| 13 | { |
| 14 | $cptName = ($count > 1) ? __('Customers', 'wp_all_export_plugin') : __('Customer', 'wp_all_export_plugin'); |
| 15 | } |
| 16 | elseif (in_array('comments', $cpt)) |
| 17 | { |
| 18 | $cptName = ($count > 1) ? __('Comments', 'wp_all_export_plugin') : __('Comment', 'wp_all_export_plugin'); |
| 19 | } |
| 20 | elseif (in_array('taxonomies', $cpt)) |
| 21 | { |
| 22 | if (!empty($post['taxonomy_to_export'])){ |
| 23 | $tx = get_taxonomy( $post['taxonomy_to_export'] ); |
| 24 | $cptName = ($count > 1) ? $tx->labels->name : $tx->labels->singular_name; |
| 25 | } |
| 26 | else{ |
| 27 | $cptName = ($count > 1) ? __('Taxonomy Terms', 'wp_all_export_plugin') : __('Taxonomy Term', 'wp_all_export_plugin'); |
| 28 | } |
| 29 | } |
| 30 | else |
| 31 | { |
| 32 | if (count($cpt) === 1 and in_array('product_variation', $cpt) and class_exists('WooCommerce')){ |
| 33 | $cptName = ($count > 1) ? 'Variations' : 'Variation'; |
| 34 | } |
| 35 | else |
| 36 | { |
| 37 | $post_type_details = get_post_type_object( $cpt[0] ); |
| 38 | if ($post_type_details) |
| 39 | { |
| 40 | $cptName = ($count > 1) ? $post_type_details->labels->name : $post_type_details->labels->singular_name; |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | if (empty($cptName)) |
| 46 | { |
| 47 | $cptName = ($count > 1) ? __('Records', 'wp_all_export_plugin') : __('Record', 'wp_all_export_plugin'); |
| 48 | } |
| 49 | |
| 50 | return $cptName; |
| 51 | } |