Ver código fonte

Introduce PSR-4 autoloading

Sobak 10 anos atrás
pai
commit
54f96b9938

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 # Ignore data/, tmp/ and vendor/
 data/
+!lib/data/
 tmp/
 vendor/
 # Ignore for safety

+ 5 - 6
composer.json

@@ -1,15 +1,14 @@
 {
     "name": "privatebin/privatebin",
     "description": "PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bit AES in Galois Counter mode (GCM).",
-    "repositories": [
-        {
-            "type": "vcs",
-            "url": "https://github.com/PrivateBin/PrivateBin"
-        }
-    ],
     "license":"zlib-acknowledgement",
     "require-dev": {
         "codacy/coverage": "dev-master",
         "codeclimate/php-test-reporter": "dev-master"
+    },
+    "autoload": {
+        "psr-4": {
+            "PrivateBin\\": "lib/"
+        }
     }
 }

+ 2 - 2
index.php

@@ -14,5 +14,5 @@
 define('PATH', '');
 
 define('PUBLIC_PATH', dirname(__FILE__));
-require PATH . 'lib/auto.php';
-new privatebin;
+require __DIR__ . '/vendor/autoload.php';
+new PrivateBin\privatebin;

+ 0 - 38
lib/auto.php

@@ -1,38 +0,0 @@
-<?php
-/**
- * PrivateBin
- *
- * a zero-knowledge paste bin
- *
- * @link      https://github.com/PrivateBin/PrivateBin
- * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
- * @license   https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
- * @version   0.22
- */
-
-spl_autoload_register('auto::loader');
-
-/**
- * auto
- *
- * provides autoloading functionality
- */
-class auto
-{
-    /**
-     * includes file for given class name
-     *
-     * @access public
-     * @static
-     * @param  string $class_name
-     * @return mixed
-     */
-    public static function loader($class_name)
-    {
-        $filename = PATH . 'lib/' . str_replace('_', '/', $class_name) . '.php';
-        if(is_readable($filename)) {
-            return include $filename;
-        }
-        return false;
-    }
-}

+ 5 - 0
lib/configuration.php

@@ -10,6 +10,11 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
+use Exception;
+use PDO;
+
 /**
  * configuration
  *

+ 3 - 1
lib/privatebin/abstract.php → lib/data/AbstractData.php

@@ -10,12 +10,14 @@
  * @version   0.22
  */
 
+namespace PrivateBin\data;
+
 /**
  * privatebin_abstract
  *
  * Abstract model for PrivateBin data access, implemented as a singleton.
  */
