Robert Marshall 9 年之前
父節點
當前提交
0ce3662b0b

+ 28 - 34
Controller/Blog.php

@@ -2,14 +2,9 @@
 ApplicationSettings::RegisterDefaultSetting("blog", "posts_per_page", 10);
 
 class Blog {
-	public function Index($params){
-		if (!isset($params['page']) || $params['page']<1)
-			$params['page']=1;
-		
-		$repo=new BlogPostRepository();
-		
-		$count=ApplicationSettings::GetSetting("blog", "posts_per_page");
-		$offset=($params['page']-1)*$count;
+	public function Index($page=1, IBlogPostRepository $repo=null){
+		$count=(int)ApplicationSettings::GetSetting("blog", "posts_per_page");
+		$offset=($page-1)*$count;
 		$total=$repo->GetCount();
 		$maxPages=$total/$count;
 		
@@ -17,23 +12,23 @@ class Blog {
 		
 		$vars=array(
 			"posts"=>$posts,
-			"page"=>$params['page'],
+			"page"=>$page,
 			"maxPages"=>$maxPages
 		);
 		return new View("Blog/index.view",$vars);
 	}
 	
-	public function Page($params) {
-		return $this->Index(array("page"=>$params[0]));
+	public function Page($page=1, IBlogPostRepository $repo=null) {
+		return $this->Index($page,$repo);
 	}
 	
-	public function Create($params){
+	public function Create($title,$draft){
 		Breadcrumbs::Add("Create", "/blog/create");
 		$post=new BlogPost();
-		if (isset($params['title']))
-			$post->PostTitle=$params['title'];
-		if (isset($params['draft']))
-			$post->PostDraft=$params['draft'];
+		if (isset($title))
+			$post->PostTitle=$title;
+		if (isset($draft))
+			$post->PostDraft=$draft;
 		if ($post->PostTitle!="" && $post->PostDraft!=""){
 			$post->Save();
 			header("location:/blog/manage");
@@ -42,55 +37,54 @@ class Blog {
 		return new View("Blog/create.view",array("post"=>$post));
 	}
 	
-	public function Manage($params){
+	public function Manage(IBlogPostRepository $repo,$formSubmitted=false,$publish=null,$delete=null){
 		Breadcrumbs::Add("Manage", "/blog/manage");
-		if (isset($params['formSubmitted']) && $params['formSubmitted']==="yes"){
-			if (isset($params['delete'])){
-				$post=new BlogPost($params['delete']);
+		if ($formSubmitted!=false && $formSubmitted==="yes"){
+			if ($delete!=null){
+				$post=new BlogPost($delete);
 				$post->Delete();
 			}
-			if (isset($params['publish'])){
-				$post=new BlogPost($params['publish']);
+			if ($publish!=null){
+				$post=new BlogPost($publish);
 				$post->Publish();
 			}
 			header("location:/blog/manage");
 			return;
 		}
 		
-		$repo=new BlogPostRepository();
 		$posts=$repo->GetAll();
 		return new View("Blog/manage.view",array("posts"=>$posts));
 	}
 	
-	public function Edit($params) {
-		$post=new BlogPost($params[0]);
+	public function Edit($postId,$title,$draft) {
+		$post=new BlogPost($postId);
 		Breadcrumbs::Add("Edit", "");
-		if(isset($params['title']) && isset($params['draft'])){
-			$post->PostTitle=$params['title'];
-			$post->PostDraft=$params['draft'];
+		if($title!=null && $draft!=null){
+			$post->PostTitle=$title;
+			$post->PostDraft=$draft;
 			$post->Save();
 		}
 		return new View("Blog/create.view",array("post"=>$post));
 	}
 	
-	public function View($params){
-		if (!isset($params[0])){
+	public function View($url){
+		if ($url==null){
 			header("location:/blog");
 			return;
 		}
-		$post=new BlogPost($params[0]);
+		$post=new BlogPost($url);
 		if (!$post->PostId)
 			return new View("E404/index.view");
 		Breadcrumbs::Add(htmlspecialchars($post->PostTitle), "");
 		return new View("Blog/view.view",array("content"=>$post->PostContent,"timestamp"=>$post->PostTimestamp));
 	}
 	
-	public function ViewDraft($params){
-		if (!isset($params[0])){
+	public function ViewDraft($url){
+		if ($url==null){
 			header("location:/blog/manage");
 			return;
 		}
-		$post=new BlogPost($params[0]);
+		$post=new BlogPost($url);
 		if (!$post->PostId)
 			return new View("E404/index.view");
 		Breadcrumbs::Add("Draft", "");

+ 7 - 8
Controller/Desktop.php

@@ -7,19 +7,19 @@ ApplicationSettings::RegisterDefaultSetting("desktop", "hardware_monitor_port",
 
 class Desktop {
 
-	public function Index($params) {
+	public function Index() {
 		return new View("Desktop/index.view");
 	}
 
-	public function Wake($params) {
+	public function Wake() {
 		$command=ApplicationSettings::GetSetting("desktop", "wake_command");
 		$mac=ApplicationSettings::GetSetting("desktop", "mac_address");
 		return $output=shell_exec(sprintf("%s %s", $command, $mac));
 	}
 
-	public function GetDesktopMonitor($params) {
-		if (!isset($params['file']))
-			$params['file']="";
+	public function GetDesktopMonitor($file) {
+		if (!isset($file))
+			$file="";
 		
 		$ipCommand=ApplicationSettings::GetSetting("desktop", "ip_command");
 		$mac=ApplicationSettings::GetSetting("desktop", "mac_address");
@@ -31,14 +31,14 @@ class Desktop {
 			return "Waiting for PC to wake<script>GetHWM(5000)</script>";
 		
 		ob_start();
-		$ch=curl_init("http://$ipAddress:$hwmPort/".$params['file']);
+		$ch=curl_init("http://$ipAddress:$hwmPort/".$file);
 		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 500);
 		curl_setopt($ch, CURLOPT_TIMEOUT, 500);
 		$output=curl_exec($ch);
 		$html=ob_get_clean();
 		
 		if ($output===true){
-			if ($params['file']==""){ // remove tags we don't want from html page
+			if ($file==""){ // remove tags we don't want from html page
 				$html=str_replace(array("<html>","</html>","<body>","</body>","<head>","</head>"),"",$html);
 				$html=preg_replace("/<title>(.*)<\/title>/im","",$html);
 			}
@@ -46,5 +46,4 @@ class Desktop {
 		} else
 			return "Waiting for hardware monitor to start<script>GetHWM(1000)</script>";
 	}
-
 }

+ 23 - 27
Controller/Gallery.php

@@ -1,54 +1,50 @@
 <?php
 class Gallery {
-	public function Index($params) {
-		$repo=new AlbumRespository();
+	public function Index(IAlbumRepository $repo) {
 		$albums=$repo->GetAlbums();
 		return new View("Gallery/index.view",array("albums"=>$albums));
 	}
 	
-	public function View($params) {
-		$album=new Album($params[0],true);
+	public function View($url) {
+		$album=new Album($url,true);
 		Breadcrumbs::Add($album->AlbumTitle, "");
 		return new View("Gallery/view.view",array("album"=>$album));
 	}
 	
-	public function Manage($params) {
-		$albumRepo=new AlbumRespository();
-		$imageRepo=new ImageRepository();
-		
+	public function Manage(IAlbumRepository $albumRepo, IImageRepository $imageRepo, $errors) {		
 		$vars=array();
 		Breadcrumbs::Add("Manage", "");
 		$vars["albums"]=$albumRepo->GetAlbums(true,true);
-		if (isset($params['errors']))
-			$vars["errors"]=$params['errors'];
+		if (isset($errors))
+			$vars["errors"]=$errors;
 		$vars['images']=$imageRepo->GetImagesByAlbum(0);
-		if(isset($params['image']))
-			$vars['image']=$params['image'];
+		if(isset($image))
+			$vars['image']=$image;
 		else
 			$vars['image']=new Image();
 		return new View("Gallery/manage.view",$vars);
 	}
 	
-	public function Move($params){
-		if (!isset($params['moveImages']))
+	public function Move($moveImages, $selected, $selectAlbumNew){
+		if (!isset($moveImages))
 			return;
 		//return print_r($params,true);
-		foreach ($params['selected'] as $imgId){
+		foreach ($selected as $imgId){
 			$image=new Image($imgId);
-			$image->AlbumId=$params['selectAlbumNew'];
+			$image->AlbumId=$selectAlbumNew;
 			$image->Save();
 		}
 		header("location:/gallery/manage");
 	}
 	
-	public function CreateAlbum($params) {
+	public function CreateAlbum($title,$description) {
 		Breadcrumbs::Add("Manage", "");
 		Breadcrumbs::Add("Create Album", "");
 		$album=new Album();
-		if (isset($params['title']))
-			$album->AlbumTitle=$params['title'];
-		if (isset($params['description']))
-			$album->AlbumDescription=$params['description'];
+		if (isset($title))
+			$album->AlbumTitle=$title;
+		if (isset($description))
+			$album->AlbumDescription=$description;
 		if ($album->AlbumTitle!="" && $album->AlbumDescription!=""){
 			$album->Save();
 			header("location:/gallery/manage");
@@ -57,7 +53,7 @@ class Gallery {
 		return new View("Gallery/create_album.view",array("album"=>$album));
 	}
 	
-	public function Upload($params) {
+	public function Upload($imageTitle,$imageDesc) {
 		if (!isset($_FILES['imageFile'])){
 			header("location: /gallery/manage/");
 			return;
@@ -65,7 +61,7 @@ class Gallery {
 		$errors=array();
 		$filename=$_FILES['imageFile']['name'];
 		$tempFile=$_FILES['imageFile']['tmp_name'];
-		if ($params['imageTitle']=="")
+		if ($imageTitle=="")
 			$errors[]="The image doesn't have a title";
 		if ($_FILES['imageFile']['error'])
 			$errors[]=Utils::FileUploadErrorToMessage($_FILES['imageFile']['error']);
@@ -76,8 +72,8 @@ class Gallery {
 				$errors[]="File is not an image";
 		}
 		$image=new Image($filename,$tempFile);
-		$image->ImageTitle=$params['imageTitle'];
-		$image->ImageDescription=$params['imageDesc'];
+		$image->ImageTitle=$imageTitle;
+		$image->ImageDescription=$imageDesc;
 		if (count($errors)==0){
 			$image->Save();
 			header("location: /gallery/manage/");
@@ -86,10 +82,10 @@ class Gallery {
 		return $this->Manage(array("errors"=>$errors,"image"=>$image));
 	}
 	
-	public function JsonLoadAlbum($params) {
+	public function JsonLoadAlbum($albumId) {
 		$repo=new ImageRepository();
 		$json='[';
-		$images=$repo->GetImagesByAlbum($params[0]);
+		$images=$repo->GetImagesByAlbum($albumId);
 		foreach ($images as $image)
 			$json.='{"ImageId":"'.$image->ImageId.'","ImageTitle":"'.$image->ImageTitle.'","Path":"'.$image->Path.'","ThumbnailPath":"'.$image->ThumbnailPath.'"},';
 		$json=trim($json,',');

+ 2 - 3
Controller/Home.php

@@ -1,7 +1,6 @@
 <?php
 class Home{
-	public function Index($params){
-		$repo=new BlogPostRepository();
-		return new View("Home/index.view",array("post"=>$repo->GetLatest()[0]));
+	public function Index(IBlogPostRepository $blogRepo){
+		return new View("Home/index.view",array("post"=>$blogRepo->GetLatest()[0]));
 	}
 }

+ 25 - 25
Controller/Member.php

@@ -1,29 +1,29 @@
 <?php
 class Member {
-	public function Index($params) {
+	public function Index($permission_error,$submit_form,$email,$password,$confirm_password) {
 		if (Session::IsUserLoggedIn())
-			return $this->Manage($params);
+			return $this->Manage($email,$password,$confirm_password);
 		else
-			return $this->Login($params);
+			return $this->Login($permission_error,$submit_form,$email,$password);
 	}
 	
-	public function Login($params){
+	public function Login($permission_error,$submit_form,$email,$password){
 		if (Session::IsUserLoggedIn()){
 			header("location:/member/manage");
 			return;
 		}
 		
-		if (!isset($params['email']))
-			$params['email']="";
+		if (!isset($email))
+			$email="";
 		
 		$errors=array();
 		
-		if (isset($params['permission_error']) && $params['permission_error']==true)
+		if (isset($permission_error) && $permission_error==true)
 			$errors[]="You don't have permission to access this page.";
 		
-		if (isset($params['submit_form']) && $params['email']!=""){
-			$user=new User($params['email']);
-			if ($user->UserId!=null && $user->ValidatePassword($params['password'])){
+		if (isset($submit_form) && $email!=""){
+			$user=new User($email);
+			if ($user->UserId!=null && $user->ValidatePassword($password)){
 				Session::SetLoggedInUser($user);
 				header("location:/member/manage");
 				return;
@@ -34,41 +34,41 @@ class Member {
 		
 		return new View("Member/login.view",array(
 			"errors"=>$errors,
-			"loginEmail"=>$params['email']
+			"loginEmail"=>$email
 		));
 	}
 	
-	public function Logout($params){
+	public function Logout(){
 		Session::Destroy();
 		header("location:/member");
 	}
 	
-	public function Register($params){
-		if (!isset($params['email'],$params['password']))
+	public function Register($email,$password){
+		if (!isset($email,$password))
 			return $this->Login($params);
 		
 		$errors=array();
-		if ($params['email']=="")
+		if ($email=="")
 			$errors[]="Email blank";
-		if  ($params['password']=="")
+		if  ($password=="")
 			$errors[]="Password blank";
 		
-		if (!Utils::IsValidEmail($params['email']))
+		if (!Utils::IsValidEmail($email))
 			$errors[]="Invalid email address";
 		
-		$user=new User($params['email']);
+		$user=new User($email);
 		if ($user->UserId!=0)
 			$errors[]="Email already in use";
 		
 		if (count($errors)>0)
 			return new View("Member/login.view",array(
 				"errors"=>$errors,
-				"registerEmail"=>$params['email']
+				"registerEmail"=>$email
 			));
 		
 		$user=new User();
-		$user->UserEmail=$params['email'];
-		$user->UserPassword=$params['password'];
+		$user->UserEmail=$email;
+		$user->UserPassword=$password;
 		$user->UserCreated=time();
 		$user->Save();
 		
@@ -77,7 +77,7 @@ class Member {
 		header("location:/member/manage");
 	}
 	
-	public function Manage($params){
+	public function Manage($submit_form,$new_password,$confirm_password){
 		if (!Session::IsUserLoggedIn()){
 			header("location:/member/");
 			return;
@@ -86,9 +86,9 @@ class Member {
 		$user=Session::GetLoggedInUser();
 		$errors=array();
 		
-		if (isset($params['submit_form']) && $params['new_password']!=""){
-			if ($params['new_password']==$params['confirm_password']){
-				$user->UserPassword=$params['new_password'];
+		if (isset($submit_form) && $new_password!=""){
+			if ($new_password==$confirm_password){
+				$user->UserPassword=$new_password;
 				$user->Save();
 				header("location:/member/manage");
 				return;

+ 22 - 22
Controller/Navigation/GalleryNav.php

@@ -1,22 +1,22 @@
-<?php
-class GalleryNav implements INavigationController{
-	private $_uri;
-	
-	public function __construct() {
-		$this->_uri=new URI("Gallery","/gallery","/images/photo.svg");
-	}
-	
-	public function GetItems() {
-		$repo=new AlbumRespository();
-		$albums=$repo->GetAlbums();
-		$uris=array();
-		foreach ($albums as $a)
-			$uris[]=new URI($a->AlbumTitle,'view/'.$a->AlbumUrl);
-		$uris[]=new URI("<i>View all</i>","");
-		return $uris;
-	}
-
-	public function GetURI() {
-		return $this->_uri;
-	}
-}
+<?php
+class GalleryNav implements INavigationController{
+	private $_uri;
+	
+	public function __construct() {
+		$this->_uri=new URI("Gallery","/gallery","/images/photo.svg");
+	}
+	
+	public function GetItems() {
+		$repo=new AlbumRepository();
+		$albums=$repo->GetAlbums();
+		$uris=array();
+		foreach ($albums as $a)
+			$uris[]=new URI($a->AlbumTitle,'view/'.$a->AlbumUrl);
+		$uris[]=new URI("<i>View all</i>","");
+		return $uris;
+	}
+
+	public function GetURI() {
+		return $this->_uri;
+	}
+}

+ 1 - 1
Controller/SettingsEditor.php

@@ -2,7 +2,7 @@
 class SettingsEditor {
 	const KEY_SPLITTER='|';
 
-	public function Index($params) {
+	public function Index() {
 		$data=parse_ini_file(ApplicationSettings::SETTINGS_PATH,true);
 		return new View("SettingsEditor/index.view",array("data"=>$data));
 	}

+ 1 - 1
Controller/SiteMap.php

@@ -1,6 +1,6 @@
 <?php
 class SiteMap {
-	public function Index($params) {
+	public function Index() {
 		$controllers=Navigation::Get();
 		return new View("SiteMap/index.view",array("controllers"=>$controllers));
 	}

+ 7 - 8
Controller/Weight.php

@@ -1,21 +1,20 @@
 <?php
 class Weight {
-	public function Index($params) {
+	public function Index(IWeightReadingRepository $repo) {
 		$userId=Session::GetLoggedInUser()->UserId;
-		$repo=new WeightReadingRepository();
 		return new View("Weight/index.view",array("readings"=>$repo::GetAll($userId)));
 	}
 	
-	public function Add($params){
+	public function Add($weight,$fat,$bmi){
 		$reading=new WeightReading();
 		
-		foreach ($params as $param)
-			if ($param=="" || $param<=0)
+		foreach (func_get_args() as $arg)
+			if ($arg=="" || $arg<=0)
 				return;
 		
-		$reading->Weight=$params['weight'];
-		$reading->Fat=$params['fat'];
-		$reading->Bmi=$params['bmi'];
+		$reading->Weight=$weight;
+		$reading->Fat=$fat;
+		$reading->Bmi=$bmi;
 		$reading->UserId=Session::GetLoggedInUser()->UserId;
 		
 		$reading->Save();

+ 1 - 1
Database/AlbumRespository.php

@@ -1,5 +1,5 @@
 <?php
-class AlbumRespository extends BaseRepository {
+class AlbumRepository extends BaseRepository implements IAlbumRepository {
 	public function GetAlbums($includeHidden=false, $includeEmpty=false) {
 		$albums=array();
 		$hidden=$includeHidden?" OR album_hidden=1":"";

+ 1 - 1
Database/BlogPostRepository.php

@@ -1,5 +1,5 @@
 <?php
-class BlogPostRepository extends BaseRepository {
+class BlogPostRepository extends BaseRepository implements IBlogPostRepository {
 	public function __construct() {
 		parent::__construct();
 	}

+ 4 - 0
Database/IAlbumRepository.php

@@ -0,0 +1,4 @@
+<?php
+interface IAlbumRepository {
+	public function GetAlbums($includeHidden=false, $includeEmpty=false);
+}

+ 6 - 0
Database/IBlogPostRepository.php

@@ -0,0 +1,6 @@
+<?php
+interface IBlogPostRepository {
+	public function GetCount();
+	public function GetLatest($count=1,$offset=0);
+	public function GetAll();
+}

+ 4 - 0
Database/IImageRepository.php

@@ -0,0 +1,4 @@
+<?php
+interface IImageRepository {
+	public static function GetImagesByAlbum($albumId);
+}

+ 4 - 0
Database/IWeightReadingRepository.php

@@ -0,0 +1,4 @@
+<?php
+interface IWeightReadingRepository {
+	public static function GetAll($userId);
+}

+ 1 - 1
Database/ImageRepository.php

@@ -1,5 +1,5 @@
 <?php
-class ImageRepository extends BaseRepository {
+class ImageRepository extends BaseRepository implements IImageRepository {
 	public static function GetImagesByAlbum($albumId) {
 		$images=array();
 		$prep=self::$PDO->prepare("SELECT image_id FROM images WHERE album_id=? AND image_deleted=0");

+ 1 - 1
Database/WeightReadingRepository.php

@@ -1,5 +1,5 @@
 <?php
-class WeightReadingRepository extends BaseRepository {
+class WeightReadingRepository extends BaseRepository implements IWeightReadingRepository {
 	public static function GetAll($userId){
 		$readings=array();
 		self::SetupPDO();

+ 23 - 1
View/Blog/create.view

@@ -1,4 +1,15 @@
 @Title{Blog}@
+@CSS{
+	#controls{
+		list-style:none;
+		padding:0;
+		margin:0;
+	}
+	
+	#controls li{
+		display:inline;
+	}
+}@
 @JavaScript{
 var buttonsPosOffset;
 
@@ -10,6 +21,13 @@ $(function(){
 	buttonsPosOffset=window.innerHeight-$("#buttons").offset().top;
 	//console.log(buttonsPosOffset);
 	setTextAreaHeight();
+	
+	$("#controls button").click(function(e){
+		e.preventDefault();
+		var tag=$(this).attr("tag");
+		console.log(tag);
+		console.log($("#draft"));
+	});
 });
 
 $(window).resize(setTextAreaHeight);
@@ -27,6 +45,10 @@ $(window).resize(setTextAreaHeight);
 <form action="" method="post" id="blogForm">
 	<input name="title" style="width:100%" value="<?= htmlspecialchars($post->PostTitle) ?>" />
 	<h3>Content</h3>
-	<textarea class="allowTabInput" name="draft" style="width:100%; height:200px" ><?= htmlspecialchars($post->PostDraft) ?></textarea>
+	<ul id="controls">
+		<li><button tag="i">Italic</button></li>
+		<li><button tag="h">Header</button></li>
+	</ul>
+	<textarea class="allowTabInput" name="draft" id="draft" style="width:100%; height:200px" ><?= htmlspecialchars($post->PostDraft) ?></textarea>
 </form>
 }@

+ 43 - 2
base/Application.php

@@ -20,7 +20,7 @@ foreach ($files as $file)
 		require_once $file;
 
 class Application{
-	protected $_view, $_controller, $_url;
+	protected $_view, $_controller, $_url, $_dependencyInjector;
 	
 	protected function LoadPage($page,$action,$params){
 		$controller=self::FindControllerPath($page);
@@ -35,13 +35,45 @@ class Application{
 		$this->_controller=new $page();
 		if (!method_exists($this->_controller, $action))
 			$action="Index";
-		$this->_view=$this->_controller->$action($params);
+		
+		$rm=new ReflectionMethod($page, $action);
+		$methodParams=$rm->getParameters();
+		
+		//Old behaviour detection, please seek to remove
+		if (count($methodParams)==1 && $methodParams[0]->getName()=="params"){
+			$this->_view=$this->_controller->$action($params);
+			return;
+		}
+		
+		$callArgs=array();
+		foreach ($methodParams as $methodParam){
+			$index=$methodParam->getPosition();
+			$name=$methodParam->getName();
+			$type=$methodParam->getClass();
+			$default=null;
+			try {
+				$default=$methodParam->getDefaultValue();
+			}catch(Exception $e){}
+			
+			if(isset($params[$name]))
+				$callArgs[$index]=$params[$name];
+			elseif (isset($params[$index]))
+				$callArgs[$index]=$params[$index];
+			elseif ($type!=null)
+				$callArgs[$index]=$this->_dependencyInjector->Resolve($type->getName());
+			else
+				$callArgs[$index]=$default;
+		}
+		
+		$this->_view=call_user_func_array(array($this->_controller,$action), $callArgs);
 	}
 	
 	function __construct($url) {
 		$this->_url;
 //		session_start();
 		
+		$this->RegisterDependencies();
+		
 		$page=ApplicationSettings::GetSetting("general", "default_page");
 		$action="Index";
 		$params=array();
@@ -85,6 +117,15 @@ class Application{
 		return "";
 	}
 	
+	private function RegisterDependencies() {
+		$this->_dependencyInjector=new DependencyInjector();
+		$this->_dependencyInjector->Register("IBlogPostRepository","BlogPostRepository");
+		$this->_dependencyInjector->Register("IWeightReadingRepository","WeightReadingRepository");
+		$this->_dependencyInjector->Register("IAlbumRepository","AlbumRepository");
+		$this->_dependencyInjector->Register("IImageRepository","ImageRepository");
+	}
+
+
 	public static function FindControllerPath($controller){
 		$controllerLower=strtolower($controller);
 		$files=glob("Controller/*.php");

+ 15 - 0
base/DependencyInjector.php

@@ -0,0 +1,15 @@
+<?php
+class DependencyInjector {
+	private $_dependencyArray=array();
+	
+	public function Register($interface,$class) {
+		if (isset(class_implements($class)[$interface])){
+			$this->_dependencyArray[$interface]=$class;
+		}else
+			throw new Exception("Class '$class' does not implement interface '$interface'");
+	}
+	
+	public function Resolve($interface) {
+		return new $this->_dependencyArray[$interface];
+	}
+}

+ 1 - 0
css/blog.css

@@ -13,6 +13,7 @@
 .code li {
   list-style-position: inside;
   background: #eeeeee;
+  padding: 1px;
 }
 .code li > div {
   display: inline;

+ 1 - 0
less/blog.less

@@ -16,6 +16,7 @@
 	li{
 		list-style-position: inside;
 		background:@control;
+		padding:1px;
 
 		>div{
 			display:inline;