@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | public $table = 'notes'; |
| 18 | 18 | public $translatedAttributes = ['content']; |
| 19 | 19 | public $translationForeignKey = 'note_id'; |
| 20 | - protected $dates = [ 'start_at', 'end_at' ]; |
|
| 20 | + protected $dates = ['start_at', 'end_at']; |
|
| 21 | 21 | |
| 22 | 22 | public static $types = ['general', 'payment', 'delivery']; |
| 23 | 23 | public static $levels = ['info', 'warning', 'error']; |
@@ -38,18 +38,18 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | if ($type != 'general') { |
| 40 | 40 | if ($note = self::getActiveNote($type)) { |
| 41 | - return '<div class="note note-' . $note->level . '"><span><i class="fa fa-fw fa-' . $note->level . '"></i>'. |
|
| 41 | + return '<div class="note note-'.$note->level.'"><span><i class="fa fa-fw fa-'.$note->level.'"></i>'. |
|
| 42 | 42 | $note->content |
| 43 | 43 | .'</span></div>'; |
| 44 | 44 | } |
| 45 | - } else { |
|
| 45 | + }else { |
|
| 46 | 46 | if ($note = self::getActiveNote($type)) { |
| 47 | 47 | if (NoteReminder::hasWatched($note, app()->getLocale())) { |
| 48 | 48 | return null; |
| 49 | - } else { |
|
| 49 | + }else { |
|
| 50 | 50 | NoteReminder::watch($note->id, $note->updated_at, app()->getLocale()); |
| 51 | 51 | |
| 52 | - return '<div id="note" class="note-' . $note->level . '">' . $note->content . '<a class="close-note" aria-label="Close"><i class="fa fa-inverse fa-times-circle"></i></a></div>'; |
|
| 52 | + return '<div id="note" class="note-'.$note->level.'">'.$note->content.'<a class="close-note" aria-label="Close"><i class="fa fa-inverse fa-times-circle"></i></a></div>'; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | $notes = self::findByType($type); |
| 100 | 100 | |
| 101 | - $notes = $notes->reject(function ($note) { |
|
| 101 | + $notes = $notes->reject(function($note) { |
|
| 102 | 102 | return !Carbon::now()->between($note->start_at, $note->end_at); |
| 103 | 103 | }); |
| 104 | 104 | |
| 105 | 105 | if ($notes->count() > 1) { |
| 106 | - $note = $notes->sortBy(function ($note) { |
|
| 106 | + $note = $notes->sortBy(function($note) { |
|
| 107 | 107 | return implode(' ', [$note->start_at, $note->created_at]); |
| 108 | 108 | })->last(); |
| 109 | - } else { |
|
| 109 | + }else { |
|
| 110 | 110 | $note = $notes->first(); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -19,11 +19,11 @@ |
||
| 19 | 19 | { |
| 20 | 20 | $cookie = Cookie::get('optiphar-note'); |
| 21 | 21 | |
| 22 | - if (! isset($cookie[$note->id])) { |
|
| 22 | + if (!isset($cookie[$note->id])) { |
|
| 23 | 23 | return false; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - return ! self::shouldWatchAgain($note, $cookie[$note->id], $locale); |
|
| 26 | + return !self::shouldWatchAgain($note, $cookie[$note->id], $locale); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | See htmLawed_README.txt/htm |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -function htmLawed($t, $C=1, $S=array()) |
|
| 12 | +function htmLawed($t, $C = 1, $S = array()) |
|
| 13 | 13 | { |
| 14 | 14 | $C = is_array($C) ? $C : array(); |
| 15 | 15 | if (!empty($C['valid_xhtml'])) { |
@@ -27,26 +27,26 @@ discard block |
||
| 27 | 27 | $e = array(); |
| 28 | 28 | } elseif (strpos($x, '*') === false) { |
| 29 | 29 | $e = array_flip(explode(',', $x)); |
| 30 | - } else { |
|
| 30 | + }else { |
|
| 31 | 31 | if (isset($x[1])) { |
| 32 | 32 | preg_match_all('`(?:^|-|\+)[^\-+]+?(?=-|\+|$)`', $x, $m, PREG_SET_ORDER); |
| 33 | - for ($i=count($m); --$i>=0;) { |
|
| 33 | + for ($i = count($m); --$i >= 0;) { |
|
| 34 | 34 | $m[$i] = $m[$i][0]; |
| 35 | 35 | } |
| 36 | 36 | foreach ($m as $v) { |
| 37 | 37 | if ($v[0] == '+') { |
| 38 | 38 | $e[substr($v, 1)] = 1; |
| 39 | 39 | } |
| 40 | - if ($v[0] == '-' && isset($e[($v = substr($v, 1))]) && !in_array('+'. $v, $m)) { |
|
| 40 | + if ($v[0] == '-' && isset($e[($v = substr($v, 1))]) && !in_array('+'.$v, $m)) { |
|
| 41 | 41 | unset($e[$v]); |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - $C['elements'] =& $e; |
|
| 46 | + $C['elements'] = & $e; |
|
| 47 | 47 | // config attrs |
| 48 | 48 | $x = !empty($C['deny_attribute']) ? str_replace(array("\n", "\r", "\t", ' '), '', $C['deny_attribute']) : ''; |
| 49 | - $x = array_flip((isset($x[0]) && $x[0] == '*') ? explode('-', $x) : explode(',', $x. (!empty($C['safe']) ? ',on*' : ''))); |
|
| 49 | + $x = array_flip((isset($x[0]) && $x[0] == '*') ? explode('-', $x) : explode(',', $x.(!empty($C['safe']) ? ',on*' : ''))); |
|
| 50 | 50 | if (isset($x['on*'])) { |
| 51 | 51 | unset($x['on*']); |
| 52 | 52 | $x += array('onblur'=>1, 'onchange'=>1, 'onclick'=>1, 'ondblclick'=>1, 'onfocus'=>1, 'onkeydown'=>1, 'onkeypress'=>1, 'onkeyup'=>1, 'onmousedown'=>1, 'onmousemove'=>1, 'onmouseout'=>1, 'onmouseover'=>1, 'onmouseup'=>1, 'onreset'=>1, 'onselect'=>1, 'onsubmit'=>1); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $t = preg_replace('`[\x00-\x08\x0b-\x0c\x0e-\x1f]`', '', $t); |
| 111 | 111 | if ($C['clean_ms_char']) { |
| 112 | 112 | $x = array("\x7f"=>'', "\x80"=>'€', "\x81"=>'', "\x83"=>'ƒ', "\x85"=>'…', "\x86"=>'†', "\x87"=>'‡', "\x88"=>'ˆ', "\x89"=>'‰', "\x8a"=>'Š', "\x8b"=>'‹', "\x8c"=>'Œ', "\x8d"=>'', "\x8e"=>'Ž', "\x8f"=>'', "\x90"=>'', "\x95"=>'•', "\x96"=>'–', "\x97"=>'—', "\x98"=>'˜', "\x99"=>'™', "\x9a"=>'š', "\x9b"=>'›', "\x9c"=>'œ', "\x9d"=>'', "\x9e"=>'ž', "\x9f"=>'Ÿ'); |
| 113 | - $x = $x + ($C['clean_ms_char'] == 1 ? array("\x82"=>'‚', "\x84"=>'„', "\x91"=>'‘', "\x92"=>'’', "\x93"=>'“', "\x94"=>'”') : array("\x82"=>'\'', "\x84"=>'"', "\x91"=>'\'', "\x92"=>'\'', "\x93"=>'"', "\x94"=>'"')); |
|
| 113 | + $x = $x+($C['clean_ms_char'] == 1 ? array("\x82"=>'‚', "\x84"=>'„', "\x91"=>'‘', "\x92"=>'’', "\x93"=>'“', "\x94"=>'”') : array("\x82"=>'\'', "\x84"=>'"', "\x91"=>'\'', "\x92"=>'\'', "\x93"=>'"', "\x94"=>'"')); |
|
| 114 | 114 | $t = strtr($t, $x); |
| 115 | 115 | } |
| 116 | 116 | if ($C['cdata'] or $C['comment']) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | // eof |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | -function hl_bal($t, $do=1, $in='div') |
|
| 199 | +function hl_bal($t, $do = 1, $in = 'div') |
|
| 200 | 200 | { |
| 201 | 201 | // balance tags |
| 202 | 202 | // by content |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $eI = array('#pcdata'=>1, 'a'=>1, 'abbr'=>1, 'acronym'=>1, 'applet'=>1, 'b'=>1, 'bdo'=>1, 'big'=>1, 'br'=>1, 'button'=>1, 'cite'=>1, 'code'=>1, 'del'=>1, 'dfn'=>1, 'em'=>1, 'embed'=>1, 'font'=>1, 'i'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'ins'=>1, 'kbd'=>1, 'label'=>1, 'map'=>1, 'object'=>1, 'q'=>1, 'ruby'=>1, 's'=>1, 'samp'=>1, 'select'=>1, 'script'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'sup'=>1, 'textarea'=>1, 'tt'=>1, 'u'=>1, 'var'=>1); |
| 219 | 219 | $eN = array('a'=>1, 'big'=>1, 'button'=>1, 'fieldset'=>1, 'font'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'label'=>1, 'object'=>1, 'ruby'=>1, 'script'=>1, 'select'=>1, 'small'=>1, 'sub'=>1, 'sup'=>1, 'textarea'=>1); // Exclude from specific ele; $cN values |
| 220 | 220 | $eO = array('area'=>1, 'caption'=>1, 'col'=>1, 'colgroup'=>1, 'dd'=>1, 'dt'=>1, 'legend'=>1, 'li'=>1, 'optgroup'=>1, 'option'=>1, 'param'=>1, 'rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1, 'script'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'thead'=>1, 'th'=>1, 'tr'=>1); // Missing in $eB & $eI |
| 221 | - $eF = $eB + $eI; |
|
| 221 | + $eF = $eB+$eI; |
|
| 222 | 222 | |
| 223 | 223 | // $in sets allowed child |
| 224 | 224 | $in = ((isset($eF[$in]) && $in != '#pcdata') or isset($eO[$in])) ? $in : 'div'; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | unset($cI['del'], $cI['ins']); |
| 240 | 240 | } |
| 241 | 241 | if (isset($cO[$in])) { |
| 242 | - $inOk = $inOk + $cO[$in]; |
|
| 242 | + $inOk = $inOk+$cO[$in]; |
|
| 243 | 243 | } |
| 244 | 244 | if (isset($cN[$in])) { |
| 245 | 245 | $inOk = array_diff_assoc($inOk, $cN[$in]); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $ok = $q = array(); // $q seq list of open non-empty ele |
| 250 | 250 | ob_start(); |
| 251 | 251 | |
| 252 | - for ($i=-1, $ci=count($t); ++$i<$ci;) { |
|
| 252 | + for ($i = -1, $ci = count($t); ++$i < $ci;) { |
|
| 253 | 253 | // allowed $ok in parent $p |
| 254 | 254 | if ($ql = count($q)) { |
| 255 | 255 | $p = array_pop($q); |
@@ -268,12 +268,12 @@ discard block |
||
| 268 | 268 | unset($cI['del'], $cI['ins']); |
| 269 | 269 | } |
| 270 | 270 | if (isset($cO[$p])) { |
| 271 | - $ok = $ok + $cO[$p]; |
|
| 271 | + $ok = $ok+$cO[$p]; |
|
| 272 | 272 | } |
| 273 | 273 | if (isset($cN[$p])) { |
| 274 | 274 | $ok = array_diff_assoc($ok, $cN[$p]); |
| 275 | 275 | } |
| 276 | - } else { |
|
| 276 | + }else { |
|
| 277 | 277 | $ok = $inOk; |
| 278 | 278 | unset($cI['del'], $cI['ins']); |
| 279 | 279 | } |
@@ -316,10 +316,10 @@ discard block |
||
| 316 | 316 | continue; |
| 317 | 317 | } // Last open |
| 318 | 318 | $add = ''; // Nesting - close open tags that need to be |
| 319 | - for ($j=-1, $cj=count($q); ++$j<$cj;) { |
|
| 319 | + for ($j = -1, $cj = count($q); ++$j < $cj;) { |
|
| 320 | 320 | if (($d = array_pop($q)) == $e) { |
| 321 | 321 | break; |
| 322 | - } else { |
|
| 322 | + }else { |
|
| 323 | 323 | $add .= "</{$d}>"; |
| 324 | 324 | } |
| 325 | 325 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | // $cB ele needs $eB ele as child |
| 332 | 332 | if (isset($cB[$e]) && strlen(trim($x))) { |
| 333 | 333 | $t[$i] = "{$e}{$a}>"; |
| 334 | - array_splice($t, $i+1, 0, 'div>'. $x); |
|
| 334 | + array_splice($t, $i+1, 0, 'div>'.$x); |
|
| 335 | 335 | unset($e, $x); |
| 336 | 336 | ++$ci; |
| 337 | 337 | --$i; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | // nesting |
| 374 | 374 | $add = ''; |
| 375 | 375 | $q2 = array(); |
| 376 | - for ($k=-1, $kc=count($q); ++$k<$kc;) { |
|
| 376 | + for ($k = -1, $kc = count($q); ++$k < $kc;) { |
|
| 377 | 377 | $d = $q[$k]; |
| 378 | 378 | $ok2 = array(); |
| 379 | 379 | if (isset($cS[$d])) { |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | $ok2 = isset($cI[$d]) ? $eI : $eF; |
| 384 | 384 | if (isset($cO[$d])) { |
| 385 | - $ok2 = $ok2 + $cO[$d]; |
|
| 385 | + $ok2 = $ok2+$cO[$d]; |
|
| 386 | 386 | } |
| 387 | 387 | if (isset($cN[$d])) { |
| 388 | 388 | $ok2 = array_diff_assoc($ok2, $cN[$d]); |
@@ -392,11 +392,11 @@ discard block |
||
| 392 | 392 | continue 2; |
| 393 | 393 | } |
| 394 | 394 | $add = "</{$d}>"; |
| 395 | - for (;++$k<$kc;) { |
|
| 395 | + for (;++$k < $kc;) { |
|
| 396 | 396 | $add = "</{$q[$k]}>{$add}"; |
| 397 | 397 | } |
| 398 | 398 | break; |
| 399 | - } else { |
|
| 399 | + }else { |
|
| 400 | 400 | $q2[] = $d; |
| 401 | 401 | } |
| 402 | 402 | } |
@@ -427,12 +427,12 @@ discard block |
||
| 427 | 427 | unset($cI['del'], $cI['ins']); |
| 428 | 428 | } |
| 429 | 429 | if (isset($cO[$p])) { |
| 430 | - $ok = $ok + $cO[$p]; |
|
| 430 | + $ok = $ok+$cO[$p]; |
|
| 431 | 431 | } |
| 432 | 432 | if (isset($cN[$p])) { |
| 433 | 433 | $ok = array_diff_assoc($ok, $cN[$p]); |
| 434 | 434 | } |
| 435 | - } else { |
|
| 435 | + }else { |
|
| 436 | 436 | $ok = $inOk; |
| 437 | 437 | unset($cI['del'], $cI['ins']); |
| 438 | 438 | } |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | if (substr(($t = preg_replace('`--+`', '-', substr($t, 4, -3))), -1) != ' ') { |
| 477 | 477 | $t .= ' '; |
| 478 | 478 | } |
| 479 | - } else { |
|
| 479 | + }else { |
|
| 480 | 480 | $t = substr($t, 1, -1); |
| 481 | 481 | } |
| 482 | 482 | $t = $v == 2 ? str_replace(array('&', '<', '>'), array('&', '<', '>'), $t) : $t; |
@@ -489,19 +489,19 @@ discard block |
||
| 489 | 489 | // entitity handler |
| 490 | 490 | global $C; |
| 491 | 491 | $t = $t[1]; |
| 492 | - static $U = array('quot'=>1,'amp'=>1,'lt'=>1,'gt'=>1); |
|
| 493 | - static $N = array('fnof'=>'402', 'Alpha'=>'913', 'Beta'=>'914', 'Gamma'=>'915', 'Delta'=>'916', 'Epsilon'=>'917', 'Zeta'=>'918', 'Eta'=>'919', 'Theta'=>'920', 'Iota'=>'921', 'Kappa'=>'922', 'Lambda'=>'923', 'Mu'=>'924', 'Nu'=>'925', 'Xi'=>'926', 'Omicron'=>'927', 'Pi'=>'928', 'Rho'=>'929', 'Sigma'=>'931', 'Tau'=>'932', 'Upsilon'=>'933', 'Phi'=>'934', 'Chi'=>'935', 'Psi'=>'936', 'Omega'=>'937', 'alpha'=>'945', 'beta'=>'946', 'gamma'=>'947', 'delta'=>'948', 'epsilon'=>'949', 'zeta'=>'950', 'eta'=>'951', 'theta'=>'952', 'iota'=>'953', 'kappa'=>'954', 'lambda'=>'955', 'mu'=>'956', 'nu'=>'957', 'xi'=>'958', 'omicron'=>'959', 'pi'=>'960', 'rho'=>'961', 'sigmaf'=>'962', 'sigma'=>'963', 'tau'=>'964', 'upsilon'=>'965', 'phi'=>'966', 'chi'=>'967', 'psi'=>'968', 'omega'=>'969', 'thetasym'=>'977', 'upsih'=>'978', 'piv'=>'982', 'bull'=>'8226', 'hellip'=>'8230', 'prime'=>'8242', 'Prime'=>'8243', 'oline'=>'8254', 'frasl'=>'8260', 'weierp'=>'8472', 'image'=>'8465', 'real'=>'8476', 'trade'=>'8482', 'alefsym'=>'8501', 'larr'=>'8592', 'uarr'=>'8593', 'rarr'=>'8594', 'darr'=>'8595', 'harr'=>'8596', 'crarr'=>'8629', 'lArr'=>'8656', 'uArr'=>'8657', 'rArr'=>'8658', 'dArr'=>'8659', 'hArr'=>'8660', 'forall'=>'8704', 'part'=>'8706', 'exist'=>'8707', 'empty'=>'8709', 'nabla'=>'8711', 'isin'=>'8712', 'notin'=>'8713', 'ni'=>'8715', 'prod'=>'8719', 'sum'=>'8721', 'minus'=>'8722', 'lowast'=>'8727', 'radic'=>'8730', 'prop'=>'8733', 'infin'=>'8734', 'ang'=>'8736', 'and'=>'8743', 'or'=>'8744', 'cap'=>'8745', 'cup'=>'8746', 'int'=>'8747', 'there4'=>'8756', 'sim'=>'8764', 'cong'=>'8773', 'asymp'=>'8776', 'ne'=>'8800', 'equiv'=>'8801', 'le'=>'8804', 'ge'=>'8805', 'sub'=>'8834', 'sup'=>'8835', 'nsub'=>'8836', 'sube'=>'8838', 'supe'=>'8839', 'oplus'=>'8853', 'otimes'=>'8855', 'perp'=>'8869', 'sdot'=>'8901', 'lceil'=>'8968', 'rceil'=>'8969', 'lfloor'=>'8970', 'rfloor'=>'8971', 'lang'=>'9001', 'rang'=>'9002', 'loz'=>'9674', 'spades'=>'9824', 'clubs'=>'9827', 'hearts'=>'9829', 'diams'=>'9830', 'apos'=>'39', 'OElig'=>'338', 'oelig'=>'339', 'Scaron'=>'352', 'scaron'=>'353', 'Yuml'=>'376', 'circ'=>'710', 'tilde'=>'732', 'ensp'=>'8194', 'emsp'=>'8195', 'thinsp'=>'8201', 'zwnj'=>'8204', 'zwj'=>'8205', 'lrm'=>'8206', 'rlm'=>'8207', 'ndash'=>'8211', 'mdash'=>'8212', 'lsquo'=>'8216', 'rsquo'=>'8217', 'sbquo'=>'8218', 'ldquo'=>'8220', 'rdquo'=>'8221', 'bdquo'=>'8222', 'dagger'=>'8224', 'Dagger'=>'8225', 'permil'=>'8240', 'lsaquo'=>'8249', 'rsaquo'=>'8250', 'euro'=>'8364', 'nbsp'=>'160', 'iexcl'=>'161', 'cent'=>'162', 'pound'=>'163', 'curren'=>'164', 'yen'=>'165', 'brvbar'=>'166', 'sect'=>'167', 'uml'=>'168', 'copy'=>'169', 'ordf'=>'170', 'laquo'=>'171', 'not'=>'172', 'shy'=>'173', 'reg'=>'174', 'macr'=>'175', 'deg'=>'176', 'plusmn'=>'177', 'sup2'=>'178', 'sup3'=>'179', 'acute'=>'180', 'micro'=>'181', 'para'=>'182', 'middot'=>'183', 'cedil'=>'184', 'sup1'=>'185', 'ordm'=>'186', 'raquo'=>'187', 'frac14'=>'188', 'frac12'=>'189', 'frac34'=>'190', 'iquest'=>'191', 'Agrave'=>'192', 'Aacute'=>'193', 'Acirc'=>'194', 'Atilde'=>'195', 'Auml'=>'196', 'Aring'=>'197', 'AElig'=>'198', 'Ccedil'=>'199', 'Egrave'=>'200', 'Eacute'=>'201', 'Ecirc'=>'202', 'Euml'=>'203', 'Igrave'=>'204', 'Iacute'=>'205', 'Icirc'=>'206', 'Iuml'=>'207', 'ETH'=>'208', 'Ntilde'=>'209', 'Ograve'=>'210', 'Oacute'=>'211', 'Ocirc'=>'212', 'Otilde'=>'213', 'Ouml'=>'214', 'times'=>'215', 'Oslash'=>'216', 'Ugrave'=>'217', 'Uacute'=>'218', 'Ucirc'=>'219', 'Uuml'=>'220', 'Yacute'=>'221', 'THORN'=>'222', 'szlig'=>'223', 'agrave'=>'224', 'aacute'=>'225', 'acirc'=>'226', 'atilde'=>'227', 'auml'=>'228', 'aring'=>'229', 'aelig'=>'230', 'ccedil'=>'231', 'egrave'=>'232', 'eacute'=>'233', 'ecirc'=>'234', 'euml'=>'235', 'igrave'=>'236', 'iacute'=>'237', 'icirc'=>'238', 'iuml'=>'239', 'eth'=>'240', 'ntilde'=>'241', 'ograve'=>'242', 'oacute'=>'243', 'ocirc'=>'244', 'otilde'=>'245', 'ouml'=>'246', 'divide'=>'247', 'oslash'=>'248', 'ugrave'=>'249', 'uacute'=>'250', 'ucirc'=>'251', 'uuml'=>'252', 'yacute'=>'253', 'thorn'=>'254', 'yuml'=>'255'); |
|
| 492 | + static $U = array('quot'=>1, 'amp'=>1, 'lt'=>1, 'gt'=>1); |
|
| 493 | + static $N = array('fnof'=>'402', 'Alpha'=>'913', 'Beta'=>'914', 'Gamma'=>'915', 'Delta'=>'916', 'Epsilon'=>'917', 'Zeta'=>'918', 'Eta'=>'919', 'Theta'=>'920', 'Iota'=>'921', 'Kappa'=>'922', 'Lambda'=>'923', 'Mu'=>'924', 'Nu'=>'925', 'Xi'=>'926', 'Omicron'=>'927', 'Pi'=>'928', 'Rho'=>'929', 'Sigma'=>'931', 'Tau'=>'932', 'Upsilon'=>'933', 'Phi'=>'934', 'Chi'=>'935', 'Psi'=>'936', 'Omega'=>'937', 'alpha'=>'945', 'beta'=>'946', 'gamma'=>'947', 'delta'=>'948', 'epsilon'=>'949', 'zeta'=>'950', 'eta'=>'951', 'theta'=>'952', 'iota'=>'953', 'kappa'=>'954', 'lambda'=>'955', 'mu'=>'956', 'nu'=>'957', 'xi'=>'958', 'omicron'=>'959', 'pi'=>'960', 'rho'=>'961', 'sigmaf'=>'962', 'sigma'=>'963', 'tau'=>'964', 'upsilon'=>'965', 'phi'=>'966', 'chi'=>'967', 'psi'=>'968', 'omega'=>'969', 'thetasym'=>'977', 'upsih'=>'978', 'piv'=>'982', 'bull'=>'8226', 'hellip'=>'8230', 'prime'=>'8242', 'Prime'=>'8243', 'oline'=>'8254', 'frasl'=>'8260', 'weierp'=>'8472', 'image'=>'8465', 'real'=>'8476', 'trade'=>'8482', 'alefsym'=>'8501', 'larr'=>'8592', 'uarr'=>'8593', 'rarr'=>'8594', 'darr'=>'8595', 'harr'=>'8596', 'crarr'=>'8629', 'lArr'=>'8656', 'uArr'=>'8657', 'rArr'=>'8658', 'dArr'=>'8659', 'hArr'=>'8660', 'forall'=>'8704', 'part'=>'8706', 'exist'=>'8707', 'empty'=>'8709', 'nabla'=>'8711', 'isin'=>'8712', 'notin'=>'8713', 'ni'=>'8715', 'prod'=>'8719', 'sum'=>'8721', 'minus'=>'8722', 'lowast'=>'8727', 'radic'=>'8730', 'prop'=>'8733', 'infin'=>'8734', 'ang'=>'8736', 'and'=>'8743', 'or'=>'8744', 'cap'=>'8745', 'cup'=>'8746', 'int'=>'8747', 'there4'=>'8756', 'sim'=>'8764', 'cong'=>'8773', 'asymp'=>'8776', 'ne'=>'8800', 'equiv'=>'8801', 'le'=>'8804', 'ge'=>'8805', 'sub'=>'8834', 'sup'=>'8835', 'nsub'=>'8836', 'sube'=>'8838', 'supe'=>'8839', 'oplus'=>'8853', 'otimes'=>'8855', 'perp'=>'8869', 'sdot'=>'8901', 'lceil'=>'8968', 'rceil'=>'8969', 'lfloor'=>'8970', 'rfloor'=>'8971', 'lang'=>'9001', 'rang'=>'9002', 'loz'=>'9674', 'spades'=>'9824', 'clubs'=>'9827', 'hearts'=>'9829', 'diams'=>'9830', 'apos'=>'39', 'OElig'=>'338', 'oelig'=>'339', 'Scaron'=>'352', 'scaron'=>'353', 'Yuml'=>'376', 'circ'=>'710', 'tilde'=>'732', 'ensp'=>'8194', 'emsp'=>'8195', 'thinsp'=>'8201', 'zwnj'=>'8204', 'zwj'=>'8205', 'lrm'=>'8206', 'rlm'=>'8207', 'ndash'=>'8211', 'mdash'=>'8212', 'lsquo'=>'8216', 'rsquo'=>'8217', 'sbquo'=>'8218', 'ldquo'=>'8220', 'rdquo'=>'8221', 'bdquo'=>'8222', 'dagger'=>'8224', 'Dagger'=>'8225', 'permil'=>'8240', 'lsaquo'=>'8249', 'rsaquo'=>'8250', 'euro'=>'8364', 'nbsp'=>'160', 'iexcl'=>'161', 'cent'=>'162', 'pound'=>'163', 'curren'=>'164', 'yen'=>'165', 'brvbar'=>'166', 'sect'=>'167', 'uml'=>'168', 'copy'=>'169', 'ordf'=>'170', 'laquo'=>'171', 'not'=>'172', 'shy'=>'173', 'reg'=>'174', 'macr'=>'175', 'deg'=>'176', 'plusmn'=>'177', 'sup2'=>'178', 'sup3'=>'179', 'acute'=>'180', 'micro'=>'181', 'para'=>'182', 'middot'=>'183', 'cedil'=>'184', 'sup1'=>'185', 'ordm'=>'186', 'raquo'=>'187', 'frac14'=>'188', 'frac12'=>'189', 'frac34'=>'190', 'iquest'=>'191', 'Agrave'=>'192', 'Aacute'=>'193', 'Acirc'=>'194', 'Atilde'=>'195', 'Auml'=>'196', 'Aring'=>'197', 'AElig'=>'198', 'Ccedil'=>'199', 'Egrave'=>'200', 'Eacute'=>'201', 'Ecirc'=>'202', 'Euml'=>'203', 'Igrave'=>'204', 'Iacute'=>'205', 'Icirc'=>'206', 'Iuml'=>'207', 'ETH'=>'208', 'Ntilde'=>'209', 'Ograve'=>'210', 'Oacute'=>'211', 'Ocirc'=>'212', 'Otilde'=>'213', 'Ouml'=>'214', 'times'=>'215', 'Oslash'=>'216', 'Ugrave'=>'217', 'Uacute'=>'218', 'Ucirc'=>'219', 'Uuml'=>'220', 'Yacute'=>'221', 'THORN'=>'222', 'szlig'=>'223', 'agrave'=>'224', 'aacute'=>'225', 'acirc'=>'226', 'atilde'=>'227', 'auml'=>'228', 'aring'=>'229', 'aelig'=>'230', 'ccedil'=>'231', 'egrave'=>'232', 'eacute'=>'233', 'ecirc'=>'234', 'euml'=>'235', 'igrave'=>'236', 'iacute'=>'237', 'icirc'=>'238', 'iuml'=>'239', 'eth'=>'240', 'ntilde'=>'241', 'ograve'=>'242', 'oacute'=>'243', 'ocirc'=>'244', 'otilde'=>'245', 'ouml'=>'246', 'divide'=>'247', 'oslash'=>'248', 'ugrave'=>'249', 'uacute'=>'250', 'ucirc'=>'251', 'uuml'=>'252', 'yacute'=>'253', 'thorn'=>'254', 'yuml'=>'255'); |
|
| 494 | 494 | if ($t[0] != '#') { |
| 495 | - return ($C['and_mark'] ? "\x06" : '&'). (isset($U[$t]) ? $t : (isset($N[$t]) ? (!$C['named_entity'] ? '#'. ($C['hexdec_entity'] > 1 ? 'x'. dechex($N[$t]) : $N[$t]) : $t) : 'amp;'. $t)). ';'; |
|
| 495 | + return ($C['and_mark'] ? "\x06" : '&').(isset($U[$t]) ? $t : (isset($N[$t]) ? (!$C['named_entity'] ? '#'.($C['hexdec_entity'] > 1 ? 'x'.dechex($N[$t]) : $N[$t]) : $t) : 'amp;'.$t)).';'; |
|
| 496 | 496 | } |
| 497 | 497 | if (($n = ctype_digit($t = substr($t, 1)) ? intval($t) : hexdec(substr($t, 1))) < 9 or ($n > 13 && $n < 32) or $n == 11 or $n == 12 or ($n > 126 && $n < 160 && $n != 133) or ($n > 55295 && ($n < 57344 or ($n > 64975 && $n < 64992) or $n == 65534 or $n == 65535 or $n > 1114111))) { |
| 498 | - return ($C['and_mark'] ? "\x06" : '&'). "amp;#{$t};"; |
|
| 498 | + return ($C['and_mark'] ? "\x06" : '&')."amp;#{$t};"; |
|
| 499 | 499 | } |
| 500 | - return ($C['and_mark'] ? "\x06" : '&'). '#'. (((ctype_digit($t) && $C['hexdec_entity'] < 2) or !$C['hexdec_entity']) ? $n : 'x'. dechex($n)). ';'; |
|
| 500 | + return ($C['and_mark'] ? "\x06" : '&').'#'.(((ctype_digit($t) && $C['hexdec_entity'] < 2) or !$C['hexdec_entity']) ? $n : 'x'.dechex($n)).';'; |
|
| 501 | 501 | // eof |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | -function hl_prot($p, $c=null) |
|
| 504 | +function hl_prot($p, $c = null) |
|
| 505 | 505 | { |
| 506 | 506 | // check URL scheme |
| 507 | 507 | global $C; |
@@ -528,18 +528,18 @@ discard block |
||
| 528 | 528 | $p = substr($p, strlen($C['base_url'])); |
| 529 | 529 | } elseif (empty($m[1])) { // Make URL abs |
| 530 | 530 | if (substr($p, 0, 2) == '//') { |
| 531 | - $p = substr($C['base_url'], 0, strpos($C['base_url'], ':')+1). $p; |
|
| 531 | + $p = substr($C['base_url'], 0, strpos($C['base_url'], ':')+1).$p; |
|
| 532 | 532 | } elseif ($p[0] == '/') { |
| 533 | - $p = preg_replace('`(^.+?://[^/]+)(.*)`', '$1', $C['base_url']). $p; |
|
| 533 | + $p = preg_replace('`(^.+?://[^/]+)(.*)`', '$1', $C['base_url']).$p; |
|
| 534 | 534 | } elseif (strcspn($p, './')) { |
| 535 | - $p = $C['base_url']. $p; |
|
| 536 | - } else { |
|
| 535 | + $p = $C['base_url'].$p; |
|
| 536 | + }else { |
|
| 537 | 537 | preg_match('`^([a-zA-Z\d\-+.]+://[^/]+)(.*)`', $C['base_url'], $m); |
| 538 | - $p = preg_replace('`(?<=/)\./`', '', $m[2]. $p); |
|
| 538 | + $p = preg_replace('`(?<=/)\./`', '', $m[2].$p); |
|
| 539 | 539 | while (preg_match('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', $p)) { |
| 540 | 540 | $p = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $p); |
| 541 | 541 | } |
| 542 | - $p = $m[1]. $p; |
|
| 542 | + $p = $m[1].$p; |
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | } |
| 556 | 556 | if ($t = ini_get('track_errors')) { |
| 557 | 557 | $o = isset($php_errormsg) ? $php_errormsg : null; |
| 558 | - } else { |
|
| 558 | + }else { |
|
| 559 | 559 | ini_set('track_errors', 1); |
| 560 | 560 | } |
| 561 | 561 | unset($php_errormsg); |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $r = isset($php_errormsg) ? 0 : 1; |
| 570 | 570 | if ($t) { |
| 571 | 571 | $php_errormsg = isset($o) ? $o : null; |
| 572 | - } else { |
|
| 572 | + }else { |
|
| 573 | 573 | ini_set('track_errors', 0); |
| 574 | 574 | } |
| 575 | 575 | return $r; |
@@ -581,9 +581,9 @@ discard block |
||
| 581 | 581 | // final $spec |
| 582 | 582 | $s = array(); |
| 583 | 583 | $t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace_callback('/"(?>(`.|[^"])*)"/sm', create_function('$m', 'return substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", \'`"\'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\""), $m[0]), 1, -1);'), trim($t))); |
| 584 | - for ($i = count(($t = explode(';', $t))); --$i>=0;) { |
|
| 584 | + for ($i = count(($t = explode(';', $t))); --$i >= 0;) { |
|
| 585 | 585 | $w = $t[$i]; |
| 586 | - if (empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))) { |
|
| 586 | + if (empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))) { |
|
| 587 | 587 | continue; |
| 588 | 588 | } |
| 589 | 589 | $y = $n = array(); |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | if (!preg_match('`^<(/?)([a-zA-Z][a-zA-Z1-6]*)([^>]*?)\s?>$`m', $t, $m)) { |
| 652 | 652 | return str_replace(array('<', '>'), array('<', '>'), $t); |
| 653 | 653 | } elseif (!isset($C['elements'][($e = strtolower($m[2]))])) { |
| 654 | - return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); |
|
| 654 | + return (($C['keep_bad'] % 2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); |
|
| 655 | 655 | } |
| 656 | 656 | // attr string |
| 657 | 657 | $a = str_replace(array("\n", "\r", "\t"), ' ', trim($m[3])); |
@@ -660,13 +660,13 @@ discard block |
||
| 660 | 660 | if ($C['make_tag_strict'] && isset($eD[$e])) { |
| 661 | 661 | $trt = hl_tag2($e, $a, $C['make_tag_strict']); |
| 662 | 662 | if (!$e) { |
| 663 | - return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); |
|
| 663 | + return (($C['keep_bad'] % 2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); |
|
| 664 | 664 | } |
| 665 | 665 | } |
| 666 | 666 | // close tag |
| 667 | 667 | static $eE = array('area'=>1, 'br'=>1, 'col'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'param'=>1); // Empty ele |
| 668 | 668 | if (!empty($m[1])) { |
| 669 | - return (!isset($eE[$e]) ? (empty($C['hook_tag']) ? "</$e>" : $C['hook_tag']($e)) : (($C['keep_bad'])%2 ? str_replace(array('<', '>'), array('<', '>'), $t) : '')); |
|
| 669 | + return (!isset($eE[$e]) ? (empty($C['hook_tag']) ? "</$e>" : $C['hook_tag']($e)) : (($C['keep_bad']) % 2 ? str_replace(array('<', '>'), array('<', '>'), $t) : '')); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | // open tag & attr |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | $w = 1; |
| 712 | 712 | $mode = 2; |
| 713 | 713 | $a = ltrim($a, '= '); |
| 714 | - } else { // No val |
|
| 714 | + }else { // No val |
|
| 715 | 715 | $w = 1; |
| 716 | 716 | $mode = 0; |
| 717 | 717 | $a = ltrim($a); |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | if (!preg_match('`\bnofollow\b`i', $aA['rel'])) { |
| 777 | 777 | $nfr = 1; |
| 778 | 778 | } |
| 779 | - } else { |
|
| 779 | + }else { |
|
| 780 | 780 | $a['rel'] = 'nofollow'; |
| 781 | 781 | } |
| 782 | 782 | } |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | } |
| 791 | 791 | } |
| 792 | 792 | if ($nfr) { |
| 793 | - $a['rel'] = isset($a['rel']) ? $a['rel']. ' nofollow' : 'nofollow'; |
|
| 793 | + $a['rel'] = isset($a['rel']) ? $a['rel'].' nofollow' : 'nofollow'; |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | // rqd attr |
@@ -813,36 +813,36 @@ discard block |
||
| 813 | 813 | if ($k == 'align') { |
| 814 | 814 | unset($a['align']); |
| 815 | 815 | if ($e == 'img' && ($v == 'left' or $v == 'right')) { |
| 816 | - $c[] = 'float: '. $v; |
|
| 816 | + $c[] = 'float: '.$v; |
|
| 817 | 817 | } elseif (($e == 'div' or $e == 'table') && $v == 'center') { |
| 818 | 818 | $c[] = 'margin: auto'; |
| 819 | - } else { |
|
| 820 | - $c[] = 'text-align: '. $v; |
|
| 819 | + }else { |
|
| 820 | + $c[] = 'text-align: '.$v; |
|
| 821 | 821 | } |
| 822 | 822 | } elseif ($k == 'bgcolor') { |
| 823 | 823 | unset($a['bgcolor']); |
| 824 | - $c[] = 'background-color: '. $v; |
|
| 824 | + $c[] = 'background-color: '.$v; |
|
| 825 | 825 | } elseif ($k == 'border') { |
| 826 | 826 | unset($a['border']); |
| 827 | 827 | $c[] = "border: {$v}px"; |
| 828 | 828 | } elseif ($k == 'bordercolor') { |
| 829 | 829 | unset($a['bordercolor']); |
| 830 | - $c[] = 'border-color: '. $v; |
|
| 830 | + $c[] = 'border-color: '.$v; |
|
| 831 | 831 | } elseif ($k == 'clear') { |
| 832 | 832 | unset($a['clear']); |
| 833 | - $c[] = 'clear: '. ($v != 'all' ? $v : 'both'); |
|
| 833 | + $c[] = 'clear: '.($v != 'all' ? $v : 'both'); |
|
| 834 | 834 | } elseif ($k == 'compact') { |
| 835 | 835 | unset($a['compact']); |
| 836 | 836 | $c[] = 'font-size: 85%'; |
| 837 | 837 | } elseif ($k == 'height' or $k == 'width') { |
| 838 | 838 | unset($a[$k]); |
| 839 | - $c[] = $k. ': '. ($v[0] != '*' ? $v. (ctype_digit($v) ? 'px' : '') : 'auto'); |
|
| 839 | + $c[] = $k.': '.($v[0] != '*' ? $v.(ctype_digit($v) ? 'px' : '') : 'auto'); |
|
| 840 | 840 | } elseif ($k == 'hspace') { |
| 841 | 841 | unset($a['hspace']); |
| 842 | 842 | $c[] = "margin-left: {$v}px; margin-right: {$v}px"; |
| 843 | 843 | } elseif ($k == 'language' && !isset($a['type'])) { |
| 844 | 844 | unset($a['language']); |
| 845 | - $a['type'] = 'text/'. strtolower($v); |
|
| 845 | + $a['type'] = 'text/'.strtolower($v); |
|
| 846 | 846 | } elseif ($k == 'name') { |
| 847 | 847 | if ($C['no_deprecated_attr'] == 2 or ($e != 'a' && $e != 'map')) { |
| 848 | 848 | unset($a['name']); |
@@ -858,13 +858,13 @@ discard block |
||
| 858 | 858 | $c[] = 'white-space: nowrap'; |
| 859 | 859 | } elseif ($k == 'size') { |
| 860 | 860 | unset($a['size']); |
| 861 | - $c[] = 'size: '. $v. 'px'; |
|
| 861 | + $c[] = 'size: '.$v.'px'; |
|
| 862 | 862 | } elseif ($k == 'start' or $k == 'value') { |
| 863 | 863 | unset($a[$k]); |
| 864 | 864 | } elseif ($k == 'type') { |
| 865 | 865 | unset($a['type']); |
| 866 | 866 | static $ol_type = array('i'=>'lower-roman', 'I'=>'upper-roman', 'a'=>'lower-latin', 'A'=>'upper-latin', '1'=>'decimal'); |
| 867 | - $c[] = 'list-style-type: '. (isset($ol_type[$v]) ? $ol_type[$v] : 'decimal'); |
|
| 867 | + $c[] = 'list-style-type: '.(isset($ol_type[$v]) ? $ol_type[$v] : 'decimal'); |
|
| 868 | 868 | } elseif ($k == 'vspace') { |
| 869 | 869 | unset($a['vspace']); |
| 870 | 870 | $c[] = "margin-top: {$v}px; margin-bottom: {$v}px"; |
@@ -872,16 +872,16 @@ discard block |
||
| 872 | 872 | } |
| 873 | 873 | if (count($c)) { |
| 874 | 874 | $c = implode('; ', $c); |
| 875 | - $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;'). '; '. $c. ';': $c. ';'; |
|
| 875 | + $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;').'; '.$c.';' : $c.';'; |
|
| 876 | 876 | } |
| 877 | 877 | } |
| 878 | 878 | // unique ID |
| 879 | 879 | if ($C['unique_ids'] && isset($a['id'])) { |
| 880 | 880 | if (!preg_match('`^[A-Za-z][A-Za-z0-9_\-.:]*$`', ($id = $a['id'])) or (isset($GLOBALS['hl_Ids'][$id]) && $C['unique_ids'] == 1)) { |
| 881 | 881 | unset($a['id']); |
| 882 | - } else { |
|
| 882 | + }else { |
|
| 883 | 883 | while (isset($GLOBALS['hl_Ids'][$id])) { |
| 884 | - $id = $C['unique_ids']. $id; |
|
| 884 | + $id = $C['unique_ids'].$id; |
|
| 885 | 885 | } |
| 886 | 886 | $GLOBALS['hl_Ids'][($a['id'] = $id)] = 1; |
| 887 | 887 | } |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | } |
| 896 | 896 | // for transformed tag |
| 897 | 897 | if (!empty($trt)) { |
| 898 | - $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;'). '; '. $trt : $trt; |
|
| 898 | + $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;').'; '.$trt : $trt; |
|
| 899 | 899 | } |
| 900 | 900 | // return with empty ele / |
| 901 | 901 | if (empty($C['hook_tag'])) { |
@@ -903,14 +903,14 @@ discard block |
||
| 903 | 903 | foreach ($a as $k=>$v) { |
| 904 | 904 | $aA .= " {$k}=\"{$v}\""; |
| 905 | 905 | } |
| 906 | - return "<{$e}{$aA}". (isset($eE[$e]) ? ' /' : ''). '>'; |
|
| 907 | - } else { |
|
| 906 | + return "<{$e}{$aA}".(isset($eE[$e]) ? ' /' : '').'>'; |
|
| 907 | + }else { |
|
| 908 | 908 | return $C['hook_tag']($e, $a); |
| 909 | 909 | } |
| 910 | 910 | // eof |
| 911 | 911 | } |
| 912 | 912 | |
| 913 | -function hl_tag2(&$e, &$a, $t=1) |
|
| 913 | +function hl_tag2(&$e, &$a, $t = 1) |
|
| 914 | 914 | { |
| 915 | 915 | // transform tag |
| 916 | 916 | if ($e == 'center') { |
@@ -933,13 +933,13 @@ discard block |
||
| 933 | 933 | if ($e == 'font') { |
| 934 | 934 | $a2 = ''; |
| 935 | 935 | if (preg_match('`face\s*=\s*(\'|")([^=]+?)\\1`i', $a, $m) or preg_match('`face\s*=(\s*)(\S+)`i', $a, $m)) { |
| 936 | - $a2 .= ' font-family: '. str_replace('"', '\'', trim($m[2])). ';'; |
|
| 936 | + $a2 .= ' font-family: '.str_replace('"', '\'', trim($m[2])).';'; |
|
| 937 | 937 | } |
| 938 | 938 | if (preg_match('`color\s*=\s*(\'|")?(.+?)(\\1|\s|$)`i', $a, $m)) { |
| 939 | - $a2 .= ' color: '. trim($m[2]). ';'; |
|
| 939 | + $a2 .= ' color: '.trim($m[2]).';'; |
|
| 940 | 940 | } |
| 941 | 941 | if (preg_match('`size\s*=\s*(\'|")?(.+?)(\\1|\s|$)`i', $a, $m) && isset($fs[($m = trim($m[2]))])) { |
| 942 | - $a2 .= ' font-size: '. $fs[$m]. ';'; |
|
| 942 | + $a2 .= ' font-size: '.$fs[$m].';'; |
|
| 943 | 943 | } |
| 944 | 944 | $e = 'span'; |
| 945 | 945 | return ltrim($a2); |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | echo str_repeat($s, ++$n); |
| 980 | 980 | } |
| 981 | 981 | echo ltrim(array_shift($t)); |
| 982 | - for ($i=-1, $j=count($t); ++$i<$j;) { |
|
| 982 | + for ($i = -1, $j = count($t); ++$i < $j;) { |
|
| 983 | 983 | $r = ''; |
| 984 | 984 | list($e, $r) = explode('>', $t[$i]); |
| 985 | 985 | $x = $e[0] == '/' ? 0 : (substr($e, -1) == '/' ? 1 : ($e[0] != '!' ? 2 : -1)); |
@@ -989,22 +989,22 @@ discard block |
||
| 989 | 989 | if (!$x) { |
| 990 | 990 | if ($n) { |
| 991 | 991 | echo "\n", str_repeat($s, --$n), "$e\n", str_repeat($s, $n); |
| 992 | - } else { |
|
| 992 | + }else { |
|
| 993 | 993 | ++$N; |
| 994 | 994 | ob_end_clean(); |
| 995 | 995 | continue 2; |
| 996 | 996 | } |
| 997 | - } else { |
|
| 997 | + }else { |
|
| 998 | 998 | echo "\n", str_repeat($s, $n), "$e\n", str_repeat($s, ($x != 1 ? ++$n : $n)); |
| 999 | 999 | } |
| 1000 | 1000 | echo $r; |
| 1001 | 1001 | continue; |
| 1002 | 1002 | } |
| 1003 | - $f = "\n". str_repeat($s, $n); |
|
| 1003 | + $f = "\n".str_repeat($s, $n); |
|
| 1004 | 1004 | if (isset($c[$y])) { |
| 1005 | 1005 | if (!$x) { |
| 1006 | 1006 | echo $e, $f, $r; |
| 1007 | - } else { |
|
| 1007 | + }else { |
|
| 1008 | 1008 | echo $f, $e, $r; |
| 1009 | 1009 | } |
| 1010 | 1010 | } elseif (isset($b[$y])) { |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | echo $e, $f, $r; |
| 1014 | 1014 | } elseif (!$y) { |
| 1015 | 1015 | echo $f, $e, $f, $r; |
| 1016 | - } else { |
|
| 1016 | + }else { |
|
| 1017 | 1017 | echo $e, $r; |
| 1018 | 1018 | } |
| 1019 | 1019 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | // eof |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | -function kses($t, $h, $p=array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'gopher', 'mailto')) |
|
| 1038 | +function kses($t, $h, $p = array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'gopher', 'mailto')) |
|
| 1039 | 1039 | { |
| 1040 | 1040 | // kses compat |
| 1041 | 1041 | foreach ($h as $k=>$v) { |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | $C['keep_bad'] = 1; |
| 1046 | 1046 | $C['elements'] = count($h) ? strtolower(implode(',', array_keys($h))) : '-*'; |
| 1047 | 1047 | $C['hook'] = 'kses_hook'; |
| 1048 | - $C['schemes'] = '*:'. implode(',', $p); |
|
| 1048 | + $C['schemes'] = '*:'.implode(',', $p); |
|
| 1049 | 1049 | return htmLawed($t, $C, $h); |
| 1050 | 1050 | // eof |
| 1051 | 1051 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $text = cleanupHTML($text, $clean); |
| 23 | 23 | } |
| 24 | 24 | $teaser = substr($text, 0, $max); |
| 25 | - return strlen($text) <= $max ? $teaser : $teaser . $ending; |
|
| 25 | + return strlen($text) <= $max ? $teaser : $teaser.$ending; |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | function cleanupHTML($value, $whitelist = null) |
| 62 | 62 | { |
| 63 | 63 | if (!function_exists('cleanupHTML')) { |
| 64 | - require_once __DIR__ . '/vendors/htmlLawed.php'; |
|
| 64 | + require_once __DIR__.'/vendors/htmlLawed.php'; |
|
| 65 | 65 | } |
| 66 | 66 | if (is_null($whitelist)) { |
| 67 | 67 | $whitelist = '<code><span><div><label><a><br><p><b><i><del><strike><u><img><video><audio><iframe><object><embed><param><blockquote><mark><cite><small><ul><ol><li><hr><dl><dt><dd><sup><sub><big><pre><code><figure><figcaption><strong><em><table><tr><td><th><tbody><thead><tfoot><h1><h2><h3><h4><h5><h6>'; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @throws \InvalidArgumentException |
| 133 | 133 | */ |
| 134 | 134 | |
| 135 | -if (! function_exists('revasset')) { |
|
| 135 | +if (!function_exists('revasset')) { |
|
| 136 | 136 | function revasset($file) |
| 137 | 137 | { |
| 138 | 138 | static $manifest = null; |
@@ -168,16 +168,16 @@ discard block |
||
| 168 | 168 | 'scheme', 'host', 'port', 'path', 'query', 'fragment' |
| 169 | 169 | ], null), $parsed_url, $overrides); |
| 170 | 170 | |
| 171 | - $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'] . '://' : null; |
|
| 172 | - $port = $parsed_url['port'] ? ':' . $parsed_url['port'] : null; |
|
| 173 | - $fragment = $parsed_url['fragment'] ? '#' . $parsed_url['fragment'] : null; |
|
| 171 | + $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'].'://' : null; |
|
| 172 | + $port = $parsed_url['port'] ? ':'.$parsed_url['port'] : null; |
|
| 173 | + $fragment = $parsed_url['fragment'] ? '#'.$parsed_url['fragment'] : null; |
|
| 174 | 174 | |
| 175 | - $baseurl = $scheme . $parsed_url['host'] . $port . $parsed_url['path']; |
|
| 175 | + $baseurl = $scheme.$parsed_url['host'].$port.$parsed_url['path']; |
|
| 176 | 176 | $current_query = []; |
| 177 | 177 | |
| 178 | 178 | $_query = explode('&', $parsed_url['query']); |
| 179 | 179 | |
| 180 | - array_map(function ($v) use (&$current_query) { |
|
| 180 | + array_map(function($v) use (&$current_query) { |
|
| 181 | 181 | if (!$v) { |
| 182 | 182 | return; |
| 183 | 183 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | $query = urldecode(http_build_query(array_merge($current_query, $query_params))); |
| 197 | 197 | |
| 198 | - return $baseurl . '?' . $query . $fragment; |
|
| 198 | + return $baseurl.'?'.$query.$fragment; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use Thinktomorrow\Chief\Users\User; |
| 4 | 4 | use Thinktomorrow\Chief\Pages\Page; |
| 5 | 5 | |
| 6 | -$factory->define(User::class, function (Faker\Generator $faker) { |
|
| 6 | +$factory->define(User::class, function(Faker\Generator $faker) { |
|
| 7 | 7 | static $password; |
| 8 | 8 | |
| 9 | 9 | return [ |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | ]; |
| 15 | 15 | }); |
| 16 | 16 | |
| 17 | -$factory->define(Page::class, function (Faker\Generator $faker) { |
|
| 17 | +$factory->define(Page::class, function(Faker\Generator $faker) { |
|
| 18 | 18 | return [ |
| 19 | 19 | 'published' => $faker->boolean(), |
| 20 | 20 | 'featured' => $faker->boolean(), |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('pages', function (Blueprint $table) { |
|
| 16 | + Schema::create('pages', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->boolean('published')->default(false); |
| 19 | 19 | $table->boolean('featured')->default(false); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $table->softDeletes(); |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | - Schema::create('page_translations', function (Blueprint $table) { |
|
| 26 | + Schema::create('page_translations', function(Blueprint $table) { |
|
| 27 | 27 | $table->increments('id'); |
| 28 | 28 | $table->integer('page_id')->unsigned(); |
| 29 | 29 | $table->string('locale'); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('relations', function (Blueprint $table) { |
|
| 16 | + Schema::create('relations', function(Blueprint $table) { |
|
| 17 | 17 | $table->string("parent_type"); |
| 18 | 18 | $table->unsignedBigInteger("parent_id"); |
| 19 | 19 | $table->string("child_type"); |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | protected function schedule(Schedule $schedule) |
| 35 | 35 | { |
| 36 | - $schedule->call(function () { |
|
| 36 | + $schedule->call(function() { |
|
| 37 | 37 | Page::onlyTrashed()->where('deleted_at', '<', Carbon::today()->subDays($this->daysBeforeDeletion))->forceDelete(); |
| 38 | 38 | })->dailyAt('03:00'); |
| 39 | 39 | } |
@@ -75,6 +75,6 @@ |
||
| 75 | 75 | |
| 76 | 76 | public function getShortNameAttribute() |
| 77 | 77 | { |
| 78 | - return $this->firstname . ' ' . substr($this->lastname, 0, 1) . '.'; |
|
| 78 | + return $this->firstname.' '.substr($this->lastname, 0, 1).'.'; |
|
| 79 | 79 | } |
| 80 | 80 | } |