Преглед на файлове

fixing page template, removing error messages when markdown or source are disabled in configuration, re-removing unnecessary spans

El RIDO преди 9 години
родител
ревизия
81b00dd422
променени са 6 файла, в които са добавени 86 реда и са изтрити 56 реда
  1. 0 7
      css/bootstrap/privatebin.css
  2. 28 22
      js/privatebin.js
  3. 29 13
      tpl/bootstrap.php
  4. 19 4
      tpl/page.php
  5. 9 9
      tst/PrivateBinTest.php
  6. 1 1
      tst/ViewTest.php

+ 0 - 7
css/bootstrap/privatebin.css

@@ -102,15 +102,10 @@ body.loading {
 	margin-bottom: 10px;
 	margin-bottom: 10px;
 }
 }
 
 
-.pl-1::before {
-	content: " ";
-}
-
 .comment {
 .comment {
 	border-left: 1px solid #ccc;
 	border-left: 1px solid #ccc;
 	padding: 5px 0 5px 10px;
 	padding: 5px 0 5px 10px;
 	white-space: pre-wrap;
 	white-space: pre-wrap;
-
 	transition: background-color 0.75s ease-out;
 	transition: background-color 0.75s ease-out;
 }
 }
 
 
@@ -119,8 +114,6 @@ body.loading {
 	transition: background-color 0.2s ease-in;
 	transition: background-color 0.2s ease-in;
 }
 }
 
 
-
-
 footer h4 {
 footer h4 {
 	margin-top: 0;
 	margin-top: 0;
 }
 }

+ 28 - 22
js/privatebin.js

@@ -995,7 +995,8 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
 
 
         var $errorMessage,
         var $errorMessage,
             $loadingIndicator,
             $loadingIndicator,
-            $statusMessage;
+            $statusMessage,
+            $remainingTime;
 
 
         var currentIcon = [
         var currentIcon = [
             'glyphicon-time', // loading icon
             'glyphicon-time', // loading icon
@@ -1036,7 +1037,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
                 args = [args];
                 args = [args];
             }
             }
 
 
