| @@ -1,38 +1,57 @@ | ||
| 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 | -<html lang='en'> | |
| 29 | +<html <?php language_attributes(); ?>> | |
| 16 | 30 | <head> |
| 17 | - <title><?php echo esc_attr($title); ?></title> | |
| 18 | - <meta charset='utf-8'> | |
| 31 | + <title><?php echo esc_attr($fluentCommunityTitle); ?></title> | |
| 32 | + <meta charset="<?php bloginfo('charset'); ?>"> | |
| 33 | + <meta name="description" content="<?php echo esc_attr($fluentCommunityDescription); ?>"> | |
| 34 | + <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover,interactive-widget=resizes-content"/> | |
| 35 | + <?php | |
| 36 | + if (!empty($load_wp)) : | |
| 37 | + wp_head(); | |
| 38 | + else: | |
| 39 | + ?> | |
| 40 | + <meta name="mobile-web-app-capable" content="yes"> | |
| 41 | + <meta name="robots" content="noindex"> | |
| 42 | + <link rel="icon" type="image/x-icon" href="<?php echo esc_url(get_site_icon_url()); ?>"/> | |
| 43 | + <meta property="og:type" content="website"> | |
| 44 | + <meta property="og:url" content="<?php echo esc_url($fluentCommunityUrl); ?>"> | |
| 45 | + <meta property="og:site_name" content="<?php bloginfo('name'); ?>"> | |
| 46 | + <meta property="og:title" content="<?php echo esc_attr($fluentCommunityOgTitle); ?>"> | |
| 47 | + <meta property="og:description" content="<?php echo esc_attr($fluentCommunityDescription); ?>"> | |
| 48 | + <?php endif; ?> | |
| 19 | 49 | |
| 20 | - <meta name="viewport" | |
| 21 | - content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover"/> | |
| 22 | - <meta name="mobile-web-app-capable" content="yes"> | |
| 23 | - <meta name="description" content="<?php echo esc_attr($description); ?>"> | |
| 24 | - <meta name="robots" content="noindex"> | |
| 25 | - <link rel="icon" type="image/x-icon" href="<?php echo esc_url(get_site_icon_url()); ?>"/> | |
| 50 | + <?php if ($fluentCommunityFeaturedImage): ?> | |
| 51 | + <meta property="og:image" content="<?php echo esc_url($fluentCommunityFeaturedImage); ?>"/> | |
| 52 | + <?php endif; ?> | |
| 26 | 53 | |
| 27 | - <meta property="og:type" content="website"> | |
| 28 | - <meta property="og:url" content="<?php echo esc_url($url); ?>"> | |
| 29 | - <meta property="og:site_name" content="<?php bloginfo('name'); ?>"> | |
| 30 | - <meta property="og:description" content="<?php echo esc_attr($description); ?>"> | |
| 31 | - | |
| 32 | - <?php if ($featured_image): ?> | |
| 33 | - <meta property="og:image" content="<?php echo esc_url($featured_image); ?>"/> | |
| 34 | - <?php endif; ?> | |
| 35 | 54 | <style> |
| 36 | 55 | .fluent_com, .fcom_full_layout { |
| 37 | 56 | display: block; |
| 38 | 57 | width: 100%; |
| @@ -38,63 +57,64 @@ | ||
| 38 | 57 | width: 100%; |
| 39 | 58 | } |
| 40 | 59 | </style> |
| 41 | 60 | |
| 42 | - <?php foreach ($css_files as $css_file): ?> | |
| 43 | - <link rel="stylesheet" | |
| 44 | - href="<?php echo esc_url($css_file); ?>?version=<?php echo esc_attr(FLUENT_COMMUNITY_PLUGIN_VERSION); ?>" | |
| 45 | - media="screen"/> | |
| 61 | + <?php do_action('fluent_community/headless/head_early', $fluentCommunityScope); ?> | |
| 62 | + | |
| 63 | + <?php foreach ($fluentCommunityCssFiles as $fluentCommunityCssFile): ?> | |
| 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 ?> | |
| 46 | 65 | <?php endforeach; ?> |
| 47 | - <?php do_action('fluent_community/headless/head', $scope); ?> | |
| 66 | + <?php do_action('fluent_community/headless/head', $fluentCommunityScope); ?> | |
| 48 | 67 | </head> |
| 49 | -<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); ?>"> | |
| 50 | 69 | |
| 51 | -<?php if ($layout == 'signup'): ?> | |
| 52 | - <div class="fcom_full_layout"> | |
| 53 | - <div class="fcom_layout_side"> | |
| 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'; ?>"> | |
| 72 | + <div class="fcom_layout_side" | |
| 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'; ?>"> | |
| 54 | 76 | <div class="fcom_welcome"> |
| 55 | - <?php if($logo = \FluentCommunity\Framework\Support\Arr::get($portal, 'logo')): ?> | |
| 56 | - <div class="fcom_logo"> | |
| 57 | - <a href="<?php echo esc_url(\FluentCommunity\App\Services\Helper::baseUrl()); ?>"> | |
| 58 | - <img src="<?php echo esc_url($logo); ?>" alt="Site logo"> | |
| 59 | - </a> | |
| 60 | - </div> | |
| 77 | + <?php if (!empty($fluentCommunityPortal['logo'])): ?> | |
| 78 | + <div class="fcom_logo"> | |
| 79 | + <a href="<?php echo esc_url(\FluentCommunity\App\Services\Helper::baseUrl()); ?>"> | |
| 80 | + <img src="<?php echo esc_url($fluentCommunityPortal['logo']); ?>" alt="<?php echo esc_attr__('Site logo', 'fluent-community'); ?>"> | |
| 81 | + </a> | |
| 82 | + </div> | |
| 61 | 83 | <?php endif; ?> |
| 62 | - <h2 class="fcom_title"> | |
| 63 | - <?php echo wp_kses_post(\FluentCommunity\Framework\Support\Arr::get($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']); ?> | |
| 64 | 86 | </h2> |
| 65 | - <div class="fcom_sub_title"> | |
| 66 | - <?php echo wp_kses_post(wp_kses_post(\FluentCommunity\Framework\Support\Arr::get($portal, 'description'))); ?> | |
| 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> | |
| 67 | 89 | </div> |
| 68 | 90 | </div> |
| 69 | 91 | </div> |
| 70 | - <div class="fcom_layout_main"> | |
| 71 | - <div class="fluent_com"> | |
| 72 | - <?php do_action('fluent_community/headless/content', $scope); ?> | |
| 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; ?>"> | |
| 93 | + <div class="fluent_com fluent_com_auth"> | |
| 94 | + <?php do_action('fluent_community/headless/content', $fluentCommunityScope); ?> | |
| 73 | 95 | </div> |
| 74 | 96 | </div> |
| 75 | 97 | </div> |
| 76 | 98 | <?php else: ?> |
| 77 | - | |
| 78 | 99 | <div class="fluent_com"> |
| 79 | - <?php do_action('fluent_community/headless/content', $scope); ?> | |
| 100 | + <?php do_action('fluent_community/headless/content', $fluentCommunityScope); ?> | |
| 80 | 101 | </div> |
| 81 | - | |
| 82 | 102 | <?php endif; ?> |
| 83 | 103 | |
| 84 | 104 | <script> |
| 85 | - <?php foreach ($js_vars as $varKey => $values): ?> | |
| 86 | - var <?php echo esc_attr($varKey); ?> = <?php echo wp_json_encode($values); // 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 ?>; | |
| 87 | 107 | <?php endforeach; ?> |
| 88 | 108 | </script> |
| 89 | 109 | |
| 90 | -<?php do_action('fluent_community/headless/before_js_loaded', $scope); ?> | |
| 110 | +<?php do_action('fluent_community/headless/before_js_loaded', $fluentCommunityScope); ?> | |
| 91 | 111 | |
| 92 | -<?php foreach ($js_files as $file): ?> | |
| 93 | - <script type="module" | |
| 94 | - src="<?php echo esc_url($file); ?>?version=<?php echo esc_attr(FLUENT_COMMUNITY_PLUGIN_VERSION); ?>" | |
| 95 | - defer="defer"></script> | |
| 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 ?> | |
| 96 | 114 | <?php endforeach; ?> |
| 97 | 115 | |
| 98 | -<?php do_action('fluent_community/headless/footer', $scope); ?> | |
| 116 | +<?php if (!empty($load_wp)) { wp_footer(); } ?> | |
| 117 | + | |
| 118 | +<?php do_action('fluent_community/headless/footer', $fluentCommunityScope); ?> | |
| 99 | 119 | </body> |
| 100 | 120 | </html> |