HEX
Server: Apache/2.4.49 (FreeBSD) OpenSSL/1.0.2s-freebsd PHP/5.6.36
System: FreeBSD hosting.icon.bg 11.3-RELEASE-p13 FreeBSD 11.3-RELEASE-p13 #0: Tue Sep 1 06:56:51 UTC 2020 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
User: ftpuser (1002)
PHP: 5.6.36
Disabled: NONE
Upload Files
File: /hosting/kak.bg/web/wp-content/plugins/wp-all-export/helpers/pmxe_render_xml_text.php
<?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">[ &dArr; ' . sprintf(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin')) . ' &dArr; ]</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&#8203;', $text); // put explicit breaks for xml content to wrap	
	$is_cdata = ( strpos($text, 'CDATABEGIN') !== false );
	$text = str_replace('CDATABEGIN', '&lt;![CDATA[', $text);
	$text = str_replace('CDATACLOSE', ']]&gt;', $text);
	$is_short = strlen($text) <= 40;
	echo '<div class="xml-content textonly' . ($is_short ? ' short' : '') . ($is_cdata ? ' cdata' : '') . ($is_render_collapsed ? ' collapsed' : '') . '">' . $text . $more . '</div>';
}