source view: _pagewrapper.php


<?php



  /*
   *
   * Optional argument: filename, page title; really this is ugly and needs to be refactored with named arguments
   *
   */
  function wrapPageTop ()
  {
    require 'headers.php';
?>
<!doctype html>
<?php

    global $nav_items, $page_color, $page_index, $post_title;
    require 'navigation.php';
    
    $extra_headings = array();
    $show_title     = false;
    
    if ( func_num_args() > 0 )
    {
      if ( func_get_arg( 0 ) != null )
      {
        $show_title = true;
        $page_index = getPageIndex( func_get_arg( 0 ), $nav_items );
        $page_color = $nav_items[$page_index]->getNavColor();
        $text_color = $nav_items[$page_index]->getNavFontColor();
      }
      else if ( $page_index >= 0 )
      {
        $page_title = $nav_items[$page_index]->getNavName();
        $page_color = $nav_items[$page_index]->getNavColor();
        $text_color = $nav_items[$page_index]->getNavFontColor();
      }
      
      if ( func_num_args() > 2 )
      {
        if ( is_string( func_get_arg( 2 ) ) )
        {
          $page_index = null;
          $page_color = func_get_arg( 2 );
          $text_color = '#fff';
        }
        else if ( is_array( func_get_arg( 2 ) ) )
        {
          $extra_headings = func_get_arg( 2 );
        }
      }
      
      $page_title = func_get_arg( 1 );
      if ( $page_title == null && isset( $post_title ) )
      {
        $show_title = false;
        $page_title = $nav_items[$page_index]->getNavName();
      }
    }
    else
    {
      $page_title = $nav_items[$page_index]->getNavName();
      $page_color = $nav_items[$page_index]->getNavColor();
      $text_color = $nav_items[$page_index]->getNavFontColor();
    }
    
?>
<html>
  <head>
    <link href="/blog.css"  rel="stylesheet" type="text/css" />
    <link href="/style.css" rel="stylesheet" type="text/css" />
    <link rel="apple-touch-icon" sizes="57x57" href="/favicons/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/favicons/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/favicons/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/favicons/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/favicons/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/favicons/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/favicons/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/favicons/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon-180x180.png">
    <link rel="icon" type="image/png" href="/favicons/favicon-32x32.png" sizes="32x32">
    <link rel="icon" type="image/png" href="/favicons/android-chrome-192x192.png" sizes="192x192">
    <link rel="icon" type="image/png" href="/favicons/favicon-96x96.png" sizes="96x96">
    <link rel="icon" type="image/png" href="/favicons/favicon-16x16.png" sizes="16x16">
    <link rel="manifest" href="/favicons/manifest.json">
    <link rel="shortcut icon" href="/favicons/favicon.ico">
    <meta name="msapplication-TileColor" content="#da532c">
    <meta name="msapplication-TileImage" content="/favicons/mstile-144x144.png">
    <meta name="msapplication-config" content="/favicons/browserconfig.xml">
    <meta name="theme-color" content="#ffffff">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta http-equiv="last-modified" content="<?php print date( 'r', filemtime( $_SERVER['SCRIPT_FILENAME'] ) ); ?>" />
    <meta name="viewport" content="width=device-width, user-scalable=no" />
<?php include 'title.reset.php';?>
    <script src="/v2/logo/jslogo.js" type="text/javascript"></script>
    <script src="/js/banner.js" type="text/javascript"></script>
    <title>kyle woodward :: <?php print isset( $post_title ) ? $post_title : $page_title; ?></title>
    <style type="text/css">
      div#linkbar-upper a
      {
        color: <?php print $text_color; ?>;
      }
    </style>
<?php

  foreach ( $extra_headings as $id => $heading )
  {
    print "\t\t$heading\n";
  }

?>
  </head>
  <body>
    <!-- main page content -->
    <div id="content_div">
      <!-- page header -->
      <div id="header_div" style="background-color:<?php print $page_color; ?>;color:<?php print $text_color; ?>;">
        <canvas id="logologo" style="height:50px;width:600px;position:relative;" height="50" width="600"></canvas>
<div id="linkbar-upper" style="background-color:<?php print $page_color; ?>;"><?php

  $has_printed = false;
  for ( $i = 0; $i < count( $nav_items ); ++$i )
  {
    $class_name = 'standard';
    if ( !$show_title && $i == $page_index )
    {
      $class_name = 'active';
    }

    $nav_item = $nav_items[$i];
    printf( '<div class="%s"><a href="/%s" target="_top" data:bgcolor="%s">%s</a></div>', $class_name, $nav_item->getNavURL(), $nav_item->getNavColor(), $nav_item->getNavName() );
  }

  if ( $show_title )
  {
    //printf( '<div class="active" style="position:absolute;bottom:0.25ex;padding:0px;"><a href="%s" target="_top" data:bgcolor="%s">%s</a></div>', $_SERVER['PHP_SELF'], $nav_items[$page_index]->getNavColor(), $page_title );
    printf( '<div class="active"><a href="%s" target="_top" data:bgcolor="%s">%s</a></div>', $_SERVER['PHP_SELF'], $nav_items[$page_index]->getNavColor(), $page_title );
  }

?>
<div id="spacer"></div></div></div><div id="content_actual">
<?php
  }



  function wrapPageBottom ()
  {
    global $nav_items, $page_color, $page_index;
    
?>
        <!-- footer -->
        <div id="footer_div">
<?php
          for ( $i = 0; $i < count($nav_items); ++$i ) {
?><div style="border-color:<?php print $nav_items[$i]->getNavColor();?>;"><a href="/<?php print $nav_items[$i]->getNavURL();?>" target="_top"><?php print $nav_items[$i]->getNavName();?></a></div><?php
          }
?>
          <br />
          <br />
          <span class="copyright">
            <?php include('copyright.php');?> | 
            <a href="/source.view.php?page=<?php print $_SERVER['PHP_SELF']; ?>" target="new">source</a>
          </span>
          <a href="http://profiles.google.com/108677732441037950707" rel="author" style="display:none;">Kyle Woodward</a>
        </div>
      </div>
    </div>
<?php
    


    include 'urchin.tracking.php';
    $carr = toRGB( $page_color );



?>
    <script type="text/javascript">
      installBanner( <?php print join( ',', $carr ); ?> );
      //window.addEventListener( 'load', function () { installBanner( <?php print join( ',', $carr ); ?> ); } );
    </script>
  </body>
<?php

    if ( func_num_args() > 0 && func_get_arg( 0 ) != null )
    {
      $post_scripts = func_get_arg( 0 );
      foreach ( $post_scripts as $id => $script )
      {
        print "\t$script\n";
      }
    }

?>
</html>
<?php
  }
  
  
  
  function toRGB ( $hex )
  {
    $hexarr = array();
    preg_match( '/([\da-f]{2})([\da-f]{2})([\da-f]{2})/i', $hex, $hexarr );
    return array( hexdec( $hexarr[1] ), hexdec( $hexarr[2] ), hexdec( $hexarr[3] ) );
  }



?>