| @@ -1,40 +1,55 @@ | ||
| 1 | -<?php if (!defined('ABSPATH')) exit; // Exit if accessed directly ?> | |
| 1 | +<?php if (!defined('ABSPATH')) { exit;} // Exit if accessed directly ?> | |
| 2 | 2 | <?php |
| 3 | 3 | /** |
| 4 | - * @var $title string | |
| 5 | - * @var $description string | |
| 6 | - * @var $url string | |
| 7 | - * @var $featured_image string | |
| 8 | - * @var $css_files array | |
| 9 | - * @var $js_files array | |
| 10 | - * @var $js_vars array | |
| 11 | - * @var $scope string | |
| 4 | + * @var string $title | |
| 5 | + * @var string $description | |
| 6 | + * @var string $url | |
| 7 | + * @var string $og_title | |
| 8 | + * @var string $featured_image | |
| 9 | + * @var array $css_files | |
| 10 | + * @var array $js_files | |
| 11 | + * @var array $js_vars | |
| 12 | + * @var string $scope | |
| 13 | + * @var string $layout | |
| 14 | + * @var array $portal | |
| 12 | 15 | */ |
| 16 | +$fluentCommunityTitle = $title ?? ''; | |
| 17 | +$fluentCommunityDescription = $description ?? ''; | |
| 18 | +$fluentCommunityUrl = $url ?? ''; | |
| 19 | +$fluentCommunityOgTitle = $og_title ?? ''; | |
| 20 | +$fluentCommunityFeaturedImage = $featured_image ?? ''; | |
| 21 | +$fluentCommunityCssFiles = $css_files ?? []; | |
| 22 | +$fluentCommunityJsFiles = $js_files ?? []; | |
| 23 | +$fluentCommunityJsVars = $js_vars ?? []; | |
| 24 | +$fluentCommunityScope = $scope ?? ''; | |
| 25 | +$fluentCommunityLayout = $layout ?? ''; | |
| 26 | +$fluentCommunityPortal = $portal ?? []; | |
| 13 | 27 | ?> |
| 14 | 28 | <!DOCTYPE html> |
| 15 | 29 | <html <?php language_attributes(); ?>> |
| 16 | 30 | <head> |
| 17 | - <title><?php echo esc_attr($title); ?></title> | |
| 31 | + <title><?php echo esc_attr($fluentCommunityTitle); ?></title> | |
| 18 | 32 | <meta charset="<?php bloginfo('charset'); ?>"> |
| 19 | - <meta name="description" content="<?php echo esc_attr($description); ?>"> | |
| 33 | + <meta name="description" content="<?php echo esc_attr($fluentCommunityDescription); ?>"> | |
| 20 | 34 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover,interactive-widget=resizes-content"/> |
| 21 | 35 | <?php |
| 22 | 36 | if (!empty($load_wp)) : |
| 23 | 37 | wp_head(); |
| 24 | - else: ?> | |
| 38 | + else: | |
| 39 | + ?> | |
| 25 | 40 | <meta name="mobile-web-app-capable" content="yes"> |
| 26 | 41 | <meta name="robots" content="noindex"> |
| 27 | 42 | <link rel="icon" type="image/x-icon" href="<?php echo esc_url(get_site_icon_url()); ?>"/> |
| 28 | 43 | <meta property="og:type" content="website"> |
| 29 | - <meta property="og:url" content="<?php echo esc_url($url); ?>"> | |
| 44 | + <meta property="og:url" content="<?php echo esc_url($fluentCommunityUrl); ?>"> | |
| 30 | 45 | <meta property="og:site_name" content="<?php bloginfo('name'); ?>"> |
| 31 | - <meta property="og:title" content="<?php echo esc_attr($og_title); ?>"> | |
| 32 | - <meta property="og:description" content="<?php echo esc_attr($description); ?>"> | |
| 46 | + <meta property="og:title" content="<?php echo esc_attr($fluentCommunityOgTitle); ?>"> | |
| 47 | + <meta property="og:description" content="<?php echo esc_attr($fluentCommunityDescription); ?>"> | |
| 33 | 48 | <?php endif; ?> |
| 34 | 49 | |
| 35 | - <?php if ($featured_image): ?> | |
| 36 | - <meta property="og:image" content="<?php echo esc_url($featured_image); ?>"/> | |
| 50 | + <?php if ($fluentCommunityFeaturedImage): ?> | |
| 51 | + <meta property="og:image" content="<?php echo esc_url($fluentCommunityFeaturedImage); ?>"/> | |
| 37 | 52 | <?php endif; ?> |
| 38 | 53 | |
| 39 | 54 | <style> |
| 40 | 55 | .fluent_com, .fcom_full_layout { |
| @@ -42,64 +57,64 @@ | ||
| 42 | 57 | width: 100%; |
| 43 | 58 | } |
| 44 | 59 | </style> |
| 45 | 60 | |
| 46 | - <?php do_action('fluent_community/headless/head_early', $scope); ?> | |
| 61 | + <?php do_action('fluent_community/headless/head_early', $fluentCommunityScope); ?> | |
| 47 | 62 | |
| 48 | - <?php foreach ($css_files as $fluentCommunityCssFile): ?> | |
| 63 | + <?php foreach ($fluentCommunityCssFiles as $fluentCommunityCssFile): ?> | |
| 49 | 64 | <link rel="stylesheet" href="<?php echo esc_url($fluentCommunityCssFile); ?>?version=<?php echo esc_attr(FLUENT_COMMUNITY_PLUGIN_VERSION); ?>" media="screen"/> <?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet ?> |
| 50 | 65 | <?php endforeach; ?> |
| 51 | - <?php do_action('fluent_community/headless/head', $scope); ?> | |
| 66 | + <?php do_action('fluent_community/headless/head', $fluentCommunityScope); ?> | |
| 52 | 67 | </head> |
| 53 | -<body class="fcom_headless_page fcom_headless_scope_<?php echo esc_attr($scope); ?>"> | |
| 68 | +<body class="fcom_headless_page fcom_headless_scope_<?php echo esc_attr($fluentCommunityScope); ?>"> | |
| 54 | 69 | |
| 55 | -<?php if ($layout == 'signup'): ?> | |
| 56 | - <div class="fcom_full_layout fluent_com_auth <?php echo $portal['position'] == 'right' ? ' fcom_auth_page_row_reverse' : ' fcom_auth_page'; ?>"> | |
| 70 | +<?php if ($fluentCommunityLayout == 'signup'): ?> | |
| 71 | + <div class="fcom_full_layout fluent_com_auth <?php echo $fluentCommunityPortal['position'] == 'right' ? ' fcom_auth_page_row_reverse' : ' fcom_auth_page'; ?>"> | |
| 57 | 72 | <div class="fcom_layout_side" |
| 58 | - style="<?php if (!empty($portal['background_image'])) echo 'background-image: url(' . esc_url($portal['background_image']) . ');'; ?> | |
| 59 | - <?php if (!empty($portal['background_color'])) echo 'background-color: ' . esc_attr($portal['background_color']) . ';'; ?> | |
| 60 | - display: <?php echo $portal['hidden'] ? 'none' : 'flex'; ?>"> | |
| 73 | + style="<?php if (!empty($fluentCommunityPortal['background_image'])) { echo 'background-image: url(' . esc_url($fluentCommunityPortal['background_image']) . ');';} ?> | |
| 74 | + <?php if (!empty($fluentCommunityPortal['background_color'])) { echo 'background-color: ' . esc_attr($fluentCommunityPortal['background_color']) . ';';} ?> | |
| 75 | + display: <?php echo $fluentCommunityPortal['hidden'] ? 'none' : 'flex'; ?>"> | |
| 61 | 76 | <div class="fcom_welcome"> |
| 62 | - <?php if (!empty($portal['logo'])): ?> | |
| 77 | + <?php if (!empty($fluentCommunityPortal['logo'])): ?> | |
| 63 | 78 | <div class="fcom_logo"> |
| 64 | 79 | <a href="<?php echo esc_url(\FluentCommunity\App\Services\Helper::baseUrl()); ?>"> |
| 65 | - <img src="<?php echo esc_url($portal['logo']); ?>" alt="Site logo"> | |
| 80 | + <img src="<?php echo esc_url($fluentCommunityPortal['logo']); ?>" alt="<?php echo esc_attr__('Site logo', 'fluent-community'); ?>"> | |
| 66 | 81 | </a> |
| 67 | 82 | </div> |
| 68 | 83 | <?php endif; ?> |
| 69 | - <h2 class="fcom_title" style="color: <?php echo esc_attr(!empty($portal['title_color']) ? $portal['title_color'] : 'var(--fcom_text_color, #606266)'); ?>"> | |
| 70 | - <?php echo wp_kses_post($portal['title']); ?> | |
| 84 | + <h2 class="fcom_title" style="color: <?php echo esc_attr(!empty($fluentCommunityPortal['title_color']) ? $fluentCommunityPortal['title_color'] : 'var(--fcom_text_color, #606266)'); ?>"> | |
| 85 | + <?php echo wp_kses_post($fluentCommunityPortal['title']); ?> | |
| 71 | 86 | </h2> |
| 72 | - <div class="fcom_sub_title" style="color: <?php echo esc_attr(!empty($portal['text_color']) ? $portal['text_color'] : 'var(--fcom_text_color, #606266)'); ?>"> | |
| 73 | - <p><?php echo wp_kses_post($portal['description']); ?></p> | |
| 87 | + <div class="fcom_sub_title" style="color: <?php echo esc_attr(!empty($fluentCommunityPortal['text_color']) ? $fluentCommunityPortal['text_color'] : 'var(--fcom_text_color, #606266)'); ?>"> | |
| 88 | + <p><?php echo wp_kses_post($fluentCommunityPortal['description']); ?></p> | |
| 74 | 89 | </div> |
| 75 | 90 | </div> |
| 76 | 91 | </div> |
| 77 | - <div class="fcom_layout_main" style="<?php if (!empty($portal['form']['background_image'])): ?>background-image: url(<?php echo esc_url($portal['form']['background_image']); ?>);<?php endif; ?>"> | |
| 92 | + <div class="fcom_layout_main" style="<?php if (!empty($fluentCommunityPortal['form']['background_image'])): ?>background-image: url(<?php echo esc_url($fluentCommunityPortal['form']['background_image']); ?>);<?php endif; ?>"> | |
| 78 | 93 | <div class="fluent_com fluent_com_auth"> |
| 79 | - <?php do_action('fluent_community/headless/content', $scope); ?> | |
| 94 | + <?php do_action('fluent_community/headless/content', $fluentCommunityScope); ?> | |
| 80 | 95 | </div> |
| 81 | 96 | </div> |
| 82 | 97 | </div> |
| 83 | 98 | <?php else: ?> |
| 84 | 99 | <div class="fluent_com"> |
| 85 | - <?php do_action('fluent_community/headless/content', $scope); ?> | |
| 100 | + <?php do_action('fluent_community/headless/content', $fluentCommunityScope); ?> | |
| 86 | 101 | </div> |
| 87 | 102 | <?php endif; ?> |
| 88 | 103 | |
| 89 | 104 | <script> |
| 90 | - <?php foreach ($js_vars as $fluentCommunityVarKey => $fluentCommunityValues): ?> | |
| 91 | - var <?php echo esc_attr($fluentCommunityVarKey); ?> = <?php echo wp_json_encode($fluentCommunityValues); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>; | |
| 105 | + <?php foreach ($fluentCommunityJsVars as $fluentCommunityVarKey => $fluentCommunityValues): ?> | |
| 106 | + var <?php echo esc_attr($fluentCommunityVarKey); ?> = <?php echo wp_json_encode($fluentCommunityValues); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>; | |
| 92 | 107 | <?php endforeach; ?> |
| 93 | 108 | </script> |
| 94 | 109 | |
| 95 | -<?php do_action('fluent_community/headless/before_js_loaded', $scope); ?> | |
| 110 | +<?php do_action('fluent_community/headless/before_js_loaded', $fluentCommunityScope); ?> | |
| 96 | 111 | |
| 97 | -<?php foreach ($js_files as $fluentCommunityFile): ?> | |
| 98 | - <script type="module" src="<?php echo esc_url($fluentCommunityFile); ?>?version=<?php echo esc_attr(FLUENT_COMMUNITY_PLUGIN_VERSION); ?>" defer="defer"></script> <?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript ?> | |
| 112 | +<?php foreach ($fluentCommunityJsFiles as $fluentCommunityFile): ?> | |
| 113 | + <script type="module" src="<?php echo esc_url(\FluentCommunity\App\Vite::versionedUrl($fluentCommunityFile)); ?>" defer="defer"></script> <?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript ?> | |
| 99 | 114 | <?php endforeach; ?> |
| 100 | 115 | |
| 101 | 116 | <?php if (!empty($load_wp)) { wp_footer(); } ?> |
| 102 | 117 | |
| 103 | -<?php do_action('fluent_community/headless/footer', $scope); ?> | |
| 118 | +<?php do_action('fluent_community/headless/footer', $fluentCommunityScope); ?> | |
| 104 | 119 | </body> |
| 105 | 120 | </html> |