[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/templates/cassiopeia/ -> offline.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Templates.cassiopeia
   6   *
   7   * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  use Joomla\CMS\Helper\AuthenticationHelper;
  16  use Joomla\CMS\Language\Text;
  17  use Joomla\CMS\Router\Route;
  18  use Joomla\CMS\Uri\Uri;
  19  
  20  /** @var Joomla\CMS\Document\HtmlDocument $this */
  21  
  22  $extraButtons     = AuthenticationHelper::getLoginButtons('form-login');
  23  $app              = Factory::getApplication();
  24  $wa               = $this->getWebAssetManager();
  25  
  26  $fullWidth = 1;
  27  
  28  // Template path
  29  $templatePath = 'media/templates/site/cassiopeia';
  30  
  31  // Color Theme
  32  $paramsColorName = $this->params->get('colorName', 'colors_standard');
  33  $assetColorName  = 'theme.' . $paramsColorName;
  34  $wa->registerAndUseStyle($assetColorName, $templatePath . '/css/global/' . $paramsColorName . '.css');
  35  
  36  // Use a font scheme if set in the template style options
  37  $paramsFontScheme = $this->params->get('useFontScheme', false);
  38  $fontStyles       = '';
  39  
  40  if ($paramsFontScheme) {
  41      if (stripos($paramsFontScheme, 'https://') === 0) {
  42          $this->getPreloadManager()->preconnect('https://fonts.googleapis.com/', ['crossorigin' => 'anonymous']);
  43          $this->getPreloadManager()->preconnect('https://fonts.gstatic.com/', ['crossorigin' => 'anonymous']);
  44          $this->getPreloadManager()->preload($paramsFontScheme, ['as' => 'style', 'crossorigin' => 'anonymous']);
  45          $wa->registerAndUseStyle('fontscheme.current', $paramsFontScheme, [], ['media' => 'print', 'rel' => 'lazy-stylesheet', 'onload' => 'this.media=\'all\'', 'crossorigin' => 'anonymous']);
  46  
  47          if (preg_match_all('/family=([^?:]*):/i', $paramsFontScheme, $matches) > 0) {
  48              $fontStyles = '--cassiopeia-font-family-body: "' . str_replace('+', ' ', $matches[1][0]) . '", sans-serif;
  49              --cassiopeia-font-family-headings: "' . str_replace('+', ' ', isset($matches[1][1]) ? $matches[1][1] : $matches[1][0]) . '", sans-serif;
  50              --cassiopeia-font-weight-normal: 400;
  51              --cassiopeia-font-weight-headings: 700;';
  52          }
  53      } else {
  54          $wa->registerAndUseStyle('fontscheme.current', $paramsFontScheme, ['version' => 'auto'], ['media' => 'print', 'rel' => 'lazy-stylesheet', 'onload' => 'this.media=\'all\'']);
  55          $this->getPreloadManager()->preload($wa->getAsset('style', 'fontscheme.current')->getUri() . '?' . $this->getMediaVersion(), ['as' => 'style']);
  56      }
  57  }
  58  
  59  // Enable assets
  60  $wa->usePreset('template.cassiopeia.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr'))
  61      ->useStyle('template.active.language')
  62      ->useStyle('template.offline')
  63      ->useStyle('template.user')
  64      ->useScript('template.user')
  65      ->addInlineStyle(":root {
  66          --hue: 214;
  67          --template-bg-light: #f0f4fb;
  68          --template-text-dark: #495057;
  69          --template-text-light: #ffffff;
  70          --template-link-color: #2a69b8;
  71          --template-special-color: #001B4C;
  72          $fontStyles
  73      }");
  74  
  75  // Override 'template.active' asset to set correct ltr/rtl dependency
  76  $wa->registerStyle('template.active', '', [], [], ['template.cassiopeia.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr')]);
  77  
  78  // Logo file or site title param
  79  $sitename = htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8');
  80  
  81  // Browsers support SVG favicons
  82  $this->addHeadLink(HTMLHelper::_('image', 'joomla-favicon.svg', '', [], true, 1), 'icon', 'rel', ['type' => 'image/svg+xml']);
  83  $this->addHeadLink(HTMLHelper::_('image', 'favicon.ico', '', [], true, 1), 'alternate icon', 'rel', ['type' => 'image/vnd.microsoft.icon']);
  84  $this->addHeadLink(HTMLHelper::_('image', 'joomla-favicon-pinned.svg', '', [], true, 1), 'mask-icon', 'rel', ['color' => '#000']);
  85  
  86  if ($this->params->get('logoFile')) {
  87      $logo = '<img src="' . htmlspecialchars(Uri::root() . $this->params->get('logoFile'), ENT_QUOTES, 'UTF-8') . '" alt="' . $sitename . '">';
  88  } elseif ($this->params->get('siteTitle')) {
  89      $logo = '<span title="' . $sitename . '">' . htmlspecialchars($this->params->get('siteTitle'), ENT_COMPAT, 'UTF-8') . '</span>';
  90  } else {
  91      $logo = '<img src="' . $templatePath . '/images/logo.svg" class="logo d-inline-block" alt="' . $sitename . '">';
  92  }
  93  
  94  // Defer font awesome
  95  $wa->getAsset('style', 'fontawesome')->setAttribute('rel', 'lazy-stylesheet');
  96  ?>
  97  <!DOCTYPE html>
  98  <html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
  99  <head>
 100      <jdoc:include type="metas" />
 101      <meta name="viewport" content="width=device-width, initial-scale=1.0">
 102      <jdoc:include type="styles" />
 103      <jdoc:include type="scripts" />
 104  </head>
 105  <body class="site">
 106      <div class="outer">
 107          <div class="offline-card">
 108              <div class="header">
 109              <?php if (!empty($logo)) : ?>
 110                  <h1><?php echo $logo; ?></h1>
 111              <?php else : ?>
 112                  <h1><?php echo $sitename; ?></h1>
 113              <?php endif; ?>
 114              <?php if ($app->get('offline_image')) : ?>
 115                  <?php echo HTMLHelper::_('image', $app->get('offline_image'), $sitename, [], false, 0); ?>
 116              <?php endif; ?>
 117              <?php if ($app->get('display_offline_message', 1) == 1 && str_replace(' ', '', $app->get('offline_message')) != '') : ?>
 118                  <p><?php echo $app->get('offline_message'); ?></p>
 119              <?php elseif ($app->get('display_offline_message', 1) == 2) : ?>
 120                  <p><?php echo Text::_('JOFFLINE_MESSAGE'); ?></p>
 121              <?php endif; ?>
 122              <div class="logo-icon">
 123                  <svg version="1.1" xmlns="https://www.w3.org/2000/svg" x="0px" y="0px"
 124                       viewBox="0 0 74.8 74.8" enable-background="new 0 0 74.8 74.8" xml:space="preserve">
 125                      <g id="brandmark">
 126                          <path id="j-green" fill="#1C3D5C" d="M13.5,37.7L12,36.3c-4.5-4.5-5.8-10.8-4.2-16.5c-4.5-1-7.8-5-7.8-9.8c0-5.5,4.5-10,10-10 c5,0,9.1,3.6,9.9,8.4c5.4-1.3,11.3,0.2,15.5,4.4l0.6,0.6l-7.4,7.4l-0.6-0.6c-2.4-2.4-6.3-2.4-8.7,0c-2.4,2.4-2.4,6.3,0,8.7l1.4,1.4 l7.4,7.4l7.8,7.8l-7.4,7.4l-7.8-7.8L13.5,37.7L13.5,37.7z"/>
 127                          <path id="j-orange" fill="#1C3D5C" d="M21.8,29.5l7.8-7.8l7.4-7.4l1.4-1.4C42.9,8.4,49.2,7,54.8,8.6C55.5,3.8,59.7,0,64.8,0 c5.5,0,10,4.5,10,10c0,5.1-3.8,9.3-8.7,9.9c1.6,5.6,0.2,11.9-4.2,16.3l-0.6,0.6l-7.4-7.4l0.6-0.6c2.4-2.4,2.4-6.3,0-8.7 c-2.4-2.4-6.3-2.4-8.7,0l-1.4,1.4L37,29l-7.8,7.8L21.8,29.5L21.8,29.5z"/>
 128                          <path id="j-red" fill="#1C3D5C" d="M55,66.8c-5.7,1.7-12.1,0.4-16.6-4.1l-0.6-0.6l7.4-7.4l0.6,0.6c2.4,2.4,6.3,2.4,8.7,0 c2.4-2.4,2.4-6.3,0-8.7L53,45.1l-7.4-7.4l-7.8-7.8l7.4-7.4l7.8,7.8l7.4,7.4l1.5,1.5c4.2,4.2,5.7,10.2,4.4,15.7 c4.9,0.7,8.6,4.9,8.6,9.9c0,5.5-4.5,10-10,10C60,74.8,56,71.3,55,66.8L55,66.8z"/>
 129                          <path id="j-blue" fill="#1C3D5C" d="M52.2,46l-7.8,7.8L37,61.2l-1.4,1.4c-4.3,4.3-10.3,5.7-15.7,4.4c-1,4.5-5,7.8-9.8,7.8 c-5.5,0-10-4.5-10-10C0,60,3.3,56.1,7.7,55C6.3,49.5,7.8,43.5,12,39.2l0.6-0.6L20,46l-0.6,0.6c-2.4,2.4-2.4,6.3,0,8.7 c2.4,2.4,6.3,2.4,8.7,0l1.4-1.4l7.4-7.4l7.8-7.8L52.2,46L52.2,46z"/>
 130                      </g>
 131                  </svg>
 132              </div>
 133              </div>
 134              <div class="login">
 135                  <jdoc:include type="message" />
 136                  <form action="<?php echo Route::_('index.php', true); ?>" method="post" id="form-login">
 137                      <fieldset>
 138                          <label for="username"><?php echo Text::_('JGLOBAL_USERNAME'); ?></label>
 139                          <input name="username" class="form-control" id="username" type="text">
 140  
 141                          <label for="password"><?php echo Text::_('JGLOBAL_PASSWORD'); ?></label>
 142                          <input name="password" class="form-control" id="password" type="password">
 143  
 144                          <?php foreach ($extraButtons as $button) :
 145                              $dataAttributeKeys = array_filter(array_keys($button), function ($key) {
 146                                  return substr($key, 0, 5) == 'data-';
 147                              });
 148                              ?>
 149                              <div class="mod-login__submit form-group">
 150                                  <button type="button"
 151                                          class="btn btn-secondary w-100 mt-4 <?php echo $button['class'] ?? '' ?>"
 152                                  <?php foreach ($dataAttributeKeys as $key) : ?>
 153                                      <?php echo $key ?>="<?php echo $button[$key] ?>"
 154                                  <?php endforeach; ?>
 155                                  <?php if ($button['onclick']) : ?>
 156                                      onclick="<?php echo $button['onclick'] ?>"
 157                                  <?php endif; ?>
 158                                  title="<?php echo Text::_($button['label']) ?>"
 159                                  id="<?php echo $button['id'] ?>"
 160                                  >
 161                                  <?php if (!empty($button['icon'])) : ?>
 162                                      <span class="<?php echo $button['icon'] ?>"></span>
 163                                  <?php elseif (!empty($button['image'])) : ?>
 164                                      <?php echo $button['image']; ?>
 165                                  <?php elseif (!empty($button['svg'])) : ?>
 166                                      <?php echo $button['svg']; ?>
 167                                  <?php endif; ?>
 168                                  <?php echo Text::_($button['label']) ?>
 169                                  </button>
 170                              </div>
 171                          <?php endforeach; ?>
 172  
 173                          <button type="submit" name="Submit" class="btn btn-primary"><?php echo Text::_('JLOGIN'); ?></button>
 174  
 175                          <input type="hidden" name="option" value="com_users">
 176                          <input type="hidden" name="task" value="user.login">
 177                          <input type="hidden" name="return" value="<?php echo base64_encode(Uri::base()); ?>">
 178                          <?php echo HTMLHelper::_('form.token'); ?>
 179                      </fieldset>
 180                  </form>
 181              </div>
 182          </div>
 183      </div>
 184  </body>
 185  </html>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer