Changeset 3882:254f3929b2c4
- Timestamp:
- 09/19/18 10:11:05 (7 years ago)
- Branch:
- default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/common.js
r3881 r3882 525 525 if (!opt.remove && opt.value !== null) { 526 526 // Compose badge classes 527 const cls = `badge badge-${opt.id} ${opt.inline ? 'badge-inline' : 'badge-block'}${opt.icon ? ' badge-icon' : ''}${opt.type !== '' ? ` badge-${opt.type}` : ''}${opt.left ? ' badge-left' : ''}${opt.noborder ? ' badge-noborder' : ''}${opt.small ? ' badge-small' : ''}${opt.classes !== '' ? ` ${opt.classes}` : ''}`; 527 const cls = `badge badge-${opt.id} \ 528 ${opt.inline ? 'badge-inline' : 'badge-block'}\ 529 ${opt.icon ? ' badge-icon' : ''}\ 530 ${opt.type !== '' ? ` badge-${opt.type}` : ''}\ 531 ${opt.left ? ' badge-left' : ''}\ 532 ${opt.noborder ? ' badge-noborder' : ''}\ 533 ${opt.small ? ' badge-small' : ''}\ 534 ${opt.classes !== '' ? ` ${opt.classes}` : ''}`; 528 535 // Compose badge 529 536 const xml = `<span class="${cls}" aria-hidden="true">${opt.value}</span>`; -
build-tools/Minifier.php
r3877 r3882 107 107 108 108 $jshrink = new Minifier(); 109 $js = $jshrink->lock($js);109 $js = $jshrink->lock($js); 110 110 $jshrink->minifyDirectToOutput($js, $options); 111 111 … … 155 155 { 156 156 $this->options = array_merge(static::$defaultOptions, $options); 157 $js = str_replace("\r\n", "\n", $js);158 $js = str_replace('/**/', '', $js);159 $this->input = str_replace("\r", "\n", $js);157 $js = str_replace("\r\n", "\n", $js); 158 $js = str_replace('/**/', '', $js); 159 $this->input = str_replace("\r", "\n", $js); 160 160 161 161 // We add a newline to the end of the script to make it easier to deal … … 190 190 // if B is a space we skip the rest of the switch block and go down to the 191 191 // string/regex check below, resetting $this->b with getReal 192 if ($this->b === ' ')192 if ($this->b === ' ') { 193 193 break; 194 } 194 195 195 196 // otherwise we treat the newline like a space 196 197 197 198 case ' ': 198 if (static::isAlphaNumeric($this->b))199 if (static::isAlphaNumeric($this->b)) { 199 200 echo $this->a; 201 } 200 202 201 203 $this->saveString(); … … 205 207 switch ($this->b) { 206 208 case "\n": 207 if (strpos('}])+-"\' ', $this->a) !== false) {209 if (strpos('}])+-"\'`', $this->a) !== false) { 208 210 echo $this->a; 209 211 $this->saveString(); … … 218 220 219 221 case ' ': 220 if (!static::isAlphaNumeric($this->a))222 if (!static::isAlphaNumeric($this->a)) { 221 223 break; 224 } 222 225 223 226 default: 224 227 // check for some regex that breaks stuff 225 if ($this->a === '/' && ($this->b === '\'' || $this->b === '"' )) {228 if ($this->a === '/' && ($this->b === '\'' || $this->b === '"' || $this->b === '`')) { 226 229 $this->saveRegex(); 227 230 continue; … … 237 240 $this->b = $this->getReal(); 238 241 239 if (($this->b == '/' && strpos('(,=:[!&|?', $this->a) !== false))242 if (($this->b == '/' && strpos('(,=:[!&|?', $this->a) !== false)) { 240 243 $this->saveRegex(); 244 } 245 241 246 } 242 247 } … … 251 256 unset($this->input); 252 257 $this->index = 0; 253 $this->a = $this->b= '';258 $this->a = $this->b = ''; 254 259 unset($this->c); 255 260 unset($this->options); … … 268 273 unset($this->c); 269 274 270 // Otherwise we start pulling from the input.275 // Otherwise we start pulling from the input. 271 276 } else { 272 277 $char = substr($this->input, $this->index, 1); … … 283 288 // Normalize all whitespace except for the newline character into a 284 289 // standard space. 285 if($char !== "\n" && ord($char) < 32) 286 290 if ($char !== "\n" && ord($char) < 32) { 287 291 return ' '; 292 } 288 293 289 294 return $char; … … 303 308 { 304 309 $startIndex = $this->index; 305 $char = $this->getChar();310 $char = $this->getChar(); 306 311 307 312 // Check to see if we're potentially in a comment … … 365 370 if ($this->getNext('*/')) { 366 371 367 $this->getChar(); // get *368 $this->getChar(); // get /372 $this->getChar(); // get * 373 $this->getChar(); // get / 369 374 $char = $this->getChar(); // get next real character 370 375 371 376 // Now we reinsert conditional comments and YUI-style licensing comments 372 377 if (($this->options['flaggedComments'] && $thirdCommentString === '!') 373 || ($thirdCommentString === '@') 378 || ($thirdCommentString === '@')) { 374 379 375 380 // If conditional comments or flagged comments are not the first thing in the script … … 395 400 } 396 401 397 if ($char === false)402 if ($char === false) { 398 403 throw new \RuntimeException('Unclosed multiline comment at position: ' . ($this->index - 2)); 404 } 399 405 400 406 // if we're here c is part of the comment and therefore tossed 401 if (isset($this->c))407 if (isset($this->c)) { 402 408 unset($this->c); 409 } 403 410 404 411 return $char; … … 419 426 420 427 // If it's not there return false. 421 if($pos === false) 422 428 if ($pos === false) { 423 429 return false; 430 } 424 431 425 432 // Adjust position of index to jump ahead to the asked for string … … 445 452 446 453 // If this isn't a string we don't need to do anything. 447 if ($this->a !== "'" && $this->a !== '"' ) {454 if ($this->a !== "'" && $this->a !== '"' && $this->a !== '`') { 448 455 return; 449 456 } 450 457 451 // String type is the quote used, " or ' 458 // String type is the quote used, " or ' or ` 452 459 $stringType = $this->a; 453 460 … … 474 481 // block below. 475 482 case "\n": 476 throw new \RuntimeException('Unclosed string at position: ' . $startpos 483 throw new \RuntimeException('Unclosed string at position: ' . $startpos); 477 484 break; 478 485 … … 494 501 break; 495 502 496 497 503 // Since we're not dealing with any special cases we simply 498 504 // output the character and continue our loop. … … 514 520 515 521 while (($this->a = $this->getChar()) !== false) { 516 if ($this->a === '/')522 if ($this->a === '/') { 517 523 break; 524 } 518 525 519 526 if ($this->a === '\\') { … … 522 529 } 523 530 524 if ($this->a === "\n")531 if ($this->a === "\n") { 525 532 throw new \RuntimeException('Unclosed regex pattern at position: ' . $this->index); 533 } 526 534 527 535 echo $this->a;
Note: See TracChangeset
for help on using the changeset viewer.