├── .gitignore ├── css ├── NOTICE.md ├── bg.gif ├── back.png ├── LondrinaSolid.ttf ├── startupPhone320.png ├── startupPhone640.png ├── likebtnstyles.css ├── tinystyles.css └── styles.css ├── sounds ├── alert.mp3 ├── alert.ogg └── alert.wav ├── connect.php ├── README.md ├── initialize-tables.md ├── admin ├── checkadminlogin.php ├── login.php └── index.php ├── checklogin.php ├── get.php ├── config-sample.php ├── detail.php ├── LICENSE.md ├── plugins ├── parsedown │ ├── LICENSE.txt │ └── Parsedown.php ├── add2home.css └── add2home.js ├── like.php ├── login.php ├── image.php └── index.php /.gitignore: -------------------------------------------------------------------------------- 1 | startup*.png -------------------------------------------------------------------------------- /css/NOTICE.md: -------------------------------------------------------------------------------- 1 | back.png is refrenced in script in index.php line 180. -------------------------------------------------------------------------------- /css/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serverwentdown/picobloggingsys/master/css/bg.gif -------------------------------------------------------------------------------- /css/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serverwentdown/picobloggingsys/master/css/back.png -------------------------------------------------------------------------------- /sounds/alert.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serverwentdown/picobloggingsys/master/sounds/alert.mp3 -------------------------------------------------------------------------------- /sounds/alert.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serverwentdown/picobloggingsys/master/sounds/alert.ogg -------------------------------------------------------------------------------- /sounds/alert.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serverwentdown/picobloggingsys/master/sounds/alert.wav -------------------------------------------------------------------------------- /css/LondrinaSolid.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serverwentdown/picobloggingsys/master/css/LondrinaSolid.ttf -------------------------------------------------------------------------------- /css/startupPhone320.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serverwentdown/picobloggingsys/master/css/startupPhone320.png -------------------------------------------------------------------------------- /css/startupPhone640.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serverwentdown/picobloggingsys/master/css/startupPhone640.png -------------------------------------------------------------------------------- /connect.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | picobloggingsys 2 | =============== 3 | 4 | Error-prone microblogging system. 5 | Uses PHP, MySQL. 6 | 7 | Copy config-sample.php to config.php and edit database details. 8 | 9 | ## Warning: error-prone. 10 | 11 | I loooove contributors. `:-)`. Help me fix bugs. 12 | -------------------------------------------------------------------------------- /initialize-tables.md: -------------------------------------------------------------------------------- 1 | 2 | Log in to your MySQL server, then run the following: 3 | 4 | ``` 5 | CREATE TABLE microblog ( 6 | id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, 7 | txt VARCHAR(320) NOT NULL, 8 | tim VARCHAR(40) NOT NULL, 9 | pluses INT(6) UNSIGNED DEFAULT 0 10 | ) 11 | ``` 12 | -------------------------------------------------------------------------------- /admin/checkadminlogin.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /checklogin.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /get.php: -------------------------------------------------------------------------------- 1 | ".mysqli_real_escape_string($db, $_GET["lastid"])." ORDER BY `$mysql_table`.`id`"; 9 | $result=mysqli_query($db, $qry); 10 | $newlastid=$_GET["lastid"]; 11 | $jspo=array(); 12 | while ($row = mysqli_fetch_array($result)) { 13 | $newlastid=$row["id"]; 14 | array_push($jspo, array("txt"=>stripslashes($row["txt"]), "tim"=>$row["tim"], "id"=>$row["id"])); 15 | } 16 | echo json_encode(array("posts"=>$jspo, "lastid"=>$newlastid)); 17 | 18 | mysqli_close($db); 19 | ?> 20 | -------------------------------------------------------------------------------- /config-sample.php: -------------------------------------------------------------------------------- 1 | github 22 | '); 23 | define('MBLOG_DESC', ' 24 |

25 | BLOG DESCRIPTION 26 |

