Skip to content

Commit 776a5c4

Browse files
committed
update less.php to v3.4.0
1 parent b54336b commit 776a5c4

19 files changed

Lines changed: 275 additions & 121 deletions

external/ExtPrograms3.csv

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Doctrine Lexer,3.0.1,github.com/doctrine/lexer,3.0.1,needed by swiftmailer v6
44
EmailValidator,4.0.2,github.com/egulias/EmailValidator,4.0.4,needed by swiftmailer v6; change folder structure and add autoloader to main file
55
ups-php,0.2,github.com/sanbornm/ups-php,0.2,"updated/fixed xml, etc to work"
66
fedex-php,31.0.0,www.fedex.com/wpor/web/jsp/drclinks.jsp?links=wss/getstarted.html,31.0.0,copy/edit RateAvailableServicesWebServiceClient.php into fedexshippingcalculator->getRates()
7-
Smarty,4.4.1,smarty.net,4.5.5/5.4.5,
7+
Smarty,4.4.1,smarty.net,4.5.5/5.5.2,
88
phpthumb,1.7.23exp,github.com/JamesHeinrich/phpThumb,1.7.23,phpThumb.config.php - we also allow &amp in parsing and err command
99
getid3,1.9.23,github.com/JamesHeinrich/getID3,1.9.23,
1010
minify,2.3.3,github.com/mrclay/minify,2.3.3/3.0.4/4.0.1,modify config.php
@@ -23,11 +23,11 @@ class.upload,2.1.6exp,github.com/verot/class.upload.php,2.1.6,"Correct flip oper
2323
iCalCreator,2.28.2,github.com/iCalcreator/iCalcreator,2.40.10/2.41.92,uncomment load utilities; php 8 fix
2424
scssphp,1.11.1exp,github.com/scssphp/scssphp,1.13.0/2.0.1,includes example server; hack to compile newui
2525
lessphp,0.5.0exp,github.com/leafo/lessphp,0.5.0,"will not compile bootstrap v3+, hack to allow prefix"
26-
less.php,5.1.2,github.com/wikimedia/less.php,5.3.1,
26+
less.php,5.40,github.com/wikimedia/less.php,5.4.0,
2727
Twitter-Bootstrap2,2.3.2,github.com/twbs/bootstrap,2.3.2,"patched bootstrap.less includes swatches, fontawesome & exp variables"
2828
Bootstrap3,3.4.1,github.com/twbs/bootstrap,3.4.1,patched bootstrap.less includes swatches & exp variables
2929
Bootstrap4,4.6.2,github.com/twbs/bootstrap,4.6.2,"patched bootstrap.scss includes swatches & exp variables, remove @page"
30-
Bootstrap5,5.3.7,github.com/twbs/bootstrap,5.3.7,patched bootstrap.scss includes swatches & exp variables
30+
Bootstrap5,5.3.8,github.com/twbs/bootstrap,5.3.8,patched bootstrap.scss includes swatches & exp variables
3131
popper.js/floating-ui,1.16.1,github.com/FezVrasta/popper.js,1.16.1/2.11.8,needed by BS4/BS5 (umd)
3232
Bootswatch2,2.3.2,bootswatch.com,2.3.2,
3333
Bootswatch3,3.4.1+1,bootswatch.com,3.4.1+1,change 1st line variables.less comment to output to .css file
@@ -36,7 +36,7 @@ Bootswatch5,5.3.7,bootswatch.com,5.3.7,change 1st line variables.scss comment to
3636
Font-Awesome3,3.2.1,fontawesome.github.com/Font-Awesome,3.2.1,updated FontAwesomePath in variables.less
3737
Font-Awesome4,4.7.0,fontawesome.github.com/Font-Awesome,4.7.0,
3838
Font-Awesome5,5.15.4,fontawesome.com,5.15.4,add import all 'fonts' sheets into main sheet
39-
Font-Awesome6,6.7.2,fontawesome.com,6.7.2,add import all 'fonts' sheets into main sheet
39+
Font-Awesome6,6.7.2,fontawesome.com,6.7.2/7.0.0,add import all 'fonts' sheets into main sheet
4040
Bootstrap-Icons,1.13.1,icons.getbootstrap.com,1.13.1,"patched bootstrap-icons.scss for custom folder structure, includes animation & size variables"
4141
Adminer,4.8.1exp,www.adminer.org,4.8.4evo,"customized plugins: tinymce, ckeditor, previewSerialized, edit-textarea & edit-calendar; edit sql tweak"
4242
SimpleAjaxUploader,2.6.7,github.com/LPology/Simple-Ajax-Uploader,2.6.7,also converted to yui module 2.5.3
@@ -50,7 +50,7 @@ html5shiv,3.7.3,github.com/aFarkas/html5shiv,3.7.3,IE6-8 shim
5050
csshover.htc,3.11,peterned.home.xs4all.nl/csshover.html,3.11,IE6 shim
5151
CKEditor,4.21.0,ckeditor.com,4.22.1/45.2.0,"add fieldinsert (exp), autosave, sourcedialog & kama and moono skins"
5252
TinyMCE,4.9.11,tiny.cloud,4.9.11,"add localautosave, fieldinsert (exp) & quickupload (exp) plugins, & xenmce skin"
53-
TinyMCE v5,5.10.9,tiny.cloud,5.10.9/6.8.6/7.9.1,"add localautosave, fieldinsert (exp) & quickupload (exp) plugins"
53+
TinyMCE v5,5.10.9,tiny.cloud,5.10.9/6.8.6/8.0.2,"add localautosave, fieldinsert (exp) & quickupload (exp) plugins"
5454
PLUpload,2.3.9,github.com/moxiecode/plupload,2.3.9/3.1.5,"needed for TinyMCE Quick Upload, placed in that plugin folder"
5555
elFinder,2.1.65,elfinder.org,2.1.65,customized in /framework with Exponent php classes and .js files
5656
jQuery1,1.12.4,jquery.com,1.12.4,v1.11.3 still needed for old firefox
@@ -64,7 +64,7 @@ validate,1.21.0exp,jqueryvalidation.org,1.21.0,edit for 'undefined' in 'min' & '
6464
Countdown,1.1,tutorialzine.com/2011/12/countdown-jquery,1.1,
6565
timepicker,1.6.3,trentrichardson.com/examples/timepicker,1.6.3,used by adminer
6666
TimeCircles,1.5.3,github.com/wimbarelds/TimeCircles,1.5.3,
67-
DataTables,2.3.2,www.datatables.net,1.13.8/2.3.2,includes boostrap2 integration w/ renamed 1.10.7 version
67+
DataTables,2.3.3,www.datatables.net,1.13.8/2.3.3,includes boostrap2 integration w/ renamed 1.10.7 version
6868
DataTables Checkboxes,1.3.0,github.com/gyrocode/jquery-datatables-checkboxes,1.3.0,
6969
DataTables Tabletools,2.2.4,www.datatables.net,2.2.4,replaced by 'Buttons' in 1.10.8
7070
Responsive DataTables,0.2.0,github.com/Comanche/datatables-responsive,0.2.0,replaced by 'Responsive' in 1.10.8
@@ -78,7 +78,7 @@ Searcher,0.3.0,github.com/lloiser/jquery-searcher,0.3.0,
7878
DateTimePicker,2.5.21exp,github.com/xdan/datetimepicker,2.5.21,rename .full version; we add .js auto-close on inline date select and extra 'reset' work & remove .css z-index issue
7979
Bootstrap DateTimePicker,4.17.49,github.com/Eonasdan/bootstrap-datetimepicker,4.17.49,"patch for 'today' button in side-by-side view, modded version placed in bootstrap4theme & bootstrap5theme to help yadcf"
8080
Tempus Dominus Bootstrap 4,5.39.0,github.com/tempusdominus/bootstrap-4,5.39.0,
81-
Tempus Dominus Bootstrap 5,6.10.2,github.com/Eonasdan/tempus-dominus,6.10.4,added .inline z-index style; scss change @use color
81+
Tempus Dominus Bootstrap 5,6.10.4,github.com/Eonasdan/tempus-dominus,6.10.4,added .inline z-index style; scss change @use color
8282
moment.js,2.30.1,github.com/moment/moment,2.30.1,needed for Bootstrap DateTimePicker; min/moment-with-locales.js renamed
8383
strength-meter,1.1.4,github.com/kartik-v/strength-meter,1.1.4,
8484
Sortable,1.15.6,github.com/SortableJS/Sortable,1.15.6,
@@ -95,21 +95,21 @@ select2,4.0.13,github.com/select2/select2,4.0.13,renamed select2.full.js to sele
9595
shuffle.js,v3.1.1,github.com/glen-cheney/Shuffle,4.2.0/5.4.1/6.1.2,
9696
Jasny Bootstrap2,2.3.1,jasny.github.io/bootstrap,2.3.1,only using bootstrap-fileupload at this time
9797
Jasny Bootstrap,4.0.0,jasny.github.io/bootstrap,4.0.0,only using fileinput at this time
98-
easypost sdk,7.4.2,github.com/EasyPost/easypost-php,8.2.0,
98+
easypost sdk,8.2.0,github.com/EasyPost/easypost-php,8.2.0,
9999
jquery.cookie.js,1.4.1,github.com/carhartl/jquery-cookie,1.4.1,
100100
jquery.history.js,1.8b2,github.com/browserstate/history.js,1.8.0,
101101
Webshim,1.16.0,github.com/aFarkas/webshim,1.16.0,
102102
,,,,
103103
"Optional, not included",,,,
104104
dompdf,3.0.1exp/1.2.2exp,github.com/dompdf/dompdf,3.1.0,"optional, patched to display our images and not break on bad tables and disable links"
105-
mPDF,8.2.5,github.com/mpdf/mpdf,8.2.5,optional
105+
mPDF,8.2.5,github.com/mpdf/mpdf,8.2.6,optional
106106
HTML2PDF,5.2.8,github.com/spipu/html2pdf,5.3.3,"optional, we tweak tcpdfConfig.php"
107107
iLess,2.2.0,github.com/mishal/iless,2.2.0,"optional, has issues with bootstrap v2"
108108
Kint,1.1/2.2/6.0.1,github.com/kint-php/kint,6.0.1,"optional, for formatted edebug output"
109109
,,,,
110110
Not included yet,,,,
111-
DataTables Buttons,,www.datatables.net,2.4.2/3.2.3,
112-
DataTables Responsive,,www.datatables.net,2.5.0/3.0.4,
111+
DataTables Buttons,,www.datatables.net,2.4.2/3.2.4,
112+
DataTables Responsive,,www.datatables.net,2.5.0/3.0.6,
113113
,,,,
114114
No longer included,,,,
115115
pwstrength-bootstrap,2.0.0,github.com/ablanco/jquery.pwstrength.bootstrap,,