-abstract class privatebin_abstract
+abstract class AbstractData
 {
     /**
      * singleton instance

+ 4 - 2
lib/privatebin/data.php → lib/data/data.php

@@ -10,12 +10,14 @@
  * @version   0.22
  */
 
+namespace PrivateBin\data;
+
 /**
  * privatebin_data
  *
  * Model for data access, implemented as a singleton.
  */
-class privatebin_data extends privatebin_abstract
+class data extends AbstractData
 {
     /**
      * directory where data is stored
@@ -248,7 +250,7 @@ class privatebin_data extends privatebin_abstract
                 if (!is_dir($path)) continue;
                 $thirdLevel = array_filter(
                     scandir($path),
-                    array('model_paste', 'isValidId')
+                    array('PrivateBin\\model\\paste', 'isValidId')
                 );
                 if (count($thirdLevel) == 0) continue;
                 $thirdKey = array_rand($thirdLevel);

+ 9 - 1
lib/privatebin/db.php → lib/data/db.php

@@ -10,12 +10,20 @@
  * @version   0.22
  */
 
+namespace PrivateBin\data;
+
+use Exception;
+use PDO;
+use PDOException;
+use PrivateBin\privatebin;
+use stdClass;
+
 /**
  * privatebin_db
  *
  * Model for DB access, implemented as a singleton.
  */
-class privatebin_db extends privatebin_abstract
+class db extends AbstractData
 {
     /**
      * cache for select queries

+ 6 - 1
lib/filter.php

@@ -10,6 +10,11 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
+use Exception;
+use PrivateBin\i18n;
+
 /**
  * filter
  *
@@ -28,7 +33,7 @@ class filter
     public static function stripslashes_deep($value)
     {
         return is_array($value) ?
-            array_map('filter::stripslashes_deep', $value) :
+            array_map('PrivateBin\\filter::stripslashes_deep', $value) :
             stripslashes($value);
     }
 

+ 3 - 1
lib/i18n.php

@@ -10,6 +10,8 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
 /**
  * i18n
  *
@@ -82,7 +84,7 @@ class i18n
      */
     public static function _($messageId)
     {
-        return call_user_func_array(array('i18n', 'translate'), func_get_args());
+        return call_user_func_array(array('self', 'translate'), func_get_args());
     }
 
     /**

+ 14 - 2
lib/model.php

@@ -10,6 +10,10 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
+use PrivateBin\model\paste;
+
 /**
  * model
  *
@@ -50,7 +54,7 @@ class model
      */
     public function getPaste($pasteId = null)
     {
-        $paste = new model_paste($this->_conf, $this->_getStore());
+        $paste = new paste($this->_conf, $this->_getStore());
         if ($pasteId !== null) $paste->setId($pasteId);
         return $paste;
     }
@@ -76,10 +80,18 @@ class model
      */
     private function _getStore()
     {
+        // FIXME
+        // Workaround so that config value don't need to be changed
+        $callable = str_replace(
+            array('privatebin_data', 'privatebin_db'),
+            array('PrivateBin\\data\\data', 'PrivateBin\\data\\db'),
+            $this->_conf->getKey('class', 'model')
+        );
+
         if ($this->_store === null)
         {
             $this->_store = forward_static_call(
-                array($this->_conf->getKey('class', 'model'), 'getInstance'),
+                array($callable, 'getInstance'),
                 $this->_conf->getSection('model_options')
             );
         }

+ 10 - 2
lib/model/abstract.php → lib/model/AbstractModel.php

@@ -10,12 +10,20 @@
  * @version   0.22
  */
 
+namespace PrivateBin\Model;
+
+use Exception;
+use PrivateBin\configuration;
+use PrivateBin\data\AbstractData;
+use PrivateBin\sjcl;
+use stdClass;
+
 /**
  * model_abstract
  *
  * Abstract model for PrivateBin objects.
  */
-abstract class model_abstract
+abstract class AbstractModel
 {
     /**
      * Instance ID.
@@ -57,7 +65,7 @@ abstract class model_abstract
      * @param  privatebin_abstract $storage
      * @return void
      */
-    public function __construct(configuration $configuration, privatebin_abstract $storage)
+    public function __construct(configuration $configuration, AbstractData $storage)
     {
         $this->_conf = $configuration;
         $this->_store = $storage;

+ 9 - 2
lib/model/comment.php

@@ -10,12 +10,19 @@
  * @version   0.22
  */
 
+namespace PrivateBin\model;
+
+use Exception;
+use PrivateBin\sjcl;
+use PrivateBin\trafficlimiter;
+use PrivateBin\vizhash16x16;
+
 /**
  * model_comment
  *
  * Model of a PrivateBin comment.
  */
-class model_comment extends model_abstract
+class comment extends AbstractModel
 {
     /**
      * Instance's parent.
@@ -118,7 +125,7 @@ class model_comment extends model_abstract
      * @throws Exception
      * @return void
      */
-    public function setPaste(model_paste $paste)
+    public function setPaste(paste $paste)
     {
         $this->_paste = $paste;
         $this->_data->meta->pasteid = $paste->getId();

+ 9 - 2
lib/model/paste.php

@@ -10,12 +10,19 @@
  * @version   0.22
  */
 
+namespace PrivateBin\model;
+
+use Exception;
+use PrivateBin\privatebin;
+use PrivateBin\serversalt;
+use PrivateBin\sjcl;
+
 /**
  * model_paste
  *
  * Model of a PrivateBin paste.
  */
-class model_paste extends model_abstract
+class paste extends AbstractModel
 {
     /**
      * Get paste data.
@@ -130,7 +137,7 @@ class model_paste extends model_abstract
         {
             throw new Exception('Invalid data.', 62);
         }
-        $comment = new model_comment($this->_conf, $this->_store);
+        $comment = new comment($this->_conf, $this->_store);
         $comment->setPaste($this);
         $comment->setParentId($parentId);
         if ($commentId !== null) $comment->setId($commentId);

+ 4 - 0
lib/persistence.php

@@ -10,6 +10,10 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
+use Exception;
+
 /**
  * persistence
  *

+ 5 - 1
lib/privatebin.php

@@ -10,6 +10,10 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
+use Exception;
+
 /**
  * privatebin
  *
@@ -419,7 +423,7 @@ class privatebin
         }
 
         // translate all the formatter options
-        $formatters = array_map(array('i18n', 'translate'), $this->_conf->getSection('formatter_options'));
+        $formatters = array_map(array('PrivateBin\\i18n', 'translate'), $this->_conf->getSection('formatter_options'));
 
         // set language cookie if that functionality was enabled
         $languageselection = '';

+ 2 - 0
lib/purgelimiter.php

@@ -10,6 +10,8 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
 /**
  * purgelimiter
  *

+ 2 - 0
lib/request.php

@@ -10,6 +10,8 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
 /**
  * request
  *

+ 4 - 0
lib/serversalt.php

@@ -10,6 +10,10 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
+use Exception;
+
 /**
  * serversalt
  *

+ 2 - 0
lib/sjcl.php

@@ -10,6 +10,8 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
 /**
  * sjcl
  *

+ 2 - 0
lib/trafficlimiter.php

@@ -10,6 +10,8 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
 /**
  * trafficlimiter
  *

+ 4 - 0
lib/view.php

@@ -10,6 +10,10 @@
  * @version   0.22
  */
 
+namespace PrivateBin;
+
+use Exception;
+
 /**
  * view
  *

+ 2 - 0
lib/vizhash16x16.php

@@ -11,6 +11,8 @@
  * @version   0.0.4 beta PrivateBin 0.22
  */
 
+namespace PrivateBin;
+
 /**
  * vizhash16x16
  *

+ 25 - 25
tpl/bootstrap-compact.php

@@ -5,7 +5,7 @@
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<meta name="robots" content="noindex" />
-		<title><?php echo i18n::_('PrivateBin'); ?></title>
+		<title><?php echo PrivateBin\i18n::_('PrivateBin'); ?></title>
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
@@ -45,28 +45,28 @@ endif; ?>
 			<div class="container">
 				<div class="navbar-header">
 					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
-						<span class="sr-only"><?php echo i18n::_('Toggle navigation'); ?></span>
+						<span class="sr-only"><?php echo PrivateBin\i18n::_('Toggle navigation'); ?></span>
 						<span class="icon-bar"></span>
 						<span class="icon-bar"></span>
 						<span class="icon-bar"></span>
 					</button>
 					<a class="reloadlink navbar-brand" href="/">
-						<img alt="<?php echo i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
+						<img alt="<?php echo PrivateBin\i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
 					</a>
 				</div>
 				<div id="navbar" class="navbar-collapse collapse">
 					<ul class="nav navbar-nav">
 						<li>
 							<button id="sendbutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo i18n::_('Send'); ?>
+								<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Send'); ?>
 							</button><?php
 if ($EXPIRECLONE): ?>
 							<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo i18n::_('Clone'); ?>
+								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Clone'); ?>
 							</button><?php
 endif; ?>
 							<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo i18n::_('Raw text'); ?>
+								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Raw text'); ?>
 							</button>
 						</li>
 						<li class="dropdown">
@@ -77,7 +77,7 @@ foreach ($EXPIRE as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 							</select>
-							<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
+							<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
 							<ul class="dropdown-menu"><?php
 foreach ($EXPIRE as $key => $value): ?>
 								<li>
@@ -89,14 +89,14 @@ endforeach; ?>
 							</ul>
 						</li>
 						<li id="formatter" class="dropdown">
-							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Options'); ?> <span class="caret"></span></a>
+							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Options'); ?> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 								<li id="burnafterreadingoption" class="checkbox hidden">
 									<label>
 										<input type="checkbox" id="burnafterreading" name="burnafterreading" <?php
 if ($BURNAFTERREADINGSELECTED): ?> checked="checked"<?php
 endif; ?> />
-										<?php echo i18n::_('Burn after reading'); ?>
+										<?php echo PrivateBin\i18n::_('Burn after reading'); ?>
 									</label>
 								</li><?php
 if ($DISCUSSION): ?>
@@ -105,14 +105,14 @@ if ($DISCUSSION): ?>
 										<input type="checkbox" id="opendiscussion" name="opendiscussion" <?php
 	if ($OPENDISCUSSION): ?> checked="checked"<?php
 	endif; ?> />
-										<?php echo i18n::_('Open discussion'); ?>
+										<?php echo PrivateBin\i18n::_('Open discussion'); ?>
 									</label>
 								</li><?php
 endif; ?>
 								<li role="separator" class="divider"></li>
 								<li>
 									<div>
-										<?php echo i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span>
+										<?php echo PrivateBin\i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span>
 									</div>
 								</li><?php
 foreach ($FORMATTER as $key => $value): ?>
@@ -134,13 +134,13 @@ endforeach; ?>
 if ($PASSWORD): ?>
 						<li>
 							<div id="password" class="navbar-form hidden">
-								<input type="password" id="passwordinput" placeholder="<?php echo i18n::_('Password (recommended)'); ?>" class="form-control" size="19"/>
+								<input type="password" id="passwordinput" placeholder="<?php echo PrivateBin\i18n::_('Password (recommended)'); ?>" class="form-control" size="19"/>
 							</div>
 						</li><?php
 endif;
 if ($FILEUPLOAD): ?>
 						<li id="attach" class="hidden dropdown">
-							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Attach a file'); ?> <span class="caret"></span></a>
+							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Attach a file'); ?> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 								<li id="filewrap">
 									<div>
@@ -149,7 +149,7 @@ if ($FILEUPLOAD): ?>
 								</li>
 								<li>
 									<a id="fileremovebutton"  href="#">
-										<?php echo i18n::_('Remove attachment'); ?>
+										<?php echo PrivateBin\i18n::_('Remove attachment'); ?>
 									</a>
 								</li>
 							</ul>
@@ -173,7 +173,7 @@ if (strlen($LANGUAGESELECTION)): ?>
 endif; ?>
 						<li>
 							<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo i18n::_('New'); ?>
+								<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('New'); ?>
 							</button>
 						</li>
 					</ul>
@@ -191,7 +191,7 @@ endif; ?>
 			</div><?php
 if ($FILEUPLOAD): ?>
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo i18n::_('Cloned file attached.'); ?></span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo PrivateBin\i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo PrivateBin\i18n::_('Cloned file attached.'); ?></span>
 			</div><?php
 endif;
 if (strlen($STATUS)): ?>
@@ -202,9 +202,9 @@ endif; ?>
 			<div id="errormessage" role="alert" class="<?php
 if (!strlen($ERROR)): ?>hidden <?php
 endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
-			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
-			<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
+			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
+			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
+			<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
 				<a href="https://www.mozilla.org/firefox/">Firefox</a>,
 				<a href="https://www.opera.com/">Opera</a>,
 				<a href="https://www.google.com/chrome">Chrome</a>,
@@ -216,14 +216,14 @@ endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden
 				<div id="pastelink"><?php
 if (strlen($URLSHORTENER)): ?>
 					<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-primary">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo i18n::_('Shorten URL'); ?>
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Shorten URL'); ?>
 					</button><?php
 endif; ?>
 				</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo i18n::_('Editor'); ?></a></li>
-				<li role="presentation"><a id="messagepreview" href="#"><?php echo i18n::_('Preview'); ?></a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo PrivateBin\i18n::_('Editor'); ?></a></li>
+				<li role="presentation"><a id="messagepreview" href="#"><?php echo PrivateBin\i18n::_('Preview'); ?></a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -238,16 +238,16 @@ endif; ?>
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4><?php echo i18n::_('Discussion'); ?></h4>
+				<h4><?php echo PrivateBin\i18n::_('Discussion'); ?></h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8"><?php echo i18n::_('PrivateBin'); ?> <small>- <?php echo i18n::_('Because ignorance is bliss'); ?></small></h4>
+				<h4 class="col-md-5 col-xs-8"><?php echo PrivateBin\i18n::_('PrivateBin'); ?> <small>- <?php echo PrivateBin\i18n::_('Because ignorance is bliss'); ?></small></h4>
 				<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					<?php echo i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
+					<?php echo PrivateBin\i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/bootstrap-dark-page.php

@@ -5,7 +5,7 @@
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<meta name="robots" content="noindex" />
-		<title><?php echo i18n::_('PrivateBin'); ?></title>
+		<title><?php echo PrivateBin\i18n::_('PrivateBin'); ?></title>
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/darkstrap-0.9.3.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
@@ -44,28 +44,28 @@ endif; ?>
 		<nav class="navbar navbar-inverse navbar-static-top">
 			<div class="navbar-header">
 				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
-					<span class="sr-only"><?php echo i18n::_('Toggle navigation'); ?></span>
+					<span class="sr-only"><?php echo PrivateBin\i18n::_('Toggle navigation'); ?></span>
 					<span class="icon-bar"></span>
 					<span class="icon-bar"></span>
 					<span class="icon-bar"></span>
 				</button>
 				<a class="reloadlink navbar-brand" href="/">
-					<img alt="<?php echo i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
+					<img alt="<?php echo PrivateBin\i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
 				</a>
 			</div>
 			<div id="navbar" class="navbar-collapse collapse">
 				<ul class="nav navbar-nav">
 					<li>
 						<button id="sendbutton" type="button" class="hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo i18n::_('Send'); ?>
+							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Send'); ?>
 						</button><?php
 if ($EXPIRECLONE): ?>
 						<button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo i18n::_('Clone'); ?>
+							<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Clone'); ?>
 						</button><?php
 endif; ?>
 						<button id="rawtextbutton" type="button" class="hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo i18n::_('Raw text'); ?>
+							<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Raw text'); ?>
 						</button>
 					</li>
 					<li class="dropdown">
@@ -76,7 +76,7 @@ foreach ($EXPIRE as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 						</select>
-						<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
+						<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
 						<ul class="dropdown-menu"><?php
 foreach ($EXPIRE as $key => $value): ?>
 							<li>
@@ -93,7 +93,7 @@ endforeach; ?>
 								<input type="checkbox" id="burnafterreading" name="burnafterreading" <?php
 if ($BURNAFTERREADINGSELECTED): ?> checked="checked"<?php
 endif; ?> />
-								<?php echo i18n::_('Burn after reading'); ?>
+								<?php echo PrivateBin\i18n::_('Burn after reading'); ?>
 							</label>
 						</div>
 					</li><?php
@@ -104,7 +104,7 @@ if ($DISCUSSION): ?>
 								<input type="checkbox" id="opendiscussion" name="opendiscussion" <?php
 	if ($OPENDISCUSSION): ?> checked="checked"<?php
 	endif; ?> />
-								<?php echo i18n::_('Open discussion'); ?>
+								<?php echo PrivateBin\i18n::_('Open discussion'); ?>
 						 	</label>
 						</div>
 					</li><?php
@@ -112,13 +112,13 @@ endif;
 if ($PASSWORD): ?>
 					<li>
 						<div id="password" class="navbar-form hidden">
-							<input type="password" id="passwordinput" placeholder="<?php echo i18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
+							<input type="password" id="passwordinput" placeholder="<?php echo PrivateBin\i18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
 						</div>
 					</li><?php
 endif;
 if ($FILEUPLOAD): ?>
 					<li id="attach" class="hidden dropdown">
-						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Attach a file'); ?> <span class="caret"></span></a>
+						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Attach a file'); ?> <span class="caret"></span></a>
 						<ul class="dropdown-menu">
 							<li id="filewrap">
 								<div>
@@ -127,7 +127,7 @@ if ($FILEUPLOAD): ?>
 							</li>
 							<li>
 								<a id="fileremovebutton"  href="#">
-									<?php echo i18n::_('Remove attachment'); ?>
+									<?php echo PrivateBin\i18n::_('Remove attachment'); ?>
 								</a>
 							</li>
 						</ul>
@@ -141,7 +141,7 @@ foreach ($FORMATTER as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 						</select>
-						<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
+						<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
 						<ul class="dropdown-menu"><?php
 foreach ($FORMATTER as $key => $value): ?>
 							<li>
@@ -170,7 +170,7 @@ if (strlen($LANGUAGESELECTION)): ?>
 endif; ?>
 					<li>
 						<button id="newbutton" type="button" class="reloadlink hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo i18n::_('New'); ?>
+							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('New'); ?>
 						</button>
 					</li>
 				</ul>
@@ -187,7 +187,7 @@ endif; ?>
 			</div><?php
 if ($FILEUPLOAD): ?>
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo i18n::_('Cloned file attached.'); ?></span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo PrivateBin\i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo PrivateBin\i18n::_('Cloned file attached.'); ?></span>
 			</div><?php
 endif;
 if (strlen($STATUS)): ?>
@@ -198,9 +198,9 @@ endif; ?>
 			<div id="errormessage" role="alert" class="<?php
 if (!strlen($ERROR)): ?>hidden <?php
 endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-error"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
-			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
-			<div id="ienotice" role="alert" class="hidden alert alert-error"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
+			<noscript><div id="noscript" role="alert" class="nonworking alert alert-error"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
+			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
+			<div id="ienotice" role="alert" class="hidden alert alert-error"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
 				<a href="https://www.mozilla.org/firefox/">Firefox</a>,
 				<a href="https://www.opera.com/">Opera</a>,
 				<a href="https://www.google.com/chrome">Chrome</a>,
@@ -212,14 +212,14 @@ endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden
 				<div id="pastelink"><?php
 if (strlen($URLSHORTENER)): ?>
 					<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-warning">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo i18n::_('Shorten URL'); ?>
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Shorten URL'); ?>
 					</button><?php
 endif; ?>
 				</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo i18n::_('Editor'); ?></a></li>
-				<li role="presentation"><a id="messagepreview" href="#"><?php echo i18n::_('Preview'); ?></a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo PrivateBin\i18n::_('Editor'); ?></a></li>
+				<li role="presentation"><a id="messagepreview" href="#"><?php echo PrivateBin\i18n::_('Preview'); ?></a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -234,16 +234,16 @@ endif; ?>
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4><?php echo i18n::_('Discussion'); ?></h4>
+				<h4><?php echo PrivateBin\i18n::_('Discussion'); ?></h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8"><?php echo i18n::_('PrivateBin'); ?> <small>- <?php echo i18n::_('Because ignorance is bliss'); ?></small></h4>
+				<h4 class="col-md-5 col-xs-8"><?php echo PrivateBin\i18n::_('PrivateBin'); ?> <small>- <?php echo PrivateBin\i18n::_('Because ignorance is bliss'); ?></small></h4>
 				<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					<?php echo i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
+					<?php echo PrivateBin\i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/bootstrap-dark.php

@@ -5,7 +5,7 @@
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<meta name="robots" content="noindex" />
-		<title><?php echo i18n::_('PrivateBin'); ?></title>
+		<title><?php echo PrivateBin\i18n::_('PrivateBin'); ?></title>
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/darkstrap-0.9.3.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
@@ -44,28 +44,28 @@ endif; ?>
 		<nav class="navbar navbar-inverse navbar-static-top">
 			<div class="navbar-header">
 				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
-					<span class="sr-only"><?php echo i18n::_('Toggle navigation'); ?></span>
+					<span class="sr-only"><?php echo PrivateBin\i18n::_('Toggle navigation'); ?></span>
 					<span class="icon-bar"></span>
 					<span class="icon-bar"></span>
 					<span class="icon-bar"></span>
 				</button>
 				<a class="reloadlink navbar-brand" href="/">
-					<img alt="<?php echo i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
+					<img alt="<?php echo PrivateBin\i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
 				</a>
 			</div>
 			<div id="navbar" class="navbar-collapse collapse">
 				<ul class="nav navbar-nav">
 					<li>
 						<button id="newbutton" type="button" class="reloadlink hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo i18n::_('New'); ?>
+							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('New'); ?>
 						</button><?php
 if ($EXPIRECLONE): ?>
 						<button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo i18n::_('Clone'); ?>
+							<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Clone'); ?>
 						</button><?php
 endif; ?>
 						<button id="rawtextbutton" type="button" class="hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo i18n::_('Raw text'); ?>
+							<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Raw text'); ?>
 						</button>
 					</li>
 					<li class="dropdown">
@@ -76,7 +76,7 @@ foreach ($EXPIRE as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 						</select>
-						<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
+						<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
 						<ul class="dropdown-menu"><?php
 foreach ($EXPIRE as $key => $value): ?>
 							<li>
@@ -93,7 +93,7 @@ endforeach; ?>
 								<input type="checkbox" id="burnafterreading" name="burnafterreading" <?php
 if ($BURNAFTERREADINGSELECTED): ?> checked="checked"<?php
 endif; ?> />
-								<?php echo i18n::_('Burn after reading'); ?>
+								<?php echo PrivateBin\i18n::_('Burn after reading'); ?>
 							</label>
 						</div>
 					</li><?php
@@ -104,7 +104,7 @@ if ($DISCUSSION): ?>
 								<input type="checkbox" id="opendiscussion" name="opendiscussion" <?php
 	if ($OPENDISCUSSION): ?> checked="checked"<?php
 	endif; ?> />
-								<?php echo i18n::_('Open discussion'); ?>
+								<?php echo PrivateBin\i18n::_('Open discussion'); ?>
 						 	</label>
 						</div>
 					</li><?php
@@ -112,13 +112,13 @@ endif;
 if ($PASSWORD): ?>
 					<li>
 						<div id="password" class="navbar-form hidden">
-							<input type="password" id="passwordinput" placeholder="<?php echo i18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
+							<input type="password" id="passwordinput" placeholder="<?php echo PrivateBin\i18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
 						</div>
 					</li><?php
 endif;
 if ($FILEUPLOAD): ?>
 					<li id="attach" class="hidden dropdown">
-						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Attach a file'); ?> <span class="caret"></span></a>
+						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Attach a file'); ?> <span class="caret"></span></a>
 						<ul class="dropdown-menu">
 							<li id="filewrap">
 								<div>
@@ -127,7 +127,7 @@ if ($FILEUPLOAD): ?>
 							</li>
 							<li>
 								<a id="fileremovebutton"  href="#">
-									<?php echo i18n::_('Remove attachment'); ?>
+									<?php echo PrivateBin\i18n::_('Remove attachment'); ?>
 								</a>
 							</li>
 						</ul>
@@ -141,7 +141,7 @@ foreach ($FORMATTER as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 						</select>
-						<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
+						<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
 						<ul class="dropdown-menu"><?php
 foreach ($FORMATTER as $key => $value): ?>
 							<li>
@@ -170,7 +170,7 @@ if (strlen($LANGUAGESELECTION)): ?>
 endif; ?>
 					<li>
 						<button id="sendbutton" type="button" class="hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo i18n::_('Send'); ?>
+							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Send'); ?>
 						</button>
 					</li>
 				</ul>
@@ -187,7 +187,7 @@ endif; ?>
 			</div><?php
 if ($FILEUPLOAD): ?>
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo i18n::_('Cloned file attached.'); ?></span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo PrivateBin\i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo PrivateBin\i18n::_('Cloned file attached.'); ?></span>
 			</div><?php
 endif;
 if (strlen($STATUS)): ?>
@@ -198,9 +198,9 @@ endif; ?>
 			<div id="errormessage" role="alert" class="<?php
 if (!strlen($ERROR)): ?>hidden <?php
 endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-error"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
-			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
-			<div id="ienotice" role="alert" class="hidden alert alert-error"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
+			<noscript><div id="noscript" role="alert" class="nonworking alert alert-error"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
+			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
+			<div id="ienotice" role="alert" class="hidden alert alert-error"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
 				<a href="https://www.mozilla.org/firefox/">Firefox</a>,
 				<a href="https://www.opera.com/">Opera</a>,
 				<a href="https://www.google.com/chrome">Chrome</a>,
@@ -212,14 +212,14 @@ endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden
 				<div id="pastelink"><?php
 if (strlen($URLSHORTENER)): ?>
 					<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-warning">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo i18n::_('Shorten URL'); ?>
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Shorten URL'); ?>
 					</button><?php
 endif; ?>
 				</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo i18n::_('Editor'); ?></a></li>
-				<li role="presentation"><a id="messagepreview" href="#"><?php echo i18n::_('Preview'); ?></a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo PrivateBin\i18n::_('Editor'); ?></a></li>
+				<li role="presentation"><a id="messagepreview" href="#"><?php echo PrivateBin\i18n::_('Preview'); ?></a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -234,16 +234,16 @@ endif; ?>
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4><?php echo i18n::_('Discussion'); ?></h4>
+				<h4><?php echo PrivateBin\i18n::_('Discussion'); ?></h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8"><?php echo i18n::_('PrivateBin'); ?> <small>- <?php echo i18n::_('Because ignorance is bliss'); ?></small></h4>
+				<h4 class="col-md-5 col-xs-8"><?php echo PrivateBin\i18n::_('PrivateBin'); ?> <small>- <?php echo PrivateBin\i18n::_('Because ignorance is bliss'); ?></small></h4>
 				<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					<?php echo i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
+					<?php echo PrivateBin\i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/bootstrap-page.php

@@ -5,7 +5,7 @@
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<meta name="robots" content="noindex" />
-		<title><?php echo i18n::_('PrivateBin'); ?></title>
+		<title><?php echo PrivateBin\i18n::_('PrivateBin'); ?></title>
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
@@ -44,28 +44,28 @@ endif; ?>
 		<nav class="navbar navbar-default navbar-static-top">
 			<div class="navbar-header">
 				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
-					<span class="sr-only"><?php echo i18n::_('Toggle navigation'); ?></span>
+					<span class="sr-only"><?php echo PrivateBin\i18n::_('Toggle navigation'); ?></span>
 					<span class="icon-bar"></span>
 					<span class="icon-bar"></span>
 					<span class="icon-bar"></span>
 				</button>
 				<a class="reloadlink navbar-brand" href="/">
-					<img alt="<?php echo i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
+					<img alt="<?php echo PrivateBin\i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
 				</a>
 			</div>
 			<div id="navbar" class="navbar-collapse collapse">
 				<ul class="nav navbar-nav">
 					<li>
 						<button id="sendbutton" type="button" class="hidden btn btn-primary navbar-btn">
-							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo i18n::_('Send'); ?>
+							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Send'); ?>
 						</button><?php
 if ($EXPIRECLONE): ?>
 						<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn">
-							<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo i18n::_('Clone'); ?>
+							<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Clone'); ?>
 						</button><?php
 endif; ?>
 						<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn">
-							<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo i18n::_('Raw text'); ?>
+							<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Raw text'); ?>
 						</button>
 					</li>
 					<li class="dropdown">
@@ -76,7 +76,7 @@ foreach ($EXPIRE as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 						</select>
-						<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
+						<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
 						<ul class="dropdown-menu"><?php
 foreach ($EXPIRE as $key => $value): ?>
 							<li>
@@ -93,7 +93,7 @@ endforeach; ?>
 								<input type="checkbox" id="burnafterreading" name="burnafterreading" <?php
 if ($BURNAFTERREADINGSELECTED): ?> checked="checked"<?php
 endif; ?> />
-								<?php echo i18n::_('Burn after reading'); ?>
+								<?php echo PrivateBin\i18n::_('Burn after reading'); ?>
 							</label>
 						</div>
 					</li><?php
@@ -104,7 +104,7 @@ if ($DISCUSSION): ?>
 								<input type="checkbox" id="opendiscussion" name="opendiscussion" <?php
 	if ($OPENDISCUSSION): ?> checked="checked"<?php
 	endif; ?> />
-								<?php echo i18n::_('Open discussion'); ?>
+								<?php echo PrivateBin\i18n::_('Open discussion'); ?>
 						 	</label>
 						</div>
 					</li><?php
@@ -112,13 +112,13 @@ endif;
 if ($PASSWORD): ?>
 					<li>
 						<div id="password" class="navbar-form hidden">
-							<input type="password" id="passwordinput" placeholder="<?php echo i18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
+							<input type="password" id="passwordinput" placeholder="<?php echo PrivateBin\i18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
 						</div>
 					</li><?php
 endif;
 if ($FILEUPLOAD): ?>
 					<li id="attach" class="hidden dropdown">
-						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Attach a file'); ?> <span class="caret"></span></a>
+						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Attach a file'); ?> <span class="caret"></span></a>
 						<ul class="dropdown-menu">
 							<li id="filewrap">
 								<div>
@@ -127,7 +127,7 @@ if ($FILEUPLOAD): ?>
 							</li>
 							<li>
 								<a id="fileremovebutton"  href="#">
-									<?php echo i18n::_('Remove attachment'); ?>
+									<?php echo PrivateBin\i18n::_('Remove attachment'); ?>
 								</a>
 							</li>
 						</ul>
@@ -141,7 +141,7 @@ foreach ($FORMATTER as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 						</select>
-						<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
+						<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
 						<ul class="dropdown-menu"><?php
 foreach ($FORMATTER as $key => $value): ?>
 							<li>
@@ -170,7 +170,7 @@ if (strlen($LANGUAGESELECTION)): ?>
 endif; ?>
 					<li>
 						<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn">
-							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo i18n::_('New'); ?>
+							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('New'); ?>
 						</button>
 					</li>
 				</ul>
@@ -187,7 +187,7 @@ endif; ?>
 			</div><?php
 if ($FILEUPLOAD): ?>
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo i18n::_('Cloned file attached.'); ?></span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo PrivateBin\i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo PrivateBin\i18n::_('Cloned file attached.'); ?></span>
 			</div><?php
 endif;
 if (strlen($STATUS)): ?>
@@ -198,9 +198,9 @@ endif; ?>
 			<div id="errormessage" role="alert" class="<?php
 if (!strlen($ERROR)): ?>hidden <?php
 endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
-			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
-			<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
+			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
+			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
+			<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
 				<a href="https://www.mozilla.org/firefox/">Firefox</a>,
 				<a href="https://www.opera.com/">Opera</a>,
 				<a href="https://www.google.com/chrome">Chrome</a>,
@@ -212,14 +212,14 @@ endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden
 				<div id="pastelink"><?php
 if (strlen($URLSHORTENER)): ?>
 					<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-primary">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo i18n::_('Shorten URL'); ?>
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Shorten URL'); ?>
 					</button><?php
 endif; ?>
 				</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo i18n::_('Editor'); ?></a></li>
-				<li role="presentation"><a id="messagepreview" href="#"><?php echo i18n::_('Preview'); ?></a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo PrivateBin\i18n::_('Editor'); ?></a></li>
+				<li role="presentation"><a id="messagepreview" href="#"><?php echo PrivateBin\i18n::_('Preview'); ?></a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -234,16 +234,16 @@ endif; ?>
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4><?php echo i18n::_('Discussion'); ?></h4>
+				<h4><?php echo PrivateBin\i18n::_('Discussion'); ?></h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8"><?php echo i18n::_('PrivateBin'); ?> <small>- <?php echo i18n::_('Because ignorance is bliss'); ?></small></h4>
+				<h4 class="col-md-5 col-xs-8"><?php echo PrivateBin\i18n::_('PrivateBin'); ?> <small>- <?php echo PrivateBin\i18n::_('Because ignorance is bliss'); ?></small></h4>
 				<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					<?php echo i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
+					<?php echo PrivateBin\i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/bootstrap.php

@@ -5,7 +5,7 @@
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<meta name="robots" content="noindex" />
-		<title><?php echo i18n::_('PrivateBin'); ?></title>
+		<title><?php echo PrivateBin\i18n::_('PrivateBin'); ?></title>
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
 		<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
@@ -44,28 +44,28 @@ endif; ?>
 		<nav class="navbar navbar-default navbar-static-top">
 			<div class="navbar-header">
 				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
-					<span class="sr-only"><?php echo i18n::_('Toggle navigation'); ?></span>
+					<span class="sr-only"><?php echo PrivateBin\i18n::_('Toggle navigation'); ?></span>
 					<span class="icon-bar"></span>
 					<span class="icon-bar"></span>
 					<span class="icon-bar"></span>
 				</button>
 				<a class="reloadlink navbar-brand" href="/">
-					<img alt="<?php echo i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
+					<img alt="<?php echo PrivateBin\i18n::_('PrivateBin'); ?>" src="img/icon.svg" width="20" />
 				</a>
 			</div>
 			<div id="navbar" class="navbar-collapse collapse">
 				<ul class="nav navbar-nav">
 					<li>
 						<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn">
-							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo i18n::_('New'); ?>
+							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('New'); ?>
 						</button><?php
 if ($EXPIRECLONE): ?>
 						<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn">
-							<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo i18n::_('Clone'); ?>
+							<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Clone'); ?>
 						</button><?php
 endif; ?>
 						<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn">
-							<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo i18n::_('Raw text'); ?>
+							<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Raw text'); ?>
 						</button>
 					</li>
 					<li class="dropdown">
@@ -76,7 +76,7 @@ foreach ($EXPIRE as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 						</select>
-						<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
+						<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
 						<ul class="dropdown-menu"><?php
 foreach ($EXPIRE as $key => $value): ?>
 							<li>
@@ -93,7 +93,7 @@ endforeach; ?>
 								<input type="checkbox" id="burnafterreading" name="burnafterreading" <?php
 if ($BURNAFTERREADINGSELECTED): ?> checked="checked"<?php
 endif; ?> />
-								<?php echo i18n::_('Burn after reading'); ?>
+								<?php echo PrivateBin\i18n::_('Burn after reading'); ?>
 							</label>
 						</div>
 					</li><?php
@@ -104,7 +104,7 @@ if ($DISCUSSION): ?>
 								<input type="checkbox" id="opendiscussion" name="opendiscussion" <?php
 	if ($OPENDISCUSSION): ?> checked="checked"<?php
 	endif; ?> />
-								<?php echo i18n::_('Open discussion'); ?>
+								<?php echo PrivateBin\i18n::_('Open discussion'); ?>
 						 	</label>
 						</div>
 					</li><?php
@@ -112,13 +112,13 @@ endif;
 if ($PASSWORD): ?>
 					<li>
 						<div id="password" class="navbar-form hidden">
-							<input type="password" id="passwordinput" placeholder="<?php echo i18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
+							<input type="password" id="passwordinput" placeholder="<?php echo PrivateBin\i18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
 						</div>
 					</li><?php
 endif;
 if ($FILEUPLOAD): ?>
 					<li id="attach" class="hidden dropdown">
-						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Attach a file'); ?> <span class="caret"></span></a>
+						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Attach a file'); ?> <span class="caret"></span></a>
 						<ul class="dropdown-menu">
 							<li id="filewrap">
 								<div>
@@ -127,7 +127,7 @@ if ($FILEUPLOAD): ?>
 							</li>
 							<li>
 								<a id="fileremovebutton"  href="#">
-									<?php echo i18n::_('Remove attachment'); ?>
+									<?php echo PrivateBin\i18n::_('Remove attachment'); ?>
 								</a>
 							</li>
 						</ul>
@@ -141,7 +141,7 @@ foreach ($FORMATTER as $key => $value): ?>
 	endif; ?>><?php echo $value; ?></option><?php
 endforeach; ?>
 						</select>
-						<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
+						<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo PrivateBin\i18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
 						<ul class="dropdown-menu"><?php
 foreach ($FORMATTER as $key => $value): ?>
 							<li>
@@ -170,7 +170,7 @@ if (strlen($LANGUAGESELECTION)): ?>
 endif; ?>
 					<li>
 						<button id="sendbutton" type="button" class="hidden btn btn-primary navbar-btn">
-							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo i18n::_('Send'); ?>
+							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Send'); ?>
 						</button>
 					</li>
 				</ul>
@@ -187,7 +187,7 @@ endif; ?>
 			</div><?php
 if ($FILEUPLOAD): ?>
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo i18n::_('Cloned file attached.'); ?></span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo PrivateBin\i18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo PrivateBin\i18n::_('Cloned file attached.'); ?></span>
 			</div><?php
 endif;
 if (strlen($STATUS)): ?>
@@ -198,9 +198,9 @@ endif; ?>
 			<div id="errormessage" role="alert" class="<?php
 if (!strlen($ERROR)): ?>hidden <?php
 endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
-			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
-			<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
+			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
+			<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
+			<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
 				<a href="https://www.mozilla.org/firefox/">Firefox</a>,
 				<a href="https://www.opera.com/">Opera</a>,
 				<a href="https://www.google.com/chrome">Chrome</a>,
@@ -212,14 +212,14 @@ endif; ?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden
 				<div id="pastelink"><?php
 if (strlen($URLSHORTENER)): ?>
 					<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-primary">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo i18n::_('Shorten URL'); ?>
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo PrivateBin\i18n::_('Shorten URL'); ?>
 					</button><?php
 endif; ?>
 				</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo i18n::_('Editor'); ?></a></li>
-				<li role="presentation"><a id="messagepreview" href="#"><?php echo i18n::_('Preview'); ?></a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo PrivateBin\i18n::_('Editor'); ?></a></li>
+				<li role="presentation"><a id="messagepreview" href="#"><?php echo PrivateBin\i18n::_('Preview'); ?></a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -234,16 +234,16 @@ endif; ?>
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4><?php echo i18n::_('Discussion'); ?></h4>
+				<h4><?php echo PrivateBin\i18n::_('Discussion'); ?></h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8"><?php echo i18n::_('PrivateBin'); ?> <small>- <?php echo i18n::_('Because ignorance is bliss'); ?></small></h4>
+				<h4 class="col-md-5 col-xs-8"><?php echo PrivateBin\i18n::_('PrivateBin'); ?> <small>- <?php echo PrivateBin\i18n::_('Because ignorance is bliss'); ?></small></h4>
 				<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					<?php echo i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
+					<?php echo PrivateBin\i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?>
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/page.php

@@ -3,7 +3,7 @@
 	<head>
 		<meta charset="utf-8" />
 		<meta name="robots" content="noindex" />
-		<title><?php echo i18n::_('PrivateBin'); ?></title>
+		<title><?php echo PrivateBin\i18n::_('PrivateBin'); ?></title>
 		<link type="text/css" rel="stylesheet" href="css/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
 if ($SYNTAXHIGHLIGHTING): ?>
 		<link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" /><?php
@@ -38,17 +38,17 @@ endif; ?>
 	<body>
 		<header>
 			<div id="aboutbox">
-				<?php echo i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?><br /><?php
+				<?php echo PrivateBin\i18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?><br /><?php
 if (strlen($NOTICE)): ?>
 				<span class="blink">▶</span> <?php echo htmlspecialchars($NOTICE);
 endif; ?>
 			</div>
-			<h1 class="title reloadlink"><?php echo i18n::_('PrivateBin'); ?></h1><br />
-			<h2 class="title"><?php echo i18n::_('Because ignorance is bliss'); ?></h2><br />
+			<h1 class="title reloadlink"><?php echo PrivateBin\i18n::_('PrivateBin'); ?></h1><br />
+			<h2 class="title"><?php echo PrivateBin\i18n::_('Because ignorance is bliss'); ?></h2><br />
 			<h3 class="title"><?php echo $VERSION; ?></h3>
-			<noscript><div id="noscript" class="nonworking"><?php echo i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
-			<div id="oldienotice" class="nonworking"><?php echo i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
-			<div id="ienotice"><?php echo i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
+			<noscript><div id="noscript" class="nonworking"><?php echo PrivateBin\i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
+			<div id="oldienotice" class="nonworking"><?php echo PrivateBin\i18n::_('PrivateBin requires a modern browser to work.'); ?></div>
+			<div id="ienotice"><?php echo PrivateBin\i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?>
 				<a href="https://www.mozilla.org/firefox/">Firefox</a>,
 				<a href="https://www.opera.com/">Opera</a>,
 				<a href="https://www.google.com/chrome">Chrome</a>,
@@ -60,13 +60,13 @@ endif; ?>
 				<div id="status"><?php echo htmlspecialchars($STATUS); ?></div>
 				<div id="errormessage" class="hidden"><?php echo htmlspecialchars($ERROR); ?></div>
 				<div id="toolbar">
-					<button id="newbutton" class="reloadlink hidden"><img src="img/icon_new.png" width="11" height="15" alt="" /><?php echo i18n::_('New'); ?></button>
-					<button id="sendbutton" class="hidden"><img src="img/icon_send.png" width="18" height="15" alt="" /><?php echo i18n::_('Send'); ?></button><?php
+					<button id="newbutton" class="reloadlink hidden"><img src="img/icon_new.png" width="11" height="15" alt="" /><?php echo PrivateBin\i18n::_('New'); ?></button>
+					<button id="sendbutton" class="hidden"><img src="img/icon_send.png" width="18" height="15" alt="" /><?php echo PrivateBin\i18n::_('Send'); ?></button><?php
 if ($EXPIRECLONE): ?>
-					<button id="clonebutton" class="hidden"><img src="img/icon_clone.png" width="15" height="17" alt="" /><?php echo i18n::_('Clone'); ?></button><?php
+					<button id="clonebutton" class="hidden"><img src="img/icon_clone.png" width="15" height="17" alt="" /><?php echo PrivateBin\i18n::_('Clone'); ?></button><?php
 endif; ?>
-					<button id="rawtextbutton" class="hidden"><img src="img/icon_raw.png" width="15" height="15" alt="" /><?php echo i18n::_('Raw text'); ?></button>
-					<div id="expiration" class="hidden button"><?php echo i18n::_('Expires'); ?>:
+					<button id="rawtextbutton" class="hidden"><img src="img/icon_raw.png" width="15" height="15" alt="" /><?php echo PrivateBin\i18n::_('Raw text'); ?></button>
+					<div id="expiration" class="hidden button"><?php echo PrivateBin\i18n::_('Expires'); ?>:
 						<select id="pasteExpiration" name="pasteExpiration"><?php
 foreach ($EXPIRE as $key => $value): ?>
 							<option value="<?php echo $key; ?>"<?php
@@ -80,7 +80,7 @@ endforeach; ?>
 						<input type="checkbox" id="burnafterreading" name="burnafterreading" <?php
 if ($BURNAFTERREADINGSELECTED): ?> checked="checked"<?php
 endif; ?> />
-						<label for="burnafterreading"><?php echo i18n::_('Burn after reading'); ?></label>
+						<label for="burnafterreading"><?php echo PrivateBin\i18n::_('Burn after reading'); ?></label>
 					</div><?php
 if ($DISCUSSION): ?>
 					<div id="opendisc" class="button hidden">
@@ -89,15 +89,15 @@ if ($DISCUSSION): ?>
 	endif; ?> />
 						<label for="opendiscussion" <?php
 	if (!$OPENDISCUSSION): ?> style="color: #BBBBBB;"<?php
-	endif; ?>><?php echo i18n::_('Open discussion'); ?></label>
+	endif; ?>><?php echo PrivateBin\i18n::_('Open discussion'); ?></label>
 					</div><?php
 endif;
 if ($PASSWORD): ?>
 					<div id="password" class="hidden">
-						<input type="password" id="passwordinput" placeholder="<?php echo i18n::_('Password (recommended)'); ?>" size="32" />
+						<input type="password" id="passwordinput" placeholder="<?php echo PrivateBin\i18n::_('Password (recommended)'); ?>" size="32" />
 					</div><?php
 endif; ?>
-					<div id="formatter" class="button hidden"><?php echo i18n::_('Format'); ?>:
+					<div id="formatter" class="button hidden"><?php echo PrivateBin\i18n::_('Format'); ?>:
 						<select id="pasteFormatter" name="pasteFormatter"><?php
 foreach ($FORMATTER as $key => $value): ?>
 							<option value="<?php echo $key; ?>"<?php
@@ -122,21 +122,21 @@ endif; ?>
 					<div id="deletelink"></div>
 					<div id="pastelink"><?php
 if (strlen($URLSHORTENER)): ?>
-						<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>"><img src="img/icon_shorten.png" width="13" height="15" /><?php echo i18n::_('Shorten URL'); ?></button><?php
+						<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>"><img src="img/icon_shorten.png" width="13" height="15" /><?php echo PrivateBin\i18n::_('Shorten URL'); ?></button><?php
 endif; ?>
 					</div>
 				</div><?php
 if ($FILEUPLOAD): ?>
-				<div id="attachment" class="hidden"><a><?php echo i18n::_('Download attachment'); ?></a></div>
+				<div id="attachment" class="hidden"><a><?php echo PrivateBin\i18n::_('Download attachment'); ?></a></div>
 				<div id="attach" class="hidden">
-					<span id="clonedfile" class="hidden"><?php echo i18n::_('Cloned file attached.'); ?></span>
-					<span id="filewrap"><?php echo i18n::_('Attach a file'); ?>: <input type="file" id="file" name="file" /></span>
-					<button id="fileremovebutton"><?php echo i18n::_('Remove attachment'); ?></button>
+					<span id="clonedfile" class="hidden"><?php echo PrivateBin\i18n::_('Cloned file attached.'); ?></span>
+					<span id="filewrap"><?php echo PrivateBin\i18n::_('Attach a file'); ?>: <input type="file" id="file" name="file" /></span>
+					<button id="fileremovebutton"><?php echo PrivateBin\i18n::_('Remove attachment'); ?></button>
 				</div><?php
 endif; ?>
 				<div id="preview" class="hidden">
-					<button id="messageedit"><?php echo i18n::_('Editor'); ?></button>
-					<button id="messagepreview"><?php echo i18n::_('Preview'); ?></button>
+					<button id="messageedit"><?php echo PrivateBin\i18n::_('Editor'); ?></button>
+					<button id="messagepreview"><?php echo PrivateBin\i18n::_('Preview'); ?></button>
 				</div>
 				<div id="image" class="hidden"></div>
 				<div id="prettymessage" class="hidden">
@@ -148,7 +148,7 @@ endif; ?>
 		</section>
 		<section>
 			<div id="discussion" class="hidden">
-				<h4 class="title"><?php echo i18n::_('Discussion'); ?></h4>
+				<h4 class="title"><?php echo PrivateBin\i18n::_('Discussion'); ?></h4>
 				<div id="comments"></div>
 			</div>
 		</section>

+ 0 - 8
tst/auto.php

@@ -1,8 +0,0 @@
-<?php
-class autoTest extends PHPUnit_Framework_TestCase
-{
-    public function testAutoloaderReturnsFalseWhenCallingNonExistingClass()
-    {
-        $this->assertFalse(auto::loader('foo2501bar42'), 'calling non existent class');
-    }
-}

+ 4 - 1
tst/bootstrap.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\serversalt;
+
 error_reporting( E_ALL | E_STRICT );
 
 // change this, if your php files and data is outside of your webservers document root
@@ -7,7 +10,7 @@ if (!defined('PATH')) define('PATH', '..' . DIRECTORY_SEPARATOR);
 if (!defined('CONF')) define('CONF', PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini');
 if (!is_file(CONF)) copy(CONF . '.sample', CONF);
 
-require PATH . 'lib/auto.php';
+require PATH . 'vendor/autoload.php';
 
 class helper
 {

+ 3 - 0
tst/configuration.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\configuration;
+
 class configurationTest extends PHPUnit_Framework_TestCase
 {
     private $_options;

+ 3 - 0
tst/filter.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\filter;
+
 class filterTest extends PHPUnit_Framework_TestCase
 {
     public function testFilterStripsSlashesDeeply()

+ 3 - 0
tst/i18n.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\i18n;
+
 class i18nTest extends PHPUnit_Framework_TestCase
 {
     private $_translations = array();

+ 7 - 1
tst/jsonApi.php

@@ -1,4 +1,10 @@
 <?php
+
+use PrivateBin\data\data;
+use PrivateBin\privatebin;
+use PrivateBin\request;
+use PrivateBin\serversalt;
+
 class jsonApiTest extends PHPUnit_Framework_TestCase
 {
     protected $_model;
@@ -6,7 +12,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
     public function setUp()
     {
         /* Setup Routine */
-        $this->_model = privatebin_data::getInstance(array('dir' => PATH . 'data'));
+        $this->_model = data::getInstance(array('dir' => PATH . 'data'));
         serversalt::setPath(PATH . 'data');
         $this->reset();
     }

+ 11 - 4
tst/model.php

@@ -1,4 +1,11 @@
 <?php
+
+use PrivateBin\configuration;
+use PrivateBin\data\db;
+use PrivateBin\model;
+use PrivateBin\model\paste;
+use PrivateBin\vizhash16x16;
+
 class modelTest extends PHPUnit_Framework_TestCase
 {
     private $_conf;
@@ -165,9 +172,9 @@ class modelTest extends PHPUnit_Framework_TestCase
 
     public function testPasteIdValidation()
     {
-        $this->assertTrue(model_paste::isValidId('a242ab7bdfb2581a'), 'valid paste id');
-        $this->assertFalse(model_paste::isValidId('foo'), 'invalid hex values');
-        $this->assertFalse(model_paste::isValidId('../bar/baz'), 'path attack');
+        $this->assertTrue(paste::isValidId('a242ab7bdfb2581a'), 'valid paste id');
+        $this->assertFalse(paste::isValidId('foo'), 'invalid hex values');
+        $this->assertFalse(paste::isValidId('../bar/baz'), 'path attack');
     }
 
     /**
@@ -214,7 +221,7 @@ class modelTest extends PHPUnit_Framework_TestCase
     public function testPurge()
     {
         $conf = new configuration;
-        $store = privatebin_db::getInstance($conf->getSection('model_options'));
+        $store = db::getInstance($conf->getSection('model_options'));
         $store->delete(helper::getPasteId());
         $expired = helper::getPaste(array('expire_date' => 1344803344));
         $paste = helper::getPaste(array('expire_date' => time() + 3600));

+ 1 - 1
tst/phpunit.xml

@@ -7,7 +7,7 @@
 		<whitelist>
 			<directory suffix=".php">../lib</directory>
 			<exclude>
-				<file>../lib/privatebin/abstract.php</file>
+				<file>../lib/data/AbstractData.php</file>
 			</exclude>
 		</whitelist>
 	</filter>

+ 7 - 1
tst/privatebin.php

@@ -1,4 +1,10 @@
 <?php
+
+use PrivateBin\data\data;
+use PrivateBin\privatebin;
+use PrivateBin\serversalt;
+use PrivateBin\trafficlimiter;
+
 class privatebinTest extends PHPUnit_Framework_TestCase
 {
     protected $_model;
@@ -6,7 +12,7 @@ class privatebinTest extends PHPUnit_Framework_TestCase
     public function setUp()
     {
         /* Setup Routine */
-        $this->_model = privatebin_data::getInstance(array('dir' => PATH . 'data'));
+        $this->_model = data::getInstance(array('dir' => PATH . 'data'));
         $this->reset();
     }
 

+ 4 - 1
tst/privatebin/data.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\data\data;
+
 class privatebin_dataTest extends PHPUnit_Framework_TestCase
 {
     private $_model;
@@ -9,7 +12,7 @@ class privatebin_dataTest extends PHPUnit_Framework_TestCase
     {
         /* Setup Routine */
         $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
-        $this->_model = privatebin_data::getInstance(array('dir' => $this->_path));
+        $this->_model = data::getInstance(array('dir' => $this->_path));
     }
 
     public function tearDown()

+ 17 - 14
tst/privatebin/db.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\data\db;
+
 class privatebin_dbTest extends PHPUnit_Framework_TestCase
 {
     private $_model;
@@ -13,7 +16,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
     public function setUp()
     {
         /* Setup Routine */
-        $this->_model = privatebin_db::getInstance($this->_options);
+        $this->_model = db::getInstance($this->_options);
     }
 
     public function tearDown()
@@ -110,7 +113,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
      */
     public function testGetIbmInstance()
     {
-        privatebin_db::getInstance(array(
+        db::getInstance(array(
             'dsn' => 'ibm:', 'usr' => null, 'pwd' => null,
             'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
         ));
@@ -121,7 +124,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
      */
     public function testGetInformixInstance()
     {
-        privatebin_db::getInstance(array(
+        db::getInstance(array(
             'dsn' => 'informix:', 'usr' => null, 'pwd' => null,
             'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
         ));
@@ -132,7 +135,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
      */
     public function testGetMssqlInstance()
     {
-        privatebin_db::getInstance(array(
+        db::getInstance(array(
             'dsn' => 'mssql:', 'usr' => null, 'pwd' => null,
             'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
         ));
@@ -143,7 +146,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
      */
     public function testGetMysqlInstance()
     {
-        privatebin_db::getInstance(array(
+        db::getInstance(array(
             'dsn' => 'mysql:', 'usr' => null, 'pwd' => null,
             'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
         ));
@@ -154,7 +157,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
      */
     public function testGetOciInstance()
     {
-        privatebin_db::getInstance(array(
+        db::getInstance(array(
             'dsn' => 'oci:', 'usr' => null, 'pwd' => null,
             'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
         ));
@@ -165,7 +168,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
      */
     public function testGetPgsqlInstance()
     {
-        privatebin_db::getInstance(array(
+        db::getInstance(array(
             'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null,
             'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
         ));
@@ -177,7 +180,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
      */
     public function testGetFooInstance()
     {
-        privatebin_db::getInstance(array(
+        db::getInstance(array(
             'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null
         ));
     }
@@ -190,7 +193,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
     {
         $options = $this->_options;
         unset($options['dsn']);
-        privatebin_db::getInstance($options);
+        db::getInstance($options);
     }
 
     /**
@@ -201,7 +204,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
     {
         $options = $this->_options;
         unset($options['usr']);
-        privatebin_db::getInstance($options);
+        db::getInstance($options);
     }
 
     /**
@@ -212,7 +215,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
     {
         $options = $this->_options;
         unset($options['pwd']);
-        privatebin_db::getInstance($options);
+        db::getInstance($options);
     }
 
     /**
@@ -223,7 +226,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
     {
         $options = $this->_options;
         unset($options['opt']);
-        privatebin_db::getInstance($options);
+        db::getInstance($options);
     }
 
     public function testOldAttachments()
@@ -233,7 +236,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
         @unlink($path);
         $this->_options['dsn'] = 'sqlite:' . $path;
         $this->_options['tbl'] = 'bar_';
-        $model = privatebin_db::getInstance($this->_options);
+        $model = db::getInstance($this->_options);
 
         $original = $paste = helper::getPasteWithAttachment(array('expire_date' => 1344803344));
         $paste['meta']['attachment'] = $paste['attachment'];
@@ -301,7 +304,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
             'vizhash BLOB, ' .
             "postdate INT );"
         );
-        privatebin_db::getInstance($this->_options);
+        db::getInstance($this->_options);
         helper::rmdir(PATH . 'data');
     }
 }

+ 7 - 1
tst/privatebinWithDb.php

@@ -1,4 +1,10 @@
 <?php
+
+use PrivateBin\data\db;
+use PrivateBin\privatebin;
+use PrivateBin\serversalt;
+use PrivateBin\trafficlimiter;
+
 require_once 'privatebin.php';
 
 class privatebinWithDbTest extends privatebinTest
@@ -20,7 +26,7 @@ class privatebinWithDbTest extends privatebinTest
         $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
         if(!is_dir($this->_path)) mkdir($this->_path);
         $this->_options['dsn'] = 'sqlite:' . $this->_path . DIRECTORY_SEPARATOR . 'tst.sq3';
-        $this->_model = privatebin_db::getInstance($this->_options);
+        $this->_model = db::getInstance($this->_options);
         $this->reset();
     }
 

+ 3 - 0
tst/purgelimiter.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\purgelimiter;
+
 class purgelimiterTest extends PHPUnit_Framework_TestCase
 {
     private $_path;

+ 3 - 0
tst/request.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\request;
+
 class requestTest extends PHPUnit_Framework_TestCase
 {
     public function setUp()

+ 3 - 0
tst/serversalt.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\serversalt;
+
 class serversaltTest extends PHPUnit_Framework_TestCase
 {
     private $_path;

+ 3 - 0
tst/sjcl.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\sjcl;
+
 class sjclTest extends PHPUnit_Framework_TestCase
 {
     public function testSjclValidatorValidatesCorrectly()

+ 3 - 0
tst/trafficlimiter.php

@@ -1,4 +1,7 @@
 <?php
+
+use PrivateBin\trafficlimiter;
+
 class trafficlimiterTest extends PHPUnit_Framework_TestCase
 {
     private $_path;

+ 4 - 0
tst/view.php

@@ -1,4 +1,8 @@
 <?php
+
+use PrivateBin\i18n;
+use PrivateBin\view;
+
 class viewTest extends PHPUnit_Framework_TestCase
 {
     private static $error = 'foo bar';

+ 4 - 0
tst/vizhash16x16.php

@@ -1,4 +1,8 @@
 <?php
+
+use PrivateBin\serversalt;
+use PrivateBin\vizhash16x16;
+
 class vizhash16x16Test extends PHPUnit_Framework_TestCase
 {
     private $_file;