Server IP : 172.67.157.199 / Your IP : 18.221.181.79 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/chroot/var/www/wp-content/plugins/wp-all-export/helpers/ |
Upload File : |
<?php function pmxe_render_xml_text($text, $shorten = false, $is_render_collapsed = false) { if (empty($text)) { return; // do not display empty text nodes } if (preg_match('%\[more:(\d+)\]%', $text, $mtch)) { $no = intval($mtch[1]); echo '<div class="xml-more">[ ⇓ ' . sprintf(wp_kses_post(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin'))) . ' ⇓ ]</div>'; return; } $more = ''; if ($shorten and preg_match('%^(.*?\s+){20}(?=\S)%', $text, $mtch)) { $text = $mtch[0]; $more = '<span class="xml-more">[' . __('more', 'pmxi_plugin') . ']</span>'; } $text = esc_html($text); // $text = preg_replace('%(?<!\s)\b(?!\s|\W[\w\s])|\w{20}%', '$0​', $text); // put explicit breaks for xml content to wrap $is_cdata = ( strpos($text, 'CDATABEGIN') !== false ); $text = str_replace('CDATABEGIN', '<![CDATA[', $text); $text = str_replace('CDATACLOSE', ']]>', $text); $is_short = strlen($text) <= 40; echo '<div class="xml-content textonly' . ($is_short ? ' short' : '') . ($is_cdata ? ' cdata' : '') . ($is_render_collapsed ? ' collapsed' : '') . '">' . esc_html($text) . $more . '</div>'; }