'); 27 | 28 | 29 | define('MBLOG_PULLEY_TEXT', "What's this?"); 30 | define('MBLOG_TOOLTIPS_TEXT', "Tap post to comment and like. :)"); 31 | ?> 32 | -------------------------------------------------------------------------------- /detail.php: -------------------------------------------------------------------------------- 1 | 14 |
15 | http://$3$4'", stripslashes($row["txt"])); 17 | // echo $postlinked; 18 | echo stripslashes($row["txt"]); 19 | ?> 20 |
21 |
22 | at 25 |
26 |
27 |
28 |
29 | 34 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Ambrose Chua 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /plugins/parsedown/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Emanuil Rusev, erusev.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /css/likebtnstyles.css: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Londrina+Solid); 2 | * { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | body, html { 7 | width: 100%; 8 | background-size: 100px 100px; 9 | font-family: "Londrina Solid"; 10 | font-size: 12px; 11 | text-align: right; 12 | } 13 | .btn, .btnm { 14 | letter-spacing:1px; 15 | font-family: "Londrina Solid"; 16 | background-color: rgba(0, 0, 0, 0.5) ; 17 | border-radius: 5px; 18 | -webkit-border-radius: 5px; 19 | -moz-border-radius: 5px; 20 | -o-border-radius: 5px; 21 | -ms-border-radius: 5px; 22 | border: 0; 23 | padding: 5px 8px; 24 | color: #eee; 25 | margin: 1px; 26 | font-size: 12px; 27 | -webkit-appearance: none; 28 | } 29 | .btn:hover { 30 | background-color: rgba(0, 0, 0, 0.6); 31 | } 32 | .btn:active { 33 | background-color: rgba(0, 0, 0, 0.7); 34 | } 35 | .btnm { 36 | display: inline-block; 37 | border-bottom-left-radius: 20px; 38 | border-top-left-radius: 20px; 39 | -webkit-border-bottom-left-radius: 20px; 40 | -webkit-border-top-left-radius: 20px; 41 | -moz-border-bottom-left-radius: 20px; 42 | -moz-border-top-left-radius: 20px; 43 | -o-border-bottom-left-radius: 20px; 44 | -o-border-top-left-radius: 20px; 45 | -ms-border-bottom-left-radius: 20px; 46 | -ms-border-top-left-radius: 20px; 47 | } -------------------------------------------------------------------------------- /like.php: -------------------------------------------------------------------------------- 1 | 36 | 37 | 38 | 39 | Like 40 | 41 | 42 | 43 | 44 |
45 | " /> 46 | 47 |
48 | 49 | 50 | -------------------------------------------------------------------------------- /admin/login.php: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 19 | Please login to admin 20 | 21 | 22 | 23 |
 
24 |

Please login to admin

25 |
26 |
27 | 28 |
29 | 30 | 35 | 36 | 37 | $_POST["un"], 'password' => $shaedpass); 41 | setcookie("adminlogin", json_encode($arr), time()+86400); 42 | header("Location: index.php"); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 19 | Please login 20 | 21 | 22 | 23 |
 
24 |

Please login

25 |
26 |
27 | 28 |
29 | 30 | 35 | 36 | 37 | $_POST["un"], 'password' => $shaedpass); 41 | setcookie("viewerlogin", json_encode($arr), time()+86400); 42 | header("Location: index.php"); 43 | } 44 | ?> -------------------------------------------------------------------------------- /css/tinystyles.css: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Londrina+Solid); 2 | * { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | body, html { 7 | width: 100%; 8 | background: #aaa url(bg.gif) repeat top left; 9 | background-size: 100px 100px; 10 | font-family: "Londrina Solid"; 11 | font-size: 17px; 12 | text-align: center; 13 | } 14 | 15 | form.login { 16 | text-align: left; 17 | width: 250px; 18 | margin: 10px auto 0 -100px; 19 | position: relative; 20 | left: 50%; 21 | } 22 | 23 | h1 { 24 | font-weight: 300; 25 | padding: 5px 20px 0px 20px; 26 | font-size: 30px; 27 | color: #444; 28 | } 29 | input, textarea { 30 | letter-spacing:1px; 31 | font-family: "Londrina Solid"; 32 | background-color: rgba(0, 0, 0, 0.5) ; 33 | border-radius: 5px; 34 | -webkit-border-radius: 5px; 35 | -moz-border-radius: 5px; 36 | -o-border-radius: 5px; 37 | -ms-border-radius: 5px; 38 | border: 0; 39 | padding: 10px; 40 | color: #eee; 41 | margin: 3px 5px 3px 5px; 42 | font-size: 17px; 43 | font-width: 15px; 44 | } 45 | textarea { 46 | width: 90%; 47 | height: 200px; 48 | } 49 | input:focus, textarea:focus { 50 | background-color: rgba(0, 0, 0, 0.6); 51 | } 52 | form { 53 | text-align: center; 54 | width: 100%; 55 | } 56 | #time { 57 | width: 170px; 58 | font-size: 12px; 59 | padding-top: 13px; 60 | padding-bottom: 13px; 61 | } 62 | input[type=submit], input[type=file] { 63 | width: 33%; 64 | -webkit-appearance: none; 65 | -moz-appearance: none; 66 | -o-appearance: none; 67 | -ms-appearance: none; 68 | } 69 | input[type=submit]:hover { 70 | background-color: rgba(0, 0, 0, 0.6); 71 | } 72 | input[type=submit]:active { 73 | background-color: rgba(0, 0, 0, 0.7); 74 | } 75 | input[type=file] { 76 | width: 90%; 77 | padding: 2px 5px; 78 | } 79 | .red { 80 | color: #f00; 81 | font-size: 10px; 82 | } 83 | .statusbarpadd { 84 | display: none; 85 | height: 20px; 86 | width: 100%; 87 | } 88 | @keyframes loading { 89 | from { 90 | -webkit-transform: rotate(0deg); 91 | } 92 | to { 93 | -webkit-transform: rotate(360deg); 94 | } 95 | } 96 | @-moz-keyframes loading { 97 | from { 98 | transform: rotate(0deg); 99 | } 100 | to { 101 | transform: rotate(360deg); 102 | } 103 | } 104 | @-webkit-keyframes loading { 105 | from { 106 | -webkit-transform: rotate(0deg); 107 | } 108 | to { 109 | -webkit-transform: rotate(360deg); 110 | } 111 | } 112 | @-o-keyframes loading { 113 | from { 114 | transform: rotate(0deg); 115 | } 116 | to { 117 | transform: rotate(360deg); 118 | } 119 | } 120 | .loading { 121 | width: 20px; 122 | height: 20px; 123 | background-color: rgba(0, 0, 0, 0.5); 124 | border-radius: 10px; 125 | border-top-right-radius: 0px; 126 | -webkit-border-radius: 10px; 127 | -webkit-border-top-right-radius: 0px; 128 | -moz-border-radius: 10px; 129 | -moz-border-top-right-radius: 0px; 130 | -o-border-radius: 10px; 131 | -o-border-top-right-radius: 0px; 132 | -ms-border-radius: 10px; 133 | -ms-border-top-right-radius: 0px; 134 | animation: loading 1s infinite; 135 | -webkit-animation: loading 1s infinite; 136 | -moz-animation: loading 1s infinite; 137 | -o-animation: loading 1s infinite; 138 | -ms-animation: loading 1s infinite; 139 | display: inline-block; 140 | margin-right: 5px; 141 | } -------------------------------------------------------------------------------- /image.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /admin/index.php: -------------------------------------------------------------------------------- 1 | http://$3$4'", $txt); 13 | 14 | $txt = Parsedown::instance()->parse($txt); 15 | 16 | if (isset($_FILES["file"]) && $_FILES["file"]["name"]) { 17 | $allok = 0; 18 | 19 | $uploadLocation = "../" . UPLOAD_LOCATION . ""; 20 | $config['max_size'] = "100000000"; 21 | 22 | $target_path = $uploadLocation; 23 | $extrl = " "; 24 | $seperator = "-"; 25 | // $rndno=rand(); 26 | $rndno = substr(md5_file($_FILES['file']['tmp_name']), 0, 7); 27 | if (move_uploaded_file($_FILES['file']['tmp_name'], $target_path.$rndno.$seperator.$_FILES["file"]["name"])) { //.$_FILES["file"]["name"] 28 | $fileurl = UPLOAD_LOCATION.$rndno.$seperator.$_FILES['file']['name']; 29 | $filephp = "image.php?url=".$rndno.$seperator.$_FILES['file']['name']; 30 | $extrl = '

'; 31 | } 32 | else{ 33 | die("File upload error"); 34 | } 35 | 36 | } 37 | 38 | if (isset($txt) && isset($tim)) { 39 | 40 | include "../connect.php"; 41 | 42 | $mysql_table = MYSQL_TABLE; 43 | $qry = "INSERT INTO `$mysql_table` (`id`, `txt`, `tim`) VALUES (NULL, '".mysqli_real_escape_string($db, nl2br($txt.$extrl))."', '".mysqli_real_escape_string($db, $tim)."')"; 44 | $result = mysqli_query($db, $qry); 45 | 46 | if (!$result) { 47 | die("Error! ".mysqli_error($db)); 48 | } else { 49 | $allok = 1; 50 | } 51 | mysqli_close($db); 52 | 53 | } 54 | ?> 55 | 56 | 57 | 58 | 59 | Create post 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |
 
68 |

Create postSent'; 74 | } 75 | else { 76 | echo ' Error'; 77 | } 78 | ?>

79 |
80 | 81 |
82 | 83 | 84 |
85 | 86 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /plugins/add2home.css: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Main container 4 | * 5 | */ 6 | #addToHomeScreen { 7 | z-index:9999; 8 | -webkit-user-select:none; 9 | -webkit-box-sizing:border-box; 10 | width:240px; 11 | font-size:15px; 12 | padding:12px 14px; 13 | text-align:left; 14 | font-family:helvetica; 15 | background-image:-webkit-gradient(linear,0 0,0 100%,color-stop(0,#fff),color-stop(0.02,#eee),color-stop(0.98,#ccc),color-stop(1,#a3a3a3)); 16 | border:1px solid #505050; 17 | -webkit-border-radius:8px; 18 | -webkit-background-clip:padding-box; 19 | color:#333; 20 | text-shadow:0 1px 0 rgba(255,255,255,0.75); 21 | line-height:130%; 22 | -webkit-box-shadow:0 0 4px rgba(0,0,0,0.5); 23 | } 24 | 25 | #addToHomeScreen.addToHomeIpad { 26 | width:268px; 27 | font-size:18px; 28 | padding:14px; 29 | } 30 | 31 | /** 32 | * 33 | * The 'wide' class is added when the popup contains the touch icon 34 | * 35 | */ 36 | #addToHomeScreen.addToHomeWide { 37 | width:296px; 38 | } 39 | 40 | #addToHomeScreen.addToHomeIpad.addToHomeWide { 41 | width:320px; 42 | font-size:18px; 43 | padding:14px; 44 | } 45 | 46 | /** 47 | * 48 | * The balloon arrow 49 | * 50 | */ 51 | #addToHomeScreen .addToHomeArrow { 52 | position:absolute; 53 | background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(0,rgba(204,204,204,0)),color-stop(0.4,rgba(204,204,204,0)),color-stop(0.4,#ccc)); 54 | border-width:0 1px 1px 0; 55 | border-style:solid; 56 | border-color:#505050; 57 | width:16px; height:16px; 58 | -webkit-transform:rotateZ(45deg); 59 | bottom:-9px; left:50%; 60 | margin-left:-8px; 61 | -webkit-box-shadow:inset -1px -1px 0 #a9a9a9; 62 | -webkit-border-bottom-right-radius:2px; 63 | } 64 | 65 | 66 | /** 67 | * 68 | * The balloon arrow for iPad 69 | * 70 | */ 71 | #addToHomeScreen.addToHomeIpad .addToHomeArrow { 72 | -webkit-transform:rotateZ(-135deg); 73 | background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(0,rgba(238,238,238,0)),color-stop(0.4,rgba(238,238,238,0)),color-stop(0.4,#eee)); 74 | -webkit-box-shadow:inset -1px -1px 0 #fff; 75 | top:-9px; bottom:auto; left:50%; 76 | } 77 | 78 | 79 | /** 80 | * 81 | * Close button 82 | * 83 | */ 84 | #addToHomeScreen .addToHomeClose { 85 | -webkit-box-sizing:border-box; 86 | position:absolute; 87 | right:4px; 88 | top:4px; 89 | width:18px; 90 | height:18px; line-height:14px; 91 | text-align:center; 92 | text-indent:1px; 93 | -webkit-border-radius:9px; 94 | background:rgba(0,0,0,0.12); 95 | color:#707070; 96 | -webkit-box-shadow:0 1px 0 #fff; 97 | font-size:16px; 98 | } 99 | 100 | 101 | /** 102 | * 103 | * The '+' icon, displayed only on iOS < 4.2 104 | * 105 | */ 106 | #addToHomeScreen .addToHomePlus { 107 | font-weight:bold; 108 | font-size:1.3em; 109 | } 110 | 111 | 112 | /** 113 | * 114 | * The 'share' icon, displayed only on iOS >= 4.2 115 | * 116 | */ 117 | #addToHomeScreen .addToHomeShare { 118 | display:inline-block; 119 | width:18px; 120 | height:15px; 121 | background-repeat:no-repeat; 122 | background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAQAAABDj1eZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAUdJREFUKFNtkLtLw1AYxS/qJLhXVKr2ZRulUNtiqgSb3CziICI6ucTFVYcOnaQOFRwUnNTRwUWXgpP/QdHNUEQUHGxofYBTlRs83iZNjKTncOGe7/vx3QchXUWn6FL3jhfKUdCCr5zuifV5oDiHQM+c+CIhiiCSWNu08iq9oHXKLAiqrgR4UXqlOEYZt++ExEL0wW7+OW0G10muLv9gmqfe5FAWKmTMYQYiFL7PYwyLOD8lSjNh2gdnPzMII4QUBxc4OothbAF7GCBKQ0YbSWyPQsIhqvetS+y0ygGMo/KFZfviDvR4AhwgZU9dGYnA0J/6ndc15i3ouYIMcVVUcEXIoOxCeRCfwP8sXBSdjtpUv/1QW+K16kCCIUC4id9Fa0JtkluwVkSfqPL6RwfSDA0aNlx7k/bWgViB7bMS2/1vk5sdsZLN/ALSuL3tylO4RAAAAABJRU5ErkJggg==); 123 | background-size:18px 15px; 124 | text-indent:-9999em; 125 | overflow:hidden; 126 | } 127 | 128 | 129 | /** 130 | * 131 | * The touch icon (if available) 132 | * 133 | */ 134 | #addToHomeScreen .addToHomeTouchIcon { 135 | display:block; 136 | float:left; 137 | -webkit-border-radius:6px; 138 | -webkit-box-shadow:0 1px 3px rgba(0,0,0,0.5), 139 | inset 0 0 2px rgba(255,255,255,0.9); 140 | background-repeat:no-repeat; 141 | width:57px; height:57px; 142 | -webkit-background-size:57px 57px; 143 | margin:0 12px 0 0; 144 | border:1px solid #333; 145 | -webkit-background-clip:padding-box; 146 | } 147 | 148 | 149 | /** 150 | * 151 | * The 'share' icon for retina display 152 | * 153 | */ 154 | @media all and (-webkit-min-device-pixel-ratio: 2) { 155 | #addToHomeScreen .addToHomeShare { 156 | background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAeCAQAAADu6HTYAAADPElEQVR4Xq3TX2gcRRzA8e/M7mVv2+TSNpc/TZtrY6jUGqgaSAmEChKLrYK0YH0RFC2CSCkEfCghiKU04J8qNigq6os+iQV98MHWFwVBrQQRWs21lBw5cw3NNb1/udu72RGG5Y77IzXW77D7sAwf5scyYoL6BGXSDKFZwaGpLvIUaeoCkvX1MmsM0Ny6oRSQYOLuIS+YZOpfQdqslpUxcZrzTVAz4qPwW2O3CeIwC/RSzeY6Ow1QhUrkr+YOWfEKDkEP8Rij7CHKJmrFSDHBdwGEE5wiGChPN+PnT8VdRtEIl1d4gRj/1EVe5ZSBKGh8iqQpo/Fo5+3C/gz0MYg4zgwbqday1/Q4B8BGQ45d/Hi54lakCrU5obOcidJpu1+Lg9whjabyaOYLnrIBFFaRD+xe2ybMDWY66GmP/WA9cGfGp0CWhy0wkMN8inepFiH2rV1j0NQSNQbFLRQnS8/8YSDBBpadfv4CYDub2fmeHDNAsL1MBWUel0iA+Xik6eHcyvD3vAMSU1TGuA/YRS+dD7ovCQN43GKRFCU20Kd3V/avDVVyAZ5niTEuLA5/zBGWg9EEEhfJKN200Tat8CmRAQb9+wv7soPlHt2tQorsz1uPbr0HTY4sJwrH47zJZwABBAKLMBoQXepwgTwdHCo+fXMkQ4lrxEmQ5AaXipPqDY9V2vn09tgvTPI71EEGYxM+/uMJLJ4svpgaWGKOi/xKgmqLSUGSUd5f2vIVJ/CgBaTIUsZ7ZBsn0+NzfMOXLFCXQyTcybN6ep5ZZgUOHn7jpfUpsZshdugPGf+E5zjbyHTSRyQ8xfRPPM/s63RHeuknSoT22mjmmnAOIMkUZ6D1xSfPPAfd1WFKM3sO2CMaHx8M1NjnXKHaAGGkOW0C02WeYHUz4qMtx+w5gUDS8NckYe5lHsMYwCZEPyEEmjLDZFmAS7CDviMdxyTkMNVBKEmYLvbiQQBIBBbCQG04bGQvFWz6CfsCQLWCigILFwcfkGYBiOpbYuOizTAyYyDdCtrGaRG1LCkIgMYEFhI0WqQZoSlbGRyHKe4qOx7iv2bVQW9dp4dlM/x6kmwnWQcd/Q3FCqwTEiT5s+6D5v/pb0SSHyg7uhMWAAAAAElFTkSuQmCC); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | <?php echo MBLOG_TITLE; ?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 |
25 |
 
26 |
27 |

28 |

29 |
30 | 31 |
32 |
33 |
34 |
35 | 36 |
37 |
38 |
 
39 |
 
40 |
41 |
42 |
'.$postlinked.'
'.$row["tim"].'
'; 52 | if ($iffirst==0) { 53 | $newlastid=$row["id"]; 54 | $iffirst=1; 55 | } 56 | } 57 | mysqli_close($db); 58 | ?> 59 |
61 |
62 |
63 |
64 | 65 |
66 |
67 | 79 | 80 | comments powered by Disqus 81 | 82 |
83 |
84 |
 
85 |
86 |
87 | 88 | 93 | 94 | 214 | 223 | 224 | 225 | 226 | -------------------------------------------------------------------------------- /css/styles.css: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Londrina+Solid); 2 | * { 3 | padding: 0; 4 | margin: 0; 5 | -webkit-tap-highlight-color: rgba(50, 205, 102, 0.65); 6 | } 7 | body, html { 8 | width: 100%; 9 | background: #aaa url(bg.gif) repeat center center; 10 | background-size: 100px 100px; 11 | font-family: "Londrina Solid", Helvitica; 12 | font-size: 17px; 13 | color: #444; 14 | font-weight: 300; 15 | height: 100%; 16 | text-align: center; 17 | overflow: hidden; 18 | } 19 | ::-moz-selection { 20 | background-color: rgba(50, 205, 102, 0.65); 21 | } 22 | ::selection { 23 | background-color: rgba(50, 205, 102, 0.65); 24 | } 25 | ul, ol { 26 | padding: 0; 27 | margin: 0; 28 | padding-left: 20px; 29 | } 30 | li { 31 | padding: 0; 32 | margin: 0; 33 | } 34 | a { 35 | color: inherit; 36 | text-decoration: none; 37 | } 38 | #mbinfo a { 39 | color: #ddf; 40 | text-decoration: none; 41 | } 42 | #mbinfo a:hover { 43 | color: #cce; 44 | text-decoration: underline; 45 | } 46 | #mbinfo a:active { 47 | color: #bbd; 48 | text-decoration: underline; 49 | } 50 | h1 { 51 | font-weight: 300; 52 | padding: 5px 20px 0px 20px; 53 | font-size: 30px; 54 | color: #eee; 55 | } 56 | h2 { 57 | font-weight: 300; 58 | padding: 10px 20px 0px 20px; 59 | font-size: 23px; 60 | color: #eee; 61 | } 62 | div#bio { 63 | padding: 0px 10px 0px 10px; 64 | text-align: center; 65 | width: 100%; 66 | } 67 | div#mbinfo { 68 | width: 100%; 69 | background-color: rgba(0, 0, 0, 0.5) ; 70 | color: #ddd; 71 | padding-bottom: 2px; 72 | overflow: hidden; 73 | transition-duration: 1s; 74 | -moz-transition-duration: 1s; 75 | -webkit-transition-duration: 1s; 76 | -o-transition-duration: 1s; 77 | transition-property: height; 78 | -moz-transition-property: height; 79 | -webkit-transition-property: height; 80 | -o-transition-property: height; 81 | height: 1px; 82 | } 83 | div#pulley { 84 | background-color: rgba(0, 0, 0, 0.5) ; 85 | border-bottom-right-radius: 5px; 86 | border-bottom-left-radius: 5px; 87 | -webkit-border-bottom-right-radius: 5px; 88 | -webkit-border-bottom-left-radius: 5px; 89 | -moz-border-bottom-right-radius: 5px; 90 | -moz-border-bottom-left-radius: 5px; 91 | -o-border-bottom-right-radius: 5px; 92 | -o-border-bottom-left-radius: 5px; 93 | -ms-border-bottom-right-radius: 5px; 94 | -ms-border-bottom-left-radius: 5px; 95 | text-align: center; 96 | color: #ddd; 97 | width: 150px; 98 | padding: 5px; 99 | margin-right: 5px; 100 | margin-left: auto; 101 | } 102 | 103 | #scrollable { 104 | overflow-y: scroll; 105 | overflow-scrolling: touch; 106 | -webkit-overflow-scrolling: touch; 107 | -moz-overflow-scrolling: touch; 108 | -o-overflow-scrolling: touch; 109 | -ms-overflow-scrolling: touch; 110 | position: relative; 111 | height: 100%; 112 | background: #fff; 113 | background: #aaa url(bg.gif) repeat center center; 114 | background-size: 100px 100px; 115 | } 116 | #content { 117 | min-height: 100%; 118 | transform: translateZ(0); 119 | -webkit-transform: translateZ(0); 120 | -moz-transform: translateZ(0); 121 | -o-transform: translateZ(0); 122 | -ms-transform: translateZ(0); 123 | max-width: 720px; 124 | text-align: left; 125 | margin: 0 auto; 126 | text-align: left; 127 | } 128 | #floating { 129 | width: 100%; 130 | position: absolute; 131 | top: 0px; 132 | z-index: 10; 133 | } 134 | .posts { 135 | border-radius: 10px; 136 | -webkit-border-radius: 10px; 137 | -moz-border-radius: 10px; 138 | -o-border-radius: 10px; 139 | -ms-border-radius: 10px; 140 | margin: 20px; 141 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.6); 142 | transition: all 1s; 143 | -webkit-transition: all 1s; 144 | -moz-transition: all 1s; 145 | -o-transition: all 1s; 146 | -ms-transition: all 1s; 147 | display: block; 148 | } 149 | .post { 150 | padding: 10px 10px 11px 10px; 151 | border: 1px solid #333; 152 | border-bottom: none; 153 | background-color: rgba(0, 0, 0, 0.075); 154 | display: block; 155 | width: auto; 156 | transition: 1s background-color; 157 | -webkit-transition: 1s background-color; 158 | -moz-transition: 1s background-color; 159 | -o-transition: 1s background-color; 160 | -ms-transition: 1s background-color; 161 | } 162 | .post:first-child { 163 | border-top-right-radius: 10px; 164 | border-top-left-radius: 10px; 165 | -webkit-top-bottom-right-radius: 10px; 166 | -webkit-top-bottom-left-radius: 10px; 167 | -moz-top-bottom-right-radius: 10px; 168 | -moz-top-bottom-left-radius: 10px; 169 | -o-top-bottom-right-radius: 10px; 170 | -o-top-bottom-left-radius: 10px; 171 | -ms-top-bottom-right-radius: 10px; 172 | -ms-top-bottom-left-radius: 10px; 173 | } 174 | .post:last-child { 175 | border-bottom-right-radius: 10px; 176 | border-bottom-left-radius: 10px; 177 | -webkit-border-bottom-right-radius: 10px; 178 | -webkit-border-bottom-left-radius: 10px; 179 | -moz-border-bottom-right-radius: 10px; 180 | -moz-border-bottom-left-radius: 10px; 181 | -o-border-bottom-right-radius: 10px; 182 | -o-border-bottom-left-radius: 10px; 183 | -ms-border-bottom-right-radius: 10px; 184 | -ms-border-bottom-left-radius: 10px; 185 | border-bottom: 1px solid #333; 186 | } 187 | .post:hover:not(.detail) { 188 | background-color: rgba(0, 0, 0, 0.125); 189 | transition: 1s background-color; 190 | -webkit-transition: 1s background-color; 191 | -moz-transition: 1s background-color; 192 | -o-transition: 1s background-color; 193 | -ms-transition: 1s background-color; 194 | } 195 | .post:active:not(.detail) { 196 | background-color: rgba(0, 0, 0, 0.135); 197 | transition: none; 198 | -webkit-transition: none; 199 | -moz-transition: none; 200 | -o-transition: none; 201 | -ms-transition: none; 202 | } 203 | #spacing { 204 | height: 40px; 205 | width: 100%; 206 | } 207 | .t { 208 | padding: 4px 4px 6px 4px; 209 | display: block; 210 | width: auto; 211 | word-wrap: break-word; 212 | } 213 | .i{ 214 | font-size: 10px; 215 | text-align: right; 216 | } 217 | .tp { 218 | font-size: 22px; 219 | min-height: 50px; 220 | } 221 | .tp a:link { 222 | color: #226; 223 | text-decoration: none; 224 | } 225 | .tp a:hover { 226 | color: #337; 227 | text-decoration: underline; 228 | } 229 | .tp a:active { 230 | color: #448; 231 | text-decoration: underline; 232 | } 233 | .ip { 234 | font-size: 15px; 235 | } 236 | hr.bfo { 237 | border: none; 238 | height: 1px; 239 | background-color: #333; 240 | margin: 10px 10px 7px 10px; 241 | box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.6); 242 | } 243 | hr.aft { 244 | border: none; 245 | height: 1px; 246 | background-color: #333; 247 | margin: 0px 10px 20px 10px; 248 | box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.6); 249 | } 250 | .toptips { 251 | height: auto; 252 | margin: 3px 30px 3px 30px; 253 | padding: 5px; 254 | } 255 | #topbar { 256 | display: block; 257 | } 258 | .backbutton { 259 | height: auto; 260 | padding: 5px 0px 0px 20px; 261 | margin: 0px 30px -6px 30px; 262 | } 263 | .backbutton:hover { 264 | transition: 1s background-color; 265 | -webkit-transition: 1s background-color; 266 | -moz-transition: 1s background-color; 267 | -o-transition: 1s background-color; 268 | -ms-transition: 1s background-color; 269 | background-color: rgba(50, 205, 102, 0.65); 270 | } 271 | .backbutton:active { 272 | transition: 1s background-color; 273 | -webkit-transition: 1s background-color; 274 | -moz-transition: 1s background-color; 275 | -o-transition: 1s background-color; 276 | -ms-transition: 1s background-color; 277 | background-color: rgba(25, 100, 50, 0.70); 278 | } 279 | iframe.like { 280 | height: 30px; 281 | width: 100%; 282 | border: none; 283 | } 284 | .iframeh { 285 | width: auto; 286 | margin: 0px 10px 0px 10px; 287 | } 288 | @keyframes loading { 289 | from { 290 | -webkit-transform: rotate(0deg); 291 | } 292 | to { 293 | -webkit-transform: rotate(360deg); 294 | } 295 | } 296 | @-moz-keyframes loading { 297 | from { 298 | transform: rotate(0deg); 299 | } 300 | to { 301 | transform: rotate(360deg); 302 | } 303 | } 304 | @-webkit-keyframes loading { 305 | from { 306 | -webkit-transform: rotate(0deg); 307 | } 308 | to { 309 | -webkit-transform: rotate(360deg); 310 | } 311 | } 312 | @-o-keyframes loading { 313 | from { 314 | transform: rotate(0deg); 315 | } 316 | to { 317 | transform: rotate(360deg); 318 | } 319 | } 320 | .loadingh { 321 | text-align: right; 322 | } 323 | .loading { 324 | width: 20px; 325 | height: 20px; 326 | background-color: rgba(0, 0, 0, 0.5); 327 | border-radius: 10px; 328 | border-top-right-radius: 0px; 329 | -webkit-border-radius: 10px; 330 | -webkit-border-top-right-radius: 0px; 331 | -moz-border-radius: 10px; 332 | -moz-border-top-right-radius: 0px; 333 | -o-border-radius: 10px; 334 | -o-border-top-right-radius: 0px; 335 | -ms-border-radius: 10px; 336 | -ms-border-top-right-radius: 0px; 337 | animation: loading 1s infinite; 338 | -webkit-animation: loading 1s infinite; 339 | -moz-animation: loading 1s infinite; 340 | -o-animation: loading 1s infinite; 341 | -ms-animation: loading 1s infinite; 342 | display: inline-block; 343 | margin-right: 5px; 344 | } 345 | .statusbarpadd { 346 | display: none; 347 | height: 20px; 348 | width: 100%; 349 | } 350 | #list img.pim { 351 | width: 150px; 352 | } 353 | #det img.pim { 354 | width: 90%; 355 | } 356 | #det { 357 | display: block; 358 | } 359 | #disqus_thread { 360 | padding: 10px 10px 0px 10px; 361 | } 362 | 363 | @media all and (min-width: 750px) { 364 | div#pulley { 365 | margin-right: 100px; 366 | } 367 | } 368 | @media all and (min-width: 950px) { 369 | div#pulley { 370 | margin-right: 200px; 371 | } 372 | } -------------------------------------------------------------------------------- /plugins/add2home.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Add to Homescreen v2.0.4 ~ Copyright (c) 2012 Matteo Spinelli, http://cubiq.org 3 | * Released under MIT license, http://cubiq.org/license 4 | */ 5 | var addToHome = (function (w) { 6 | var nav = w.navigator, 7 | isIDevice = 'platform' in nav && (/iphone|ipod|ipad/gi).test(nav.platform), 8 | isIPad, 9 | isRetina, 10 | isSafari, 11 | isStandalone, 12 | OSVersion, 13 | startX = 0, 14 | startY = 0, 15 | lastVisit = 0, 16 | isExpired, 17 | isSessionActive, 18 | isReturningVisitor, 19 | balloon, 20 | overrideChecks, 21 | 22 | positionInterval, 23 | closeTimeout, 24 | 25 | options = { 26 | autostart: true, // Automatically open the balloon 27 | returningVisitor: false, // Show the balloon to returning visitors only (setting this to true is HIGHLY RECCOMENDED) 28 | animationIn: 'drop', // drop || bubble || fade 29 | animationOut: 'fade', // drop || bubble || fade 30 | startDelay: 2000, // 2 seconds from page load before the balloon appears 31 | lifespan: 15000, // 15 seconds before it is automatically destroyed 32 | bottomOffset: 14, // Distance of the balloon from bottom 33 | expire: 0, // Minutes to wait before showing the popup again (0 = always displayed) 34 | message: '', // Customize your message or force a language ('' = automatic) 35 | touchIcon: false, // Display the touch icon 36 | arrow: true, // Display the balloon arrow 37 | hookOnLoad: true, // Should we hook to onload event? (really advanced usage) 38 | iterations: 100 // Internal/debug use 39 | }, 40 | 41 | intl = { 42 | ar: 'قم بتثبيت هذا التطبيق على %device:انقر%icon ،ثم اضفه الى الشاشة الرئيسية.', 43 | ca_es: 'Per instal·lar aquesta aplicació al vostre %device premeu %icon i llavors Afegir a pantalla d\'inici.', 44 | cs_cz: 'Pro instalaci aplikace na Váš %device, stiskněte %icon a v nabídce Přidat na plochu.', 45 | da_dk: 'Tilføj denne side til din %device: tryk på %icon og derefter Føj til hjemmeskærm.', 46 | de_de: 'Installieren Sie diese App auf Ihrem %device: %icon antippen und dann Zum Home-Bildschirm.', 47 | el_gr: 'Εγκαταστήσετε αυτήν την Εφαρμογή στήν συσκευή σας %device: %icon μετά πατάτε Προσθήκη σε Αφετηρία.', 48 | en_us: 'Install this web app on your %device: tap %icon and then Add to Home Screen.', 49 | es_es: 'Para instalar esta app en su %device, pulse %icon y seleccione Añadir a pantalla de inicio.', 50 | fi_fi: 'Asenna tämä web-sovellus laitteeseesi %device: paina %icon ja sen jälkeen valitse Lisää Koti-valikkoon.', 51 | fr_fr: 'Ajoutez cette application sur votre %device en cliquant sur %icon, puis Ajouter à l\'écran d\'accueil.', 52 | he_il: 'התקן אפליקציה זו על ה-%device שלך: הקש %icon ואז הוסף למסך הבית.', 53 | hr_hr: 'Instaliraj ovu aplikaciju na svoj %device: klikni na %icon i odaberi Dodaj u početni zaslon.', 54 | hu_hu: 'Telepítse ezt a web-alkalmazást az Ön %device-jára: nyomjon a %icon-ra majd a Főképernyőhöz adás gombra.', 55 | it_it: 'Installa questa applicazione sul tuo %device: premi su %icon e poi Aggiungi a Home.', 56 | ja_jp: 'このウェブアプリをあなたの%deviceにインストールするには%iconをタップしてホーム画面に追加を選んでください。', 57 | ko_kr: '%device에 웹앱을 설치하려면 %icon을 터치 후 "홈화면에 추가"를 선택하세요', 58 | nb_no: 'Installer denne appen på din %device: trykk på %icon og deretter Legg til på Hjem-skjerm', 59 | nl_nl: 'Installeer deze webapp op uw %device: tik %icon en dan Voeg toe aan beginscherm.', 60 | pl_pl: 'Aby zainstalować tę aplikacje na %device: naciśnij %icon a następnie Dodaj jako ikonę.', 61 | pt_br: 'Instale este aplicativo em seu %device: aperte %icon e selecione Adicionar à Tela Inicio.', 62 | pt_pt: 'Para instalar esta aplicação no seu %device, prima o %icon e depois o Adicionar ao ecrã principal.', 63 | ru_ru: 'Установите это веб-приложение на ваш %device: нажмите %icon, затем Добавить в «Домой».', 64 | sv_se: 'Lägg till denna webbapplikation på din %device: tryck på %icon och därefter Lägg till på hemskärmen.', 65 | th_th: 'ติดตั้งเว็บแอพฯ นี้บน %device ของคุณ: แตะ %icon และ เพิ่มที่หน้าจอโฮม', 66 | tr_tr: '%device için bu uygulamayı kurduktan sonra %icon simgesine dokunarak Ana Ekrana Ekleyin.', 67 | zh_cn: '您可以将此应用程式安装到您的 %device 上。请按 %icon 然后点选添加至主屏幕。', 68 | zh_tw: '您可以將此應用程式安裝到您的 %device 上。請按 %icon 然後點選加入主畫面螢幕。' 69 | }; 70 | 71 | function init () { 72 | // Preliminary check, all further checks are performed on iDevices only 73 | if ( !isIDevice ) return; 74 | 75 | var now = Date.now(), 76 | i; 77 | 78 | // Merge local with global options 79 | if ( w.addToHomeConfig ) { 80 | for ( i in w.addToHomeConfig ) { 81 | options[i] = w.addToHomeConfig[i]; 82 | } 83 | } 84 | if ( !options.autostart ) options.hookOnLoad = false; 85 | 86 | isIPad = (/ipad/gi).test(nav.platform); 87 | isRetina = w.devicePixelRatio && w.devicePixelRatio > 1; 88 | isSafari = (/Safari/i).test(nav.appVersion) && !(/CriOS/i).test(nav.appVersion); 89 | isStandalone = nav.standalone; 90 | OSVersion = nav.appVersion.match(/OS (\d+_\d+)/i); 91 | OSVersion = OSVersion[1] ? +OSVersion[1].replace('_', '.') : 0; 92 | 93 | lastVisit = +w.localStorage.getItem('addToHome'); 94 | 95 | isSessionActive = w.sessionStorage.getItem('addToHomeSession'); 96 | isReturningVisitor = options.returningVisitor ? lastVisit && lastVisit + 28*24*60*60*1000 > now : true; 97 | 98 | if ( !lastVisit ) lastVisit = now; 99 | 100 | // If it is expired we need to reissue a new balloon 101 | isExpired = isReturningVisitor && lastVisit <= now; 102 | 103 | if ( options.hookOnLoad ) w.addEventListener('load', loaded, false); 104 | else if ( !options.hookOnLoad && options.autostart ) loaded(); 105 | } 106 | 107 | function loaded () { 108 | w.removeEventListener('load', loaded, false); 109 | 110 | if ( !isReturningVisitor ) w.localStorage.setItem('addToHome', Date.now()); 111 | else if ( options.expire && isExpired ) w.localStorage.setItem('addToHome', Date.now() + options.expire * 60000); 112 | 113 | if ( !overrideChecks && ( !isSafari || !isExpired || isSessionActive || isStandalone || !isReturningVisitor ) ) return; 114 | 115 | var icons = options.touchIcon ? document.querySelectorAll('head link[rel=apple-touch-icon],head link[rel=apple-touch-icon-precomposed]') : [], 116 | sizes, 117 | touchIcon = '', 118 | closeButton, 119 | platform = nav.platform.split(' ')[0], 120 | language = nav.language.replace('-', '_'), 121 | i, l; 122 | 123 | balloon = document.createElement('div'); 124 | balloon.id = 'addToHomeScreen'; 125 | balloon.style.cssText += 'left:-9999px;-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0;-webkit-transform:translate3d(0,0,0);position:' + (OSVersion < 5 ? 'absolute' : 'fixed'); 126 | 127 | // Localize message 128 | if ( options.message in intl ) { // You may force a language despite the user's locale 129 | language = options.message; 130 | options.message = ''; 131 | } 132 | if ( options.message === '' ) { // We look for a suitable language (defaulted to en_us) 133 | options.message = language in intl ? intl[language] : intl['en_us']; 134 | } 135 | 136 | // Search for the apple-touch-icon 137 | if ( icons.length ) { 138 | for ( i = 0, l = icons.length; i < l; i++ ) { 139 | sizes = icons[i].getAttribute('sizes'); 140 | 141 | if ( sizes ) { 142 | if ( isRetina && sizes == '114x114' ) { 143 | touchIcon = icons[i].href; 144 | break; 145 | } 146 | } else { 147 | touchIcon = icons[i].href; 148 | } 149 | } 150 | 151 | touchIcon = ''; 152 | } 153 | 154 | balloon.className = (isIPad ? 'addToHomeIpad' : 'addToHomeIphone') + (touchIcon ? ' addToHomeWide' : ''); 155 | balloon.innerHTML = touchIcon + 156 | options.message.replace('%device', platform).replace('%icon', OSVersion >= 4.2 ? '' : '+') + 157 | (options.arrow ? '' : '') + 158 | '\u00D7'; 159 | 160 | document.body.appendChild(balloon); 161 | 162 | // Add the close action 163 | closeButton = balloon.querySelector('.addToHomeClose'); 164 | if ( closeButton ) closeButton.addEventListener('click', clicked, false); 165 | 166 | if ( !isIPad && OSVersion >= 6 ) window.addEventListener('orientationchange', orientationCheck, false); 167 | 168 | setTimeout(show, options.startDelay); 169 | } 170 | 171 | function show () { 172 | var duration, 173 | iPadXShift = 208; 174 | 175 | // Set the initial position 176 | if ( isIPad ) { 177 | if ( OSVersion < 5 ) { 178 | startY = w.scrollY; 179 | startX = w.scrollX; 180 | } else if ( OSVersion < 6 ) { 181 | iPadXShift = 160; 182 | } 183 | 184 | balloon.style.top = startY + options.bottomOffset + 'px'; 185 | balloon.style.left = startX + iPadXShift - Math.round(balloon.offsetWidth / 2) + 'px'; 186 | 187 | switch ( options.animationIn ) { 188 | case 'drop': 189 | duration = '0.6s'; 190 | balloon.style.webkitTransform = 'translate3d(0,' + -(w.scrollY + options.bottomOffset + balloon.offsetHeight) + 'px,0)'; 191 | break; 192 | case 'bubble': 193 | duration = '0.6s'; 194 | balloon.style.opacity = '0'; 195 | balloon.style.webkitTransform = 'translate3d(0,' + (startY + 50) + 'px,0)'; 196 | break; 197 | default: 198 | duration = '1s'; 199 | balloon.style.opacity = '0'; 200 | } 201 | } else { 202 | startY = w.innerHeight + w.scrollY; 203 | 204 | if ( OSVersion < 5 ) { 205 | startX = Math.round((w.innerWidth - balloon.offsetWidth) / 2) + w.scrollX; 206 | balloon.style.left = startX + 'px'; 207 | balloon.style.top = startY - balloon.offsetHeight - options.bottomOffset + 'px'; 208 | } else { 209 | balloon.style.left = '50%'; 210 | balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px'; 211 | balloon.style.bottom = options.bottomOffset + 'px'; 212 | } 213 | 214 | switch (options.animationIn) { 215 | case 'drop': 216 | duration = '1s'; 217 | balloon.style.webkitTransform = 'translate3d(0,' + -(startY + options.bottomOffset) + 'px,0)'; 218 | break; 219 | case 'bubble': 220 | duration = '0.6s'; 221 | balloon.style.webkitTransform = 'translate3d(0,' + (balloon.offsetHeight + options.bottomOffset + 50) + 'px,0)'; 222 | break; 223 | default: 224 | duration = '1s'; 225 | balloon.style.opacity = '0'; 226 | } 227 | } 228 | 229 | balloon.offsetHeight; // repaint trick 230 | balloon.style.webkitTransitionDuration = duration; 231 | balloon.style.opacity = '1'; 232 | balloon.style.webkitTransform = 'translate3d(0,0,0)'; 233 | balloon.addEventListener('webkitTransitionEnd', transitionEnd, false); 234 | 235 | closeTimeout = setTimeout(close, options.lifespan); 236 | } 237 | 238 | function manualShow (override) { 239 | if ( !isIDevice || balloon ) return; 240 | 241 | overrideChecks = override; 242 | loaded(); 243 | } 244 | 245 | function close () { 246 | clearInterval( positionInterval ); 247 | clearTimeout( closeTimeout ); 248 | closeTimeout = null; 249 | 250 | var posY = 0, 251 | posX = 0, 252 | opacity = '1', 253 | duration = '0', 254 | closeButton = balloon.querySelector('.addToHomeClose'); 255 | 256 | if ( closeButton ) closeButton.removeEventListener('click', close, false); 257 | if ( !isIPad && OSVersion >= 6 ) window.removeEventListener('orientationchange', orientationCheck, false); 258 | 259 | if ( OSVersion < 5 ) { 260 | posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY; 261 | posX = isIPad ? w.scrollX - startX : w.scrollX + Math.round((w.innerWidth - balloon.offsetWidth)/2) - startX; 262 | } 263 | 264 | balloon.style.webkitTransitionProperty = '-webkit-transform,opacity'; 265 | 266 | switch ( options.animationOut ) { 267 | case 'drop': 268 | if ( isIPad ) { 269 | duration = '0.4s'; 270 | opacity = '0'; 271 | posY = posY + 50; 272 | } else { 273 | duration = '0.6s'; 274 | posY = posY + balloon.offsetHeight + options.bottomOffset + 50; 275 | } 276 | break; 277 | case 'bubble': 278 | if ( isIPad ) { 279 | duration = '0.8s'; 280 | posY = posY - balloon.offsetHeight - options.bottomOffset - 50; 281 | } else { 282 | duration = '0.4s'; 283 | opacity = '0'; 284 | posY = posY - 50; 285 | } 286 | break; 287 | default: 288 | duration = '0.8s'; 289 | opacity = '0'; 290 | } 291 | 292 | balloon.addEventListener('webkitTransitionEnd', transitionEnd, false); 293 | balloon.style.opacity = opacity; 294 | balloon.style.webkitTransitionDuration = duration; 295 | balloon.style.webkitTransform = 'translate3d(' + posX + 'px,' + posY + 'px,0)'; 296 | } 297 | 298 | 299 | function clicked () { 300 | w.sessionStorage.setItem('addToHomeSession', '1'); 301 | isSessionActive = true; 302 | close(); 303 | } 304 | 305 | function transitionEnd () { 306 | balloon.removeEventListener('webkitTransitionEnd', transitionEnd, false); 307 | 308 | balloon.style.webkitTransitionProperty = '-webkit-transform'; 309 | balloon.style.webkitTransitionDuration = '0.2s'; 310 | 311 | // We reached the end! 312 | if ( !closeTimeout ) { 313 | balloon.parentNode.removeChild(balloon); 314 | balloon = null; 315 | return; 316 | } 317 | 318 | // On iOS 4 we start checking the element position 319 | if ( OSVersion < 5 && closeTimeout ) positionInterval = setInterval(setPosition, options.iterations); 320 | } 321 | 322 | function setPosition () { 323 | var matrix = new WebKitCSSMatrix(w.getComputedStyle(balloon, null).webkitTransform), 324 | posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY, 325 | posX = isIPad ? w.scrollX - startX : w.scrollX + Math.round((w.innerWidth - balloon.offsetWidth) / 2) - startX; 326 | 327 | // Screen didn't move 328 | if ( posY == matrix.m42 && posX == matrix.m41 ) return; 329 | 330 | balloon.style.webkitTransform = 'translate3d(' + posX + 'px,' + posY + 'px,0)'; 331 | } 332 | 333 | // Clear local and session storages (this is useful primarily in development) 334 | function reset () { 335 | w.localStorage.removeItem('addToHome'); 336 | w.sessionStorage.removeItem('addToHomeSession'); 337 | } 338 | 339 | function orientationCheck () { 340 | balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px'; 341 | } 342 | 343 | // Bootstrap! 344 | init(); 345 | 346 | return { 347 | show: manualShow, 348 | close: close, 349 | reset: reset 350 | }; 351 | })(window); 352 | -------------------------------------------------------------------------------- /plugins/parsedown/Parsedown.php: -------------------------------------------------------------------------------- 1 | ', '\#', '\+', '\-', '\.', '\!'); 64 | 65 | foreach ($escape_sequences as $index => $escape_sequence) 66 | { 67 | if (strpos($text, $escape_sequence) !== FALSE) 68 | { 69 | $code = "\x1A".'\\'.$index.';'; 70 | 71 | $text = str_replace($escape_sequence, $code, $text); 72 | 73 | $this->escape_sequence_map[$code] = $escape_sequence; 74 | } 75 | } 76 | } 77 | 78 | # ~ 79 | 80 | $text = preg_replace('/\n\s*\n/', "\n\n", $text); 81 | $text = trim($text, "\n"); 82 | 83 | $lines = explode("\n", $text); 84 | 85 | $text = $this->parse_block_elements($lines); 86 | 87 | # decodes escape sequences 88 | 89 | foreach ($this->escape_sequence_map as $code => $escape_sequence) 90 | { 91 | $text = str_replace($code, $escape_sequence[1], $text); 92 | } 93 | 94 | $text = rtrim($text, "\n"); 95 | 96 | return $text; 97 | } 98 | 99 | # 100 | # Private Methods 101 | # 102 | 103 | private function parse_block_elements(array $lines, $context = '') 104 | { 105 | $elements = array(); 106 | 107 | $element = array( 108 | 'type' => '', 109 | ); 110 | 111 | foreach ($lines as $line) 112 | { 113 | # 114 | # fenced elements 115 | 116 | switch ($element['type']) 117 | { 118 | case 'fenced_code_block': 119 | 120 | if ( ! isset($element['closed'])) 121 | { 122 | if (preg_match('/^[ ]*'.$element['fence'][0].'{3,}[ ]*$/', $line)) 123 | { 124 | $element['closed'] = true; 125 | } 126 | else 127 | { 128 | $element['text'] !== '' and $element['text'] .= "\n"; 129 | 130 | $element['text'] .= $line; 131 | } 132 | 133 | continue 2; 134 | } 135 | 136 | break; 137 | 138 | case 'markup': 139 | 140 | if ( ! isset($element['closed'])) 141 | { 142 | if (preg_match('{<'.$element['subtype'].'>$}', $line)) # opening tag 143 | { 144 | $element['depth']++; 145 | } 146 | 147 | if (preg_match('{$}', $line)) # closing tag 148 | { 149 | $element['depth'] > 0 150 | ? $element['depth']-- 151 | : $element['closed'] = true; 152 | } 153 | 154 | $element['text'] .= "\n".$line; 155 | 156 | continue 2; 157 | } 158 | 159 | break; 160 | } 161 | 162 | # * 163 | 164 | if ($line === '') 165 | { 166 | $element['interrupted'] = true; 167 | 168 | continue; 169 | } 170 | 171 | # 172 | # composite elements 173 | 174 | switch ($element['type']) 175 | { 176 | case 'blockquote': 177 | 178 | if ( ! isset($element['interrupted'])) 179 | { 180 | $line = preg_replace('/^[ ]*>[ ]?/', '', $line); 181 | 182 | $element['lines'] []= $line; 183 | 184 | continue 2; 185 | } 186 | 187 | break; 188 | 189 | case 'li': 190 | 191 | if (preg_match('/^([ ]{0,3})(\d+[.]|[*+-])[ ](.*)/', $line, $matches)) 192 | { 193 | if ($element['indentation'] !== $matches[1]) 194 | { 195 | $element['lines'] []= $line; 196 | } 197 | else 198 | { 199 | unset($element['last']); 200 | 201 | $elements []= $element; 202 | 203 | $element = array( 204 | 'type' => 'li', 205 | 'indentation' => $matches[1], 206 | 'last' => true, 207 | 'lines' => array( 208 | preg_replace('/^[ ]{0,4}/', '', $matches[3]), 209 | ), 210 | ); 211 | } 212 | 213 | continue 2; 214 | } 215 | 216 | if (isset($element['interrupted'])) 217 | { 218 | if ($line[0] === ' ') 219 | { 220 | $element['lines'] []= ''; 221 | 222 | $line = preg_replace('/^[ ]{0,4}/', '', $line); 223 | 224 | $element['lines'] []= $line; 225 | 226 | continue 2; 227 | } 228 | } 229 | else 230 | { 231 | $line = preg_replace('/^[ ]{0,4}/', '', $line); 232 | 233 | $element['lines'] []= $line; 234 | 235 | continue 2; 236 | } 237 | 238 | break; 239 | } 240 | 241 | # 242 | # indentation sensitive types 243 | 244 | $deindented_line = $line; 245 | 246 | switch ($line[0]) 247 | { 248 | case ' ': 249 | 250 | # ~ 251 | 252 | $deindented_line = ltrim($line); 253 | 254 | if ($deindented_line === '') 255 | { 256 | continue 2; 257 | } 258 | 259 | # code block 260 | 261 | if (preg_match('/^[ ]{4}(.*)/', $line, $matches)) 262 | { 263 | if ($element['type'] === 'code_block') 264 | { 265 | if (isset($element['interrupted'])) 266 | { 267 | $element['text'] .= "\n"; 268 | 269 | unset ($element['interrupted']); 270 | } 271 | 272 | $element['text'] .= "\n".$matches[1]; 273 | } 274 | else 275 | { 276 | $elements []= $element; 277 | 278 | $element = array( 279 | 'type' => 'code_block', 280 | 'text' => $matches[1], 281 | ); 282 | } 283 | 284 | continue 2; 285 | } 286 | 287 | break; 288 | 289 | case '#': 290 | 291 | # atx heading (#) 292 | 293 | if (preg_match('/^(#{1,6})[ ]*(.+?)[ ]*#*$/', $line, $matches)) 294 | { 295 | $elements []= $element; 296 | 297 | $level = strlen($matches[1]); 298 | 299 | $element = array( 300 | 'type' => 'h.', 301 | 'text' => $matches[2], 302 | 'level' => $level, 303 | ); 304 | 305 | continue 2; 306 | } 307 | 308 | break; 309 | 310 | case '-': 311 | 312 | # setext heading (---) 313 | 314 | if ($line[0] === '-' and $element['type'] === 'p' and ! isset($element['interrupted']) and preg_match('/^[-]+[ ]*$/', $line)) 315 | { 316 | $element['type'] = 'h.'; 317 | $element['level'] = 2; 318 | 319 | continue 2; 320 | } 321 | 322 | break; 323 | 324 | case '=': 325 | 326 | # setext heading (===) 327 | 328 | if ($line[0] === '=' and $element['type'] === 'p' and ! isset($element['interrupted']) and preg_match('/^[=]+[ ]*$/', $line)) 329 | { 330 | $element['type'] = 'h.'; 331 | $element['level'] = 1; 332 | 333 | continue 2; 334 | } 335 | 336 | break; 337 | } 338 | 339 | # 340 | # indentation insensitive types 341 | 342 | switch ($deindented_line[0]) 343 | { 344 | case '<': 345 | 346 | # self-closing tag 347 | 348 | if (preg_match('{^<.+?/>$}', $deindented_line)) 349 | { 350 | $elements []= $element; 351 | 352 | $element = array( 353 | 'type' => '', 354 | 'text' => $deindented_line, 355 | ); 356 | 357 | continue 2; 358 | } 359 | 360 | # opening tag 361 | 362 | if (preg_match('{^<(\w+)(?:[ ].*?)?>}', $deindented_line, $matches)) 363 | { 364 | $elements []= $element; 365 | 366 | $element = array( 367 | 'type' => 'markup', 368 | 'subtype' => strtolower($matches[1]), 369 | 'text' => $deindented_line, 370 | 'depth' => 0, 371 | ); 372 | 373 | preg_match('{\s*$}', $deindented_line) and $element['closed'] = true; 374 | 375 | continue 2; 376 | } 377 | 378 | break; 379 | 380 | case '>': 381 | 382 | # quote 383 | 384 | if (preg_match('/^>[ ]?(.*)/', $deindented_line, $matches)) 385 | { 386 | $elements []= $element; 387 | 388 | $element = array( 389 | 'type' => 'blockquote', 390 | 'lines' => array( 391 | $matches[1], 392 | ), 393 | ); 394 | 395 | continue 2; 396 | } 397 | 398 | break; 399 | 400 | case '[': 401 | 402 | # reference 403 | 404 | if (preg_match('/^\[(.+?)\]:[ ]*([^ ]+)/', $deindented_line, $matches)) 405 | { 406 | $label = strtolower($matches[1]); 407 | 408 | $this->reference_map[$label] = trim($matches[2], '<>');; 409 | 410 | continue 2; 411 | } 412 | 413 | break; 414 | 415 | case '`': 416 | case '~': 417 | 418 | # fenced code block 419 | 420 | if (preg_match('/^([`]{3,}|[~]{3,})[ ]*(\S+)?[ ]*$/', $deindented_line, $matches)) 421 | { 422 | $elements []= $element; 423 | 424 | $element = array( 425 | 'type' => 'fenced_code_block', 426 | 'text' => '', 427 | 'fence' => $matches[1], 428 | ); 429 | 430 | isset($matches[2]) and $element['language'] = $matches[2]; 431 | 432 | continue 2; 433 | } 434 | 435 | break; 436 | 437 | case '*': 438 | case '+': 439 | case '-': 440 | case '_': 441 | 442 | # hr 443 | 444 | if (preg_match('/^([-*_])([ ]{0,2}\1){2,}[ ]*$/', $deindented_line)) 445 | { 446 | $elements []= $element; 447 | 448 | $element = array( 449 | 'type' => 'hr', 450 | ); 451 | 452 | continue 2; 453 | } 454 | 455 | # li 456 | 457 | if (preg_match('/^([ ]*)[*+-][ ](.*)/', $line, $matches)) 458 | { 459 | $elements []= $element; 460 | 461 | $element = array( 462 | 'type' => 'li', 463 | 'ordered' => false, 464 | 'indentation' => $matches[1], 465 | 'last' => true, 466 | 'lines' => array( 467 | preg_replace('/^[ ]{0,4}/', '', $matches[2]), 468 | ), 469 | ); 470 | 471 | continue 2; 472 | } 473 | } 474 | 475 | # li 476 | 477 | if ($deindented_line[0] <= '9' and $deindented_line >= '0' and preg_match('/^([ ]*)\d+[.][ ](.*)/', $line, $matches)) 478 | { 479 | $elements []= $element; 480 | 481 | $element = array( 482 | 'type' => 'li', 483 | 'ordered' => true, 484 | 'indentation' => $matches[1], 485 | 'last' => true, 486 | 'lines' => array( 487 | preg_replace('/^[ ]{0,4}/', '', $matches[2]), 488 | ), 489 | ); 490 | 491 | continue; 492 | } 493 | 494 | # paragraph 495 | 496 | if ($element['type'] === 'p') 497 | { 498 | if (isset($element['interrupted'])) 499 | { 500 | $elements []= $element; 501 | 502 | $element['text'] = $line; 503 | 504 | unset($element['interrupted']); 505 | } 506 | else 507 | { 508 | $element['text'] .= "\n".$line; 509 | } 510 | } 511 | else 512 | { 513 | $elements []= $element; 514 | 515 | $element = array( 516 | 'type' => 'p', 517 | 'text' => $line, 518 | ); 519 | } 520 | } 521 | 522 | $elements []= $element; 523 | 524 | unset($elements[0]); 525 | 526 | # 527 | # ~ 528 | # 529 | 530 | $markup = ''; 531 | 532 | foreach ($elements as $element) 533 | { 534 | switch ($element['type']) 535 | { 536 | case 'p': 537 | 538 | $text = $this->parse_span_elements($element['text']); 539 | 540 | $text = preg_replace('/[ ]{2}\n/', '
'."\n", $text); 541 | 542 | if ($context === 'li' and $markup === '') 543 | { 544 | if (isset($element['interrupted'])) 545 | { 546 | $markup .= "\n".'

'.$text.'

'."\n"; 547 | } 548 | else 549 | { 550 | $markup .= $text; 551 | } 552 | } 553 | else 554 | { 555 | $markup .= '

'.$text.'

'."\n"; 556 | } 557 | 558 | break; 559 | 560 | case 'blockquote': 561 | 562 | $text = $this->parse_block_elements($element['lines']); 563 | 564 | $markup .= '
'."\n".$text.'
'."\n"; 565 | 566 | break; 567 | 568 | case 'code_block': 569 | case 'fenced_code_block': 570 | 571 | $text = htmlentities($element['text'], ENT_NOQUOTES); 572 | 573 | strpos($text, "\x1A\\") !== FALSE and $text = strtr($text, $this->escape_sequence_map); 574 | 575 | $markup .= '
'.$text.'
'."\n"; 576 | 577 | break; 578 | 579 | case 'h.': 580 | 581 | $text = $this->parse_span_elements($element['text']); 582 | 583 | $markup .= ''.$text.''."\n"; 584 | 585 | break; 586 | 587 | case 'hr': 588 | 589 | $markup .= '
'."\n"; 590 | 591 | break; 592 | 593 | case 'li': 594 | 595 | if (isset($element['ordered'])) # first 596 | { 597 | $list_type = $element['ordered'] ? 'ol' : 'ul'; 598 | 599 | $markup .= '<'.$list_type.'>'."\n"; 600 | } 601 | 602 | if (isset($element['interrupted']) and ! isset($element['last'])) 603 | { 604 | $element['lines'] []= ''; 605 | } 606 | 607 | $text = $this->parse_block_elements($element['lines'], 'li'); 608 | 609 | $markup .= '
  • '.$text.'
  • '."\n"; 610 | 611 | isset($element['last']) and $markup .= ''."\n"; 612 | 613 | break; 614 | 615 | default: 616 | 617 | $markup .= $element['text']."\n"; 618 | } 619 | } 620 | 621 | return $markup; 622 | } 623 | 624 | private function parse_span_elements($text) 625 | { 626 | $map = array(); 627 | 628 | $index = 0; 629 | 630 | # code span 631 | 632 | if (strpos($text, '`') !== FALSE and preg_match_all('/`(.+?)`/', $text, $matches, PREG_SET_ORDER)) 633 | { 634 | foreach ($matches as $matches) 635 | { 636 | $element_text = $matches[1]; 637 | $element_text = htmlentities($element_text, ENT_NOQUOTES); 638 | 639 | # decodes escape sequences 640 | 641 | $this->escape_sequence_map 642 | and strpos($element_text, "\x1A") !== FALSE 643 | and $element_text = strtr($element_text, $this->escape_sequence_map); 644 | 645 | # composes element 646 | 647 | $element = ''.$element_text.''; 648 | 649 | # encodes element 650 | 651 | $code = "\x1A".'$'.$index; 652 | 653 | $text = str_replace($matches[0], $code, $text); 654 | 655 | $map[$code] = $element; 656 | 657 | $index ++; 658 | } 659 | } 660 | 661 | # inline link or image 662 | 663 | if (strpos($text, '](') !== FALSE and preg_match_all('/(!?)(\[((?:[^\[\]]|(?2))*)\])\((.*?)\)/', $text, $matches, PREG_SET_ORDER)) # inline 664 | { 665 | foreach ($matches as $matches) 666 | { 667 | $url = $matches[4]; 668 | 669 | strpos($url, '&') !== FALSE and $url = preg_replace('/&(?!#?\w+;)/', '&', $url); 670 | 671 | if ($matches[1]) # image 672 | { 673 | $element = ''.$matches[3].''; 674 | } 675 | else 676 | { 677 | $element_text = $this->parse_span_elements($matches[3]); 678 | 679 | $element = ''.$element_text.''; 680 | } 681 | 682 | # ~ 683 | 684 | $code = "\x1A".'$'.$index; 685 | 686 | $text = str_replace($matches[0], $code, $text); 687 | 688 | $map[$code] = $element; 689 | 690 | $index ++; 691 | } 692 | } 693 | 694 | # reference link or image 695 | 696 | if ($this->reference_map and strpos($text, '[') !== FALSE and preg_match_all('/(!?)\[(.+?)\](?:\n?[ ]?\[(.*?)\])?/ms', $text, $matches, PREG_SET_ORDER)) 697 | { 698 | foreach ($matches as $matches) 699 | { 700 | $link_definition = isset($matches[3]) && $matches[3] 701 | ? $matches[3] 702 | : $matches[2]; # implicit 703 | 704 | $link_definition = strtolower($link_definition); 705 | 706 | if (isset($this->reference_map[$link_definition])) 707 | { 708 | $url = $this->reference_map[$link_definition]; 709 | 710 | strpos($url, '&') !== FALSE and $url = preg_replace('/&(?!#?\w+;)/', '&', $url); 711 | 712 | if ($matches[1]) # image 713 | { 714 | $element = ''.$matches[2].''; 715 | } 716 | else # anchor 717 | { 718 | $element_text = $this->parse_span_elements($matches[2]); 719 | 720 | $element = ''.$element_text.''; 721 | } 722 | 723 | # ~ 724 | 725 | $code = "\x1A".'$'.$index; 726 | 727 | $text = str_replace($matches[0], $code, $text); 728 | 729 | $map[$code] = $element; 730 | 731 | $index ++; 732 | } 733 | } 734 | } 735 | 736 | # automatic link 737 | 738 | if (strpos($text, '<') !== FALSE and preg_match_all('/<((https?|ftp|dict):[^\^\s]+?)>/i', $text, $matches, PREG_SET_ORDER)) 739 | { 740 | foreach ($matches as $matches) 741 | { 742 | $url = $matches[1]; 743 | 744 | strpos($url, '&') !== FALSE and $url = preg_replace('/&(?!#?\w+;)/', '&', $url); 745 | 746 | $element = ':text'; 747 | $element = str_replace(':text', $url, $element); 748 | $element = str_replace(':href', $url, $element); 749 | 750 | # ~ 751 | 752 | $code = "\x1A".'$'.$index; 753 | 754 | $text = str_replace($matches[0], $code, $text); 755 | 756 | $map[$code] = $element; 757 | 758 | $index ++; 759 | } 760 | } 761 | 762 | # ~ 763 | 764 | strpos($text, '&') !== FALSE and $text = preg_replace('/&(?!#?\w+;)/', '&', $text); 765 | strpos($text, '<') !== FALSE and $text = preg_replace('/<(?!\/?\w.*?>)/', '<', $text); 766 | 767 | # ~ 768 | 769 | if (strpos($text, '_') !== FALSE) 770 | { 771 | $text = preg_replace('/__(?=\S)(.+?)(?<=\S)__(?!_)/s', '$1', $text); 772 | $text = preg_replace('/_(?=\S)(.+?)(?<=\S)_/s', '$1', $text); 773 | } 774 | 775 | if (strpos($text, '*') !== FALSE) 776 | { 777 | $text = preg_replace('/\*\*(?=\S)(.+?)(?<=\S)\*\*(?!\*)/s', '$1', $text); 778 | $text = preg_replace('/\*(?=\S)(.+?)(?<=\S)\*/s', '$1', $text); 779 | } 780 | 781 | $text = strtr($text, $map); 782 | 783 | return $text; 784 | } 785 | } --------------------------------------------------------------------------------