', $html);
$html = str_replace('{{wp_navigation_links}}', '', $html);
$html = str_replace('{{acpt_breadcrumbs}}', '', $html);
preg_match_all('/{{wp_date format[^}}]*}}/', $html, $dateFormats);
if (!empty($dateFormats[0])) {
foreach ($dateFormats[0] as $index => $dateFormat) {
preg_match('/format=\"[a-zA-Z0-9\-\/\.\s+]+\"/', $dateFormat, $format);
if (!empty($format[0])) {
$html = str_replace($dateFormat, '[wp_date '. $format[0].']', $html);
}
}
}
preg_match_all('/{{wp_thumbnail format[^}}]*}}/', $html, $thumbnailFormats);
if (!empty($thumbnailFormats[0])) {
foreach ($thumbnailFormats[0] as $index => $thumbnailFormat) {
preg_match('/format=\"[a-zA-Z0-9\-\/\.\s+]+\"/', $thumbnailFormat, $format);
if (!empty($format[0])) {
$html = str_replace($thumbnailFormat, '[wp_thumbnail '. $format[0].']', $html);
}
}
}
preg_match_all('/{{wp_permalink[^}}]*}}/', $html, $permalinks);
if (!empty($permalinks[0])) {
foreach ($permalinks[0] as $index => $permalink) {
$permalinkShortcode = '[wp_permalink';
preg_match('/anchor=\"[a-zA-Z0-9\-\/\.\s+]+\"/', $permalink, $anchor);
if (!empty($anchor[0])) {
$permalinkShortcode .= ' ' . $anchor[0];
}
preg_match('/target=\"[a-zA-Z0-9_\-\/\.\s+]+\"/', $permalink, $target);
if (!empty($target[0])) {
$permalinkShortcode .= ' ' . $target[0];
}
$permalinkShortcode .= ']';
$html = str_replace($permalink, $permalinkShortcode, $html);
}
}
preg_match_all('/{{acpt_breadcrumb[^}}]*}}/', $html, $breadcrumbs);
if (!empty($breadcrumbs[0])) {
foreach ($breadcrumbs[0] as $index => $breadcrumb) {
preg_match('/separator=\"[a-zA-Z0-9;&\-\/.\s+]+\"/', $breadcrumb, $separator);
if (!empty($separator[0])) {
$html = str_replace($breadcrumb, '', $html);
}
}
}
return $html;
}
/**
* @param string $html
*
* @return string
*/
private static function convertACPTLoopTags($html)
{
$tags = [
'acpt-loop',
'acpt-tax-loop',
'acpt-field-loop',
'acpt-block-loop',
];
foreach ($tags as $tag) {
preg_match_all('/<'.$tag.'[^>]*>/', $html, $loops);
if (!empty($loops[0])) {
foreach ($loops[ 0 ] as $index => $loop) {
$newTag = str_replace('-', '_', $tag);
$shortcode = str_replace('<'.$tag, '['.$newTag, $loop);
$shortcode = str_replace('>', ']', $shortcode);
$html = str_replace($loop, $shortcode, $html);
$html = str_replace(''.$tag.'>', '[/'.$newTag.']', $html);
}
}
}
return $html;
}
/**
* @param string $html
*
* @return string
*/
private static function convertWooCommerceTags($html)
{
$html = str_replace('{{wc_breadcrumb}}', "", $html);
$html = str_replace('{{wc_sale_flash}}', "", $html);
$html = str_replace('{{wc_product_images}}', "", $html);
$html = str_replace('{{wc_product_thumbnails}}', "", $html);
$html = str_replace('{{wc_product_sku}}', "", $html);
$html = str_replace('{{wc_product_title}}', "", $html);
$html = str_replace('{{wc_product_rating}}', "", $html);
$html = str_replace('{{wc_product_price}}', "", $html);
$html = str_replace('{{wc_product_excerpt}}', "", $html);
$html = str_replace('{{wc_add_to_cart}}', "", $html);
$html = str_replace('{{wc_sharing}}', "", $html);
$html = str_replace('{{wc_product_meta}}', "", $html);
$html = str_replace('{{wc_product_data_tabs}}', "", $html);
$html = str_replace('{{wc_product_upsell}}', "", $html);
$html = str_replace('{{wc_product_related}}', "", $html);
$html = str_replace('', '', $html);
$html = str_replace('', '', $html);
$html = str_replace('', '', $html);
$html = str_replace('', '', $html);
$html = str_replace('', '', $html);
$html = str_replace('', '', $html);
$html = str_replace('', '', $html);
$html = str_replace('', '', $html);
return $html;
}
/**
* @param string $html
*
* @return string
*/
private static function convertThemeTags($html)
{
$html = str_replace('{{header}}', "", $html);
$html = str_replace('{{footer}}', "", $html);
preg_match_all('/{{template_part[^}}]*}}/', $html, $templateParts);
if (!empty($templateParts[0])) {
foreach ($templateParts[0] as $index => $templatePart) {
$html = str_replace($templatePart, "", $html);
}
}
preg_match_all('/{{header[^}}]*}}/', $html, $headers);
if (!empty($headers[0])) {
foreach ($headers[0] as $index => $header) {
$html = str_replace($header, "", $html);
}
}
preg_match_all('/{{footer[^}}]*}}/', $html, $footers);
if (!empty($footers[0])) {
foreach ($footers[0] as $index => $footer) {
$html = str_replace($footer, "", $html);
}
}
return $html;
}
/**
* @param string $html
*
* @return string
*/
private static function convertACPTTags($html)
{
preg_match_all('/{{acpt[^}}]*}}/', $html, $acptTags);
if (!empty($acptTags[0])) {
foreach ($acptTags[0] as $index => $acptTag) {
$html = str_replace($acptTag, "[".str_replace(['{{', '}}'], '', $acptTag)."]", $html);
}
}
return $html;
}
/**
* @param string $php
* @return void
*/
public static function phpToHtml(string $php): void
{
// @TODO to be implemented
}
}