maxExcerptLength = $wp->applyFilters('mailpoet_newsletter_post_excerpt_length', $this->maxExcerptLength); $this->woocommerceHelper = $woocommerceHelper ?: new WooCommerceHelper(); } public function getContent($post, $displayType) { if ($displayType === 'titleOnly') { return ''; } if ($this->woocommerceHelper->isWooCommerceActive() && $post->post_type === 'product') { // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps $product = $this->woocommerceHelper->wcGetProduct($post->ID); if ($product) { return $this->getContentForProduct($product, $displayType); } } if ($displayType === 'excerpt') { if (!empty($post->post_excerpt)) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps return self::stripShortCodes($post->post_excerpt); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps } return $this->generateExcerpt($post->post_content); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps } return self::stripShortCodes($post->post_content); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps } public function filterContent($content, $displayType, $withPostClass = true) { $content = self::convertEmbeddedContent($content); // convert h4 h5 h6 to h3 $content = preg_replace('/<([\/])?h[456](.*?)>/', '<$1h3$2>', $content); // convert currency signs $content = str_replace( ['$', '€', '£', '¥'], ['$', '€', '£', '¥'], $content ); // strip useless tags $tagsNotBeingStripped = [ '

', '', '', '', '', '', '', '