[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/templates/cassiopeia/ -> error.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\Language\Text;
  16  use Joomla\CMS\Uri\Uri;
  17  
  18  /** @var Joomla\CMS\Document\ErrorDocument $this */
  19  
  20  $app = Factory::getApplication();
  21  $wa  = $this->getWebAssetManager();
  22  
  23  // Detecting Active Variables
  24  $option   = $app->input->getCmd('option', '');
  25  $view     = $app->input->getCmd('view', '');
  26  $layout   = $app->input->getCmd('layout', '');
  27  $task     = $app->input->getCmd('task', '');
  28  $itemid   = $app->input->getCmd('Itemid', '');
  29  $sitename = htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8');
  30  $menu     = $app->getMenu()->getActive();
  31  $pageclass = $menu !== null ? $menu->getParams()->get('pageclass_sfx', '') : '';
  32  
  33  // Template path
  34  $templatePath = 'media/templates/site/cassiopeia';
  35  
  36  // Color Theme
  37  $paramsColorName = $this->params->get('colorName', 'colors_standard');
  38  $assetColorName  = 'theme.' . $paramsColorName;
  39  $wa->registerAndUseStyle($assetColorName, $templatePath . '/css/global/' . $paramsColorName . '.css');
  40  
  41  // Use a font scheme if set in the template style options
  42  $paramsFontScheme = $this->params->get('useFontScheme', false);
  43  $fontStyles       = '';
  44  
  45  if ($paramsFontScheme) {
  46      if (stripos($paramsFontScheme, 'https://') === 0) {
  47          $this->getPreloadManager()->preconnect('https://fonts.googleapis.com/', ['crossorigin' => 'anonymous']);
  48          $this->getPreloadManager()->preconnect('https://fonts.gstatic.com/', ['crossorigin' => 'anonymous']);
  49          $this->getPreloadManager()->preload($paramsFontScheme, ['as' => 'style', 'crossorigin' => 'anonymous']);
  50          $wa->registerAndUseStyle('fontscheme.current', $paramsFontScheme, [], ['media' => 'print', 'rel' => 'lazy-stylesheet', 'onload' => 'this.media=\'all\'', 'crossorigin' => 'anonymous']);
  51  
  52          if (preg_match_all('/family=([^?:]*):/i', $paramsFontScheme, $matches) > 0) {
  53              $fontStyles = '--cassiopeia-font-family-body: "' . str_replace('+', ' ', $matches[1][0]) . '", sans-serif;
  54              --cassiopeia-font-family-headings: "' . str_replace('+', ' ', isset($matches[1][1]) ? $matches[1][1] : $matches[1][0]) . '", sans-serif;
  55              --cassiopeia-font-weight-normal: 400;
  56              --cassiopeia-font-weight-headings: 700;';
  57          }
  58      } else {
  59          $wa->registerAndUseStyle('fontscheme.current', $paramsFontScheme, ['version' => 'auto'], ['media' => 'print', 'rel' => 'lazy-stylesheet', 'onload' => 'this.media=\'all\'']);
  60          $this->getPreloadManager()->preload($wa->getAsset('style', 'fontscheme.current')->getUri() . '?' . $this->getMediaVersion(), ['as' => 'style']);
  61      }
  62  }
  63  
  64  // Enable assets
  65  $wa->usePreset('template.cassiopeia.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr'))
  66      ->useStyle('template.active.language')
  67      ->useStyle('template.user')
  68      ->useScript('template.user')
  69      ->addInlineStyle(":root {
  70          --hue: 214;
  71          --template-bg-light: #f0f4fb;
  72          --template-text-dark: #495057;
  73          --template-text-light: #ffffff;
  74          --template-link-color: #2a69b8;
  75          --template-special-color: #001B4C;
  76          $fontStyles
  77      }");
  78  
  79  // Override 'template.active' asset to set correct ltr/rtl dependency
  80  $wa->registerStyle('template.active', '', [], [], ['template.cassiopeia.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr')]);
  81  
  82  // Browsers support SVG favicons
  83  $this->addHeadLink(HTMLHelper::_('image', 'joomla-favicon.svg', '', [], true, 1), 'icon', 'rel', ['type' => 'image/svg+xml']);
  84  $this->addHeadLink(HTMLHelper::_('image', 'favicon.ico', '', [], true, 1), 'alternate icon', 'rel', ['type' => 'image/vnd.microsoft.icon']);
  85  $this->addHeadLink(HTMLHelper::_('image', 'joomla-favicon-pinned.svg', '', [], true, 1), 'mask-icon', 'rel', ['color' => '#000']);
  86  
  87  // Logo file or site title param
  88  if ($this->params->get('logoFile')) {
  89      $logo = '<img src="' . htmlspecialchars(Uri::root() . $this->params->get('logoFile'), ENT_QUOTES, 'UTF-8') . '" alt="' . $sitename . '">';
  90  } elseif ($this->params->get('siteTitle')) {
  91      $logo = '<span title="' . $sitename . '">' . htmlspecialchars($this->params->get('siteTitle'), ENT_COMPAT, 'UTF-8') . '</span>';
  92  } else {
  93      $logo = HTMLHelper::_('image', 'logo.svg', $sitename, ['class' => 'logo d-inline-block'], true, 0);
  94  }
  95  
  96  // Container
  97  $wrapper = $this->params->get('fluidContainer') ? 'wrapper-fluid' : 'wrapper-static';
  98  
  99  $this->setMetaData('viewport', 'width=device-width, initial-scale=1');
 100  
 101  // Defer font awesome
 102  $wa->getAsset('style', 'fontawesome')->setAttribute('rel', 'lazy-stylesheet');
 103  ?>
 104  <!DOCTYPE html>
 105  <html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
 106  <head>
 107      <jdoc:include type="metas" />
 108      <jdoc:include type="styles" />
 109      <jdoc:include type="scripts" />
 110  </head>
 111  
 112  <body class="site error_site <?php echo $option
 113      . ' ' . $wrapper
 114      . ' view-' . $view
 115      . ($layout ? ' layout-' . $layout : ' no-layout')
 116      . ($task ? ' task-' . $task : ' no-task')
 117      . ($itemid ? ' itemid-' . $itemid : '')
 118      . ' ' . $pageclass;
 119      echo ($this->direction == 'rtl' ? ' rtl' : '');
 120  ?>">
 121      <header class="header container-header full-width">
 122          <?php if ($this->params->get('brand', 1)) : ?>
 123              <div class="grid-child">
 124                  <div class="navbar-brand">
 125                      <a class="brand-logo" href="<?php echo $this->baseurl; ?>/">
 126                          <?php echo $logo; ?>
 127                      </a>
 128                      <?php if ($this->params->get('siteDescription')) : ?>
 129                          <div class="site-description"><?php echo htmlspecialchars($this->params->get('siteDescription')); ?></div>
 130                      <?php endif; ?>
 131                  </div>
 132              </div>
 133          <?php endif; ?>
 134          <?php if ($this->countModules('menu') || $this->countModules('search')) : ?>
 135              <div class="grid-child container-nav">
 136                  <?php if ($this->countModules('menu')) : ?>
 137                      <jdoc:include type="modules" name="menu" style="none" />
 138                  <?php endif; ?>
 139                  <?php if ($this->countModules('search')) : ?>
 140                      <div class="container-search">
 141                          <jdoc:include type="modules" name="search" style="none" />
 142                      </div>
 143                  <?php endif; ?>
 144              </div>
 145          <?php endif; ?>
 146      </header>
 147  
 148      <div class="site-grid">
 149          <div class="grid-child container-component">
 150              <h1 class="page-header"><?php echo Text::_('JERROR_LAYOUT_PAGE_NOT_FOUND'); ?></h1>
 151              <div class="card">
 152                  <div class="card-body">
 153                      <jdoc:include type="message" />
 154                      <p><strong><?php echo Text::_('JERROR_LAYOUT_ERROR_HAS_OCCURRED_WHILE_PROCESSING_YOUR_REQUEST'); ?></strong></p>
 155                      <p><?php echo Text::_('JERROR_LAYOUT_NOT_ABLE_TO_VISIT'); ?></p>
 156                      <ul>
 157                          <li><?php echo Text::_('JERROR_LAYOUT_AN_OUT_OF_DATE_BOOKMARK_FAVOURITE'); ?></li>
 158                          <li><?php echo Text::_('JERROR_LAYOUT_MIS_TYPED_ADDRESS'); ?></li>
 159                          <li><?php echo Text::_('JERROR_LAYOUT_SEARCH_ENGINE_OUT_OF_DATE_LISTING'); ?></li>
 160                          <li><?php echo Text::_('JERROR_LAYOUT_YOU_HAVE_NO_ACCESS_TO_THIS_PAGE'); ?></li>
 161                      </ul>
 162                      <p><?php echo Text::_('JERROR_LAYOUT_GO_TO_THE_HOME_PAGE'); ?></p>
 163                      <p><a href="<?php echo $this->baseurl; ?>/index.php" class="btn btn-secondary"><span class="icon-home" aria-hidden="true"></span> <?php echo Text::_('JERROR_LAYOUT_HOME_PAGE'); ?></a></p>
 164                      <hr>
 165                      <p><?php echo Text::_('JERROR_LAYOUT_PLEASE_CONTACT_THE_SYSTEM_ADMINISTRATOR'); ?></p>
 166                      <blockquote>
 167                          <span class="badge bg-secondary"><?php echo $this->error->getCode(); ?></span> <?php echo htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8'); ?>
 168                      </blockquote>
 169                      <?php if ($this->debug) : ?>
 170                          <div>
 171                              <?php echo $this->renderBacktrace(); ?>
 172                              <?php // Check if there are more Exceptions and render their data as well ?>
 173                              <?php if ($this->error->getPrevious()) : ?>
 174                                  <?php $loop = true; ?>
 175                                  <?php // Reference $this->_error here and in the loop as setError() assigns errors to this property and we need this for the backtrace to work correctly ?>
 176                                  <?php // Make the first assignment to setError() outside the loop so the loop does not skip Exceptions ?>
 177                                  <?php $this->setError($this->_error->getPrevious()); ?>
 178                                  <?php while ($loop === true) : ?>
 179                                      <p><strong><?php echo Text::_('JERROR_LAYOUT_PREVIOUS_ERROR'); ?></strong></p>
 180                                      <p><?php echo htmlspecialchars($this->_error->getMessage(), ENT_QUOTES, 'UTF-8'); ?></p>
 181                                      <?php echo $this->renderBacktrace(); ?>
 182                                      <?php $loop = $this->setError($this->_error->getPrevious()); ?>
 183                                  <?php endwhile; ?>
 184                                  <?php // Reset the main error object to the base error ?>
 185                                  <?php $this->setError($this->error); ?>
 186                              <?php endif; ?>
 187                          </div>
 188                      <?php endif; ?>
 189                  </div>
 190              </div>
 191          </div>
 192      </div>
 193      <?php if ($this->countModules('footer')) : ?>
 194      <footer class="container-footer footer full-width">
 195          <div class="grid-child">
 196              <jdoc:include type="modules" name="footer" style="none" />
 197          </div>
 198      </footer>
 199      <?php endif; ?>
 200  
 201      <jdoc:include type="modules" name="debug" style="none" />
 202  </body>
 203  </html>


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