-            // pass to custom handler if dfined
+            // pass to custom handler if defined
             if (typeof customHandler === 'function') {
             if (typeof customHandler === 'function') {
                 var handlerResult = customHandler(alertType[id], $element, args, icon);
                 var handlerResult = customHandler(alertType[id], $element, args, icon);
                 if (handlerResult === true) {
                 if (handlerResult === true) {
@@ -1069,11 +1070,13 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
 
 
             // show text
             // show text
             if (args !== null) {
             if (args !== null) {
-                // add jQuery object to it as first parameter
-                args.unshift($element.find(':last'));
-
-                // pass it to I18n
-                I18n._.apply(this, args);
+                // get last text node of element
+                var content = $element.contents();
+                if (content.length > 1) {
+                    content[content.length - 1].nodeValue = ' ' + I18n._(args);
+                } else {
+                    $element.text(I18n._(args));
+                }
             }
             }
 
 
             // show notification
             // show notification
@@ -1130,6 +1133,21 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
             handleNotification(3, $errorMessage, message, icon);
             handleNotification(3, $errorMessage, message, icon);
         }
         }
 
 
+        /**
+         * display remaining message
+         *
+         * This automatically passes the text to I18n for translation.
+         *
+         * @name   Alert.showRemaining
+         * @function
+         * @param  {string|array} message     string, use an array for %s/%d options
+         */
+        me.showRemaining = function(message)
+        {
+            console.error('remaining message shown: ', message);
+            handleNotification(1, $remainingTime, message);
+        }
+
         /**
         /**
          * shows a loading message, optionally with a percentage
          * shows a loading message, optionally with a percentage
          *
          *
@@ -1230,18 +1248,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
             $errorMessage = $('#errormessage');
             $errorMessage = $('#errormessage');
             $loadingIndicator = $('#loadingindicator');
             $loadingIndicator = $('#loadingindicator');
             $statusMessage = $('#status');
             $statusMessage = $('#status');
-
-            // display status returned by php code, if any (e.g. paste was properly deleted)
-            var serverStatus = $statusMessage.text();
-            if (Helper.isValidText(serverStatus)) {
-                me.showStatus();
-            }
-
-            // display error message from php code
-            var serverError = $errorMessage.text();
-            if (Helper.isValidText(serverError)) {
-                Alert.showError();
-            }
+            $remainingTime = $('#remainingtime');
         }
         }
 
 
         return me;
         return me;
@@ -1339,7 +1346,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
                 // actually remove paste, before we claim it is deleted
                 // actually remove paste, before we claim it is deleted
                 Controller.removePaste(Model.getPasteId(), 'burnafterreading');
                 Controller.removePaste(Model.getPasteId(), 'burnafterreading');
 
 
-                I18n._($remainingTime.find(':last'), "FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.");
+                Alert.showRemaining("FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.");
                 $remainingTime.addClass('foryoureyesonly');
                 $remainingTime.addClass('foryoureyesonly');
 
 
                 // discourage cloning (it cannot really be prevented)
                 // discourage cloning (it cannot really be prevented)
@@ -1353,7 +1360,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
                         'This document will expire in %d ' + expiration[1] + 's.'
                         'This document will expire in %d ' + expiration[1] + 's.'
                     ];
                     ];
 
 
-                I18n._($remainingTime.find(':last'), expirationLabel, expiration[0]);
+                Alert.showRemaining(expirationLabel, expiration[0]);
                 $remainingTime.removeClass('foryoureyesonly')
                 $remainingTime.removeClass('foryoureyesonly')
             } else {
             } else {
                 // never expires
                 // never expires
@@ -1620,7 +1627,6 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
             $message.addClass('hidden');
             $message.addClass('hidden');
 
 
             // show preview
             // show preview
-            $('#errormessage').find(':last')
             PasteViewer.setText($message.val());
             PasteViewer.setText($message.val());
             PasteViewer.run();
             PasteViewer.run();
 
 

+ 29 - 13
tpl/bootstrap.php

@@ -69,7 +69,7 @@ if ($MARKDOWN):
 <?php
 <?php
 endif;
 endif;
 ?>
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-rvc7nkZjk/ntvq0byTiVQX6lP+vXkg0TwZ+LLd7EpeV+7Rr2hm/bUwOrc77t1JkIicywjvfu6tKYBWVkjuCHNw==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Np6M1TYAhyN/c5SaNYsTnQW+yLyMW3zr/TuiJipi77GxWdayOxcc/3CqCodtm5YPxxdyIwhjjJTclMOdwjdBKQ==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
 		<![endif]-->
@@ -122,7 +122,7 @@ endif;
 				<ul class="nav navbar-nav">
 				<ul class="nav navbar-nav">
 					<li id="loadingindicator" class="navbar-text hidden">
 					<li id="loadingindicator" class="navbar-text hidden">
 						<span class="glyphicon glyphicon-time" aria-hidden="true"></span>
 						<span class="glyphicon glyphicon-time" aria-hidden="true"></span>
-						<span class="pl-1"><?php echo I18n::_('Loading…'), PHP_EOL; ?></span>
+						<?php echo I18n::_('Loading…'), PHP_EOL; ?>
 					</li>
 					</li>
 					<li>
 					<li>
 <?php
 <?php
@@ -379,31 +379,46 @@ endif;
 if (strlen($NOTICE)):
 if (strlen($NOTICE)):
 ?>
 ?>
 				<div role="alert" class="alert alert-info">
 				<div role="alert" class="alert alert-info">
-					<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span><span class="pl-1"><?php echo htmlspecialchars($NOTICE), PHP_EOL; ?></span>
+					<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
+					<?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
 				</div>
 				</div>
 <?php
 <?php
 endif;
 endif;
 ?>
 ?>
 				<div id="remainingtime" role="alert" class="hidden alert alert-info">
 				<div id="remainingtime" role="alert" class="hidden alert alert-info">
-					<span class="glyphicon glyphicon-fire" aria-hidden="true"></span><span class="pl-1"></span>
+					<span class="glyphicon glyphicon-fire" aria-hidden="true"></span>
 				</div>
 				</div>
 <?php
 <?php
 if ($FILEUPLOAD):
 if ($FILEUPLOAD):
 ?>
 ?>
 				<div id="attachment" role="alert" class="hidden alert alert-info">
 				<div id="attachment" role="alert" class="hidden alert alert-info">
-					<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span><a class="alert-link pl-1"><?php echo I18n::_('Download attachment'); ?></a>
+					<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>
+					<a class="alert-link"><?php echo I18n::_('Download attachment'), PHP_EOL; ?></a>
 				</div>
 				</div>
 <?php
 <?php
 endif;
 endif;
 ?>
 ?>
 				<div id="status" role="alert" class="statusmessage alert alert-info<?php echo empty($STATUS) ? ' hidden' : '' ?>">
 				<div id="status" role="alert" class="statusmessage alert alert-info<?php echo empty($STATUS) ? ' hidden' : '' ?>">
 					<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
 					<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
-					<span class="pl-1"><?php echo htmlspecialchars($STATUS); ?></span>
+					<?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
+				</div>
+				<div id="errormessage" role="alert" class="statusmessage<?php echo empty($ERROR) ? ' hidden' : '' ?> alert alert-danger">
+					<span class="glyphicon glyphicon-alert" aria-hidden="true"></span>
+					<?php echo htmlspecialchars($ERROR), PHP_EOL; ?>
+				</div>
+				<noscript>
+					<div id="noscript" role="alert" class="nonworking alert alert-<?php echo $isDark ? 'error' : 'warning'; ?>">
+						<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
+						<?php echo I18n::_('JavaScript is required for %s to work.<br />Sorry for the inconvenience.', I18n::_($NAME)), PHP_EOL; ?>
+					</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::_('%s requires a modern browser to work.', I18n::_($NAME)), PHP_EOL; ?>
 				</div>
 				</div>
-				<div id="errormessage" role="alert" class="statusmessage<?php echo empty($ERROR) ? ' hidden' : '' ?> alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span><span class="pl-1"><?php echo htmlspecialchars($ERROR); ?></span></div>
-				<noscript><div id="noscript" role="alert" class="nonworking alert alert-<?php echo $isDark ? 'error' : 'warning'; ?>"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span><?php echo I18n::_('JavaScript is required for %s to work.<br />Sorry for the inconvenience.', I18n::_($NAME)); ?></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::_('%s requires a modern browser to work.', I18n::_($NAME)); ?></div>
-				<div id="ienotice" role="alert" class="hidden alert alert-<?php echo $isDark ? 'error' : '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:'), PHP_EOL; ?>
+				<div id="ienotice" role="alert" class="hidden alert alert-<?php echo $isDark ? 'error' : '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:'), PHP_EOL; ?>
 					<a href="https://www.mozilla.org/firefox/">Firefox</a>,
 					<a href="https://www.mozilla.org/firefox/">Firefox</a>,
 					<a href="https://www.opera.com/">Opera</a>,
 					<a href="https://www.opera.com/">Opera</a>,
 					<a href="https://www.google.com/chrome">Chrome</a>…
 					<a href="https://www.google.com/chrome">Chrome</a>…
@@ -446,8 +461,9 @@ endif;
 				</div>
 				</div>
 			</section>
 			</section>
 			<section class="container">
 			<section class="container">
-				<div id="noscript" role="alert" class="nonworking alert alert-info noscript-hide"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true">
-					<span class="pl-1"><?php echo I18n::_('Loading…'); ?></span><br />
+				<div id="noscript" role="alert" class="nonworking alert alert-info noscript-hide">
+					<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
+					<?php echo I18n::_('Loading…'); ?><br />
 					<span class="small"><?php echo I18n::_('In case this message never disappears please have a look at <a href="https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away">this FAQ for information to troubleshoot</a>.'); ?></span>
 					<span class="small"><?php echo I18n::_('In case this message never disappears please have a look at <a href="https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away">this FAQ for information to troubleshoot</a>.'); ?></span>
 				</div>
 				</div>
 			</section>
 			</section>
@@ -469,7 +485,7 @@ if ($DISCUSSION):
 			<div id="templates">
 			<div id="templates">
 				<!-- @TODO: when I intend/structure this corrrectly Firefox adds whitespaces everywhere which completly destroy the layout. (same possible when you remove the template data below and show this area in the browser) -->
 				<!-- @TODO: when I intend/structure this corrrectly Firefox adds whitespaces everywhere which completly destroy the layout. (same possible when you remove the template data below and show this area in the browser) -->
 				<article id="commenttemplate" class="comment"><div class="commentmeta"><span class="nickname">name</span><span class="commentdate">0000-00-00</span></div><div class="commentdata">c</div><button class="btn btn-default btn-sm"><?php echo I18n::_('Reply'); ?></button></article>
 				<article id="commenttemplate" class="comment"><div class="commentmeta"><span class="nickname">name</span><span class="commentdate">0000-00-00</span></div><div class="commentdata">c</div><button class="btn btn-default btn-sm"><?php echo I18n::_('Reply'); ?></button></article>
-				<div id="commenttailtemplate" class="comment"><button class="btn btn-default btn-sm"><?php echo I18n::_('Add comment'); ?></button></div>
+				<p id="commenttailtemplate" class="comment"><button class="btn btn-default btn-sm"><?php echo I18n::_('Add comment'); ?></button></p>
 				<div id="replytemplate" class="reply hidden"><input type="text" id="nickname" class="form-control" title="<?php echo I18n::_('Optional nickname…'); ?>" placeholder="<?php echo I18n::_('Optional nickname…'); ?>" /><textarea id="replymessage" class="replymessage form-control" cols="80" rows="7"></textarea><br /><div id="replystatus" role="alert" class="statusmessage hidden alert"><span class="glyphicon" aria-hidden="true"></span><span></span></div><button id="replybutton" class="btn btn-default btn-sm"><?php echo I18n::_('Post comment'); ?></button></div>
 				<div id="replytemplate" class="reply hidden"><input type="text" id="nickname" class="form-control" title="<?php echo I18n::_('Optional nickname…'); ?>" placeholder="<?php echo I18n::_('Optional nickname…'); ?>" /><textarea id="replymessage" class="replymessage form-control" cols="80" rows="7"></textarea><br /><div id="replystatus" role="alert" class="statusmessage hidden alert"><span class="glyphicon" aria-hidden="true"></span><span></span></div><button id="replybutton" class="btn btn-default btn-sm"><?php echo I18n::_('Post comment'); ?></button></div>
 			</div>
 			</div>
 <?php
 <?php

+ 19 - 4
tpl/page.php

@@ -47,7 +47,7 @@ if ($MARKDOWN):
 <?php
 <?php
 endif;
 endif;
 ?>
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-rvc7nkZjk/ntvq0byTiVQX6lP+vXkg0TwZ+LLd7EpeV+7Rr2hm/bUwOrc77t1JkIicywjvfu6tKYBWVkjuCHNw==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Np6M1TYAhyN/c5SaNYsTnQW+yLyMW3zr/TuiJipi77GxWdayOxcc/3CqCodtm5YPxxdyIwhjjJTclMOdwjdBKQ==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
 		<![endif]-->
@@ -84,6 +84,7 @@ endif;
 		</header>
 		</header>
 		<section>
 		<section>
 			<article>
 			<article>
+				<div id="loadingindicator" class="hidden"><?php echo I18n::_('Loading…'); ?></div>
 				<div id="status"><?php echo htmlspecialchars($STATUS); ?></div>
 				<div id="status"><?php echo htmlspecialchars($STATUS); ?></div>
 				<div id="errormessage" class="hidden"><?php echo htmlspecialchars($ERROR); ?></div>
 				<div id="errormessage" class="hidden"><?php echo htmlspecialchars($ERROR); ?></div>
 				<div id="toolbar">
 				<div id="toolbar">
@@ -215,17 +216,31 @@ endif;
 				<div id="prettymessage" class="hidden">
 				<div id="prettymessage" class="hidden">
 					<pre id="prettyprint" class="prettyprint linenums:1"></pre>
 					<pre id="prettyprint" class="prettyprint linenums:1"></pre>
 				</div>
 				</div>
-				<div id="cleartext" class="hidden"></div>
+				<div id="plaintext" class="hidden"></div>
 				<textarea id="message" name="message" cols="80" rows="25" class="hidden"></textarea>
 				<textarea id="message" name="message" cols="80" rows="25" class="hidden"></textarea>
 			</article>
 			</article>
 		</section>
 		</section>
 		<section>
 		<section>
 			<div id="discussion" class="hidden">
 			<div id="discussion" class="hidden">
 				<h4 class="title"><?php echo I18n::_('Discussion'); ?></h4>
 				<h4 class="title"><?php echo I18n::_('Discussion'); ?></h4>
-				<div id="comments"></div>
+				<div id="commentcontainer"></div>
 			</div>
 			</div>
 		</section>
 		</section>
-		<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
+		<div id="serverdata" class="hidden" aria-hidden="true">
+			<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
+<?php
+if ($DISCUSSION):
+?>
+			<div id="templates">
+				<!-- @TODO: when I intend/structure this corrrectly Firefox adds whitespaces everywhere which completly destroy the layout. (same possible when you remove the template data below and show this area in the browser) -->
+				<article id="commenttemplate" class="comment"><div class="commentmeta"><span class="nickname">name</span><span class="commentdate">0000-00-00</span></div><div class="commentdata">c</div><button class="btn btn-default btn-sm"><?php echo I18n::_('Reply'); ?></button></article>
+				<div id="commenttailtemplate" class="comment"><button class="btn btn-default btn-sm"><?php echo I18n::_('Add comment'); ?></button></div>
+				<div id="replytemplate" class="reply hidden"><input type="text" id="nickname" class="form-control" title="<?php echo I18n::_('Optional nickname…'); ?>" placeholder="<?php echo I18n::_('Optional nickname…'); ?>" /><textarea id="replymessage" class="replymessage form-control" cols="80" rows="7"></textarea><br /><div id="replystatus" role="alert" class="statusmessage hidden alert"><span class="glyphicon" aria-hidden="true"></span><span></span></div><button id="replybutton" class="btn btn-default btn-sm"><?php echo I18n::_('Post comment'); ?></button></div>
+			</div>
+<?php
+endif;
+?>
+		</div>
         <section class="container">
         <section class="container">
 			<div id="noscript" role="alert" class="nonworking alert alert-info noscript-hide"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true">
 			<div id="noscript" role="alert" class="nonworking alert alert-info noscript-hide"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true">
 				<span> <?php echo I18n::_('Loading…'); ?></span><br>
 				<span> <?php echo I18n::_('Loading…'); ?></span><br>

+ 9 - 9
tst/PrivateBinTest.php

@@ -760,7 +760,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.</#',
+            '#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.#s',
             $content,
             $content,
             'outputs error correctly'
             'outputs error correctly'
         );
         );
@@ -778,7 +778,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.</#',
+            '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
             $content,
             $content,
             'outputs error correctly'
             'outputs error correctly'
         );
         );
@@ -798,7 +798,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.</#',
+            '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
             $content,
             $content,
             'outputs error correctly'
             'outputs error correctly'
         );
         );
@@ -939,7 +939,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="status"[^>]*>.*Paste was properly deleted\.</#s',
+            '#<div[^>]*id="status"[^>]*>.*Paste was properly deleted\.#s',
             $content,
             $content,
             'outputs deleted status correctly'
             'outputs deleted status correctly'
         );
         );
@@ -960,7 +960,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.</#',
+            '#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.#s',
             $content,
             $content,
             'outputs delete error correctly'
             'outputs delete error correctly'
         );
         );
@@ -980,7 +980,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.</#',
+            '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
             $content,
             $content,
             'outputs delete error correctly'
             'outputs delete error correctly'
         );
         );
@@ -1000,7 +1000,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="errormessage"[^>]*>.*Wrong deletion token\. Paste was not deleted\.</#',
+            '#<div[^>]*id="errormessage"[^>]*>.*Wrong deletion token\. Paste was not deleted\.#s',
             $content,
             $content,
             'outputs delete error correctly'
             'outputs delete error correctly'
         );
         );
@@ -1067,7 +1067,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.</#',
+            '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
             $content,
             $content,
             'outputs error correctly'
             'outputs error correctly'
         );
         );
@@ -1091,7 +1091,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
         $content = ob_get_contents();
         $content = ob_get_contents();
         ob_end_clean();
         ob_end_clean();
         $this->assertRegExp(
         $this->assertRegExp(
-            '#<div[^>]*id="status"[^>]*>.*Paste was properly deleted\.</#s',
+            '#<div[^>]*id="status"[^>]*>.*Paste was properly deleted\.#s',
             $content,
             $content,
             'outputs deleted status correctly'
             'outputs deleted status correctly'
         );
         );

+ 1 - 1
tst/ViewTest.php

@@ -104,7 +104,7 @@ class ViewTest extends PHPUnit_Framework_TestCase
                 $template . ': outputs data correctly'
                 $template . ': outputs data correctly'
             );
             );
             $this->assertRegExp(
             $this->assertRegExp(
-                '#<div[^>]+id="errormessage"[^>]*>.*' . self::$error . '</#',
+                '#<div[^>]+id="errormessage"[^>]*>.*' . self::$error . '#s',
                 $content,
                 $content,
                 $template . ': outputs error correctly'
                 $template . ': outputs error correctly'
             );
             );