backward.php
2 months ago
get_taxonomies_by_object_type.php
2 months ago
pmxe_filter.php
2 months ago
pmxe_functions.php
2 months ago
pmxe_prepare_price.php
2 months ago
pmxe_render_xml_attributes.php
2 months ago
pmxe_render_xml_element.php
2 months ago
pmxe_render_xml_text.php
2 months ago
str_getcsv.php
2 months ago
wp_all_export_check_children_assign.php
2 months ago
wp_all_export_clear_xss.php
2 months ago
wp_all_export_comments_clauses.php
2 months ago
wp_all_export_generate_export_file.php
2 months ago
wp_all_export_get_cpt_name.php
2 months ago
wp_all_export_get_export_format.php
2 months ago
wp_all_export_is_compatible.php
2 months ago
wp_all_export_parse_field_name.php
2 months ago
wp_all_export_posts_join.php
2 months ago
wp_all_export_posts_where.php
2 months ago
wp_all_export_pre_user_query.php
2 months ago
wp_all_export_prepare_template_csv.php
2 months ago
wp_all_export_prepare_template_xml.php
2 months ago
wp_all_export_rand_char.php
2 months ago
wp_all_export_remove_colons.php
2 months ago
wp_all_export_remove_source.php
2 months ago
wp_all_export_reverse_rules_html.php
2 months ago
wp_all_export_rmdir.php
2 months ago
wp_all_export_secure_file.php
2 months ago
wp_all_export_terms_clauses.php
2 months ago
wp_all_export_url_title.php
2 months ago
wp_all_export_write_article.php
2 months ago
wp_redirect_or_javascript.php
2 months ago
wp_all_export_get_cpt_name.php
58 lines
| 1 | <?php |
| 2 | |
| 3 | // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- legitimate plugin prefixes (pmxe/PMXE/wpae/Wpae/wp_all_export/wpallexport/XmlExport/CdataStrategy/VariableProductTitle/Soflyy/GF_Export); Plugin Check does not honor phpcs.xml prefix declaration |
| 4 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | |
| 7 | function wp_all_export_get_cpt_name($cpt = array(), $count = 2, $post = array()) |
| 8 | { |
| 9 | $cptName = ''; |
| 10 | if ( ! empty($cpt)) |
| 11 | { |
| 12 | if (in_array('users', $cpt)) |
| 13 | { |
| 14 | $cptName = ($count > 1) ? __('Users', 'wp-all-export') : __('User', 'wp-all-export'); |
| 15 | } |
| 16 | elseif (in_array('shop_customer', $cpt)) |
| 17 | { |
| 18 | $cptName = ($count > 1) ? __('Customers', 'wp-all-export') : __('Customer', 'wp-all-export'); |
| 19 | } |
| 20 | elseif (in_array('comments', $cpt)) |
| 21 | { |
| 22 | $cptName = ($count > 1) ? __('Comments', 'wp-all-export') : __('Comment', 'wp-all-export'); |
| 23 | } |
| 24 | elseif (in_array('taxonomies', $cpt)) |
| 25 | { |
| 26 | if (!empty($post['taxonomy_to_export'])){ |
| 27 | $tx = get_taxonomy( $post['taxonomy_to_export'] ); |
| 28 | $cptName = ($count > 1) ? $tx->labels->name : $tx->labels->singular_name; |
| 29 | } |
| 30 | else{ |
| 31 | $cptName = ($count > 1) ? __('Taxonomy Terms', 'wp-all-export') : __('Taxonomy Term', 'wp-all-export'); |
| 32 | } |
| 33 | } |
| 34 | elseif (in_array('custom_wpae-gf-addon', $cpt)) { |
| 35 | $cptName = ($count > 1) ? __('Entries', 'wp-all-export') : __('Entry', 'wp-all-export'); |
| 36 | } |
| 37 | else |
| 38 | { |
| 39 | if (count($cpt) === 1 and in_array('product_variation', $cpt) and class_exists('WooCommerce')){ |
| 40 | $cptName = ($count > 1) ? 'Variations' : 'Variation'; |
| 41 | } |
| 42 | else |
| 43 | { |
| 44 | $post_type_details = get_post_type_object( $cpt[0] ); |
| 45 | if ($post_type_details) |
| 46 | { |
| 47 | $cptName = ($count > 1) ? $post_type_details->labels->name : $post_type_details->labels->singular_name; |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | if (empty($cptName)) |
| 53 | { |
| 54 | $cptName = ($count > 1) ? __('Records', 'wp-all-export') : __('Record', 'wp-all-export'); |
| 55 | } |
| 56 | |
| 57 | return $cptName; |
| 58 | } |