<?php
/* 
	

	
*/

defined('WikyBlog') or die("Not an entry point...");


class pluginDisplay{
	////////////////////////////////////////////////////////
	//
	//	Date and Time
	//
	function time($name,&$value){
		global $dbObject;
		
		echo '<tr><td>';
		echo '<b>'.$name.'</b>';
		echo '</td><td>';
		if( substr($value,5) == ':00'){
			echo substr($value,0,5);
		}else{
			echo $value;
		}
		echo '</td></tr>';
	}
	function date($name,&$value){
		global $dbObject;
		
		echo '<tr><td>';
		echo '<b>'.$name.'</b>';
		echo '</td><td>';
		$name = wbStrtolower($name);
		$value =& $dbObject->$name;
		$test = str_replace(array('-','0'),'',$value);
		if( !empty($test) ){
			echo dbFromDate($value,1);
		}
		echo '</td></tr>';
	}
	////////////////////////////////////////////////////////
	//
	//
	function display($name,&$value){
		echo '<tr><td>';
		echo '<b>'.$name.'</b>';
		echo '</td><td>';
		echo $value;
		echo '</td></tr>';
	}
	
	function wiki(&$value){
		global $wbParser;
		initiateParser();
		echo '<tr><td colspan="2">';
		echo $wbParser->justParse($value,$this->flags,$this->file_id);
		echo '</td></tr>';
	}
	function abbrevWiki(&$value,&$uniqLink){
		global $langA;
		
		echo '<tr><td colspan="2">';
		$bool = outputWiki($value,400);
		if($bool == true){
			echo '... '.wbLinks::local($$uniqLink,$langA['read_more']).' <span class="sm">('.$bool.$langA['words'].')</span>';
		}		
		echo '</td></tr>';
	}
	function abbrevHeading(&$row){
		global $langA,$page;
		
		$links = array();
		$links[$langA['file']] = $row->uniqLink;
		$links[$langA['talk']] = '/Talk'.$row->uniqLink;
		
		echo '<h2 class="heading underline">';
		echo wbLinks::local($row->uniqLink, toDisplay($row->title));
		echo '</h2>';

		echo ' <div class="fileInfo">';
			echo '<span>';
			$temp = Array();
			foreach( $links as $key => $value){
				if( is_string($value) ){
					$temp[] = wbLinks::local($value,$key);
				}
			}
			echo implode(' :: ',$temp);
			echo '</span>';
			
			echo '<span>'.$langA['modified'].': '.dbFromDate($row->modified,3).'</span>';
			echo '<span>'.$langA['created'].': '. dbFromDate($row->created,3).'</span>';
		echo ' </div>';
	}
	
	function url($name,&$value){
		global $page;
		echo '<tr><td>';
		echo '<b>'.$name.'</b>';
		echo '</td><td>';
		if( !empty($value) ){
			if( $urlArray = @parse_url($value) ){
				echo '<a href="'.$value.'" class="external"';
				if( $page->nofollow ){
					echo ' rel="nofollow"';
				}
				echo '>'.$urlArray['host'].'</a>';
			}
		}
		echo '</td></tr>';
		
	}
}
