REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 6.09 KB
Close
/home/nshryvcy/himaltourism.com/wp-content/plugins/mailpoet/lib/Form/AssetsController.php
Text
Base64
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\Form; if (!defined('ABSPATH')) exit; use MailPoet\Config\Env; use MailPoet\Config\Renderer as BasicRenderer; use MailPoet\Settings\SettingsController; use MailPoet\Subscription\Captcha\CaptchaConstants; use MailPoet\WP\Functions as WPFunctions; class AssetsController { /** @var WPFunctions */ private $wp; /** @var BasicRenderer */ private $renderer; /** @var SettingsController */ private $settings; const RECAPTCHA_API_URL = 'https://www.google.com/recaptcha/api.js?render=explicit'; public function __construct( WPFunctions $wp, BasicRenderer $renderer, SettingsController $settings ) { $this->wp = $wp; $this->renderer = $renderer; $this->settings = $settings; } /** * Returns assets scripts tags as string * @return string */ public function printScripts() { ob_start(); $captcha = $this->settings->get('captcha'); if (!empty($captcha['type']) && CaptchaConstants::isReCaptcha($captcha['type'])) { echo '<script src="' . esc_attr(self::RECAPTCHA_API_URL) . '" async defer></script>'; } $this->wp->wpPrintScripts('jquery'); $this->wp->wpPrintScripts('mailpoet_vendor'); $this->wp->wpPrintScripts('mailpoet_public'); $scripts = ob_get_contents(); ob_end_clean(); if ($scripts === false) { return ''; } return $scripts; } public function setupFormPreviewDependencies() { $this->setupFrontEndDependencies(); $this->wp->wpEnqueueScript( 'mailpoet_form_preview', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('form_preview.js'), ['jquery'], Env::$version, true ); } public function setupFrontEndDependencies() { $captcha = $this->settings->get('captcha'); if (!empty($captcha['type']) && CaptchaConstants::isRecaptcha($captcha['type'])) { $this->wp->wpEnqueueScript( 'mailpoet_recaptcha', self::RECAPTCHA_API_URL ); } $this->wp->wpEnqueueStyle( 'mailpoet_public', Env::$assetsUrl . '/dist/css/' . $this->renderer->getCssAsset('mailpoet-public.css') ); $this->wp->wpEnqueueScript( 'mailpoet_public', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('public.js'), ['jquery'], Env::$version, true ); $this->wp->wpLocalizeScript('mailpoet_public', 'MailPoetForm', [ 'ajax_url' => $this->wp->adminUrl('admin-ajax.php'), 'is_rtl' => (function_exists('is_rtl') ? (bool)is_rtl() : false), ]); $ajaxFailedErrorMessage = __('An error has happened while performing a request, please try again later.', 'mailpoet'); $inlineScript = <<<EOL function initMailpoetTranslation() { if (typeof MailPoet !== 'undefined') { MailPoet.I18n.add('ajaxFailedErrorMessage', '%s') } else { setTimeout(initMailpoetTranslation, 250); } } setTimeout(initMailpoetTranslation, 250); EOL; $this->wp->wpAddInlineScript( 'mailpoet_public', sprintf($inlineScript, esc_js($ajaxFailedErrorMessage)), 'after' ); } public function setupAdminWidgetPageDependencies() { $this->wp->wpEnqueueScript( 'mailpoet_vendor', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('vendor.js'), [], Env::$version, true ); $this->wp->wpEnqueueScript( 'mailpoet_admin', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('mailpoet.js'), [], Env::$version, true ); } public function setupAutomationListingDependencies(): void { $this->wp->wpEnqueueScript( 'automation', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('automation.js'), [], Env::$version, true ); $this->wp->wpSetScriptTranslations('automation', 'mailpoet'); } public function setupAutomationEditorDependencies(): void { $this->wp->wpEnqueueScript( 'automation_editor', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('automation_editor.js'), [], Env::$version, true ); $this->wp->wpSetScriptTranslations('automation_editor', 'mailpoet'); } public function setupAutomationTemplatesDependencies(): void { $this->wp->wpEnqueueScript( 'automation_templates', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('automation_templates.js'), [], Env::$version, true ); $this->wp->wpSetScriptTranslations('automation_templates', 'mailpoet'); } public function setupNewsletterEditorDependencies(): void { $this->wp->wpRegisterScript( 'newsletter_editor', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('newsletter_editor.js'), [], Env::$version, true ); $this->wp->wpPrintScripts('wp-i18n'); $this->wp->wpSetScriptTranslations('newsletter_editor', 'mailpoet'); /** * The js file needs to be added immediately since the mailpoet_newsletters_editor_initialize hook is dispatched in template files * Update and remove this line in MAILPOET-4930 */ \wp_scripts()->do_item('newsletter_editor'); } public function setupAdminPagesDependencies(): void { $this->wp->wpPrintScripts('wp-i18n'); $this->addAdminCommons(); $this->wp->wpEnqueueScript( 'mailpoet_admin_pages', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('admin.js'), [], Env::$version, true ); $this->wp->wpSetScriptTranslations('mailpoet_admin_pages', 'mailpoet'); } private function addAdminCommons(): void { $this->wp->wpRegisterScript( 'mailpoet_admin_commons', Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('commons.js'), [], Env::$version, true ); $this->wp->wpSetScriptTranslations('mailpoet_admin_commons', 'mailpoet'); /** * The js file needs to be added immediately since the mailpoet_newsletters_editor_initialize hook is dispatched in template files * Update and remove this line in MAILPOET-4930 */ \wp_scripts()->do_item('mailpoet_admin_commons'); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 4 × Files: 15
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Block
DIR
-
drwxr-xr-x
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Listing
DIR
-
drwxr-xr-x
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Templates
DIR
-
drwxr-xr-x
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Util
DIR
-
drwxr-xr-x
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ApiDataSanitizer.php
1.91 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
AssetsController.php
6.09 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BlocksRenderer.php
4.18 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BlockStylesRenderer.php
4.04 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BlockWrapperRenderer.php
642 B
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DisplayFormInWPContent.php
10.86 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FormHtmlSanitizer.php
1.26 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FormMessageController.php
1.61 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FormSaveController.php
1.16 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FormsRepository.php
2.61 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.php
0 B
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PreviewPage.php
4.03 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PreviewWidget.php
726 B
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Renderer.php
4.19 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Widget.php
9.12 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).