Просмотр исходного кода

refactoring to improve code quality

El RIDO 10 лет назад
Родитель
Сommit
3b3b5277eb

+ 10 - 0
composer.json

@@ -1,4 +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.",
+    "version": "0.22",
+    "repositories": [
+        {
+            "type": "vcs",
+            "url": "https://github.com/PrivateBin/PrivateBin"
+        }
+    ],
+    "license":"zlib-acknowledgement",
     "require-dev": {
         "phpunit/phpunit": "4.8.*",
         "codacy/coverage": "dev-master",

+ 2 - 2
js/privatebin.js

@@ -507,7 +507,7 @@ $(function() {
 
         /**
          * Get the pastes unique identifier from the URL
-         * eg. http://server.com/zero/?c05354954c49a487#xxx --> c05354954c49a487
+         * eg. http://server.com/zero/?c05354954c49a487#c05354954c49a487 returns c05354954c49a487
          *
          * @return string unique identifier
          */
@@ -589,7 +589,7 @@ $(function() {
                         this.prettyPrint.html(
                             prettyPrintOne(text, null, true)
                         );
-                    };
+                    }
                 default:
                     // Convert URLs to clickable links.
                     helper.urls2links(this.clearText);

+ 5 - 20
lib/RainTPL.php

@@ -321,7 +321,7 @@ class RainTPL{
 
 			// file doesn't exsist, or the template was updated, Rain will compile the template
 			if( !file_exists( $this->tpl['compiled_filename'] ) || ( self::$check_template_update && filemtime($this->tpl['compiled_filename']) < filemtime( $this->tpl['tpl_filename'] ) ) ){
-				$this->compileFile( $tpl_basename, $tpl_basedir, $this->tpl['tpl_filename'], PATH . self::$cache_dir, $this->tpl['compiled_filename'] );
+				$this->compileFile( $tpl_basedir, $this->tpl['tpl_filename'], PATH . self::$cache_dir, $this->tpl['compiled_filename'] );
 				return true;
 			}
 			$this->tpl['checked'] = true;
@@ -347,7 +347,6 @@ class RainTPL{
 	 * Compile and write the compiled template file
 	 *
 	 * @access protected
-	 * @param  string $tpl_basename
 	 * @param  string $tpl_basedir
 	 * @param  string $tpl_filename
 	 * @param  string $cache_dir
@@ -355,7 +354,7 @@ class RainTPL{
 	 * @throws RainTpl_Exception
 	 * @return void
 	 */
-	protected function compileFile( $tpl_basename, $tpl_basedir, $tpl_filename, $cache_dir, $compiled_filename ){
+	protected function compileFile( $tpl_basedir, $tpl_filename, $cache_dir, $compiled_filename ){
 
 		//read template file
 		$this->tpl['source'] = $template_code = file_get_contents( $tpl_filename );
@@ -1036,13 +1035,13 @@ class RainTPL{
 			$e->getTemplateFile()
 		);
 		if ($e instanceof RainTpl_SyntaxException) {
-			if (null != $e->getTemplateLine()) {
+			if (null !== $e->getTemplateLine()) {
 				$output .= '<p>line: ' . $e->getTemplateLine() . '</p>';
 			}
-			if (null != $e->getTag()) {
+			if (null !== $e->getTag()) {
 				$output .= '<p>in tag: ' . htmlspecialchars($e->getTag()) . '</p>';
 			}
-			if (null != $e->getTemplateLine() && null != $e->getTag()) {
+			if (null !== $e->getTemplateLine() && null !== $e->getTag()) {
 				$rows=explode("\n",  htmlspecialchars($this->tpl['source']));
 				$rows[$e->getTemplateLine()] = '<font color=red>' . $rows[$e->getTemplateLine()] . '</font>';
 				$output .= '<h3>template code</h3>' . implode('<br />', $rows) . '</pre>';
@@ -1162,18 +1161,4 @@ class RainTpl_SyntaxException extends RainTpl_Exception{
 	}
 }
 
-/**
- * shorthand translate function for use in templates
- *
- * alias for i18n::translate()
- *
- * @access public
- * @param  string $messageId
- * @param  mixed $args one or multiple parameters injected into placeholders
- * @return string
- */
-function t() {
-	return call_user_func_array(array('i18n', 'translate'), func_get_args());
-}
-
 // -- end

+ 11 - 3
lib/configuration.php

@@ -29,7 +29,7 @@ class configuration
      *
      * @var array
      */
-    private $_defaults = array(
+    private static $_defaults = array(
         'main' => array(
             'discussion' => true,
             'opendiscussion' => false,
@@ -97,7 +97,7 @@ class configuration
             }
         }
         $opts = '_options';
-        foreach ($this->_defaults as $section => $values)
+        foreach (self::getDefaults() as $section => $values)
         {
             // fill missing sections with default values
             if (!array_key_exists($section, $config) || count($config[$section]) == 0)
@@ -197,6 +197,15 @@ class configuration
         return $this->_configuration;
     }
 
+    /**
+     * get default configuration as array
+     *
+     * return array
+     */
+    public static function getDefaults()
+    {
+        return self::$_defaults;
+    }
 
     /**
      * get a key from the configuration, typically the main section or all keys
@@ -216,7 +225,6 @@ class configuration
         return $this->_configuration[$section][$key];
     }
 
-
     /**
      * get a section from the configuration, must exist
      *

+ 40 - 23
lib/privatebin/db.php

@@ -102,14 +102,14 @@ class privatebin_db extends privatebin_abstract
                 $tables = self::$_db->query($tableQuery)->fetchAll(PDO::FETCH_COLUMN, 0);
 
                 // create paste table if necessary
-                if (!in_array(self::$_prefix . 'paste', $tables))
+                if (!in_array(self::_sanitizeIdentifier('paste'), $tables))
                 {
                     self::_createPasteTable();
                     $db_tables_exist = false;
                 }
 
                 // create comment table if necessary
-                if (!in_array(self::$_prefix . 'comment', $tables))
+                if (!in_array(self::_sanitizeIdentifier('comment'), $tables))
                 {
                     self::_createCommentTable();
                     $db_tables_exist = false;
@@ -117,7 +117,7 @@ class privatebin_db extends privatebin_abstract
 
                 // create config table if necessary
                 $db_version = privatebin::VERSION;
-                if (!in_array(self::$_prefix . 'config', $tables))
+                if (!in_array(self::_sanitizeIdentifier('config'), $tables))
                 {
                     self::_createConfigTable();
                     // if we only needed to create the config table, the DB is older then 0.22
@@ -190,7 +190,8 @@ class privatebin_db extends privatebin_abstract
             unset($meta['attachmentname']);
         }
         return self::_exec(
-            'INSERT INTO ' . self::$_prefix . 'paste VALUES(?,?,?,?,?,?,?,?,?)',
+            'INSERT INTO ' . self::_sanitizeIdentifier('paste') .
+            ' VALUES(?,?,?,?,?,?,?,?,?)',
             array(
                 $pasteid,
                 $paste['data'],
@@ -219,8 +220,8 @@ class privatebin_db extends privatebin_abstract
         ) {
             self::$_cache[$pasteid] = false;
             $paste = self::_select(
-                'SELECT * FROM ' . self::$_prefix . 'paste WHERE dataid = ?',
-                array($pasteid), true
+                'SELECT * FROM ' . self::_sanitizeIdentifier('paste') .
+                ' WHERE dataid = ?', array($pasteid), true
             );
 
             if(false !== $paste) {
@@ -279,12 +280,12 @@ class privatebin_db extends privatebin_abstract
     public function delete($pasteid)
     {
         self::_exec(
-            'DELETE FROM ' . self::$_prefix . 'paste WHERE dataid = ?',
-            array($pasteid)
+            'DELETE FROM ' . self::_sanitizeIdentifier('paste') .
+            ' WHERE dataid = ?', array($pasteid)
         );
         self::_exec(
-            'DELETE FROM ' . self::$_prefix . 'comment WHERE pasteid = ?',
-            array($pasteid)
+            'DELETE FROM ' . self::_sanitizeIdentifier('comment') .
+            ' WHERE pasteid = ?', array($pasteid)
         );
         if (
             array_key_exists($pasteid, self::$_cache)
@@ -319,7 +320,8 @@ class privatebin_db extends privatebin_abstract
     public function createComment($pasteid, $parentid, $commentid, $comment)
     {
         return self::_exec(
-            'INSERT INTO ' . self::$_prefix . 'comment VALUES(?,?,?,?,?,?,?)',
+            'INSERT INTO ' . self::_sanitizeIdentifier('comment') .
+            ' VALUES(?,?,?,?,?,?,?)',
             array(
                 $commentid,
                 $pasteid,
@@ -342,8 +344,8 @@ class privatebin_db extends privatebin_abstract
     public function readComments($pasteid)
     {
         $rows = self::_select(
-            'SELECT * FROM ' . self::$_prefix . 'comment WHERE pasteid = ?',
-            array($pasteid)
+            'SELECT * FROM ' . self::_sanitizeIdentifier('comment') .
+            ' WHERE pasteid = ?', array($pasteid)
         );
 
         // create comment list
@@ -381,8 +383,8 @@ class privatebin_db extends privatebin_abstract
     public function existsComment($pasteid, $parentid, $commentid)
     {
         return (bool) self::_select(
-            'SELECT dataid FROM ' . self::$_prefix . 'comment ' .
-            'WHERE pasteid = ? AND parentid = ? AND dataid = ?',
+            'SELECT dataid FROM ' . self::_sanitizeIdentifier('comment') .
+            ' WHERE pasteid = ? AND parentid = ? AND dataid = ?',
             array($pasteid, $parentid, $commentid), true
         );
     }
@@ -495,8 +497,8 @@ class privatebin_db extends privatebin_abstract
     private static function _getConfig($key)
     {
         $row = self::_select(
-            'SELECT value FROM ' . self::$_prefix . 'config WHERE id = ?',
-            array($key), true
+            'SELECT value FROM ' . self::_sanitizeIdentifier('config') .
+            ' WHERE id = ?', array($key), true
         );
         return $row['value'];
     }
@@ -534,7 +536,7 @@ class privatebin_db extends privatebin_abstract
     {
         list($main_key, $after_key) = self::_getPrimaryKeyClauses();
         self::$_db->exec(
-            'CREATE TABLE ' . self::$_prefix . 'paste ( ' .
+            'CREATE TABLE ' . self::_sanitizeIdentifier('paste') . ' ( ' .
             "dataid CHAR(16) NOT NULL$main_key, " .
             'data BLOB, ' .
             'postdate INT, ' .
@@ -558,7 +560,7 @@ class privatebin_db extends privatebin_abstract
     {
         list($main_key, $after_key) = self::_getPrimaryKeyClauses();
         self::$_db->exec(
-            'CREATE TABLE ' . self::$_prefix . 'comment ( ' .
+            'CREATE TABLE ' . self::_sanitizeIdentifier('comment') . ' ( ' .
             "dataid CHAR(16) NOT NULL$main_key, " .
             'pasteid CHAR(16), ' .
             'parentid CHAR(16), ' .
@@ -568,7 +570,8 @@ class privatebin_db extends privatebin_abstract
             "postdate INT$after_key );"
         );
         self::$_db->exec(
-            'CREATE INDEX parent ON ' . self::$_prefix . 'comment(pasteid);'
+            'CREATE INDEX parent ON ' . self::_sanitizeIdentifier('comment') .
+            '(pasteid);'
         );
     }
 
@@ -583,15 +586,29 @@ class privatebin_db extends privatebin_abstract
     {
         list($main_key, $after_key) = self::_getPrimaryKeyClauses('id');
         self::$_db->exec(
-            'CREATE TABLE ' . self::$_prefix . 'config ( ' .
-            "id CHAR(16) NOT NULL$main_key, value TEXT$after_key );"
+            'CREATE TABLE ' . self::_sanitizeIdentifier('config') .
+            " ( id CHAR(16) NOT NULL$main_key, value TEXT$after_key );"
         );
         self::_exec(
-            'INSERT INTO ' . self::$_prefix . 'config VALUES(?,?)',
+            'INSERT INTO ' . self::_sanitizeIdentifier('config') .
+            ' VALUES(?,?)',
             array('VERSION', privatebin::VERSION)
         );
     }
 
+    /**
+     * sanitizes identifiers
+     *
+     * @access private
+     * @static
+     * @param  string $identifier
+     * @return string
+     */
+    private static function _sanitizeIdentifier($identifier)
+    {
+        return self::$_prefix . preg_replace('/[^A-Za-z0-9_]+/', '', $identifier);
+    }
+
     /**
      * upgrade the database schema from an old version
      *

+ 1 - 1
lib/request.php

@@ -257,4 +257,4 @@ class request
         }
         return false;
     }
-}
+}

+ 2 - 1
lib/vizhash16x16.php

@@ -91,10 +91,11 @@ class vizhash16x16
         // We hash the input string.
         $hash=hash('sha1',$text.$this->salt).hash('md5',$text.$this->salt);
         $hash=$hash.strrev($hash);  # more data to make graphics
+        $hashlen=strlen($hash);
 
         // We convert the hash into an array of integers.
         $this->VALUES=array();
-        for($i=0; $i<strlen($hash); $i=$i+2){ array_push($this->VALUES,hexdec(substr($hash,$i,2))); }
+        for($i=0; $i<$hashlen; $i=$i+2){ array_push($this->VALUES,hexdec(substr($hash,$i,2))); }
         $this->VALUES_INDEX=0; // to walk the array.
 
         // Then use these integers to drive the creation of an image.

+ 25 - 25
tpl/bootstrap-compact.html

@@ -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>{function="t('PrivateBin')"}</title>
+		<title>{function="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?{$VERSION|rawurlencode}" />{if="$SYNTAXHIGHLIGHTING"}
@@ -34,24 +34,24 @@
 			<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">{function="t('Toggle navigation')"}</span>
+						<span class="sr-only">{function="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="/">{function="t('PrivateBin')"}</a>
+				<a class="reloadlink navbar-brand" href="/">{function="i18n::_('PrivateBin')"}</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> {function="t('Send')"}
+								<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> {function="i18n::_('Send')"}
 							</button>{if="$EXPIRECLONE"}
 							<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="t('Clone')"}
+								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="i18n::_('Clone')"}
 							</button>{/if}
 							<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="t('Raw text')"}
+								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="i18n::_('Raw text')"}
 							</button>
 						</li>
 						<li class="dropdown">
@@ -59,7 +59,7 @@
 {loop="EXPIRE"}
 								<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Expires')"}: <span id="pasteExpirationDisplay">{$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">{function="i18n::_('Expires')"}: <span id="pasteExpirationDisplay">{$EXPIRE[$EXPIREDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="EXPIRE"}
 								<li>
@@ -70,24 +70,24 @@
 							</ul>
 						</li>
 						<li id="formatter" class="dropdown">
-							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Options')"} <span class="caret"></span></a>
+							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="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" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
-										{function="t('Burn after reading')"}
+										{function="i18n::_('Burn after reading')"}
 									</label>
 								</li>{if="$DISCUSSION"}
 								<li id="opendisc" class="checkbox hidden">
 									<label>
 										<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="$OPENDISCUSSION"} checked="checked"{/if} />
-										{function="t('Open discussion')"}
+										{function="i18n::_('Open discussion')"}
 									</label>
 								</li>{/if}
 								<li role="separator" class="divider"></li>
 								<li>
 									<div>
-										{function="t('Format')"}: <span id="pasteFormatterDisplay">{$FORMATTER[$FORMATTERDEFAULT]}</span> <span class="caret"></span>
+										{function="i18n::_('Format')"}: <span id="pasteFormatterDisplay">{$FORMATTER[$FORMATTERDEFAULT]}</span> <span class="caret"></span>
 									</div>
 								</li>
 {loop="FORMATTER"}
@@ -104,11 +104,11 @@
 						</li>{if="$PASSWORD"}
 						<li>
 							<div id="password" class="navbar-form hidden">
-								<input type="password" id="passwordinput" placeholder="{function="t('Password (recommended)')"}" class="form-control" size="19"/>
+								<input type="password" id="passwordinput" placeholder="{function="i18n::_('Password (recommended)')"}" class="form-control" size="19"/>
 							</div>
 						</li>{/if}{if="$FILEUPLOAD"}
 						<li id="attach" class="hidden dropdown">
-							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Attach a file')"} <span class="caret"></span></a>
+							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="i18n::_('Attach a file')"} <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 								<li id="filewrap">
 									<div>
@@ -117,7 +117,7 @@
 								</li>
 								<li>
 									<a id="fileremovebutton"  href="#">
-										{function="t('Remove attachment')"}
+										{function="i18n::_('Remove attachment')"}
 									</a>
 								</li>
 							</ul>
@@ -137,7 +137,7 @@
 						</li>{/if}
 						<li>
 							<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {function="t('New')"}
+								<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {function="i18n::_('New')"}
 							</button>
 						</li>
 					</ul>
@@ -152,15 +152,15 @@
 				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
 			</div>{if="$FILEUPLOAD"}
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="t('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="t('Cloned file attached.')"}</span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="i18n::_('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="i18n::_('Cloned file attached.')"}</span>
 			</div>{/if}{if="strlen($STATUS)"}
 			<div id="status" role="alert" class="alert alert-success">
 				<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> {$STATUS|htmlspecialchars}
 			</div>{/if}
 			<div id="errormessage" role="alert" class="{if="!strlen($ERROR)"}hidden {/if}alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> {$ERROR|htmlspecialchars}</div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> {function="t('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> {function="t('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> {function="t('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> {function="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> {function="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> {function="i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:')"}
 				<a href="http://www.mozilla.org/firefox/">Firefox</a>, 
 				<a href="http://www.opera.com/">Opera</a>, 
 				<a href="http://www.google.com/chrome">Chrome</a>, 
@@ -171,13 +171,13 @@
 				<div id="deletelink"></div>
 				<div id="pastelink">{if="strlen($URLSHORTENER)"}
 					<button id="shortenbutton" data-shortener="{$URLSHORTENER|htmlspecialchars}" type="button" class="btn btn-primary">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="t('Shorten URL')"}
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="i18n::_('Shorten URL')"}
 					</button>
 				{/if}</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#">{function="t('Editor')"}</a></li>
-				<li role="presentation"><a id="messagepreview" href="#">{function="t('Preview')"}</a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#">{function="i18n::_('Editor')"}</a></li>
+				<li role="presentation"><a id="messagepreview" href="#">{function="i18n::_('Preview')"}</a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -192,16 +192,16 @@
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4>{function="t('Discussion')"}</h4>
+				<h4>{function="i18n::_('Discussion')"}</h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8">{function="t('PrivateBin')"} <small>- {function="t('Because ignorance is bliss')"}</small></h4>
+				<h4 class="col-md-5 col-xs-8">{function="i18n::_('PrivateBin')"} <small>- {function="i18n::_('Because ignorance is bliss')"}</small></h4>
 				<p class="col-md-1 col-xs-4 text-center">{$VERSION}</p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					{function="t('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/elrido/PrivateBin/wiki">project page</a>.')"}
+					{function="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/elrido/PrivateBin/wiki">project page</a>.')"}
 				</p>
 			</div>
 		</footer>

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

@@ -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>{function="t('PrivateBin')"}</title>
+		<title>{function="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?{$VERSION|rawurlencode}" />{if="$SYNTAXHIGHLIGHTING"}
@@ -33,24 +33,24 @@
 		<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">{function="t('Toggle navigation')"}</span>
+						<span class="sr-only">{function="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="/">{function="t('PrivateBin')"}</a>
+				<a class="reloadlink navbar-brand" href="/">{function="i18n::_('PrivateBin')"}</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> {function="t('Send')"}
+								<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> {function="i18n::_('Send')"}
 							</button>{if="$EXPIRECLONE"}
 							<button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn">
-								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="t('Clone')"}
+								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="i18n::_('Clone')"}
 							</button>{/if}
 							<button id="rawtextbutton" type="button" class="hidden btn btn-warning navbar-btn">
-								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="t('Raw text')"}
+								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="i18n::_('Raw text')"}
 							</button>
 						</li>
 						<li class="dropdown">
@@ -58,7 +58,7 @@
 {loop="EXPIRE"}
 								<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Expires')"}: <span id="pasteExpirationDisplay">{$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">{function="i18n::_('Expires')"}: <span id="pasteExpirationDisplay">{$EXPIRE[$EXPIREDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="EXPIRE"}
 								<li>
@@ -72,7 +72,7 @@
 							<div id="burnafterreadingoption" class="navbar-text checkbox hidden">
 								<label>
 									<input type="checkbox" id="burnafterreading" name="burnafterreading" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
-									{function="t('Burn after reading')"}
+									{function="i18n::_('Burn after reading')"}
 								</label>
 							</div>
 						</li>{if="$DISCUSSION"}
@@ -80,17 +80,17 @@
 							<div id="opendisc" class="navbar-text checkbox hidden">
 								<label>
 									<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="$OPENDISCUSSION"} checked="checked"{/if} />
-									{function="t('Open discussion')"}
+									{function="i18n::_('Open discussion')"}
 							 	</label>
 							</div>
 						</li>{/if}{if="$PASSWORD"}
 						<li>
 							<div id="password" class="navbar-form hidden">
-								<input type="password" id="passwordinput" placeholder="{function="t('Password (recommended)')"}" class="form-control" size="19"/>
+								<input type="password" id="passwordinput" placeholder="{function="i18n::_('Password (recommended)')"}" class="form-control" size="19"/>
 							</div>
 						</li>{/if}{if="$FILEUPLOAD"}
 						<li id="attach" class="hidden dropdown">
-							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Attach a file')"} <span class="caret"></span></a>
+							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="i18n::_('Attach a file')"} <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 								<li id="filewrap">
 									<div>
@@ -99,7 +99,7 @@
 								</li>
 								<li>
 									<a id="fileremovebutton"  href="#">
-										{function="t('Remove attachment')"}
+										{function="i18n::_('Remove attachment')"}
 									</a>
 								</li>
 							</ul>
@@ -109,7 +109,7 @@
 {loop="FORMATTER"}
 								<option value="{$key}"{if="$key == $FORMATTERDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Format')"}: <span id="pasteFormatterDisplay">{$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">{function="i18n::_('Format')"}: <span id="pasteFormatterDisplay">{$FORMATTER[$FORMATTERDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="FORMATTER"}
 								<li>
@@ -134,7 +134,7 @@
 					</li>{/if}
 					<li>
 						<button id="newbutton" type="button" class="reloadlink hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {function="t('New')"}
+							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {function="i18n::_('New')"}
 						</button>
 					</li>
 				</ul>
@@ -148,15 +148,15 @@
 				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
 			</div>{if="$FILEUPLOAD"}
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="t('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="t('Cloned file attached.')"}</span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="i18n::_('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="i18n::_('Cloned file attached.')"}</span>
 			</div>{/if}{if="strlen($STATUS)"}
 			<div id="status" role="alert" class="alert alert-success">
 				<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> {$STATUS|htmlspecialchars}
 			</div>{/if}
 			<div id="errormessage" role="alert" class="{if="!strlen($ERROR)"}hidden {/if}alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> {$ERROR|htmlspecialchars}</div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-error"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> {function="t('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> {function="t('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> {function="t('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> {function="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> {function="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> {function="i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:')"}
 				<a href="http://www.mozilla.org/firefox/">Firefox</a>, 
 				<a href="http://www.opera.com/">Opera</a>, 
 				<a href="http://www.google.com/chrome">Chrome</a>, 
@@ -167,13 +167,13 @@
 				<div id="deletelink"></div>
 				<div id="pastelink">{if="strlen($URLSHORTENER)"}
 					<button id="shortenbutton" data-shortener="{$URLSHORTENER|htmlspecialchars}" type="button" class="btn btn-warning">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="t('Shorten URL')"}
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="i18n::_('Shorten URL')"}
 					</button>
 				{/if}</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#">{function="t('Editor')"}</a></li>
-				<li role="presentation"><a id="messagepreview" href="#">{function="t('Preview')"}</a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#">{function="i18n::_('Editor')"}</a></li>
+				<li role="presentation"><a id="messagepreview" href="#">{function="i18n::_('Preview')"}</a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -188,16 +188,16 @@
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4>{function="t('Discussion')"}</h4>
+				<h4>{function="i18n::_('Discussion')"}</h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8">{function="t('PrivateBin')"} <small>- {function="t('Because ignorance is bliss')"}</small></h4>
+				<h4 class="col-md-5 col-xs-8">{function="i18n::_('PrivateBin')"} <small>- {function="i18n::_('Because ignorance is bliss')"}</small></h4>
 				<p class="col-md-1 col-xs-4 text-center">{$VERSION}</p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					{function="t('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/elrido/PrivateBin/wiki">project page</a>.')"}
+					{function="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/elrido/PrivateBin/wiki">project page</a>.')"}
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/bootstrap-dark.html

@@ -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>{function="t('PrivateBin')"}</title>
+		<title>{function="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?{$VERSION|rawurlencode}" />{if="$SYNTAXHIGHLIGHTING"}
@@ -33,24 +33,24 @@
 		<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">{function="t('Toggle navigation')"}</span>
+						<span class="sr-only">{function="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="/">{function="t('PrivateBin')"}</a>
+				<a class="reloadlink navbar-brand" href="/">{function="i18n::_('PrivateBin')"}</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> {function="t('New')"}
+								<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {function="i18n::_('New')"}
 							</button>{if="$EXPIRECLONE"}
 							<button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn">
-								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="t('Clone')"}
+								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="i18n::_('Clone')"}
 							</button>{/if}
 							<button id="rawtextbutton" type="button" class="hidden btn btn-warning navbar-btn">
-								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="t('Raw text')"}
+								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="i18n::_('Raw text')"}
 							</button>
 						</li>
 						<li class="dropdown">
@@ -58,7 +58,7 @@
 {loop="EXPIRE"}
 								<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Expires')"}: <span id="pasteExpirationDisplay">{$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">{function="i18n::_('Expires')"}: <span id="pasteExpirationDisplay">{$EXPIRE[$EXPIREDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="EXPIRE"}
 								<li>
@@ -72,7 +72,7 @@
 							<div id="burnafterreadingoption" class="navbar-text checkbox hidden">
 								<label>
 									<input type="checkbox" id="burnafterreading" name="burnafterreading" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
-									{function="t('Burn after reading')"}
+									{function="i18n::_('Burn after reading')"}
 								</label>
 							</div>
 						</li>{if="$DISCUSSION"}
@@ -80,17 +80,17 @@
 							<div id="opendisc" class="navbar-text checkbox hidden">
 								<label>
 									<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="$OPENDISCUSSION"} checked="checked"{/if} />
-									{function="t('Open discussion')"}
+									{function="i18n::_('Open discussion')"}
 							 	</label>
 							</div>
 						</li>{/if}{if="$PASSWORD"}
 						<li>
 							<div id="password" class="navbar-form hidden">
-								<input type="password" id="passwordinput" placeholder="{function="t('Password (recommended)')"}" class="form-control" size="19"/>
+								<input type="password" id="passwordinput" placeholder="{function="i18n::_('Password (recommended)')"}" class="form-control" size="19"/>
 							</div>
 						</li>{/if}{if="$FILEUPLOAD"}
 						<li id="attach" class="hidden dropdown">
-							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Attach a file')"} <span class="caret"></span></a>
+							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="i18n::_('Attach a file')"} <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 								<li id="filewrap">
 									<div>
@@ -99,7 +99,7 @@
 								</li>
 								<li>
 									<a id="fileremovebutton"  href="#">
-										{function="t('Remove attachment')"}
+										{function="i18n::_('Remove attachment')"}
 									</a>
 								</li>
 							</ul>
@@ -109,7 +109,7 @@
 {loop="FORMATTER"}
 								<option value="{$key}"{if="$key == $FORMATTERDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Format')"}: <span id="pasteFormatterDisplay">{$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">{function="i18n::_('Format')"}: <span id="pasteFormatterDisplay">{$FORMATTER[$FORMATTERDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="FORMATTER"}
 								<li>
@@ -134,7 +134,7 @@
 					</li>{/if}
 					<li>
 						<button id="sendbutton" type="button" class="hidden btn btn-warning navbar-btn">
-							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> {function="t('Send')"}
+							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> {function="i18n::_('Send')"}
 						</button>
 					</li>
 				</ul>
@@ -148,15 +148,15 @@
 				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
 			</div>{if="$FILEUPLOAD"}
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="t('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="t('Cloned file attached.')"}</span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="i18n::_('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="i18n::_('Cloned file attached.')"}</span>
 			</div>{/if}{if="strlen($STATUS)"}
 			<div id="status" role="alert" class="alert alert-success">
 				<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> {$STATUS|htmlspecialchars}
 			</div>{/if}
 			<div id="errormessage" role="alert" class="{if="!strlen($ERROR)"}hidden {/if}alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> {$ERROR|htmlspecialchars}</div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-error"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> {function="t('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> {function="t('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> {function="t('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> {function="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> {function="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> {function="i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:')"}
 				<a href="http://www.mozilla.org/firefox/">Firefox</a>, 
 				<a href="http://www.opera.com/">Opera</a>, 
 				<a href="http://www.google.com/chrome">Chrome</a>, 
@@ -167,13 +167,13 @@
 				<div id="deletelink"></div>
 				<div id="pastelink">{if="strlen($URLSHORTENER)"}
 					<button id="shortenbutton" data-shortener="{$URLSHORTENER|htmlspecialchars}" type="button" class="btn btn-warning">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="t('Shorten URL')"}
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="i18n::_('Shorten URL')"}
 					</button>
 				{/if}</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#">{function="t('Editor')"}</a></li>
-				<li role="presentation"><a id="messagepreview" href="#">{function="t('Preview')"}</a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#">{function="i18n::_('Editor')"}</a></li>
+				<li role="presentation"><a id="messagepreview" href="#">{function="i18n::_('Preview')"}</a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -188,16 +188,16 @@
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4>{function="t('Discussion')"}</h4>
+				<h4>{function="i18n::_('Discussion')"}</h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8">{function="t('PrivateBin')"} <small>- {function="t('Because ignorance is bliss')"}</small></h4>
+				<h4 class="col-md-5 col-xs-8">{function="i18n::_('PrivateBin')"} <small>- {function="i18n::_('Because ignorance is bliss')"}</small></h4>
 				<p class="col-md-1 col-xs-4 text-center">{$VERSION}</p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					{function="t('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/elrido/PrivateBin/wiki">project page</a>.')"}
+					{function="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/elrido/PrivateBin/wiki">project page</a>.')"}
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/bootstrap-page.html

@@ -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>{function="t('PrivateBin')"}</title>
+		<title>{function="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?{$VERSION|rawurlencode}" />{if="$SYNTAXHIGHLIGHTING"}
@@ -33,24 +33,24 @@
 		<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">{function="t('Toggle navigation')"}</span>
+						<span class="sr-only">{function="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="/">{function="t('PrivateBin')"}</a>
+				<a class="reloadlink navbar-brand" href="/">{function="i18n::_('PrivateBin')"}</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> {function="t('Send')"}
+								<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> {function="i18n::_('Send')"}
 							</button>{if="$EXPIRECLONE"}
 							<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="t('Clone')"}
+								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="i18n::_('Clone')"}
 							</button>{/if}
 							<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="t('Raw text')"}
+								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="i18n::_('Raw text')"}
 							</button>
 						</li>
 						<li class="dropdown">
@@ -58,7 +58,7 @@
 {loop="EXPIRE"}
 								<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Expires')"}: <span id="pasteExpirationDisplay">{$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">{function="i18n::_('Expires')"}: <span id="pasteExpirationDisplay">{$EXPIRE[$EXPIREDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="EXPIRE"}
 								<li>
@@ -72,7 +72,7 @@
 							<div id="burnafterreadingoption" class="navbar-text checkbox hidden">
 								<label>
 									<input type="checkbox" id="burnafterreading" name="burnafterreading" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
-									{function="t('Burn after reading')"}
+									{function="i18n::_('Burn after reading')"}
 								</label>
 							</div>
 						</li>{if="$DISCUSSION"}
@@ -80,17 +80,17 @@
 							<div id="opendisc" class="navbar-text checkbox hidden">
 								<label>
 									<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="$OPENDISCUSSION"} checked="checked"{/if} />
-									{function="t('Open discussion')"}
+									{function="i18n::_('Open discussion')"}
 							 	</label>
 							</div>
 						</li>{/if}{if="$PASSWORD"}
 						<li>
 							<div id="password" class="navbar-form hidden">
-								<input type="password" id="passwordinput" placeholder="{function="t('Password (recommended)')"}" class="form-control" size="19"/>
+								<input type="password" id="passwordinput" placeholder="{function="i18n::_('Password (recommended)')"}" class="form-control" size="19"/>
 							</div>
 						</li>{/if}{if="$FILEUPLOAD"}
 						<li id="attach" class="hidden dropdown">
-							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Attach a file')"} <span class="caret"></span></a>
+							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="i18n::_('Attach a file')"} <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 								<li id="filewrap">
 									<div>
@@ -99,7 +99,7 @@
 								</li>
 								<li>
 									<a id="fileremovebutton"  href="#">
-										{function="t('Remove attachment')"}
+										{function="i18n::_('Remove attachment')"}
 									</a>
 								</li>
 							</ul>
@@ -109,7 +109,7 @@
 {loop="FORMATTER"}
 								<option value="{$key}"{if="$key == $FORMATTERDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Format')"}: <span id="pasteFormatterDisplay">{$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">{function="i18n::_('Format')"}: <span id="pasteFormatterDisplay">{$FORMATTER[$FORMATTERDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="FORMATTER"}
 								<li>
@@ -134,7 +134,7 @@
 					</li>{/if}
 					<li>
 						<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn">
-							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {function="t('New')"}
+							<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {function="i18n::_('New')"}
 						</button>
 					</li>
 				</ul>
@@ -148,15 +148,15 @@
 				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
 			</div>{if="$FILEUPLOAD"}
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="t('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="t('Cloned file attached.')"}</span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="i18n::_('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="i18n::_('Cloned file attached.')"}</span>
 			</div>{/if}{if="strlen($STATUS)"}
 			<div id="status" role="alert" class="alert alert-success">
 				<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> {$STATUS|htmlspecialchars}
 			</div>{/if}
 			<div id="errormessage" role="alert" class="{if="!strlen($ERROR)"}hidden {/if}alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> {$ERROR|htmlspecialchars}</div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> {function="t('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> {function="t('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> {function="t('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> {function="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> {function="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> {function="i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:')"}
 				<a href="http://www.mozilla.org/firefox/">Firefox</a>, 
 				<a href="http://www.opera.com/">Opera</a>, 
 				<a href="http://www.google.com/chrome">Chrome</a>, 
@@ -167,13 +167,13 @@
 				<div id="deletelink"></div>
 				<div id="pastelink">{if="strlen($URLSHORTENER)"}
 					<button id="shortenbutton" data-shortener="{$URLSHORTENER|htmlspecialchars}" type="button" class="btn btn-primary">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="t('Shorten URL')"}
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="i18n::_('Shorten URL')"}
 					</button>
 				{/if}</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#">{function="t('Editor')"}</a></li>
-				<li role="presentation"><a id="messagepreview" href="#">{function="t('Preview')"}</a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#">{function="i18n::_('Editor')"}</a></li>
+				<li role="presentation"><a id="messagepreview" href="#">{function="i18n::_('Preview')"}</a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -188,16 +188,16 @@
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4>{function="t('Discussion')"}</h4>
+				<h4>{function="i18n::_('Discussion')"}</h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8">{function="t('PrivateBin')"} <small>- {function="t('Because ignorance is bliss')"}</small></h4>
+				<h4 class="col-md-5 col-xs-8">{function="i18n::_('PrivateBin')"} <small>- {function="i18n::_('Because ignorance is bliss')"}</small></h4>
 				<p class="col-md-1 col-xs-4 text-center">{$VERSION}</p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					{function="t('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/elrido/PrivateBin/wiki">project page</a>.')"}
+					{function="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/elrido/PrivateBin/wiki">project page</a>.')"}
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/bootstrap.html

@@ -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>{function="t('PrivateBin')"}</title>
+		<title>{function="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?{$VERSION|rawurlencode}" />{if="$SYNTAXHIGHLIGHTING"}
@@ -33,24 +33,24 @@
 		<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">{function="t('Toggle navigation')"}</span>
+						<span class="sr-only">{function="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="/">{function="t('PrivateBin')"}</a>
+				<a class="reloadlink navbar-brand" href="/">{function="i18n::_('PrivateBin')"}</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> {function="t('New')"}
+								<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {function="i18n::_('New')"}
 							</button>{if="$EXPIRECLONE"}
 							<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="t('Clone')"}
+								<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> {function="i18n::_('Clone')"}
 							</button>{/if}
 							<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn">
-								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="t('Raw text')"}
+								<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> {function="i18n::_('Raw text')"}
 							</button>
 						</li>
 						<li class="dropdown">
@@ -58,7 +58,7 @@
 {loop="EXPIRE"}
 								<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Expires')"}: <span id="pasteExpirationDisplay">{$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">{function="i18n::_('Expires')"}: <span id="pasteExpirationDisplay">{$EXPIRE[$EXPIREDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="EXPIRE"}
 								<li>
@@ -72,7 +72,7 @@
 							<div id="burnafterreadingoption" class="navbar-text checkbox hidden">
 								<label>
 									<input type="checkbox" id="burnafterreading" name="burnafterreading" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
-									{function="t('Burn after reading')"}
+									{function="i18n::_('Burn after reading')"}
 								</label>
 							</div>
 						</li>{if="$DISCUSSION"}
@@ -80,17 +80,17 @@
 							<div id="opendisc" class="navbar-text checkbox hidden">
 								<label>
 									<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="$OPENDISCUSSION"} checked="checked"{/if} />
-									{function="t('Open discussion')"}
+									{function="i18n::_('Open discussion')"}
 							 	</label>
 							</div>
 						</li>{/if}{if="$PASSWORD"}
 						<li>
 							<div id="password" class="navbar-form hidden">
-								<input type="password" id="passwordinput" placeholder="{function="t('Password (recommended)')"}" class="form-control" size="19"/>
+								<input type="password" id="passwordinput" placeholder="{function="i18n::_('Password (recommended)')"}" class="form-control" size="19"/>
 							</div>
 						</li>{/if}{if="$FILEUPLOAD"}
 						<li id="attach" class="hidden dropdown">
-							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Attach a file')"} <span class="caret"></span></a>
+							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="i18n::_('Attach a file')"} <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 								<li id="filewrap">
 									<div>
@@ -99,7 +99,7 @@
 								</li>
 								<li>
 									<a id="fileremovebutton"  href="#">
-										{function="t('Remove attachment')"}
+										{function="i18n::_('Remove attachment')"}
 									</a>
 								</li>
 							</ul>
@@ -109,7 +109,7 @@
 {loop="FORMATTER"}
 								<option value="{$key}"{if="$key == $FORMATTERDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
 							</select>
-							<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{function="t('Format')"}: <span id="pasteFormatterDisplay">{$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">{function="i18n::_('Format')"}: <span id="pasteFormatterDisplay">{$FORMATTER[$FORMATTERDEFAULT]}</span> <span class="caret"></span></a>
 							<ul class="dropdown-menu">
 {loop="FORMATTER"}
 								<li>
@@ -134,7 +134,7 @@
 					</li>{/if}
 					<li>
 						<button id="sendbutton" type="button" class="hidden btn btn-primary navbar-btn">
-							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> {function="t('Send')"}
+							<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> {function="i18n::_('Send')"}
 						</button>
 					</li>
 				</ul>
@@ -148,15 +148,15 @@
 				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
 			</div>{if="$FILEUPLOAD"}
 			<div id="attachment" role="alert" class="hidden alert alert-info">
-				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="t('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="t('Cloned file attached.')"}</span>
+				<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a>{function="i18n::_('Download attachment')"}</a> <span id="clonedfile" class="hidden">{function="i18n::_('Cloned file attached.')"}</span>
 			</div>{/if}{if="strlen($STATUS)"}
 			<div id="status" role="alert" class="alert alert-success">
 				<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> {$STATUS|htmlspecialchars}
 			</div>{/if}
 			<div id="errormessage" role="alert" class="{if="!strlen($ERROR)"}hidden {/if}alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> {$ERROR|htmlspecialchars}</div>
-			<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> {function="t('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> {function="t('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> {function="t('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> {function="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> {function="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> {function="i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:')"}
 				<a href="http://www.mozilla.org/firefox/">Firefox</a>, 
 				<a href="http://www.opera.com/">Opera</a>, 
 				<a href="http://www.google.com/chrome">Chrome</a>, 
@@ -167,13 +167,13 @@
 				<div id="deletelink"></div>
 				<div id="pastelink">{if="strlen($URLSHORTENER)"}
 					<button id="shortenbutton" data-shortener="{$URLSHORTENER|htmlspecialchars}" type="button" class="btn btn-primary">
-						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="t('Shorten URL')"}
+						<span class="glyphicon glyphicon-send" aria-hidden="true"></span> {function="i18n::_('Shorten URL')"}
 					</button>
 				{/if}</div>
 			</div>
 			<ul id="preview" class="nav nav-tabs hidden">
-				<li role="presentation" class="active"><a id="messageedit" href="#">{function="t('Editor')"}</a></li>
-				<li role="presentation"><a id="messagepreview" href="#">{function="t('Preview')"}</a></li>
+				<li role="presentation" class="active"><a id="messageedit" href="#">{function="i18n::_('Editor')"}</a></li>
+				<li role="presentation"><a id="messagepreview" href="#">{function="i18n::_('Preview')"}</a></li>
 			</ul>
 		</header>
 		<section class="container">
@@ -188,16 +188,16 @@
 		</section>
 		<section class="container">
 			<div id="discussion" class="hidden">
-				<h4>{function="t('Discussion')"}</h4>
+				<h4>{function="i18n::_('Discussion')"}</h4>
 				<div id="comments"></div>
 			</div>
 		</section>
 		<footer class="container">
 			<div class="row">
-				<h4 class="col-md-5 col-xs-8">{function="t('PrivateBin')"} <small>- {function="t('Because ignorance is bliss')"}</small></h4>
+				<h4 class="col-md-5 col-xs-8">{function="i18n::_('PrivateBin')"} <small>- {function="i18n::_('Because ignorance is bliss')"}</small></h4>
 				<p class="col-md-1 col-xs-4 text-center">{$VERSION}</p>
 				<p id="aboutbox" class="col-md-6 col-xs-12">
-					{function="t('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/elrido/PrivateBin/wiki">project page</a>.')"}
+					{function="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/elrido/PrivateBin/wiki">project page</a>.')"}
 				</p>
 			</div>
 		</footer>

+ 24 - 24
tpl/page.html

@@ -3,7 +3,7 @@
 	<head>
 		<meta charset="utf-8" />
 		<meta name="robots" content="noindex" />
-		<title>{function="t('PrivateBin')"}</title>
+		<title>{function="i18n::_('PrivateBin')"}</title>
 		<link type="text/css" rel="stylesheet" href="css/privatebin.css?{$VERSION|rawurlencode}" />{if="$SYNTAXHIGHLIGHTING"}
 		<link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?{$VERSION|rawurlencode}" />{if="strlen($SYNTAXHIGHLIGHTINGTHEME)"}
 		<link type="text/css" rel="stylesheet" href="css/prettify/{$SYNTAXHIGHLIGHTINGTHEME}.css?{$VERSION|rawurlencode}" />{/if}{/if}
@@ -27,15 +27,15 @@
 	<body>
 		<header>
 			<div id="aboutbox">
-				{function="t('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/elrido/PrivateBin/wiki">project page</a>.')"}<br />{if="strlen($NOTICE)"}
+				{function="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/elrido/PrivateBin/wiki">project page</a>.')"}<br />{if="strlen($NOTICE)"}
 				<span class="blink">▶</span> {$NOTICE}{/if}
 			</div>
-			<h1 class="title reloadlink">{function="t('PrivateBin')"}</h1><br />
-			<h2 class="title">{function="t('Because ignorance is bliss')"}</h2><br />
+			<h1 class="title reloadlink">{function="i18n::_('PrivateBin')"}</h1><br />
+			<h2 class="title">{function="i18n::_('Because ignorance is bliss')"}</h2><br />
 			<h3 class="title">{$VERSION}</h3>
-			<noscript><div id="noscript" class="nonworking">{function="t('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.')"}</div></noscript>
-			<div id="oldienotice" class="nonworking">{function="t('PrivateBin requires a modern browser to work.')"}</div>
-			<div id="ienotice">{function="t('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:')"}
+			<noscript><div id="noscript" class="nonworking">{function="i18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.')"}</div></noscript>
+			<div id="oldienotice" class="nonworking">{function="i18n::_('PrivateBin requires a modern browser to work.')"}</div>
+			<div id="ienotice">{function="i18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:')"}
 				<a href="http://www.mozilla.org/firefox/">Firefox</a>, 
 				<a href="http://www.opera.com/">Opera</a>, 
 				<a href="http://www.google.com/chrome">Chrome</a>, 
@@ -47,11 +47,11 @@
 				<div id="status">{$STATUS|htmlspecialchars}</div>
 				<div id="errormessage" class="hidden">{$ERROR|htmlspecialchars}</div>
 				<div id="toolbar">
-					<button id="newbutton" class="reloadlink hidden"><img src="img/icon_new.png" width="11" height="15" alt="" />{function="t('New')"}</button>
-					<button id="sendbutton" class="hidden"><img src="img/icon_send.png" width="18" height="15" alt="" />{function="t('Send')"}</button>{if="$EXPIRECLONE"}
-					<button id="clonebutton" class="hidden"><img src="img/icon_clone.png" width="15" height="17" alt="" />{function="t('Clone')"}</button>{/if}
-					<button id="rawtextbutton" class="hidden"><img src="img/icon_raw.png" width="15" height="15" alt="" />{function="t('Raw text')"}</button>
-					<div id="expiration" class="hidden button">{function="t('Expires')"}:
+					<button id="newbutton" class="reloadlink hidden"><img src="img/icon_new.png" width="11" height="15" alt="" />{function="i18n::_('New')"}</button>
+					<button id="sendbutton" class="hidden"><img src="img/icon_send.png" width="18" height="15" alt="" />{function="i18n::_('Send')"}</button>{if="$EXPIRECLONE"}
+					<button id="clonebutton" class="hidden"><img src="img/icon_clone.png" width="15" height="17" alt="" />{function="i18n::_('Clone')"}</button>{/if}
+					<button id="rawtextbutton" class="hidden"><img src="img/icon_raw.png" width="15" height="15" alt="" />{function="i18n::_('Raw text')"}</button>
+					<div id="expiration" class="hidden button">{function="i18n::_('Expires')"}:
 						<select id="pasteExpiration" name="pasteExpiration">
 {loop="EXPIRE"}
 							<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
@@ -60,16 +60,16 @@
 					<div id="remainingtime" class="hidden"></div>
 					<div id="burnafterreadingoption" class="button hidden">
 						<input type="checkbox" id="burnafterreading" name="burnafterreading" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
-						<label for="burnafterreading">{function="t('Burn after reading')"}</label>
+						<label for="burnafterreading">{function="i18n::_('Burn after reading')"}</label>
 					</div>{if="$DISCUSSION"}
 					<div id="opendisc" class="button hidden">
 						<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="$OPENDISCUSSION"} checked="checked"{/if} />
-						<label for="opendiscussion" {if="!$OPENDISCUSSION"} style="color: #BBBBBB;"{/if}>{function="t('Open discussion')"}</label>
+						<label for="opendiscussion" {if="!$OPENDISCUSSION"} style="color: #BBBBBB;"{/if}>{function="i18n::_('Open discussion')"}</label>
 					</div>{/if}{if="$PASSWORD"}
 					<div id="password" class="hidden">
-						<input type="password" id="passwordinput" placeholder="{function="t('Password (recommended)')"}" size="32" />
+						<input type="password" id="passwordinput" placeholder="{function="i18n::_('Password (recommended)')"}" size="32" />
 					</div>{/if}
-					<div id="formatter" class="button hidden">{function="t('Format')"}:
+					<div id="formatter" class="button hidden">{function="i18n::_('Format')"}:
 						<select id="pasteFormatter" name="pasteFormatter">
 {loop="FORMATTER"}
 							<option value="{$key}"{if="$key == $FORMATTERDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
@@ -85,18 +85,18 @@
 				<div id="pasteresult" class="hidden">
 					<div id="deletelink"></div>
 					<div id="pastelink">{if="strlen($URLSHORTENER)"}
-						<button id="shortenbutton" data-shortener="{$URLSHORTENER|htmlspecialchars}"><img src="img/icon_shorten.png" width="13" height="15" />{function="t('Shorten URL')"}</button>
+						<button id="shortenbutton" data-shortener="{$URLSHORTENER|htmlspecialchars}"><img src="img/icon_shorten.png" width="13" height="15" />{function="i18n::_('Shorten URL')"}</button>
 					{/if}</div>
 				</div>{if="$FILEUPLOAD"}
-				<div id="attachment" class="hidden"><a>{function="t('Download attachment')"}</a></div>
+				<div id="attachment" class="hidden"><a>{function="i18n::_('Download attachment')"}</a></div>
 				<div id="attach" class="hidden">
-					<span id="clonedfile" class="hidden">{function="t('Cloned file attached.')"}</span>
-					<span id="filewrap">{function="t('Attach a file')"}: <input type="file" id="file" name="file" /></span>
-					<button id="fileremovebutton">{function="t('Remove attachment')"}</button>
+					<span id="clonedfile" class="hidden">{function="i18n::_('Cloned file attached.')"}</span>
+					<span id="filewrap">{function="i18n::_('Attach a file')"}: <input type="file" id="file" name="file" /></span>
+					<button id="fileremovebutton">{function="i18n::_('Remove attachment')"}</button>
 				</div>{/if}
 				<div id="preview" class="hidden">
-					<button id="messageedit">{function="t('Editor')"}</button>
-					<button id="messagepreview">{function="t('Preview')"}</button>
+					<button id="messageedit">{function="i18n::_('Editor')"}</button>
+					<button id="messagepreview">{function="i18n::_('Preview')"}</button>
 				</div>
 				<div id="image" class="hidden"></div>
 				<div id="prettymessage" class="hidden">
@@ -108,7 +108,7 @@
 		</section>
 		<section>
 			<div id="discussion" class="hidden">
-				<h4 class="title">{function="t('Discussion')"}</h4>
+				<h4 class="title">{function="i18n::_('Discussion')"}</h4>
 				<div id="comments"></div>
 			</div>
 		</section>

+ 4 - 48
tst/configuration.php

@@ -1,59 +1,15 @@
 <?php
 class configurationTest extends PHPUnit_Framework_TestCase
 {
-    private $_options = array(
-        'main' => array(
-            'discussion' => true,
-            'opendiscussion' => false,
-            'password' => true,
-            'fileupload' => false,
-            'burnafterreadingselected' => false,
-            'defaultformatter' => 'plaintext',
-            'syntaxhighlightingtheme' => null,
-            'sizelimit' => 2097152,
-            'template' => 'bootstrap',
-            'notice' => '',
-            'languageselection' => false,
-            'languagedefault' => '',
-            'urlshortener' => '',
-            'zerobincompatibility' => false,
-        ),
-        'expire' => array(
-            'default' => '1week',
-            'clone' => true,
-        ),
-        'expire_options' => array(
-            '5min' => 300,
-            '10min' => 600,
-            '1hour' => 3600,
-            '1day' => 86400,
-            '1week' => 604800,
-            '1month' => 2592000,
-            '1year' => 31536000,
-            'never' => 0,
-        ),
-        'formatter_options' => array(
-            'plaintext' => 'Plain Text',
-            'syntaxhighlighting' => 'Source Code',
-            'markdown' => 'Markdown',
-        ),
-        'traffic' => array(
-            'limit' => 10,
-            'header' => null,
-            'dir' => '../data',
-        ),
-        'model' => array(
-            'class' => 'privatebin_data',
-        ),
-        'model_options' => array(
-            'dir' => '../data',
-        ),
-    );
+    private $_options;
 
     public function setUp()
     {
         /* Setup Routine */
         helper::confBackup();
+        $this->_options = configuration::getDefaults();
+        $this->_options['model_options']['dir'] = PATH . $this->_options['model_options']['dir'];
+        $this->_options['traffic']['dir'] = PATH . $this->_options['traffic']['dir'];
     }
 
     public function tearDown()

+ 1 - 1
tst/model.php

@@ -208,4 +208,4 @@ class modelTest extends PHPUnit_Framework_TestCase
         $paste->store();
         $paste->getComment(helper::getPasteId())->delete();
     }
-}
+}

+ 1 - 1
tst/privatebinWithDb.php

@@ -40,4 +40,4 @@ class privatebinWithDbTest extends privatebinTest
         helper::confBackup();
         helper::createIniFile(CONF, $options);
     }
-}
+}

+ 1 - 1
tst/request.php

@@ -150,4 +150,4 @@ class requestTest extends PHPUnit_Framework_TestCase
         $this->assertEquals('foo', $request->getParam('pasteid'));
         $this->assertEquals('read', $request->getOperation());
     }
-}
+}