Rearrage code! Not tested on a web-server !
This commit is contained in:
parent
2f353a43b5
commit
880b6111f8
|
@ -36,9 +36,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
* @example https://github.com/neitanod/forceutf8
|
||||
* @license Revised BSD
|
||||
*/
|
||||
|
||||
|
||||
class Encoding {
|
||||
class Encoding
|
||||
{
|
||||
|
||||
const ICONV_TRANSLIT = "TRANSLIT";
|
||||
const ICONV_IGNORE = "IGNORE";
|
||||
|
@ -149,7 +148,39 @@ class Encoding {
|
|||
"\xc5\xb8" => "\x9f"
|
||||
);
|
||||
|
||||
static function toUTF8($text){
|
||||
static function toISO8859($text, $option = self::WITHOUT_ICONV)
|
||||
{
|
||||
return self::toWin1252($text, $option);
|
||||
}
|
||||
|
||||
static function toWin1252($text, $option = self::WITHOUT_ICONV)
|
||||
{
|
||||
if (is_array($text)) {
|
||||
foreach ($text as $k => $v) {
|
||||
$text[$k] = self::toWin1252($v, $option);
|
||||
}
|
||||
return $text;
|
||||
} elseif (is_string($text)) {
|
||||
return static::utf8_decode($text, $option);
|
||||
} else {
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
protected static function utf8_decode($text, $option = self::WITHOUT_ICONV)
|
||||
{
|
||||
if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) {
|
||||
$o = utf8_decode(
|
||||
str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))
|
||||
);
|
||||
} else {
|
||||
$o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text);
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
static function toUTF8($text)
|
||||
{
|
||||
/**
|
||||
* Function \ForceUTF8\Encoding::toUTF8
|
||||
*
|
||||
|
@ -175,10 +206,8 @@ class Encoding {
|
|||
*
|
||||
*/
|
||||
|
||||
if(is_array($text))
|
||||
{
|
||||
foreach($text as $k => $v)
|
||||
{
|
||||
if (is_array($text)) {
|
||||
foreach ($text as $k => $v) {
|
||||
$text[$k] = self::toUTF8($v);
|
||||
}
|
||||
return $text;
|
||||
|
@ -244,28 +273,14 @@ class Encoding {
|
|||
return $buf;
|
||||
}
|
||||
|
||||
static function toWin1252($text, $option = self::WITHOUT_ICONV) {
|
||||
if(is_array($text)) {
|
||||
foreach($text as $k => $v) {
|
||||
$text[$k] = self::toWin1252($v, $option);
|
||||
}
|
||||
return $text;
|
||||
} elseif(is_string($text)) {
|
||||
return static::utf8_decode($text, $option);
|
||||
} else {
|
||||
return $text;
|
||||
}
|
||||
protected static function strlen($text)
|
||||
{
|
||||
return (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload')) & 2) ?
|
||||
mb_strlen($text, '8bit') : strlen($text);
|
||||
}
|
||||
|
||||
static function toISO8859($text, $option = self::WITHOUT_ICONV) {
|
||||
return self::toWin1252($text, $option);
|
||||
}
|
||||
|
||||
static function toLatin1($text, $option = self::WITHOUT_ICONV) {
|
||||
return self::toWin1252($text, $option);
|
||||
}
|
||||
|
||||
static function fixUTF8($text, $option = self::WITHOUT_ICONV){
|
||||
static function fixUTF8($text, $option = self::WITHOUT_ICONV)
|
||||
{
|
||||
if (is_array($text)) {
|
||||
foreach ($text as $k => $v) {
|
||||
$text[$k] = self::fixUTF8($v, $option);
|
||||
|
@ -286,7 +301,8 @@ class Encoding {
|
|||
return $text;
|
||||
}
|
||||
|
||||
static function UTF8FixWin1252Chars($text){
|
||||
static function UTF8FixWin1252Chars($text)
|
||||
{
|
||||
// If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1
|
||||
// (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it.
|
||||
// See: http://en.wikipedia.org/wiki/Windows-1252
|
||||
|
@ -294,16 +310,19 @@ class Encoding {
|
|||
return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text);
|
||||
}
|
||||
|
||||
static function removeBOM($str=""){
|
||||
static function removeBOM($str = "")
|
||||
{
|
||||
if (substr($str, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
|
||||
$str = substr($str, 3);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
protected static function strlen($text){
|
||||
return (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload')) & 2) ?
|
||||
mb_strlen($text,'8bit') : strlen($text);
|
||||
public static function encode($encodingLabel, $text)
|
||||
{
|
||||
$encodingLabel = self::normalizeEncoding($encodingLabel);
|
||||
if ($encodingLabel == 'ISO-8859-1') return self::toLatin1($text);
|
||||
return self::toUTF8($text);
|
||||
}
|
||||
|
||||
public static function normalizeEncoding($encodingLabel)
|
||||
|
@ -329,42 +348,33 @@ class Encoding {
|
|||
return $equivalences[$encoding];
|
||||
}
|
||||
|
||||
public static function encode($encodingLabel, $text)
|
||||
static function toLatin1($text, $option = self::WITHOUT_ICONV)
|
||||
{
|
||||
$encodingLabel = self::normalizeEncoding($encodingLabel);
|
||||
if($encodingLabel == 'ISO-8859-1') return self::toLatin1($text);
|
||||
return self::toUTF8($text);
|
||||
}
|
||||
|
||||
protected static function utf8_decode($text, $option = self::WITHOUT_ICONV)
|
||||
{
|
||||
if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) {
|
||||
$o = utf8_decode(
|
||||
str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))
|
||||
);
|
||||
} else {
|
||||
$o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text);
|
||||
}
|
||||
return $o;
|
||||
return self::toWin1252($text, $option);
|
||||
}
|
||||
|
||||
/****/
|
||||
|
||||
public static function destructionH4x0RChaine($chaine){
|
||||
public static function destructionH4x0RChaine($chaine)
|
||||
{
|
||||
return preg_replace('#[\x00-\x1F\x7F-\x9F/\\\\]#', '', $chaine);
|
||||
}
|
||||
|
||||
public static function protectionDoubleQuote($chaine){
|
||||
public static function protectionDoubleQuote($chaine)
|
||||
{
|
||||
$chaine = preg_replace('/"(\w+)"/', '« ${1} »', $chaine);
|
||||
$chaine = preg_replace('#"#', '_', $chaine);
|
||||
return $chaine;
|
||||
}
|
||||
public static function protectionSimpleQuote($chaine){
|
||||
|
||||
public static function protectionSimpleQuote($chaine)
|
||||
{
|
||||
$chaine = preg_replace("#'#", '_', $chaine);
|
||||
return $chaine;
|
||||
}
|
||||
|
||||
public static function myUrlEncode($string) {
|
||||
public static function myUrlEncode($string)
|
||||
{
|
||||
$replacements = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D'/*, '%2B'*/, '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
||||
$entities = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "="/*, "+"*/, "$", ",", "/", "?", "%", "#", "[", "]");
|
||||
$string = urlencode($string);
|
||||
|
@ -372,7 +382,8 @@ class Encoding {
|
|||
return $string;
|
||||
}
|
||||
|
||||
public static function myUrlDecode($string) {
|
||||
public static function myUrlDecode($string)
|
||||
{
|
||||
$entities = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D'/*, '%2B'*/, '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
||||
$replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "="/*, "+"*/, "$", ",", "/", "?", "%", "#", "[", "]");
|
||||
$string = str_replace($entities, $replacements, $string);
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace {
|
|||
*
|
||||
* @return string|false The hashed password, or false on error.
|
||||
*/
|
||||
function password_hash($password, $algo, array $options = array()) {
|
||||
function password_hash($password, $algo, array $options = array())
|
||||
{
|
||||
if (!function_exists('crypt')) {
|
||||
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
|
||||
return null;
|
||||
|
@ -180,7 +181,8 @@ namespace {
|
|||
*
|
||||
* @return array The array of information about the hash.
|
||||
*/
|
||||
function password_get_info($hash) {
|
||||
function password_get_info($hash)
|
||||
{
|
||||
$return = array(
|
||||
'algo' => 0,
|
||||
'algoName' => 'unknown',
|
||||
|
@ -206,7 +208,8 @@ namespace {
|
|||
*
|
||||
* @return boolean True if the password needs to be rehashed.
|
||||
*/
|
||||
function password_needs_rehash($hash, $algo, array $options = array()) {
|
||||
function password_needs_rehash($hash, $algo, array $options = array())
|
||||
{
|
||||
$info = password_get_info($hash);
|
||||
if ($info['algo'] !== (int)$algo) {
|
||||
return true;
|
||||
|
@ -230,7 +233,8 @@ namespace {
|
|||
*
|
||||
* @return boolean If the password matches the hash
|
||||
*/
|
||||
function password_verify($password, $hash) {
|
||||
function password_verify($password, $hash)
|
||||
{
|
||||
if (!function_exists('crypt')) {
|
||||
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
|
||||
return false;
|
||||
|
@ -264,10 +268,11 @@ namespace PasswordCompat\binary {
|
|||
*
|
||||
* @param string $binary_string The input string
|
||||
*
|
||||
* @internal
|
||||
* @return int The number of bytes
|
||||
* @internal
|
||||
*/
|
||||
function _strlen($binary_string) {
|
||||
function _strlen($binary_string)
|
||||
{
|
||||
if (function_exists('mb_strlen')) {
|
||||
return mb_strlen($binary_string, '8bit');
|
||||
}
|
||||
|
@ -277,16 +282,17 @@ namespace PasswordCompat\binary {
|
|||
/**
|
||||
* Get a substring based on byte limits
|
||||
*
|
||||
* @see _strlen()
|
||||
*
|
||||
* @param string $binary_string The input string
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
*
|
||||
* @internal
|
||||
* @return string The substring
|
||||
* @internal
|
||||
* @see _strlen()
|
||||
*
|
||||
*/
|
||||
function _substr($binary_string, $start, $length) {
|
||||
function _substr($binary_string, $start, $length)
|
||||
{
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($binary_string, $start, $length, '8bit');
|
||||
}
|
||||
|
@ -298,7 +304,8 @@ namespace PasswordCompat\binary {
|
|||
*
|
||||
* @return boolean the check result
|
||||
*/
|
||||
function check() {
|
||||
function check()
|
||||
{
|
||||
static $pass = NULL;
|
||||
|
||||
if (is_null($pass)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
<footer>
|
||||
<p>© Unachieved <a href="http://www.evolutis.fr/">Evolutis</a> & <a href="http://www.ip-formation.com/">IP-formation</a> 2011 - develloped by Emmanuel ROY on an Debian dev2 original totally reindexed by sadness</p>
|
||||
<p>© Unachieved <a href="http://www.evolutis.fr/">Evolutis</a> & <a href="http://www.ip-formation.com/">IP-formation</a>
|
||||
2011 - develloped by Emmanuel ROY on an Debian dev2 original totally reindexed by sadness</p>
|
||||
</footer>
|
||||
|
||||
|
||||
|
@ -16,7 +16,10 @@
|
|||
input.editor = this;
|
||||
this.update();
|
||||
}
|
||||
var $ = function (id) { return document.getElementById(id); };
|
||||
|
||||
var $ = function (id) {
|
||||
return document.getElementById(id);
|
||||
};
|
||||
new Editor($("text-input"), $("preview"));
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
|
||||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
|
||||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
|
||||
<!--[if lt IE 7]>
|
||||
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
|
||||
<!--[if IE 7]>
|
||||
<html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
|
||||
<!--[if IE 8]>
|
||||
<html class="no-js lt-ie9" lang="en"> <![endif]-->
|
||||
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="fr"> <!--<![endif]-->
|
||||
<!--[if gt IE 8]><!-->
|
||||
<html class="no-js" lang="fr"> <!--<![endif]-->
|
||||
<head>
|
||||
<META charset="utf-8">
|
||||
|
||||
|
@ -29,8 +33,13 @@
|
|||
*/
|
||||
?>
|
||||
|
||||
<META NAME='Keywords' lang='fr' CONTENT="Art, Programming, Languages, Personnal Website, Curriculum Vitae Multimédia"/>
|
||||
<META NAME="Author" CONTENT="<?php if(isset($auteur)){ echo $auteur; }else {echo 'Emmanuel ROY And More'; } ?>"/>
|
||||
<META NAME='Keywords' lang='fr'
|
||||
CONTENT="Art, Programming, Languages, Personnal Website, Curriculum Vitae Multimédia"/>
|
||||
<META NAME="Author" CONTENT="<?php if (isset($auteur)) {
|
||||
echo $auteur;
|
||||
} else {
|
||||
echo 'Emmanuel ROY And More';
|
||||
} ?>"/>
|
||||
<META NAME="Reply-to" CONTENT="contact@emmanuelroy.name"/>
|
||||
<META NAME="Date-Creation-yyyymmdd" CONTENT="<?php echo $dateCreation ?>"/>
|
||||
<META NAME="Date-Revision-yyyymmdd" CONTENT="<?php echo $dateRevision ?>"/>
|
||||
|
@ -55,8 +64,6 @@
|
|||
<!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- All JavaScript at the bottom, except this Modernizr build.
|
||||
Modernizr enables HTML5 elements & feature detects for optimal performance.
|
||||
Create your own custom Modernizr build: www.modernizr.com/download/ -->
|
||||
|
@ -65,8 +72,9 @@
|
|||
</head>
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you support IE 6.
|
||||
chromium.org/developers/how-tos/chrome-frame-getting-started -->
|
||||
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
|
||||
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a
|
||||
different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a>
|
||||
to experience this site.</p><![endif]-->
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
rows="6" cols="60">Type **Markdown** here.</textarea>
|
||||
<div id="preview"></div>
|
||||
|
||||
<textarea class='span8' name=message id=message tabindex="1" cols="80" rows="5" required><?php if(isset($_GET['message'])){echo Encoding::myUrlDecode($_GET['message']);}?></textarea>
|
||||
<textarea class='span8' name=message id=message tabindex="1" cols="80" rows="5"
|
||||
required><?php if (isset($_GET['message'])) {
|
||||
echo Encoding::myUrlDecode($_GET['message']);
|
||||
} ?></textarea>
|
||||
|
||||
<div class="clearfix" style="padding: 14px 200px;">
|
||||
<input class="btn primary" name="password" type="password" id="password" tabindex="2" required/>
|
||||
|
|
|
@ -4,10 +4,14 @@
|
|||
<p>Il semblerait que ce soit:</p>
|
||||
<ul>
|
||||
<li>un acte malveillant <br/>
|
||||
<i>( entendez par là qu'il faudrais revoir la mentalité avec laquelle vous abordez l'immensité de la toile Internet )</i>
|
||||
<i>( entendez par là qu'il faudrais revoir la mentalité avec laquelle vous abordez l'immensité de la toile
|
||||
Internet )</i>
|
||||
</li>
|
||||
<li>un test de sécurité <br/>
|
||||
<i>( entendez par là que vous pouvez m'envoyer un <a href='<?php echo Url::link_rewrite_slashParam('contact'); ?>'>courriel</a> afin de me le notifier ), dites vous aussi que je reponds aux courriels au moins la première fois et que j'essaye de ne pas laissez une question sans réponse ( on ne peut pas tout savoir sur tout, c'est tout! )</i>
|
||||
<i>( entendez par là que vous pouvez m'envoyer un <a
|
||||
href='<?php echo Url::link_rewrite_slashParam('contact'); ?>'>courriel</a> afin de me le notifier ),
|
||||
dites vous aussi que je reponds aux courriels au moins la première fois et que j'essaye de ne pas laissez
|
||||
une question sans réponse ( on ne peut pas tout savoir sur tout, c'est tout! )</i>
|
||||
</li>
|
||||
<li>une succession d'erreur de mot de passe <br/>
|
||||
<i>( entendez par là : « La Mémoire est <u>la</u> grande des connaissances actuelles« )</i>
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
<i>( entendez par là qu'il faudrais revoir l'adresse que vous avez pianoté dasn la barre de votre butineur )</i>
|
||||
</li>
|
||||
<li>un lien dont la source n'existe plus <br/>
|
||||
<i>( entendez par là que vous pouvez m'envoyer un <a href='<?php echo Url::link_rewrite_slashParam('contact'); ?>'>courriel</a> afin de me le notifier ), dites vous aussi que je reponds aux courriels au moins la première fois et que j'essaye de ne pas laissez une question sans réponse ( on ne peut pas tout savoir sur tout, c'est tout! )</i>
|
||||
<i>( entendez par là que vous pouvez m'envoyer un <a
|
||||
href='<?php echo Url::link_rewrite_slashParam('contact'); ?>'>courriel</a> afin de me le notifier ),
|
||||
dites vous aussi que je reponds aux courriels au moins la première fois et que j'essaye de ne pas laissez
|
||||
une question sans réponse ( on ne peut pas tout savoir sur tout, c'est tout! )</i>
|
||||
</li>
|
||||
<li>une page que j'aurais dû déjà créer <br/>
|
||||
<i>( entendez par là : « La Patience est <u>une</u> mère de sureté« )</i>
|
||||
|
@ -39,5 +42,7 @@
|
|||
<li><a href='/CSS-cursors'>La liste des curseurs de souris</a></li>
|
||||
<li><a href='/HTML-fontStyle'>Les balise de style prééditées en HTML</a></li>
|
||||
<li><a href='/HTML-specialsChar'>LA liste des caractères spéciaux en HTML</a></li>
|
||||
<li><a href='/PHP-url_path_evolved/date/2016/version/1.00/doc-root?page=version2/path-folder?page=1/itx/x/recursive/no/simple--%3Eedit'>Un exemple de variables que l'on peut passer dans l'url</a></li>
|
||||
<li>
|
||||
<a href='/PHP-url_path_evolved/date/2016/version/1.00/doc-root?page=version2/path-folder?page=1/itx/x/recursive/no/simple--%3Eedit'>Un
|
||||
exemple de variables que l'on peut passer dans l'url</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -45,8 +45,7 @@ var Markdown = expose.Markdown = function(dialect) {
|
|||
default:
|
||||
if (dialect in Markdown.dialects) {
|
||||
this.dialect = Markdown.dialects[dialect];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new Error("Unknown Markdown dialect '" + String(dialect) + "'");
|
||||
}
|
||||
break;
|
||||
|
@ -263,8 +262,7 @@ Markdown.prototype.toTree = function toTree( source, custom_root ) {
|
|||
this.tree.push.apply(this.tree, b);
|
||||
}
|
||||
return this.tree;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (custom_root) {
|
||||
this.tree = old_tree;
|
||||
}
|
||||
|
@ -356,14 +354,15 @@ Markdown.dialects.Gruber = {
|
|||
do {
|
||||
// Now pull out the rest of the lines
|
||||
var b = this.loop_re_over_block(
|
||||
re, block.valueOf(), function( m ) { ret.push( m[1] ); } );
|
||||
re, block.valueOf(), function (m) {
|
||||
ret.push(m[1]);
|
||||
});
|
||||
|
||||
if (b.length) {
|
||||
// Case alluded to in first comment. push it back on as a new block
|
||||
next.unshift(mk_block(b, block.trailing));
|
||||
break block_search;
|
||||
}
|
||||
else if ( next.length ) {
|
||||
} else if (next.length) {
|
||||
// Check the next block - it might be code too
|
||||
if (!next[0].match(re)) break block_search;
|
||||
|
||||
|
@ -371,8 +370,7 @@ Markdown.dialects.Gruber = {
|
|||
ret.push(block.trailing.replace(/[^\n]/g, "").substring(2));
|
||||
|
||||
block = next.shift();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break block_search;
|
||||
}
|
||||
} while (true);
|
||||
|
@ -440,6 +438,7 @@ Markdown.dialects.Gruber = {
|
|||
"(^" + indent_re + "{0," + (depth - 1) + "}[ ]{0,4})"
|
||||
);
|
||||
}
|
||||
|
||||
function expand_tab(input) {
|
||||
return input.replace(/ {0,3}\t/g, " ");
|
||||
}
|
||||
|
@ -464,8 +463,7 @@ Markdown.dialects.Gruber = {
|
|||
is_str = typeof what == "string";
|
||||
if (is_str && add_to.length > 1 && typeof add_to[add_to.length - 1] == "string") {
|
||||
add_to[add_to.length - 1] += what;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
add_to.push(what);
|
||||
}
|
||||
}
|
||||
|
@ -486,8 +484,7 @@ Markdown.dialects.Gruber = {
|
|||
x = b.replace(replace, "");
|
||||
|
||||
ret.push(mk_block(x, b.trailing, b.lineNumber));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -506,8 +503,7 @@ Markdown.dialects.Gruber = {
|
|||
// Last stack frame
|
||||
// Keep the same array, but replace the contents
|
||||
last_li.push(["para"].concat(last_li.splice(1, last_li.length - 1)));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var sublist = last_li.pop();
|
||||
last_li.push(["para"].concat(last_li.splice(1, last_li.length - 1)), sublist);
|
||||
}
|
||||
|
@ -549,7 +545,10 @@ Markdown.dialects.Gruber = {
|
|||
tight_search:
|
||||
for (var line_no = 0; line_no < lines.length; line_no++) {
|
||||
var nl = "",
|
||||
l = lines[line_no].replace(/^\n/, function(n) { nl = n; return ""; });
|
||||
l = lines[line_no].replace(/^\n/, function (n) {
|
||||
nl = n;
|
||||
return "";
|
||||
});
|
||||
|
||||
// TODO: really should cache this
|
||||
var line_re = regex_for_depth(stack.length);
|
||||
|
@ -576,8 +575,7 @@ Markdown.dialects.Gruber = {
|
|||
list = make_list(m);
|
||||
last_li.push(list);
|
||||
last_li = list[1] = ["listitem"];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// We aren't deep enough to be strictly a new level. This is
|
||||
// where Md.pl goes nuts. If the indent matches a level in the
|
||||
// stack, put it there, else put it one deeper then the
|
||||
|
@ -599,8 +597,7 @@ Markdown.dialects.Gruber = {
|
|||
//print("Desired depth now", wanted_depth, "stack:", stack.length);
|
||||
list = stack[wanted_depth - 1].list;
|
||||
//print("list:", uneval(list) );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//print ("made new stack for messy indent");
|
||||
list = make_list(m);
|
||||
last_li.push(list);
|
||||
|
@ -781,8 +778,7 @@ Markdown.dialects.Gruber.inline = {
|
|||
if (!m) {
|
||||
// Just boring text
|
||||
return [text.length, text];
|
||||
}
|
||||
else if ( m[1] ) {
|
||||
} else if (m[1]) {
|
||||
// Some un-interesting text matched. Return that first
|
||||
return [m[1].length, m[1]];
|
||||
}
|
||||
|
@ -822,8 +818,10 @@ Markdown.dialects.Gruber.inline = {
|
|||
|
||||
// These characters are intersting elsewhere, so have rules for them so that
|
||||
// chunks of plain text blocks don't include them
|
||||
"]": function () {},
|
||||
"}": function () {},
|
||||
"]": function () {
|
||||
},
|
||||
"}": function () {
|
||||
},
|
||||
|
||||
__escape__: /^\\[\\`\*_{}\[\]()#\+.!\-]/,
|
||||
|
||||
|
@ -973,11 +971,9 @@ Markdown.dialects.Gruber.inline = {
|
|||
if (m[3]) {
|
||||
return [m[0].length, ["link", {href: "mailto:" + m[3]}, m[3]]];
|
||||
|
||||
}
|
||||
else if ( m[2] == "mailto" ) {
|
||||
} else if (m[2] == "mailto") {
|
||||
return [m[0].length, ["link", {href: m[1]}, m[1].substr("mailto:".length)]];
|
||||
}
|
||||
else
|
||||
} else
|
||||
return [m[0].length, ["link", {href: m[1]}, m[1]]];
|
||||
}
|
||||
|
||||
|
@ -1023,8 +1019,7 @@ function strong_em( tag, md ) {
|
|||
|
||||
// "Consume" everything to go back to the recrusion in the else-block below
|
||||
return [text.length, new CloseTag(text.length - md.length)];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Store a clone of the em/strong states
|
||||
var other = this[other_slot].slice(),
|
||||
state = this[state_slot].slice();
|
||||
|
@ -1047,8 +1042,7 @@ function strong_em( tag, md ) {
|
|||
// We matched! Huzzah.
|
||||
var consumed = text.length - last.len_after;
|
||||
return [consumed, [tag].concat(res)];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Restore the state of the other kind. We might have mistakenly closed it.
|
||||
this[other_slot] = other;
|
||||
this[state_slot] = state;
|
||||
|
@ -1096,9 +1090,7 @@ Markdown.buildInlinePatterns = function(d) {
|
|||
d.__call__ = function (text, pattern) {
|
||||
if (pattern != undefined) {
|
||||
return fn.call(this, text, pattern);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return fn.call(this, text, patterns);
|
||||
}
|
||||
};
|
||||
|
@ -1130,9 +1122,14 @@ Markdown.DialectHelpers.inline_until_char = function( text, want ) {
|
|||
|
||||
// Helper function to make sub-classing a dialect easier
|
||||
Markdown.subclassDialect = function (d) {
|
||||
function Block() {}
|
||||
function Block() {
|
||||
}
|
||||
|
||||
Block.prototype = d.block;
|
||||
function Inline() {}
|
||||
|
||||
function Inline() {
|
||||
}
|
||||
|
||||
Inline.prototype = d.inline;
|
||||
|
||||
return {block: new Block(), inline: new Inline()};
|
||||
|
@ -1157,8 +1154,7 @@ Markdown.dialects.Maruku.processMetaHash = function processMetaHash( meta_string
|
|||
// if class already exists, append the new one
|
||||
if (attr["class"]) {
|
||||
attr["class"] = attr["class"] + meta[i].replace(/./, " ");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
attr["class"] = meta[i].substring(1);
|
||||
}
|
||||
}
|
||||
|
@ -1315,8 +1311,7 @@ Markdown.dialects.Maruku.block.definition_list = function definition_list( block
|
|||
list.push(["dd"].concat(this.processInline(defns[i].replace(/(\n)\s+/, "$1"))));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -1330,7 +1325,9 @@ Markdown.dialects.Maruku.block.table = function table (block, next) {
|
|||
|
||||
var _split_on_unescaped = function (s, ch) {
|
||||
ch = ch || '\\s';
|
||||
if (ch.match(/^[\\|\[\]{}?*.+^$]$/)) { ch = '\\' + ch; }
|
||||
if (ch.match(/^[\\|\[\]{}?*.+^$]$/)) {
|
||||
ch = '\\' + ch;
|
||||
}
|
||||
var res = [],
|
||||
r = new RegExp('^((?:\\\\.|[^\\\\' + ch + '])*)' + ch + '(.*)'),
|
||||
m;
|
||||
|
@ -1441,8 +1438,7 @@ if ( Array.prototype.forEach ) {
|
|||
forEach = function (arr, cb, thisp) {
|
||||
return arr.forEach(cb, thisp);
|
||||
};
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
forEach = function (arr, cb, thisp) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
cb.call(thisp || arr, arr[i], i, arr);
|
||||
|
@ -1470,7 +1466,6 @@ function extract_attr( jsonml ) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* renderJsonML( jsonml[, options] ) -> String
|
||||
* - jsonml (Array): JsonML array to render to XML
|
||||
|
@ -1493,8 +1488,7 @@ expose.renderJsonML = function( jsonml, options ) {
|
|||
|
||||
if (options.root) {
|
||||
content.push(render_tree(jsonml));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
jsonml.shift(); // get rid of the tag
|
||||
if (jsonml.length && typeof jsonml[0] === "object" && !(jsonml[0] instanceof Array)) {
|
||||
jsonml.shift(); // get rid of the attributes
|
||||
|
@ -1542,8 +1536,7 @@ function render_tree( jsonml ) {
|
|||
// be careful about adding whitespace here for inline elements
|
||||
if (tag == "img" || tag == "br" || tag == "hr") {
|
||||
return "<" + tag + tag_attrs + "/>";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return "<" + tag + tag_attrs + ">" + content.join("") + "</" + tag + ">";
|
||||
}
|
||||
}
|
||||
|
@ -1701,8 +1694,7 @@ function merge_text_nodes( jsonml ) {
|
|||
if (i + 1 < jsonml.length && typeof jsonml[i + 1] === "string") {
|
||||
// merge the second string into the first and remove it
|
||||
jsonml[i] += jsonml.splice(i + 1, 1)[0];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
@ -1718,8 +1710,7 @@ function merge_text_nodes( jsonml ) {
|
|||
if (typeof exports === "undefined") {
|
||||
window.markdown = {};
|
||||
return window.markdown;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return exports;
|
||||
}
|
||||
})());
|
||||
|
|
|
@ -12,7 +12,8 @@ require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'encoding.class.php';
|
|||
error_reporting(-1);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
function passValide($password){
|
||||
function passValide($password)
|
||||
{
|
||||
|
||||
//password_hash('tototo', HASH_ALGORITHM)
|
||||
|
||||
|
@ -46,12 +47,14 @@ function passValide($password){
|
|||
|
||||
//https://code.tutsplus.com/tutorials/8-regular-expressions-you-should-know--net-6149
|
||||
|
||||
function extractLink($message){
|
||||
function extractLink($message)
|
||||
{
|
||||
preg_match_all("#((?:https?:\/\/)?(?:[\da-z\.-]+)\.(?:[a-z\.]{2,6})(?:[\/\w \.-]*)*\/?)#", $message, $matches);
|
||||
return $matches;
|
||||
}
|
||||
|
||||
function extractText($message){
|
||||
function extractText($message)
|
||||
{
|
||||
$links = extractLink($message);
|
||||
array_shift($links);
|
||||
foreach ($links as $link) {
|
||||
|
|
Loading…
Reference in a new issue