diff --git a/core/lostpassword/controller.php b/core/lostpassword/controller.php
index e616fe7dff89e6486b5fa3e3f3e778adb7041bd2..523520dc754a3ac8c244b2d5095c540213742c96 100644
--- a/core/lostpassword/controller.php
+++ b/core/lostpassword/controller.php
@@ -8,14 +8,16 @@
 
 class OC_Core_LostPassword_Controller {
 	protected static function displayLostPasswordPage($error, $requested) {
-		OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => $error, 'requested' => $requested));
+		OC_Template::printGuestPage('core/lostpassword', 'lostpassword',
+			array('error' => $error, 'requested' => $requested));
 	}
 	
 	protected static function displayResetPasswordPage($success, $args) {
 		$route_args = array();
 		$route_args['token'] = $args['token'];
 		$route_args['user'] = $args['user'];
-		OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => $success, 'args' => $route_args));
+		OC_Template::printGuestPage('core/lostpassword', 'resetpassword',
+			array('success' => $success, 'args' => $route_args));
 	}
 
 	protected static function checkToken($user, $token) {
@@ -29,10 +31,12 @@ class OC_Core_LostPassword_Controller {
 	public static function sendEmail($args) {
 		if (OC_User::userExists($_POST['user'])) {
 			$token = hash('sha256', OC_Util::generate_random_bytes(30).OC_Config::getValue('passwordsalt', ''));
-			OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token)); // Hash the token again to prevent timing attacks
+			OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword',
+				hash('sha256', $token)); // Hash the token again to prevent timing attacks
 			$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
 			if (!empty($email)) {
-				$link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
+				$link = OC_Helper::linkToRoute('core_lostpassword_reset',
+					array('user' => $_POST['user'], 'token' => $token));
 				$link = OC_Helper::makeURLAbsolute($link);
 
 				$tmpl = new OC_Template('core/lostpassword', 'email');
diff --git a/core/routes.php b/core/routes.php
index 7cf27498846436300b01a18f2f4258230990ef8a..186fa8ae562a0fddee319a933f03057066877bc4 100644
--- a/core/routes.php
+++ b/core/routes.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-require_once('settings/routes.php');
+require_once 'settings/routes.php';
 
 // Core ajax actions
 // AppConfig
diff --git a/lib/base.php b/lib/base.php
index f810b1f186e0e942a03df3df3c7cfcdf604db3f0..d7d5eef32564e04c1ad4a92ff113bd1640382826 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -516,7 +516,8 @@ class OC{
 				}
 				$file_ext = substr($param['file'], -3);
 				if ($file_ext != 'php'
-				    || !self::loadAppScriptFile($param)) {
+				    || !self::loadAppScriptFile($param))
+				{
 					header('HTTP/1.0 404 Not Found');
 				}
 			}
diff --git a/lib/ocs.php b/lib/ocs.php
index 60577ec5d575c55bf711b68c7c67c32be01a5fa5..1a0abf0e367173576eee93afaa0bb935752608e1 100644
--- a/lib/ocs.php
+++ b/lib/ocs.php
@@ -111,8 +111,8 @@ class OC_OCS {
 					$format = $parameters['format'];
 					$login = OC_OCS::readData('post', 'login', 'text');
 					$passwd = OC_OCS::readData('post', 'password', 'text');
-					OC_OCS::personCheck($format,$login,$passwd);
-					})
+					OC_OCS::personCheck($format, $login, $passwd);
+				})
 			->requirements(array('format'=>'xml|json'));
 
 		// ACTIVITY
@@ -125,7 +125,7 @@ class OC_OCS {
 					$pagesize = OC_OCS::readData('get', 'pagesize', 'int', 10);
 					if($pagesize<1 or $pagesize>100) $pagesize=10;
 					OC_OCS::activityGet($format, $page, $pagesize);
-					})
+				})
 			->requirements(array('format'=>'xml|json'));
 		// activityput - POST ACTIVITY
 		$router->create('activity_put', '/activity.{format}')
@@ -134,8 +134,8 @@ class OC_OCS {
 			->action(function ($parameters) {
 					$format = $parameters['format'];
 					$message = OC_OCS::readData('post', 'message', 'text');
-					OC_OCS::activityPut($format,$message);
-					})
+					OC_OCS::activityPut($format, $message);
+				})
 			->requirements(array('format'=>'xml|json'));
 
 		// PRIVATEDATA
@@ -148,7 +148,7 @@ class OC_OCS {
 					$app = addslashes(strip_tags($parameters['app']));
 					$key = addslashes(strip_tags($parameters['key']));
 					OC_OCS::privateDataGet($format, $app, $key);
-					})
+				})
 			->requirements(array('format'=>'xml|json'));
 		// set - POST DATA
 		$router->create('privatedata_set',
@@ -161,7 +161,7 @@ class OC_OCS {
 					$key = addslashes(strip_tags($parameters['key']));
 					$value=OC_OCS::readData('post', 'value', 'text');
 					OC_OCS::privateDataSet($format, $app, $key, $value);
-					})
+				})
 			->requirements(array('format'=>'xml|json'));
 		// delete - POST DATA
 		$router->create('privatedata_delete',
@@ -173,7 +173,7 @@ class OC_OCS {
 					$app = addslashes(strip_tags($parameters['app']));
 					$key = addslashes(strip_tags($parameters['key']));
 					OC_OCS::privateDataDelete($format, $app, $key);
-					})
+				})
 			->requirements(array('format'=>'xml|json'));
 
 		// CLOUD
