wp = new WPFunctions; $this->maxExcerptLength = $this->wp->applyFilters('mailpoet_newsletter_post_excerpt_length', $this->maxExcerptLength); $this->woocommerceHelper = $woocommerceHelper ?: new WooCommerceHelper($this->wp); } public function getContent($post, $displayType) { if ($displayType === 'titleOnly') { return ''; } if ($this->woocommerceHelper->isWooCommerceActive() && $this->wp->getPostType($post) === 'product') { $product = $this->woocommerceHelper->wcGetProduct($post->ID); if ($product) { return $this->getContentForProduct($product, $displayType); } } if ($displayType === 'excerpt') { if ($this->wp->hasExcerpt($post)) { return self::stripShortCodes($this->wp->getTheExcerpt($post)); } return $this->generateExcerpt($post->post_content); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps } return self::stripShortCodes($post->post_content); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps } 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 = [ '

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