GlobalSettings/Settings.php 0000644 00000002517 15073226770 0012014 0 ustar 00 app = $app;
}
/**
* Render the page for native global settings components
*
* @throws \Exception
*/
public function render()
{
$this->enqueue();
$this->app->view->render('admin.globalSettings.settings');
}
/**
* Enqueue necessary resources.
*
* @throws \Exception
*/
public function enqueue()
{
wp_enqueue_script('fluentform-global-settings-js');
wp_localize_script('fluentform-global-settings-js', 'FluentFormApp', [
'plugin' => $this->app->config->get('app.slug'),
'akismet_activated' => AkismetHandler::isPluginEnabled(),
'has_pro' => defined('FLUENTFORMPRO'),
'form_settings_str' => TranslationString::getGlobalSettingsI18n()
]);
}
}
Preprocessor.php 0000644 00000006115 15073230132 0007742 0 ustar 00
| ';
const WC_HEADING_AFTER = '
|
';
/** @var AbandonedCartContent */
private $abandonedCartContent;
/** @var AutomatedLatestContentBlock */
private $automatedLatestContent;
/** @var ContentPreprocessor */
private $wooCommerceContentPreprocessor;
/*** @var CouponPreProcessor */
private $couponPreProcessor;
public function __construct(
AbandonedCartContent $abandonedCartContent,
AutomatedLatestContentBlock $automatedLatestContent,
ContentPreprocessor $wooCommerceContentPreprocessor,
CouponPreProcessor $couponPreProcessor
) {
$this->abandonedCartContent = $abandonedCartContent;
$this->automatedLatestContent = $automatedLatestContent;
$this->wooCommerceContentPreprocessor = $wooCommerceContentPreprocessor;
$this->couponPreProcessor = $couponPreProcessor;
}
/**
* @param array $content
* @param NewsletterEntity $newsletter
* @return array
*/
public function process(NewsletterEntity $newsletter, $content, bool $preview = false, SendingQueueEntity $sendingQueue = null) {
if (!array_key_exists('blocks', $content)) {
return $content;
}
$blocks = [];
$contentBlocks = $content['blocks'];
$contentBlocks = $this->couponPreProcessor->processCoupons($newsletter, $contentBlocks, $preview);
foreach ($contentBlocks as $block) {
$processedBlock = $this->processBlock($newsletter, $block, $preview, $sendingQueue);
if (!empty($processedBlock)) {
$blocks = array_merge($blocks, $processedBlock);
}
}
$content['blocks'] = $blocks;
return $content;
}
public function processBlock(NewsletterEntity $newsletter, array $block, bool $preview = false, SendingQueueEntity $sendingQueue = null): array {
switch ($block['type']) {
case 'abandonedCartContent':
return $this->abandonedCartContent->render($newsletter, $block, $preview, $sendingQueue);
case 'automatedLatestContentLayout':
return $this->automatedLatestContent->render($newsletter, $block);
case 'woocommerceHeading':
return $this->wooCommerceContentPreprocessor->preprocessHeader();
case 'woocommerceContent':
return $this->wooCommerceContentPreprocessor->preprocessContent();
}
return [$block];
}
}
BodyRenderer.php 0000644 00000002072 15073230132 0007636 0 ustar 00 blocksRenderer = $blocksRenderer;
$this->columnsRenderer = $columnsRenderer;
}
/**
* @param NewsletterEntity $newsletter
* @param array $content
* @return string
*/
public function renderBody(NewsletterEntity $newsletter, array $content) {
$blocks = (array_key_exists('blocks', $content))
? $content['blocks']
: [];
$renderedContent = [];
foreach ($blocks as $contentBlock) {
$columnsData = $this->blocksRenderer->render($newsletter, $contentBlock);
$renderedContent[] = $this->columnsRenderer->render(
$contentBlock,
$columnsData
);
}
return implode('', $renderedContent);
}
}
index.php 0000644 00000000006 15073230132 0006354 0 ustar 00
{{newsletter_meta_robots}}
{{newsletter_subject}}
{{newsletter_custom_fonts}}