Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/theme/classic/classic.php - 140 lines - 3776 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*
   4  $HeadURL: https://textpattern.googlecode.com/svn/releases/4.5.4/source/textpattern/theme/classic/classic.php $
   5  $LastChangedRevision: 4055 $
   6  */
   7  
   8  if (!defined('txpinterface')) die('txpinterface is undefined.');
   9  
  10  class classic_theme extends theme
  11  {
  12  	function html_head()
  13      {
  14          return '<link type="text/css" href="'.$this->url.'textpattern.css" rel="stylesheet" />'.n;
  15      }
  16  
  17  	function header()
  18      {
  19          $out[] = '<div id="masthead">'.
  20              n.'<div id="navpop">'.n.navPop(1).n.'</div>'.
  21              n.'<h1 id="branding">Textpattern</h1>'.
  22              n.'</div>';
  23  
  24          if (!$this->is_popup)
  25          {
  26              $out[] = '<div id="nav-primary" class="nav-tabs">'.
  27                  n.'<ul>';
  28  
  29              $secondary = '';
  30              foreach ($this->menu as $tab)
  31              {
  32                  $tc = ($tab['active']) ? 'tabup' : 'tabdown';
  33                  $out[] = '<li><a class="'.$tc.'" href="?event='.$tab["event"].'">'.$tab["label"].'</a></li>';
  34  
  35                  if ($tab['active'] && !empty($tab['items']))
  36                  {
  37                      $secondary = '<div id="nav-secondary" class="nav-tabs">'.
  38                          n.'<ul>';
  39                      foreach ($tab['items'] as $item)
  40                      {
  41                          $tc = ($item['active']) ? 'tabup' : 'tabdown';
  42                          $secondary .= n.'<li><a class="'.$tc.'" href="?event='.$item['event'].'">'.$item['label'].'</a></li>';
  43                      }
  44                      $secondary .= n.'</ul>'.
  45                          n.'</div>';
  46                  }
  47              }
  48              $out[] = '<li id="view-site"><a class="tabdown" href="'.hu.'" target="_blank">'.gTxt('tab_view_site').'</a></li>';
  49              $out[] = '</ul>';
  50              $out[] = '</div>';
  51              $out[] = $secondary;
  52          }
  53          $out[] = '<div id="messagepane">'.$this->announce($this->message).'</div>'.n;
  54          return join(n, $out);
  55      }
  56  
  57  	function footer()
  58      {
  59          global $txp_user;
  60  
  61          $out[] = '<a id="mothership" href="http://textpattern.com/" title="'.gTxt('go_txp_com').'" rel="external"><img src="'.$this->url.'carver.png" width="40" height="40" alt="Textpattern" /></a>'.n.
  62              graf('Textpattern CMS &#183; '.txp_version);
  63  
  64          if ($txp_user)
  65          {
  66              $out[] = graf(gTxt('logged_in_as').' '.span(txpspecialchars($txp_user)).br.
  67                  '<a href="index.php?logout=1">'.gTxt('logout').'</a>', ' id="moniker"');
  68          }
  69  
  70          return join(n, $out);;
  71      }
  72  
  73  	function announce($thing=array('', 0), $modal = false)
  74      {
  75          return $this->_announce($thing, false, $modal);
  76      }
  77  
  78  	function announce_async($thing=array('', 0), $modal = false)
  79      {
  80          return $this->_announce($thing, true, $modal);
  81      }
  82  
  83  	private function _announce($thing, $async, $modal)
  84      {
  85          // $thing[0]: message text
  86          // $thing[1]: message type, defaults to "success" unless empty or a different flag is set
  87  
  88          if (!is_array($thing) || !isset($thing[1]))    {
  89              $thing = array($thing, 0);
  90          }
  91  
  92          // still nothing to say?
  93          if (trim($thing[0]) === '') return '';
  94  
  95          switch ($thing[1]) {
  96              case E_ERROR:
  97                  $class = 'error';
  98                  break;
  99              case E_WARNING:
 100                  $class = 'warning';
 101                  break;
 102              default:
 103                  $class = 'success';
 104                  break;
 105          }
 106  
 107          if ($modal) {
 108              $html = ''; // TODO: Say what?
 109              $js = 'window.alert("'.escape_js(strip_tags($thing[0])).'")';
 110          } else {
 111              $html = '<span id="message" class="'.$class.'">'.gTxt($thing[0]).' <a href="#close" class="close">&times;</a></span>';
 112              // Try to inject $html into the message pane no matter when _announce()'s output is printed
 113              $js = escape_js($html);
 114              $js = <<< EOS
 115                  $(document).ready(function() {
 116                      $("#messagepane").html("{$js}");
 117                      $('#message.success, #message.warning, #message.error').fadeOut('fast').fadeIn('fast');
 118                  });
 119  EOS;
 120          }
 121          if ($async) {
 122              return $js;
 123          } else {
 124              return script_js(str_replace('</', '<\/', $js), $html);
 125          }
 126      }
 127  
 128  	function manifest()
 129      {
 130          global $prefs;
 131          return array(
 132              'author'      => 'Team Textpattern',
 133              'author_uri'  => 'http://textpattern.com/',
 134              'version'     => $prefs['version'],
 135              'description' => 'Textpattern Classic Theme',
 136              'help'        => 'http://textpattern.com/admin-theme-help',
 137          );
 138      }
 139  }
 140  ?>

title

Description

title

Description

title

Description

title

title

Body