Browse Source

Cleaner code

pull/40/head
Savetheinternet 14 years ago
parent
commit
2dcef7e1eb
  1. 75
      inc/display.php

75
inc/display.php

@ -118,29 +118,64 @@
public function build($index=false) { public function build($index=false) {
$built = '<p class="fileinfo"> $built = '<p class="fileinfo">File: <a href="' . ROOT . $this->file .'">' . basename($this->file) . '</a> <span class="unimportant">(' .
File: <a href="' . ROOT . $this->file.'">'.basename($this->file).'</a> <span class="unimportant">('.format_bytes($this->filesize).', '.$this->filex.'x'.$this->filey.', '.$this->filename.')</span> // Filesize
</p> format_bytes($this->filesize) . ', ' .
<a href="' . ROOT . $this->file.'"><img src="' . ROOT . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a> // File dimensions
<div class="post op"> $this->filex . 'x' . $this->filey;
<p class="intro"> // Aspect Ratio
<span class="subject"> if(SHOW_RATIO) {
'.$this->subject.' $fraction = fraction($this->filex, $this->filey, ':');
</span> $built .= ', ' . $fraction;
' . ( !empty($this->email) ? '<a class="email" href="mailto:' . $this->email . '">':'') . }
'<span class="name">' // Filename
. $this->name . $built .= ', ' . $this->filename . ')</span></p>' .
'</span>' . (!empty($this->trip) ? ' <span class="trip">'.$this->trip.'</span>':'') // Thumbnail
. ( !empty($this->email) ? '</a>':'') '<a href="' . ROOT . $this->file.'"><img src="' . ROOT . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
. ' ' . date('m/d/y (D) H:i:s', $this->time). '
<a class="post_no"' . ($index?'':' onclick="highlightReply(' . $this->id . ');"') . ' href="' . ROOT . DIR_RES . $this->id . '.html' . '#' . $this->id . '">No.</a><a class="post_no"' . ($index?'':'onclick="citeReply(' . $this->id . ');"') . 'href="' . ($index?ROOT . DIR_RES . $this->id . '.html' . '#q' . $this->id:'javascript:void(0);') . '">'.$this->id.'</a>' . ($index ? '<a href="' . ROOT . DIR_RES . $this->id . '.html">[Reply]</a>' : '') . $built .= '<div class="post op"><p class="intro"' . (!$index?' id="' . $this->id . '"':'') . '>';
'</p>'
.$this->body.' // Subject
' . ($this->omitted ? '<span class="omitted">' . $this->omitted . ' post' . ($this->omitted==1?'':'s') . ' omitted. Click reply to view.</span>':'') . ' $built .= '<span class="subject">' . $this->subject . '</span>';
</div>'; // Email
if(!empty($this->email))
$built .= '<a class="email" href="mailto:' . $this->email . '">';
// Name
$built .= '<span class="name">' . $this->name . '</span>'
// Trip
. (!empty($this->trip) ? ' <span class="trip">'.$this->trip.'</span>':'');
// End email
if(!empty($this->email))
$built .= '</a>';
// Date/time
$built .= ' ' . date('m/d/y (D) H:i:s', $this->time);
$built .= ' <a class="post_no"' .
// JavaScript highlight
($index?'':' onclick="highlightReply(' . $this->id . ');"') .
' href="' . ROOT . DIR_RES . $this->id . '.html' . '#' . $this->id . '">No.</a>' .
// JavaScript cite
'<a class="post_no"' . ($index?'':'onclick="citeReply(' . $this->id . ');"') . 'href="' . ($index?ROOT . DIR_RES . $this->id . '.html' . '#q' . $this->id:'javascript:void(0);') . '">'.$this->id.'</a>' .
// [Reply]
($index ? '<a href="' . ROOT . DIR_RES . $this->id . '.html">[Reply]</a>' : '') .
'</p>';
// Body
$built .= $this->body .
// Omitted posts
($this->omitted ? '<span class="omitted">' . $this->omitted . ' post' . ($this->omitted==1?'':'s') . ' omitted. Click reply to view.</span>':'') .
// End
'</div>';
// Replies
foreach($this->posts as &$post) { foreach($this->posts as &$post) {
$built .= $post->build($index); $built .= $post->build($index);
} }
$built .= '<br class="clear"/><hr/>'; $built .= '<br class="clear"/><hr/>';
return $built; return $built;
} }

Loading…
Cancel
Save