@@ -184,7 +184,7 @@ class OC_OCS {
 			->action(function ($parameters) {
 					$format = $parameters['format'];
 					OC_OCS::systemwebapps($format);
-					})
+				})
 			->requirements(array('format'=>'xml|json'));
 
 		// quotaget
@@ -195,7 +195,7 @@ class OC_OCS {
 					$format = $parameters['format'];
 					$user = $parameters['user'];
 					OC_OCS::quotaGet($format, $user);
-					})
+				})
 			->requirements(array('format'=>'xml|json'));
 		// quotaset
 		$router->create('quota_set',
@@ -207,7 +207,7 @@ class OC_OCS {
 					$user = $parameters['user'];
 					$quota = self::readData('post', 'quota', 'int');
 					OC_OCS::quotaSet($format, $user, $quota);
-					})
+				})
 			->requirements(array('format'=>'xml|json'));
 
 		// keygetpublic
@@ -217,8 +217,8 @@ class OC_OCS {
 			->action(function ($parameters) {
 					$format = $parameters['format'];
 					$user = $parameters['user'];
-					OC_OCS::publicKeyGet($format,$user);
-					})
+					OC_OCS::publicKeyGet($format, $user);
+				})
 			->requirements(array('format'=>'xml|json'));
 
 		// keygetprivate
@@ -228,8 +228,8 @@ class OC_OCS {
 			->action(function ($parameters) {
 					$format = $parameters['format'];
 					$user = $parameters['user'];
-					OC_OCS::privateKeyGet($format,$user);
-					})
+					OC_OCS::privateKeyGet($format, $user);
+				})
 			->requirements(array('format'=>'xml|json'));
 
 