external/less.php/CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v5.4.0
4+
5+
Added:
6+
* Add support for Logical Functions `if()` and `boolean()`. (Hannah Okwelum) [T393383](https://phabricator.wikimedia.org/T393383)
7+
8+
Changed:
9+
* Remove support for PHP 7.4 and 8.0. Raise requirement to PHP 8.1+. (James D. Forrester)
10+
311
## v5.3.1
412

513
Fixed:

external/less.php/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ _See also [SECURITY](./SECURITY.md)._
4848
* **[Icinga](https://en.wikipedia.org/wiki/Icinga)** in Icinga Web ([docs](https://github.com/Icinga/icingaweb2)).
4949
* **[Shopware](https://de.wikipedia.org/wiki/Shopware)** ([docs](https://developers.shopware.com/designers-guide/less/)).
5050
* **[Winter CMS](https://wintercms.com/)** ([docs](https://wintercms.com/docs/v1.2/docs/themes/development))
51+
* **[Flarum](https://en.wikipedia.org/wiki/Flarum)** ([docs](https://docs.flarum.org/themes/))
5152

5253
## Integrations
5354

external/less.php/lib/Less/Autoloader.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
*/
66
class Less_Autoloader {
77

8-
/** @var bool */
9-
protected static $registered = false;
8+
protected static bool $registered = false;
109

1110
/**
1211
* Register the autoloader in the SPL autoloader
1312
*
14-
* @return void
1513
* @throws Exception If there was an error in registration
1614
*/
17-
public static function register() {
15+
public static function register(): void {
1816
if ( self::$registered ) {
1917
return;
2018
}
@@ -28,10 +26,8 @@ public static function register() {
2826

2927
/**
3028
* Unregister the autoloader
31-
*
32-
* @return void
3329
*/
34-
public static function unregister() {
30+
public static function unregister(): void {
3531
spl_autoload_unregister( [ __CLASS__, 'loadClass' ] );
3632
self::$registered = false;
3733
}
@@ -41,17 +37,16 @@ public static function unregister() {
4137
*
4238
* @param string $className The class to load
4339
*/
44-
public static function loadClass( $className ) {
40+
public static function loadClass( string $className ): void {
4541
// handle only package classes
46-
if ( strpos( $className, 'Less_' ) !== 0 ) {
42+
if ( !str_starts_with( $className, 'Less_' ) ) {
4743
return;
4844
}
4945

5046
$className = substr( $className, 5 );
5147
$fileName = __DIR__ . DIRECTORY_SEPARATOR . str_replace( '_', DIRECTORY_SEPARATOR, $className ) . '.php';
5248

5349
require $fileName;
54-
return true;
5550
}
5651

5752
}

external/less.php/lib/Less/Cache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public static function Cache( &$less_files, $parser_options = [] ) {
147147
foreach ( $less_files as $file_path => $uri_or_less ) {
148148

149149
// treat as less markup if there are newline characters
150-
if ( strpos( $uri_or_less, "\n" ) !== false ) {
150+
if ( str_contains( $uri_or_less, "\n" ) ) {
151151
$parser->Parse( $uri_or_less );
152152
continue;
153153
}
@@ -236,7 +236,7 @@ public static function CleanCache( $dir = null ) {
236236
foreach ( $files as $file ) {
237237

238238
// don't delete if the file wasn't created with less.php
239-
if ( strpos( $file, self::$prefix ) !== 0 ) {
239+
if ( !str_starts_with( $file, self::$prefix ) ) {
240240
continue;
241241
}
242242

external/less.php/lib/Less/Exception/Chunk.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function __construct( $input, ?Exception $previous = null, $index = null,
3232

3333
$this->Chunks();
3434
$this->genMessage();
35+
$this->getFinalMessage();
3536
}
3637

3738
/**

external/less.php/lib/Less/Exception/Parser.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class Less_Exception_Parser extends Exception {
1919
*/
2020
public $index;
2121

22+
/** @var string */
23+
public $finalMessage = '';
24+
2225
/** @var string|null */
2326
protected $input;
2427

@@ -49,14 +52,14 @@ protected function getInput() {
4952
*/
5053
public function genMessage() {
5154
if ( $this->currentFile && $this->currentFile['filename'] ) {
52-
$this->message .= ' in ' . basename( $this->currentFile['filename'] );
55+
$this->finalMessage .= ' in ' . basename( $this->currentFile['filename'] );
5356
}
5457

5558
if ( $this->index !== null ) {
5659
$this->getInput();
5760
if ( $this->input ) {
5861
$line = self::getLineNumber();
59-
$this->message .= ' on line ' . $line . ', column ' . self::getColumn();
62+
$this->finalMessage .= ' on line ' . $line . ', column ' . self::getColumn();
6063

6164
$lines = explode( "\n", $this->input );
6265

@@ -65,7 +68,7 @@ public function genMessage() {
6568
$last_line = min( $count, $start_line + 6 );
6669
$num_len = strlen( $last_line );
6770
for ( $i = $start_line; $i < $last_line; $i++ ) {
68-
$this->message .= "\n" . str_pad( (string)( $i + 1 ), $num_len, '0', STR_PAD_LEFT ) . '| ' . $lines[$i];
71+
$this->finalMessage .= "\n" . str_pad( (string)( $i + 1 ), $num_len, '0', STR_PAD_LEFT ) . '| ' . $lines[$i];
6972
}
7073
}
7174
}
@@ -78,12 +81,7 @@ public function genMessage() {
7881
*/
7982
public function getLineNumber() {
8083
if ( $this->index ) {
81-
// https://bugs.php.net/bug.php?id=49790
82-
if ( ini_get( "mbstring.func_overload" ) ) {
83-
return substr_count( substr( $this->input, 0, $this->index ), "\n" ) + 1;
84-
} else {
85-
return substr_count( $this->input, "\n", 0, $this->index ) + 1;
86-
}
84+
return substr_count( $this->input, "\n", 0, $this->index ) + 1;
8785
}
8886
return 1;
8987
}
@@ -99,4 +97,7 @@ public function getColumn() {
9997
return $this->index - $pos;
10098
}
10199

100+
public function getFinalMessage() {
101+
$this->message .= $this->finalMessage;
102+
}
102103
}

external/less.php/lib/Less/Functions.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,4 +1388,13 @@ private function colorBlendNegation( $cb, $cs ) {
13881388

13891389
// ~ End of Color Blending
13901390

1391+
public function if( $condition, $trueValue, $falseValue = null ) {
1392+
return $condition->compile( $this->env ) ? $trueValue->compile( $this->env )
1393+
: ( $falseValue ? $falseValue->compile( $this->env ) : new Less_Tree_Anonymous( '' ) );
1394+
}
1395+
1396+
public function boolean( $condition ) {
1397+
return $condition ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' );
1398+
}
1399+
13911400
}

external/less.php/lib/Less/Output.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) {
2525
$this->strs[] = $chunk;
2626
}
2727

28-
/**
29-
* Is the output empty?
30-
*
31-
* @return bool
32-
*/
33-
public function isEmpty() {
34-
return count( $this->strs ) === 0;
35-
}
36-
3728
/**
3829
* Converts the output to string
3930
*

0 commit comments

Comments
 (0)