backward.php
12 years ago
get_taxonomies_by_object_type.php
10 years ago
pmxe_filter.php
8 years ago
pmxe_functions.php
5 years ago
pmxe_prepare_price.php
8 years ago
pmxe_render_xml_attributes.php
9 years ago
pmxe_render_xml_element.php
8 years ago
pmxe_render_xml_text.php
8 years ago
str_getcsv.php
12 years ago
wp_all_export_check_children_assign.php
10 years ago
wp_all_export_clear_xss.php
4 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
10 years ago
wp_all_export_parse_field_name.php
9 years ago
wp_all_export_posts_join.php
10 years ago
wp_all_export_posts_where.php
8 years ago
wp_all_export_pre_user_query.php
6 years ago
wp_all_export_prepare_template_csv.php
6 years ago
wp_all_export_prepare_template_xml.php
6 years ago
wp_all_export_rand_char.php
10 years ago
wp_all_export_remove_colons.php
10 years ago
wp_all_export_remove_source.php
10 years ago
wp_all_export_reverse_rules_html.php
8 years ago
wp_all_export_rmdir.php
10 years ago
wp_all_export_secure_file.php
9 years ago
wp_all_export_url_title.php
10 years ago
wp_all_export_write_article.php
10 years ago
wp_redirect_or_javascript.php
12 years ago
pmxe_render_xml_text.php
25 lines
| 1 | <?php |
| 2 | function pmxe_render_xml_text($text, $shorten = false, $is_render_collapsed = false) |
| 3 | { |
| 4 | if (empty($text)) { |
| 5 | return; // do not display empty text nodes |
| 6 | } |
| 7 | |
| 8 | if (preg_match('%\[more:(\d+)\]%', $text, $mtch)) { |
| 9 | $no = intval($mtch[1]); |
| 10 | echo '<div class="xml-more">[ ⇓ ' . sprintf(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin')) . ' ⇓ ]</div>'; |
| 11 | return; |
| 12 | } |
| 13 | $more = ''; |
| 14 | if ($shorten and preg_match('%^(.*?\s+){20}(?=\S)%', $text, $mtch)) { |
| 15 | $text = $mtch[0]; |
| 16 | $more = '<span class="xml-more">[' . __('more', 'pmxi_plugin') . ']</span>'; |
| 17 | } |
| 18 | $text = esc_html($text); |
| 19 | // $text = preg_replace('%(?<!\s)\b(?!\s|\W[\w\s])|\w{20}%', '$0​', $text); // put explicit breaks for xml content to wrap |
| 20 | $is_cdata = ( strpos($text, 'CDATABEGIN') !== false ); |
| 21 | $text = str_replace('CDATABEGIN', '<![CDATA[', $text); |
| 22 | $text = str_replace('CDATACLOSE', ']]>', $text); |
| 23 | $is_short = strlen($text) <= 40; |
| 24 | echo '<div class="xml-content textonly' . ($is_short ? ' short' : '') . ($is_cdata ? ' cdata' : '') . ($is_render_collapsed ? ' collapsed' : '') . '">' . $text . $more . '</div>'; |
| 25 | } |