Advertisement
Guest User

habari code from Andrew Rickman

a guest
Aug 15th, 2010
13,460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1.     /**
  2.      * Return the title for the page
  3.      * @return String the title.
  4.      */
  5.     public function the_title( $head = false ){
  6.         $title = '';
  7.         //Copy Pasta from Andrew Rickman's ported theme, Dilectio http://www.habari-fun.co.uk/converting-wordpress-themes-to-habari-file-names
  8.         //check against the matched rule
  9.         switch( $this->matched_rule->name ){
  10.             case 'display_404':
  11.                 $title = 'Error 404';
  12.             break;
  13.             case 'display_entry':
  14.                 $title .= $this->post->title;
  15.             break;
  16.             case 'display_page':
  17.                 $title .= $this->post->title;
  18.             break;
  19.             case 'display_search':
  20.                 $title .= 'Search for ' . ucfirst( $this->criteria );
  21.             break;
  22.             case 'display_entries_by_tag':
  23.                 $title .= ucfirst( $this->tag ) . ' Tag';
  24.             break;
  25.             case 'display_entries_by_date':
  26.                 $title .= 'Archive for ';
  27.                 $archive_date = new HabariDateTime();
  28.                 if ( empty($date_array['day']) ){
  29.                     if ( empty($date_array['month']) ){
  30.                         //Year only
  31.                         $archive_date->set_date( $this->year , 1 , 1 );
  32.                         $title .= $archive_date->format( 'Y' );
  33.                         break;
  34.                     }
  35.                     //year and month only
  36.                     $archive_date->set_date( $this->year , $this->month , 1 );
  37.                     $title .= $archive_date->format( 'F Y' );
  38.                     break;
  39.                 }
  40.                 $archive_date->set_date( $this->year , $this->month , $this->day );
  41.                 $title .= $archive_date->format( 'F jS, Y' );
  42.             break;
  43.         }
  44.        
  45.         if ( $head ){
  46.             return ( empty($title)) ? Options::get( 'title' ) : $title . ' - ' . Options::get( 'title' );
  47.         }
  48.                        
  49.         return $title;
  50.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement