Example #1
0
 /**
  * Return the title for the page
  * @return String the title.
  */
 public function the_title($head = false)
 {
     $title = '';
     //check against the matched rule
     switch ($this->matched_rule->name) {
         case 'display_404':
             $title = 'Error 404';
             break;
         case 'display_entry':
             $title .= $this->post->title;
             break;
         case 'display_page':
             $title .= $this->post->title;
             break;
         case 'display_search':
             $title .= 'Search for ' . ucfirst($this->criteria);
             break;
         case 'display_entries_by_tag':
             $title .= ucfirst($this->tag) . ' Tag';
             break;
         case 'display_entries_by_date':
             $title .= 'Archive for ';
             $archive_date = new HabariDateTime();
             if (empty($date_array['day'])) {
                 if (empty($date_array['month'])) {
                     //Year only
                     $archive_date->set_date($this->year, 1, 1);
                     $title .= $archive_date->format('Y');
                     break;
                 }
                 //year and month only
                 $archive_date->set_date($this->year, $this->month, 1);
                 $title .= $archive_date->format('F Y');
                 break;
             }
             $archive_date->set_date($this->year, $this->month, $this->day);
             $title .= $archive_date->format('F jS, Y');
             break;
         case 'display_home':
             return Options::get('title');
             break;
     }
     return $title;
 }