Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/admin-themes/hive/hive.php - 138 lines - 5671 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*
   4   * Textpattern Content Management System
   5   * https://textpattern.com/
   6   *
   7   * Copyright (C) 2020 The Textpattern Development Team
   8   *
   9   * This file is part of Textpattern.
  10   *
  11   * Textpattern is free software; you can redistribute it and/or
  12   * modify it under the terms of the GNU General Public License
  13   * as published by the Free Software Foundation, version 2.
  14   *
  15   * Textpattern is distributed in the hope that it will be useful,
  16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18   * GNU General Public License for more details.
  19   *
  20   * You should have received a copy of the GNU General Public License
  21   * along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
  22   */
  23  
  24  if (!defined('txpinterface')) {
  25      die('txpinterface is undefined.');
  26  }
  27  
  28  class hive_theme extends \Textpattern\Admin\Theme
  29  {
  30      function html_head()
  31      {
  32          $out[] = '<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">';
  33          $out[] = '<link rel="stylesheet" href="'.$this->url.'assets/css/textpattern.css">';
  34          $out[] = '<link rel="icon" href="'.$this->url.'assets/img/favicon.ico">';
  35          $out[] = '<meta name="color-scheme" content="dark light">';
  36          $out[] = '<meta name="generator" content="Textpattern CMS">';
  37          $out[] = '<script defer src="'.$this->url.'assets/js/main.js"></script>'.n;
  38  
  39          if (!defined('no_autosize')) {
  40              $out[] = '<script defer src="'.$this->url.'assets/js/autosize.js"></script>'.n;
  41          }
  42  
  43          return join(n, $out);
  44      }
  45  
  46      function header()
  47      {
  48          $out[] = '<script src="'.$this->url.'assets/js/darkmode.js"></script>'.n;
  49  
  50          global $txp_user;
  51  
  52          $default_event = get_pref('default_event');
  53          $homelink = span('Textpattern');
  54  
  55          if (!empty($default_event) && has_privs($default_event)) {
  56              $homelink = href($homelink, array('event' => $default_event));
  57          }
  58  
  59          $out[] = hed($homelink, 1);
  60  
  61          if ($txp_user) {
  62              $out[] = '<button class="txp-nav-toggle collapsed" type="button" data-toggle="collapse" data-target="#txp-nav" aria-expanded="false" aria-controls="txp-nav"><span class="txp-accessibility">'.gTxt('navigation').'</span></button>';
  63              $out[] = '<nav class="txp-nav" id="txp-nav" aria-label="'.gTxt('navigation').'">';
  64              $out[] = '<ul class="data-dropdown">';
  65              $txpnavdrop = 0;
  66  
  67              foreach ($this->menu as $tab) {
  68                  $txpnavdrop++;
  69                  $class = ($tab['active']) ? ' selected' : '';
  70                  $out[] = '<li class="dropdown'.$class.'">'.
  71                      n.href($tab['label'], '#',
  72                      ' class="dropdown-toggle" id="txp-nav-drop'.$txpnavdrop.'" role="button" aria-controls="txp-nav-drop'.$txpnavdrop.'-menu" data-toggle="dropdown"');
  73  
  74                  if (!empty($tab['items'])) {
  75                      $out[] = '<ul class="dropdown-menu" id="txp-nav-drop'.$txpnavdrop.'-menu" role="menu" aria-labelledby="txp-nav-drop'.$txpnavdrop.'">';
  76  
  77                      foreach ($tab['items'] as $item) {
  78                          $class = ($item['active']) ? ' class="selected"' : '';
  79                          $ariacurrent = ($item['active']) ? ' aria-current="page"' : '';
  80                          $out[] = '<li'.$class.' role="presentation">'.
  81                              href($item['label'], array('event' => $item['event']), ' role="menuitem"'.$ariacurrent.' tabindex="-1"').
  82                              '</li>';
  83                      }
  84  
  85                      $out[] = '</ul>';
  86                  }
  87  
  88                  $out[] = '</li>';
  89              }
  90  
  91              $out[] = '</ul>';
  92              $out[] = '</nav>';
  93  
  94              if (get_pref('sitename')) {
  95                  $out[] = graf(
  96                      span(href(htmlspecialchars(get_pref('sitename')), hu, array(
  97                          'rel'        => 'noopener',
  98                          'target'     => '_blank',
  99                          'title'      => gTxt('tab_view_site'),
 100                          'aria-label' => gTxt('tab_view_site'),
 101                      )), array('class' => 'txp-view-site-name'))
 102                  , array('class' => 'txp-view-site'));
 103              } else {
 104                  $out[] = graf(
 105                      span(href(gTxt('tab_view_site'), hu, array(
 106                          'rel'        => 'noopener',
 107                          'target'     => '_blank',
 108                      )), array('class' => 'txp-view-site-name'))
 109                  , array('class' => 'txp-view-site'));
 110              }
 111  
 112              $out[] = graf(
 113                  href(span(gTxt('lightswitch'), array('class' => 'ui-icon ui-icon-lightbulb')), '#', array(
 114                      'id'         => 'lightswitch',
 115                      'title'      => gTxt('lightswitch'),
 116                      'aria-label' => gTxt('lightswitch'),
 117                  )), array('class' => 'txp-lightswitch'));
 118              $out[] = graf(
 119                  href(gTxt('logout'), 'index.php?logout=1', ' onclick="return verify(\''.gTxt('are_you_sure').'\')"'), array('class' => 'txp-logout'));
 120          }
 121  
 122          return join(n, $out);
 123      }
 124  
 125      function footer()
 126      {
 127          $out[] = graf(
 128              href('Textpattern CMS'.sp.span(gTxt('opens_external_link'), array('class' => 'ui-icon ui-icon-extlink')), 'https://textpattern.com/', array(
 129                  'rel'    => 'external noopener',
 130                  'target' => '_blank',
 131              )).
 132              ' (v'.txp_version.')', array('class' => 'mothership'));
 133  
 134          $out[] = graf(href(gTxt('back_to_top'), '#'), array('class' => 'pagejump'));
 135  
 136          return join(n, $out);
 137      }
 138  }

title

Description

title

Description

title

Description

title

title

Body