@@ -247,7 +247,10 @@ class OC_OCS {
 		try {
 			$router->match($_SERVER['PATH_INFO']);
 		} catch (ResourceNotFoundException $e) {
-			$txt='Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n";
+			$txt='Invalid query, please check the syntax. '
+			.'API specifications are here: '
+			.'http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'
+			.'DEBUG OUTPUT:'."\n";
 			$txt.=OC_OCS::getdebugoutput();
 			echo(OC_OCS::generatexml($format, 'failed', 999, $txt));
 		} catch (MethodNotAllowedException $e) {
@@ -323,7 +326,7 @@ class OC_OCS {
 	* @param int $itemsperpage
 	* @return string xml/json
 	*/
-	private static function generateXml($format,$status,$statuscode,$message,$data=array(),$tag='',$tagattribute='',$dimension=-1,$itemscount='',$itemsperpage='') {
+	private static function generateXml($format, $status, $statuscode, $message, $data=array(), $tag='', $tagattribute='', $dimension=-1, $itemscount='', $itemsperpage='') {
 		if($format=='json') {
 			$json=array();
 			$json['status']=$status;
@@ -343,7 +346,7 @@ class OC_OCS {
 			xmlwriter_write_element($writer, 'status', $status);
 			xmlwriter_write_element($writer, 'statuscode', $statuscode);
 			xmlwriter_write_element($writer, 'message', $message);
-			if($itemscount<>'') xmlwriter_write_element($writer,'totalitems',$itemscount);
+			if($itemscount<>'') xmlwriter_write_element($writer, 'totalitems', $itemscount);
 			if(!empty($itemsperpage)) xmlwriter_write_element($writer, 'itemsperpage', $itemsperpage);
 			xmlwriter_end_element($writer);
 			if($dimension=='0') {
@@ -358,7 +361,7 @@ class OC_OCS {
 				xmlwriter_end_element($writer);
 
 			}elseif($dimension=='2') {
-				xmlwriter_start_element($writer,'data');
+				xmlwriter_start_element($writer, 'data');
 				foreach($data as $entry) {
 					xmlwriter_start_element($writer, $tag);
 					if(!empty($tagattribute)) {
@@ -413,14 +416,14 @@ class OC_OCS {
 		}
 	}
 
-	public static function toXml($writer,$data,$node) {
+	public static function toXml($writer, $data, $node) {
 		foreach($data as $key => $value) {
 			if (is_numeric($key)) {
 				$key = $node;
 			}
 			if (is_array($value)) {
 				xmlwriter_start_element($writer, $key);
-				OC_OCS::toxml($writer,$value, $node);
+				OC_OCS::toxml($writer, $value, $node);
 				xmlwriter_end_element($writer);
 			}else{
 				xmlwriter_write_element($writer, $key, $value);
@@ -453,7 +456,7 @@ class OC_OCS {
 	* @param string $passwd
 	* @return string xml/json
 	*/
-	private static function personCheck($format,$login,$passwd) {
+	private static function personCheck($format, $login, $passwd) {
 		if($login<>'') {
 			if(OC_User::login($login, $passwd)) {
 				$xml['person']['personid']=$login;
@@ -480,7 +483,7 @@ class OC_OCS {
 
 			//TODO
 
-		$txt=OC_OCS::generatexml($format, 'ok', 100, '', $xml, 'activity', 'full', 2, $totalcount,$pagesize);
+		$txt=OC_OCS::generatexml($format, 'ok', 100, '', $xml, 'activity', 'full', 2, $totalcount, $pagesize);
 		echo($txt);
 	}
 
@@ -490,7 +493,7 @@ class OC_OCS {
 	* @param string $message
 	* @return string xml/json
 	*/
-	private static function activityPut($format,$message) {
+	private static function activityPut($format, $message) {
 		// not implemented in ownCloud
 		$user=OC_OCS::checkpassword();
 		echo(OC_OCS::generatexml($format, 'ok', 100, ''));
@@ -621,7 +624,7 @@ class OC_OCS {
 		foreach($apps as $app) {
 			$info=OC_App::getAppInfo($app);
 			if(isset($info['standalone'])) {
-				$newvalue=array('name'=>$info['name'],'url'=>OC_Helper::linkToAbsolute($app,''),'icon'=>'');
+				$newvalue=array('name'=>$info['name'], 'url'=>OC_Helper::linkToAbsolute($app, ''), 'icon'=>'');
 				$values[]=$newvalue;
 			}
 
@@ -638,7 +641,7 @@ class OC_OCS {
         * @param string $user
         * @return string xml/json
         */
-        private static function quotaGet($format,$user) {
+        private static function quotaGet($format, $user) {
                 $login=OC_OCS::checkpassword();
 		if(OC_Group::inGroup($login, 'admin') or ($login==$user)) {
 
@@ -677,7 +680,7 @@ class OC_OCS {
         * @param string $quota
         * @return string xml/json
         */
-        private static function quotaSet($format,$user,$quota) {
+        private static function quotaSet($format, $user, $quota) {
                 $login=OC_OCS::checkpassword();
                 if(OC_Group::inGroup($login, 'admin')) {
 
@@ -700,7 +703,7 @@ class OC_OCS {
         * @param string $user
         * @return string xml/json
         */
-        private static function publicKeyGet($format,$user) {
+        private static function publicKeyGet($format, $user) {
                 $login=OC_OCS::checkpassword();
 
 		if(OC_User::userExists($user)) {
@@ -718,7 +721,7 @@ class OC_OCS {
         * @param string $user
         * @return string xml/json
         */
-        private static function privateKeyGet($format,$user) {
+        private static function privateKeyGet($format, $user) {
                 $login=OC_OCS::checkpassword();
                 if(OC_Group::inGroup($login, 'admin') or ($login==$user)) {
 
diff --git a/lib/route.php b/lib/route.php
index 89af829d3d342ca9e3e0119526baac1893a7ace8..d5233d79861cf1f822de0ef8ad201c8d8430f82a 100644
--- a/lib/route.php
+++ b/lib/route.php
@@ -106,7 +106,11 @@ class OC_Route extends Route {
 	 * @param $file
 	 */
 	public function actionInclude($file) {
-		$function = create_function('$param', 'unset($param["_route"]);$_GET=array_merge($_GET,$param);unset($param);require_once "'.$file.'";');
+		$function = create_function('$param',
+			'unset($param["_route"]);'
+			.'$_GET=array_merge($_GET,$param);'
+			.'unset($param);'
+			.'require_once "'.$file.'";');
 		$this->action($function);
 	}
 }
diff --git a/lib/router.php b/lib/router.php
index a471a06802ce57781ae036f08941a6c518959849..d5adb72055a4b5cad8a3a35a713fadee5ced5781 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -35,9 +35,9 @@ class OC_Router {
 	public function loadRoutes() {
 		foreach(OC_APP::getEnabledApps() as $app){
 			$file = OC_App::getAppPath($app).'/appinfo/routes.php';
-			if(file_exists($file)){
+			if(file_exists($file)) {
 				$this->useCollection($app);
-				require_once($file);
+				require_once $file;
 				$collection = $this->getCollection($app);
 				$this->root->addCollection($collection, '/apps/'.$app);
 			}
@@ -81,7 +81,7 @@ class OC_Router {
 	 *
 	 * @param string $url The url to find
 	 */
-    	public function match($url) {
+	public function match($url) {
 		$matcher = new UrlMatcher($this->root, $this->context);
 		$parameters = $matcher->match($url);
 		if (isset($parameters['action'])) {
@@ -93,7 +93,7 @@ class OC_Router {
 			unset($parameters['action']);
 			call_user_func($action, $parameters);
 		} elseif (isset($parameters['file'])) {
-			include ($parameters['file']);
+			include $parameters['file'];
 		} else {
 			throw new Exception('no action available');
 		}