@@ -123,7 +123,7 @@ |
||
123 | 123 | /** |
124 | 124 | * Getting the config of Htsl. |
125 | 125 | * |
126 | - * @param string $keys |
|
126 | + * @param string[] $keys |
|
127 | 127 | * |
128 | 128 | * @return mixed |
129 | 129 | */ |
@@ -212,7 +212,7 @@ |
||
212 | 212 | * |
213 | 213 | * @param [ string, ] ...$keys |
214 | 214 | * |
215 | - * @return mixed |
|
215 | + * @return string |
|
216 | 216 | */ |
217 | 217 | public function getConfig( string...$keys ) |
218 | 218 | { |
@@ -68,35 +68,35 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @var int |
70 | 70 | */ |
71 | - private $level= 0; |
|
71 | + private $level=0; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Section indent level. |
75 | 75 | * |
76 | 76 | * @var int |
77 | 77 | */ |
78 | - private $sectionLevel= 0; |
|
78 | + private $sectionLevel=0; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Opened nodes. |
82 | 82 | * |
83 | 83 | * @var [ Htsl\Parser\Node\Contracts\ANode, ] |
84 | 84 | */ |
85 | - private $openedNodes= []; |
|
85 | + private $openedNodes=[ ]; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Current scopes. |
89 | 89 | * |
90 | 90 | * @var [ Htsl\Parser\Node\Contracts\ANode, ] |
91 | 91 | */ |
92 | - private $scopes= []; |
|
92 | + private $scopes=[ ]; |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Current line number. |
96 | 96 | * |
97 | 97 | * @var int |
98 | 98 | */ |
99 | - private $lineNumber= 0; |
|
99 | + private $lineNumber=0; |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Current line. |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @var [ Htsl\Parser\Section, ] |
112 | 112 | */ |
113 | - private $sections=[]; |
|
113 | + private $sections=[ ]; |
|
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Whether the document is executed. |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function __construct( Htsl$htsl, Buffer$buffer, self$parent=null ) |
144 | 144 | { |
145 | - $this->htsl= $htsl; |
|
146 | - $this->buffer= $buffer; |
|
145 | + $this->htsl=$htsl; |
|
146 | + $this->buffer=$buffer; |
|
147 | 147 | |
148 | 148 | if( $parent ){ |
149 | - $this->parent= $parent; |
|
150 | - $this->docType= $parent->docType; |
|
151 | - $this->indentation= $parent->indentation; |
|
149 | + $this->parent=$parent; |
|
150 | + $this->docType=$parent->docType; |
|
151 | + $this->indentation=$parent->indentation; |
|
152 | 152 | }else{ |
153 | 153 | $this->parseFirstLine(); |
154 | 154 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | protected function getLine():Line |
202 | 202 | { |
203 | 203 | do{ |
204 | - $line= $this->buffer->getLine(); |
|
204 | + $line=$this->buffer->getLine(); |
|
205 | 205 | }while( $line->isEmpty() && $line->hasMore() ); |
206 | 206 | |
207 | 207 | return $line; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function getConfig( string...$keys ) |
218 | 218 | { |
219 | - return $this->htsl->getConfig(array_shift($keys),$this->docType,...$keys); |
|
219 | + return $this->htsl->getConfig(array_shift($keys), $this->docType, ...$keys); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -256,16 +256,16 @@ discard block |
||
256 | 256 | */ |
257 | 257 | protected function parseFirstLine():self |
258 | 258 | { |
259 | - $line= $this->getLine(); |
|
259 | + $line=$this->getLine(); |
|
260 | 260 | |
261 | 261 | if( '@'===$line->getChar(0) ){ |
262 | 262 | return $this->setExtending($line); |
263 | 263 | } |
264 | 264 | |
265 | - $this->docType= $line->content; |
|
266 | - $docTypeContent= $this->getConfig('doc_types') or $this->throw("DocType $this->docType is not supported"); |
|
265 | + $this->docType=$line->content; |
|
266 | + $docTypeContent=$this->getConfig('doc_types') or $this->throw("DocType $this->docType is not supported"); |
|
267 | 267 | |
268 | - $this->indentation= $this->htsl->getConfig('indentation',$this->docType) ?? ( function( $scalarOrFalse ){ return is_scalar($scalarOrFalse)?$scalarOrFalse:false; } )($this->htsl->getConfig('indentation')); |
|
268 | + $this->indentation=$this->htsl->getConfig('indentation', $this->docType) ?? (function( $scalarOrFalse ){ return is_scalar($scalarOrFalse)? $scalarOrFalse : false; } )($this->htsl->getConfig('indentation')); |
|
269 | 269 | |
270 | 270 | $this->appendLine($docTypeContent); |
271 | 271 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | protected function setExtending( Line$firstLine ):self |
281 | 281 | { |
282 | - switch( $name= $firstLine->pregGet('/(?<=^@)[\w-:]+/') ){ |
|
282 | + switch( $name=$firstLine->pregGet('/(?<=^@)[\w-:]+/') ){ |
|
283 | 283 | default:{ |
284 | 284 | $this->throw("The @$name is not supported."); |
285 | 285 | }break; |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | */ |
304 | 304 | protected function lineByLine():self |
305 | 305 | { |
306 | - while( ($line= $this->getLine())->hasMore() ){ |
|
307 | - $this->lineNumber+= 1; |
|
306 | + while( ($line=$this->getLine())->hasMore() ){ |
|
307 | + $this->lineNumber+=1; |
|
308 | 308 | |
309 | 309 | if( $this->embedment ){ |
310 | 310 | $this->embeddingParse($line); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $this->closeNodes($this->level); |
319 | 319 | |
320 | - $this->isExecuted= true; |
|
320 | + $this->isExecuted=true; |
|
321 | 321 | |
322 | 322 | return $this; |
323 | 323 | } |
@@ -348,10 +348,10 @@ discard block |
||
348 | 348 | */ |
349 | 349 | protected function startEmbedding( string$embedType ):self |
350 | 350 | { |
351 | - $embedmentClass= '\\Htsl\\Embedment\\'.ucfirst($embedType).'Embedment'; |
|
351 | + $embedmentClass='\\Htsl\\Embedment\\'.ucfirst($embedType).'Embedment'; |
|
352 | 352 | class_exists($embedmentClass) or $this->throw("Embed type $embedType not exists."); |
353 | 353 | |
354 | - $this->embedment= new $embedmentClass($this); |
|
354 | + $this->embedment=new $embedmentClass($this); |
|
355 | 355 | |
356 | 356 | return $this; |
357 | 357 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | public function breakEmbedding():self |
365 | 365 | { |
366 | 366 | $this->append($this->embedment->getContent()); |
367 | - $this->embedment= null; |
|
367 | + $this->embedment=null; |
|
368 | 368 | |
369 | 369 | return $this; |
370 | 370 | } |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | protected function parseLine( Line$line ):self |
380 | 380 | { |
381 | - $this->currentLine= $line; |
|
381 | + $this->currentLine=$line; |
|
382 | 382 | $this->setLevel($line->getIndentLevel()); |
383 | 383 | |
384 | 384 | switch( $line->getChar(0) ){ |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | protected function parseHtmlLine( Line$line ):self |
421 | 421 | { |
422 | - $node= new StringNode($this,$line); |
|
422 | + $node=new StringNode($this, $line); |
|
423 | 423 | |
424 | 424 | $this->openNode($node); |
425 | 425 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | protected function parseStringLine( Line$line ):self |
439 | 439 | { |
440 | - $node= new StringNode($this,$line); |
|
440 | + $node=new StringNode($this, $line); |
|
441 | 441 | |
442 | 442 | $this->openNode($node); |
443 | 443 | |
@@ -455,13 +455,13 @@ discard block |
||
455 | 455 | */ |
456 | 456 | protected function parseExpressionLine( Line$line ):self |
457 | 457 | { |
458 | - $node= new StringNode($this,$line); |
|
458 | + $node=new StringNode($this, $line); |
|
459 | 459 | |
460 | 460 | $this->openNode($node); |
461 | 461 | |
462 | - $content= $line->slice(1); |
|
463 | - $ent_flag= var_export($this->htsl->getConfig('ENT_flags',$this->docType),true); |
|
464 | - $charset= var_export($this->htsl->getConfig('charset'),true); |
|
462 | + $content=$line->slice(1); |
|
463 | + $ent_flag=var_export($this->htsl->getConfig('ENT_flags', $this->docType), true); |
|
464 | + $charset=var_export($this->htsl->getConfig('charset'), true); |
|
465 | 465 | |
466 | 466 | $this->appendLine("<?=htmlentities($content,$ent_flag,$charset,false)?>"); |
467 | 467 | |
@@ -477,11 +477,11 @@ discard block |
||
477 | 477 | */ |
478 | 478 | protected function parseExpressionHtmlLine( Line$line ):self |
479 | 479 | { |
480 | - $node= new StringNode($this,$line); |
|
480 | + $node=new StringNode($this, $line); |
|
481 | 481 | |
482 | 482 | $this->openNode($node); |
483 | 483 | |
484 | - $content= $line->slice(1); |
|
484 | + $content=$line->slice(1); |
|
485 | 485 | |
486 | 486 | $this->appendLine("<?$content?>"); |
487 | 487 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | */ |
498 | 498 | protected function parseCommentLine( Line$line ):self |
499 | 499 | { |
500 | - $node= new CommentNode($this,$line); |
|
500 | + $node=new CommentNode($this, $line); |
|
501 | 501 | |
502 | 502 | $this->openNode($node); |
503 | 503 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | */ |
516 | 516 | protected function parseTagLine( Line$line ):self |
517 | 517 | { |
518 | - $tag= new TagNode($this,$line); |
|
518 | + $tag=new TagNode($this, $line); |
|
519 | 519 | |
520 | 520 | $this->appendLine($tag->open()); |
521 | 521 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | */ |
536 | 536 | protected function parseControlLine( Line$line ):self |
537 | 537 | { |
538 | - $controlStructure= new ControlNode($this,$line); |
|
538 | + $controlStructure=new ControlNode($this, $line); |
|
539 | 539 | |
540 | 540 | $this->appendLine($controlStructure->open()); |
541 | 541 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | */ |
554 | 554 | protected function parseDocControlLine( Line$line ):self |
555 | 555 | { |
556 | - switch( $name= $line->pregGet('/(?<=^@)[\w-:]+/') ){ |
|
556 | + switch( $name=$line->pregGet('/(?<=^@)[\w-:]+/') ){ |
|
557 | 557 | default:{ |
558 | 558 | $this->throw("The @$name is not supported."); |
559 | 559 | }break; |
@@ -583,10 +583,10 @@ discard block |
||
583 | 583 | */ |
584 | 584 | protected function extend( string$fileName ):self |
585 | 585 | { |
586 | - $this->parent= new static($this->htsl,$this->buffer->goSide($fileName),null,$this->indentation); |
|
586 | + $this->parent=new static($this->htsl, $this->buffer->goSide($fileName), null, $this->indentation); |
|
587 | 587 | |
588 | - $this->docType= $this->parent->docType; |
|
589 | - $this->indentation= $this->parent->indentation; |
|
588 | + $this->docType=$this->parent->docType; |
|
589 | + $this->indentation=$this->parent->indentation; |
|
590 | 590 | |
591 | 591 | return $this; |
592 | 592 | } |
@@ -598,15 +598,15 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return \Htsl\Parser\Document |
600 | 600 | */ |
601 | - protected function include( Line$line ):self |
|
601 | + protected function include(Line$line):self |
|
602 | 602 | { |
603 | - $inclued= (new static($this->htsl,$this->buffer->goSide($line->pregGet('/(?<=\( ).*(?= \))/')),$this,$this->indentation))->execute()->content; |
|
603 | + $inclued=(new static($this->htsl, $this->buffer->goSide($line->pregGet('/(?<=\( ).*(?= \))/')), $this, $this->indentation))->execute()->content; |
|
604 | 604 | |
605 | 605 | if( false!==$this->indentation ){ |
606 | - $inclued= preg_replace('/(?<=^|\\n)(?!$)/',str_repeat($this->indentation,$this->level-$this->sectionLevel),$inclued); |
|
606 | + $inclued=preg_replace('/(?<=^|\\n)(?!$)/', str_repeat($this->indentation, $this->level-$this->sectionLevel), $inclued); |
|
607 | 607 | } |
608 | 608 | |
609 | - $node= new StringNode($this,$line); |
|
609 | + $node=new StringNode($this, $line); |
|
610 | 610 | |
611 | 611 | $this->openNode($node); |
612 | 612 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | */ |
625 | 625 | protected function defineSection( Line$line ):self |
626 | 626 | { |
627 | - $node= new SectionNode($this,$line); |
|
627 | + $node=new SectionNode($this, $line); |
|
628 | 628 | |
629 | 629 | $node->open(); |
630 | 630 | |
@@ -642,22 +642,22 @@ discard block |
||
642 | 642 | */ |
643 | 643 | protected function showSection( Line$line ):self |
644 | 644 | { |
645 | - $sectionName= $line->pregGet('/(?<=\( ).*(?= \))/'); |
|
645 | + $sectionName=$line->pregGet('/(?<=\( ).*(?= \))/'); |
|
646 | 646 | |
647 | - if( !isset($this->sections[$sectionName]) ){ |
|
648 | - $this->openNode(new StringNode($this,$line)); |
|
647 | + if( !isset($this->sections[ $sectionName ]) ){ |
|
648 | + $this->openNode(new StringNode($this, $line)); |
|
649 | 649 | |
650 | 650 | return $this; |
651 | 651 | } |
652 | - $content= $this->sections[$sectionName]->content; |
|
652 | + $content=$this->sections[ $sectionName ]->content; |
|
653 | 653 | |
654 | 654 | if( false!==$this->indentation ){ |
655 | - $content= preg_replace('/(?<=^|\\n)(?!$)/',str_repeat($this->indentation,$this->level),$content); |
|
655 | + $content=preg_replace('/(?<=^|\\n)(?!$)/', str_repeat($this->indentation, $this->level), $content); |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | $this->append($content); |
659 | 659 | |
660 | - $node= new NamelessSectionNode($this,$line); |
|
660 | + $node=new NamelessSectionNode($this, $line); |
|
661 | 661 | |
662 | 662 | $node->open(); |
663 | 663 | |
@@ -674,8 +674,8 @@ discard block |
||
674 | 674 | public function setSection( Section$section=null ):self |
675 | 675 | { |
676 | 676 | if( !$section ){ |
677 | - $this->sectionLevel= 0; |
|
678 | - $this->currentSection= null; |
|
677 | + $this->sectionLevel=0; |
|
678 | + $this->currentSection=null; |
|
679 | 679 | |
680 | 680 | return $this; |
681 | 681 | } |
@@ -684,17 +684,17 @@ discard block |
||
684 | 684 | $this->throw('Nesting definition of section is forbidden.'); |
685 | 685 | } |
686 | 686 | |
687 | - if( isset($this->parent->sections[$section->name]) ){ |
|
687 | + if( isset($this->parent->sections[ $section->name ]) ){ |
|
688 | 688 | $this->throw("Section $sectionName already defined."); |
689 | 689 | } |
690 | 690 | |
691 | - $this->currentSection= $section; |
|
691 | + $this->currentSection=$section; |
|
692 | 692 | |
693 | 693 | if( $section->name ){ |
694 | - $this->parent->sections[$section->name]=$section; |
|
694 | + $this->parent->sections[ $section->name ]=$section; |
|
695 | 695 | } |
696 | 696 | |
697 | - $this->sectionLevel= $this->level+1; |
|
697 | + $this->sectionLevel=$this->level+1; |
|
698 | 698 | |
699 | 699 | return $this; |
700 | 700 | } |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | { |
709 | 709 | if( $this->parent ){ |
710 | 710 | foreach( $this->sections as $name=>$section ){ |
711 | - if( !isset($this->parent->sections[$name]) ){ |
|
712 | - $this->parent->sections[$name]=$section; |
|
711 | + if( !isset($this->parent->sections[ $name ]) ){ |
|
712 | + $this->parent->sections[ $name ]=$section; |
|
713 | 713 | }; |
714 | 714 | } |
715 | 715 | } |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | */ |
727 | 727 | public function htmlEntities( string$input ):string |
728 | 728 | { |
729 | - return htmlentities($input,$this->htsl->getConfig('ENT_flags',$this->docType),$this->htsl->getConfig('charset'),false); |
|
729 | + return htmlentities($input, $this->htsl->getConfig('ENT_flags', $this->docType), $this->htsl->getConfig('charset'), false); |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | /** |
@@ -736,12 +736,12 @@ discard block |
||
736 | 736 | */ |
737 | 737 | protected function setLevel( int$level ):self |
738 | 738 | { |
739 | - $level-= $this->level; |
|
739 | + $level-=$this->level; |
|
740 | 740 | |
741 | 741 | if( $level<=0 ){ |
742 | 742 | $this->closeNodes(-$level); |
743 | 743 | }elseif( $level==1 ){ |
744 | - $this->level+= 1; |
|
744 | + $this->level+=1; |
|
745 | 745 | }else{ |
746 | 746 | $this->throw('Indent error.'); |
747 | 747 | } |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | */ |
759 | 759 | protected function openNode( Node$node ):self |
760 | 760 | { |
761 | - array_push($this->openedNodes,$node); |
|
761 | + array_push($this->openedNodes, $node); |
|
762 | 762 | |
763 | 763 | $node->scope and $this->setScope($node); |
764 | 764 | |
@@ -777,13 +777,13 @@ discard block |
||
777 | 777 | if( empty($this->openedNodes) ) return $this; |
778 | 778 | |
779 | 779 | while( $level-->=0 ){ |
780 | - $node= array_pop($this->openedNodes); |
|
780 | + $node=array_pop($this->openedNodes); |
|
781 | 781 | |
782 | 782 | $node->scope and $this->removeScope($node); |
783 | 783 | |
784 | 784 | $closer=$node->close($this->currentLine) and $this->appendLine($closer); |
785 | 785 | |
786 | - $this->level-= $level>=0 ?1:0; |
|
786 | + $this->level-=$level>=0? 1 : 0; |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | return $this; |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | */ |
797 | 797 | protected function setScope( Node$scope ):int |
798 | 798 | { |
799 | - return array_unshift($this->scopes,$scope); |
|
799 | + return array_unshift($this->scopes, $scope); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | /** |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | */ |
807 | 807 | public function getScope() |
808 | 808 | { |
809 | - return $this->scopes[0]??null; |
|
809 | + return $this->scopes[ 0 ]??null; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | /** |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | protected function appendLine( string$content ):self |
836 | 836 | { |
837 | 837 | if( false!==$this->indentation ){ |
838 | - $content= str_repeat($this->indentation,$this->level-$this->sectionLevel).$content."\n"; |
|
838 | + $content=str_repeat($this->indentation, $this->level-$this->sectionLevel).$content."\n"; |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | return $this->append($content); |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @throw \Htsl\Parser\HtslParsingException |
878 | 878 | */ |
879 | - public function throw( string$message ) |
|
879 | + public function throw(string$message) |
|
880 | 880 | { |
881 | 881 | throw new HtslParsingException("$message at file {$this->buffer->fileName} line $this->lineNumber"); |
882 | 882 | } |
@@ -90,7 +90,6 @@ |
||
90 | 90 | /** |
91 | 91 | * Close this tag node, and returning node closer. |
92 | 92 | * |
93 | - * @param \Htsl\ReadingBuffer\Line $closerLine The line when node closed. |
|
94 | 93 | * |
95 | 94 | * @return string |
96 | 95 | */ |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @var array |
32 | 32 | */ |
33 | - private $attributes=[]; |
|
33 | + private $attributes=[ ]; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Real constructor. |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | protected function construct():parent |
41 | 41 | { |
42 | 42 | |
43 | - $name= $this->line->pregGet('/(?<=^-)[\w-:]+/'); |
|
43 | + $name=$this->line->pregGet('/(?<=^-)[\w-:]+/'); |
|
44 | 44 | $this->name=$name; |
45 | 45 | |
46 | - $this->loadConfig($name,$this->document); |
|
46 | + $this->loadConfig($name, $this->document); |
|
47 | 47 | |
48 | - $this->tagName=$this->config['name']??$name; |
|
49 | - $this->isEmpty= $this->line->getChar(-1)==='/' || $this->document->getConfig('empty_tags',$this->tagName); |
|
50 | - isset($this->config['default_attributes']) and array_walk($this->config['default_attributes'],function( $value,$key ){ $this->setAttribute($key,$value); }); |
|
48 | + $this->tagName=$this->config[ 'name' ]??$name; |
|
49 | + $this->isEmpty=$this->line->getChar(-1)==='/' || $this->document->getConfig('empty_tags', $this->tagName); |
|
50 | + isset($this->config[ 'default_attributes' ]) and array_walk($this->config[ 'default_attributes' ], function( $value, $key ){ $this->setAttribute($key, $value); }); |
|
51 | 51 | |
52 | 52 | return $this; |
53 | 53 | } |
@@ -59,30 +59,30 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function open():string |
61 | 61 | { |
62 | - if( isset($this->config['opener']) ) |
|
63 | - { return $this->config['opener']; } |
|
62 | + if( isset($this->config[ 'opener' ]) ) |
|
63 | + { return $this->config[ 'opener' ]; } |
|
64 | 64 | |
65 | - if( isset($this->config['params']) ) |
|
65 | + if( isset($this->config[ 'params' ]) ) |
|
66 | 66 | { $this->parseParams(); } |
67 | 67 | |
68 | - if( isset($this->config['name_value']) ) |
|
68 | + if( isset($this->config[ 'name_value' ]) ) |
|
69 | 69 | { $this->parseNameValue(); } |
70 | 70 | |
71 | - if( isset($this->config['link']) ) |
|
71 | + if( isset($this->config[ 'link' ]) ) |
|
72 | 72 | { $this->parseLink(); } |
73 | 73 | |
74 | - if( isset($this->config['target']) ) |
|
74 | + if( isset($this->config[ 'target' ]) ) |
|
75 | 75 | { $this->parseTarget(); } |
76 | 76 | |
77 | - if( isset($this->config['alt']) ) |
|
77 | + if( isset($this->config[ 'alt' ]) ) |
|
78 | 78 | { $this->parseAlt(); } |
79 | 79 | |
80 | 80 | $this->parseCommonAttributes(); |
81 | 81 | |
82 | - if( isset($this->config['in_scope']) && isset($this->config['scope_function']) && is_callable($this->config['scope_function']) ) |
|
83 | - { $this->config['scope_function']->call($this,$this->document->scope); } |
|
82 | + if( isset($this->config[ 'in_scope' ]) && isset($this->config[ 'scope_function' ]) && is_callable($this->config[ 'scope_function' ]) ) |
|
83 | + { $this->config[ 'scope_function' ]->call($this, $this->document->scope); } |
|
84 | 84 | |
85 | - $finisher= $this->isEmpty ? ' />' : '>'; |
|
85 | + $finisher=$this->isEmpty? ' />' : '>'; |
|
86 | 86 | |
87 | 87 | return "<{$this->tagName}{$this->attributesString}{$finisher}"; |
88 | 88 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function close( Line$Line ):string |
98 | 98 | { |
99 | - return $this->isEmpty ? '' : $this->config['closer']??"</{$this->tagName}>"; |
|
99 | + return $this->isEmpty? '' : $this->config[ 'closer' ]??"</{$this->tagName}>"; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getEmbed():string |
108 | 108 | { |
109 | - return $this->config['embedding']??''; |
|
109 | + return $this->config[ 'embedding' ]??''; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getScope() |
118 | 118 | { |
119 | - return $this->config['scope']??null; |
|
119 | + return $this->config[ 'scope' ]??null; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | */ |
127 | 127 | protected function parseParams():self |
128 | 128 | { |
129 | - $params= preg_split('/(?<!\\\\)\\|/',$this->line->pregGet('/^-[\w-:]+\((.*?)\)(?= |(\\{>)?$)/',1)); |
|
129 | + $params=preg_split('/(?<!\\\\)\\|/', $this->line->pregGet('/^-[\w-:]+\((.*?)\)(?= |(\\{>)?$)/', 1)); |
|
130 | 130 | |
131 | - if( ($m= count($params)) != ($n= count($this->config['params'])) ){$this->document->throw("Tag $this->name has $n parameters $m given.");} |
|
131 | + if( ($m=count($params))!=($n=count($this->config[ 'params' ])) ){$this->document->throw("Tag $this->name has $n parameters $m given."); } |
|
132 | 132 | |
133 | - array_map(function( $key, $value ){return $this->setAttribute($key,str_replace('\\|','|',$value));},$this->config['params'],$params); |
|
133 | + array_map(function( $key, $value ){return $this->setAttribute($key, str_replace('\\|', '|', $value)); },$this->config[ 'params' ], $params); |
|
134 | 134 | |
135 | 135 | return $this; |
136 | 136 | } |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | */ |
143 | 143 | protected function parseNameValue():self |
144 | 144 | { |
145 | - $params= $this->line->pregGet('/ <(.*?)>(?= |$)/',1) |
|
146 | - and $params= preg_split('/(?<!\\\\)\\|/',$params) |
|
147 | - and array_map(function( $key, $value ){return isset($key)&&isset($value) ? $this->setAttribute($key,$this->checkExpression(str_replace('\\|','|',$value))) : '';},$this->config['name_value'],$params); |
|
145 | + $params=$this->line->pregGet('/ <(.*?)>(?= |$)/', 1) |
|
146 | + and $params=preg_split('/(?<!\\\\)\\|/', $params) |
|
147 | + and array_map(function( $key, $value ){return isset($key) && isset($value)? $this->setAttribute($key, $this->checkExpression(str_replace('\\|', '|', $value))) : ''; },$this->config[ 'name_value' ], $params); |
|
148 | 148 | |
149 | 149 | return $this; |
150 | 150 | } |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function parseLink():self |
158 | 158 | { |
159 | - $link= $this->line->pregGet('/ @((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1); |
|
159 | + $link=$this->line->pregGet('/ @((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1); |
|
160 | 160 | |
161 | 161 | if( strlen($link) ){ |
162 | - if( isset($this->config['target']) && ':'===$link{0} ){ |
|
163 | - $this->setAttribute($this->config['link'],'javascript'.$link); |
|
164 | - }elseif( '//'===($firstTwoLetters=substr($link,0,2)) ){ |
|
165 | - $this->setAttribute($this->config['link'],'http:'.$link); |
|
162 | + if( isset($this->config[ 'target' ]) && ':'===$link{0} ){ |
|
163 | + $this->setAttribute($this->config[ 'link' ], 'javascript'.$link); |
|
164 | + }elseif( '//'===($firstTwoLetters=substr($link, 0, 2)) ){ |
|
165 | + $this->setAttribute($this->config[ 'link' ], 'http:'.$link); |
|
166 | 166 | }elseif( '\\\\'===$firstTwoLetters ){ |
167 | - $this->setAttribute($this->config['link'],'https://'.substr($link,2)); |
|
167 | + $this->setAttribute($this->config[ 'link' ], 'https://'.substr($link, 2)); |
|
168 | 168 | }else{ |
169 | - $this->setAttribute($this->config['link'],$this->checkExpression($link)); |
|
169 | + $this->setAttribute($this->config[ 'link' ], $this->checkExpression($link)); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function parseTarget():self |
182 | 182 | { |
183 | - $target= $this->line->pregGet('/ >((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1); |
|
183 | + $target=$this->line->pregGet('/ >((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1); |
|
184 | 184 | |
185 | 185 | if( strlen($target) ){ |
186 | - $this->setAttribute($this->config['target'],$this->checkExpression($target)); |
|
186 | + $this->setAttribute($this->config[ 'target' ], $this->checkExpression($target)); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $this; |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | */ |
197 | 197 | protected function parseAlt():self |
198 | 198 | { |
199 | - $alt= $this->line->pregGet('/ _((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1); |
|
199 | + $alt=$this->line->pregGet('/ _((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1); |
|
200 | 200 | |
201 | 201 | if( strlen($alt) ){ |
202 | - $this->setAttribute($this->config['alt'],$this->checkExpression($alt)); |
|
202 | + $this->setAttribute($this->config[ 'alt' ], $this->checkExpression($alt)); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return $this; |
@@ -212,33 +212,33 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function parseCommonAttributes():string |
214 | 214 | { |
215 | - $attributes= ''; |
|
215 | + $attributes=''; |
|
216 | 216 | |
217 | - $id= $this->line->pregGet('/ #([^ ]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1) |
|
218 | - and $this->setAttribute('id',$id); |
|
217 | + $id=$this->line->pregGet('/ #([^ ]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1) |
|
218 | + and $this->setAttribute('id', $id); |
|
219 | 219 | |
220 | - $classes= $this->line->pregGet('/ \.[^ ]+(?= |$)/') |
|
221 | - and preg_match_all('/\.((?(?!\()[^.]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\))))/',$classes,$matches) |
|
222 | - and $classes= implode(' ',array_filter(array_map(function( $className ){return $this->checkExpression($className);},$matches[1]))) |
|
223 | - and $this->setAttribute('class',$classes); |
|
220 | + $classes=$this->line->pregGet('/ \.[^ ]+(?= |$)/') |
|
221 | + and preg_match_all('/\.((?(?!\()[^.]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\))))/', $classes, $matches) |
|
222 | + and $classes=implode(' ', array_filter(array_map(function( $className ){return $this->checkExpression($className); },$matches[ 1 ]))) |
|
223 | + and $this->setAttribute('class', $classes); |
|
224 | 224 | |
225 | - $title= $this->line->pregGet('/ \^((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1) |
|
226 | - and $this->setAttribute('title',$title); |
|
225 | + $title=$this->line->pregGet('/ \^((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1) |
|
226 | + and $this->setAttribute('title', $title); |
|
227 | 227 | |
228 | - $style= $this->line->pregGet('/ \[([^\]]+;)(?=\]( |$))/',1) |
|
229 | - and $this->setAttribute('style',$style); |
|
228 | + $style=$this->line->pregGet('/ \[([^\]]+;)(?=\]( |$))/', 1) |
|
229 | + and $this->setAttribute('style', $style); |
|
230 | 230 | |
231 | - $eventListeners= $this->line->pregMap('/ %(\w+)\{>(.*?)<\}(?= |$)/',function( $string, $name, $code ){ |
|
232 | - $this->setAttribute('on'.$name,str_replace('"','"',$code)); |
|
231 | + $eventListeners=$this->line->pregMap('/ %(\w+)\{>(.*?)<\}(?= |$)/', function( $string, $name, $code ){ |
|
232 | + $this->setAttribute('on'.$name, str_replace('"', '"', $code)); |
|
233 | 233 | }) |
234 | - and implode('',$eventListeners); |
|
234 | + and implode('', $eventListeners); |
|
235 | 235 | |
236 | - $other= $this->line->pregGet('/(?<=\{).*?(?=;\}( |$))/') |
|
236 | + $other=$this->line->pregGet('/(?<=\{).*?(?=;\}( |$))/') |
|
237 | 237 | and array_map(function( $keyValue ){ |
238 | - preg_replace_callback('/^([\w-:]+)(?:\?(.+?))?(?:\=(.*))?$/',function($matches){ |
|
239 | - $this->setAttribute($matches[1],($matches[3]??$matches[1])?:$matches[1],$matches[2]??null); |
|
238 | + preg_replace_callback('/^([\w-:]+)(?:\?(.+?))?(?:\=(.*))?$/', function( $matches ){ |
|
239 | + $this->setAttribute($matches[ 1 ], ($matches[ 3 ]??$matches[ 1 ])?: $matches[ 1 ], $matches[ 2 ]??null); |
|
240 | 240 | },$keyValue); |
241 | - },explode(';',$other)); |
|
241 | + },explode(';', $other)); |
|
242 | 242 | |
243 | 243 | return $attributes; |
244 | 244 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | protected function checkExpression( string$value ):string |
254 | 254 | { |
255 | - return preg_match('/^\(.*\)$/',$value) ? '<?='.substr($value,1,-1).'?>' : str_replace('"','"',$value); |
|
255 | + return preg_match('/^\(.*\)$/', $value)? '<?='.substr($value, 1, -1).'?>' : str_replace('"', '"', $value); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | protected function getAttributesString():string |
264 | 264 | { |
265 | 265 | ksort($this->attributes); |
266 | - return implode('',array_map(static function( string$key, array$data ){ |
|
267 | - return (isset($data['condition'])&&strlen($data['condition'])? |
|
268 | - "<?php if( {$data['condition']} ){?> $key=\"{$data['value']}\"<?php }?>" |
|
266 | + return implode('', array_map(static function( string$key, array$data ){ |
|
267 | + return (isset($data[ 'condition' ]) && strlen($data[ 'condition' ])? |
|
268 | + "<?php if( {$data[ 'condition' ]} ){?> $key=\"{$data[ 'value' ]}\"<?php }?>" |
|
269 | 269 | : |
270 | - " $key=\"{$data['value']}\"" |
|
270 | + " $key=\"{$data[ 'value' ]}\"" |
|
271 | 271 | ); |
272 | - },array_keys($this->attributes),$this->attributes)); |
|
272 | + },array_keys($this->attributes), $this->attributes)); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
@@ -281,10 +281,10 @@ discard block |
||
281 | 281 | */ |
282 | 282 | protected function setAttribute( string$key, string$value, string$condition=null ):self |
283 | 283 | { |
284 | - if( isset($this->attributes[$key]) ) |
|
284 | + if( isset($this->attributes[ $key ]) ) |
|
285 | 285 | { $this->document->throw("Attribute $key of $this->name cannot redeclare."); } |
286 | 286 | |
287 | - $this->attributes[$key]=[ |
|
287 | + $this->attributes[ $key ]=[ |
|
288 | 288 | 'value'=> $value, |
289 | 289 | 'condition'=> $condition, |
290 | 290 | ]; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | public function offsetExists( $offset ):bool |
308 | 308 | { |
309 | - return isset($this->attributes[$offset]); |
|
309 | + return isset($this->attributes[ $offset ]); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function offsetGet( $offset ) |
320 | 320 | { |
321 | - return $this->attributes[$offset]??null; |
|
321 | + return $this->attributes[ $offset ]??null; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function offsetSet( $offset, $value ) |
331 | 331 | { |
332 | - $this->setAttribute($offset,$value); |
|
332 | + $this->setAttribute($offset, $value); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | public function offsetUnset( $offset ) |
341 | 341 | { |
342 | - if( isset($this->attributes[$offset]) ) |
|
343 | - { unset($this->attributes[$offset]); } |
|
342 | + if( isset($this->attributes[ $offset ]) ) |
|
343 | + { unset($this->attributes[ $offset ]); } |
|
344 | 344 | } |
345 | 345 | } |
@@ -168,66 +168,66 @@ discard block |
||
168 | 168 | ], |
169 | 169 | ], |
170 | 170 | 'tag_nodes'=> [ |
171 | - 'SVG1.1'=> $svgTags= [ |
|
171 | + 'SVG1.1'=> $svgTags=[ |
|
172 | 172 | 'svg'=> [ |
173 | 173 | 'out'=> [ |
174 | - 'default_attributes'=> ['xmlns'=> 'http://www.w3.org/2000/svg','version'=> '1.1',], |
|
175 | - 'params'=> ['viewBox',], |
|
174 | + 'default_attributes'=> [ 'xmlns'=> 'http://www.w3.org/2000/svg', 'version'=> '1.1', ], |
|
175 | + 'params'=> [ 'viewBox', ], |
|
176 | 176 | 'scope'=> 'svg', |
177 | 177 | ], |
178 | 178 | 'in'=> [ |
179 | 179 | 'svg'=> [ |
180 | - 'params'=> ['x','y','width','height',], |
|
180 | + 'params'=> [ 'x', 'y', 'width', 'height', ], |
|
181 | 181 | ], |
182 | 182 | ], |
183 | 183 | ], |
184 | - '*'=> [], |
|
184 | + '*'=> [ ], |
|
185 | 185 | 'polygon'=> [ |
186 | - 'params'=> ['points',], |
|
187 | - 'only_in'=> ['svg',], |
|
186 | + 'params'=> [ 'points', ], |
|
187 | + 'only_in'=> [ 'svg', ], |
|
188 | 188 | ], |
189 | 189 | 'polyline'=> [ |
190 | - 'params'=> ['points',], |
|
191 | - 'only_in'=> ['svg',], |
|
190 | + 'params'=> [ 'points', ], |
|
191 | + 'only_in'=> [ 'svg', ], |
|
192 | 192 | ], |
193 | 193 | 'path'=> [ |
194 | - 'params'=> ['d',], |
|
195 | - 'only_in'=> ['svg',], |
|
194 | + 'params'=> [ 'd', ], |
|
195 | + 'only_in'=> [ 'svg', ], |
|
196 | 196 | ], |
197 | 197 | 'line'=> [ |
198 | - 'params'=> ['x1','y1','x2','y2',], |
|
199 | - 'only_in'=> ['svg',], |
|
198 | + 'params'=> [ 'x1', 'y1', 'x2', 'y2', ], |
|
199 | + 'only_in'=> [ 'svg', ], |
|
200 | 200 | ], |
201 | 201 | 'rect'=> [ |
202 | - 'params'=> ['x','y','width','height',], |
|
203 | - 'only_in'=> ['svg',], |
|
202 | + 'params'=> [ 'x', 'y', 'width', 'height', ], |
|
203 | + 'only_in'=> [ 'svg', ], |
|
204 | 204 | ], |
205 | 205 | 'circle'=> [ |
206 | - 'params'=> ['cx','cy','r',], |
|
207 | - 'only_in'=> ['svg',], |
|
206 | + 'params'=> [ 'cx', 'cy', 'r', ], |
|
207 | + 'only_in'=> [ 'svg', ], |
|
208 | 208 | ], |
209 | 209 | 'ellipse'=> [ |
210 | - 'params'=> ['cx','cy','rx','ry',], |
|
211 | - 'only_in'=> ['svg',], |
|
210 | + 'params'=> [ 'cx', 'cy', 'rx', 'ry', ], |
|
211 | + 'only_in'=> [ 'svg', ], |
|
212 | 212 | ], |
213 | 213 | 'text'=> [ |
214 | - 'params'=> ['x','y',], |
|
215 | - 'only_in'=> ['svg',], |
|
214 | + 'params'=> [ 'x', 'y', ], |
|
215 | + 'only_in'=> [ 'svg', ], |
|
216 | 216 | ], |
217 | 217 | ], |
218 | 218 | 'HTML5'=> [ |
219 | - '*'=> [], |
|
219 | + '*'=> [ ], |
|
220 | 220 | 'charset'=> [ |
221 | 221 | 'name'=> 'meta', |
222 | - 'params'=> ['charset',], |
|
222 | + 'params'=> [ 'charset', ], |
|
223 | 223 | ], |
224 | 224 | 'equiv'=> [ |
225 | 225 | 'name'=> 'meta', |
226 | - 'name_value'=> ['http-equiv','content','scheme',], |
|
226 | + 'name_value'=> [ 'http-equiv', 'content', 'scheme', ], |
|
227 | 227 | ], |
228 | 228 | 'meta'=> [ |
229 | 229 | 'name'=> 'meta', |
230 | - 'name_value'=> ['name','content','scheme',], |
|
230 | + 'name_value'=> [ 'name', 'content', 'scheme', ], |
|
231 | 231 | ], |
232 | 232 | 'php'=> [ |
233 | 233 | 'opener'=> '<?php ', |
@@ -239,14 +239,14 @@ discard block |
||
239 | 239 | 'multiple'=> [ |
240 | 240 | [ |
241 | 241 | 'pattern'=> '/\{>$/', |
242 | - 'params'=> ['type',], |
|
243 | - 'default_attributes'=> ['codeset'=> 'codeset',], |
|
242 | + 'params'=> [ 'type', ], |
|
243 | + 'default_attributes'=> [ 'codeset'=> 'codeset', ], |
|
244 | 244 | 'embedding'=> 'code', |
245 | 245 | ], |
246 | 246 | [ |
247 | 247 | 'pattern'=> '/.?/', |
248 | 248 | 'name'=> 'code', |
249 | - 'params'=> ['type',], |
|
249 | + 'params'=> [ 'type', ], |
|
250 | 250 | ], |
251 | 251 | ], |
252 | 252 | ], |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | [ |
256 | 256 | 'pattern'=> '/^-js @/', |
257 | 257 | 'name'=> 'script', |
258 | - 'default_attributes'=> ['type'=> 'text/javascript',], |
|
258 | + 'default_attributes'=> [ 'type'=> 'text/javascript', ], |
|
259 | 259 | 'link'=> 'src', |
260 | 260 | ], |
261 | 261 | [ |
262 | 262 | 'pattern'=> '/^-js\{>/', |
263 | 263 | 'name'=> 'script', |
264 | - 'default_attributes'=> ['type'=> 'text/javascript',], |
|
264 | + 'default_attributes'=> [ 'type'=> 'text/javascript', ], |
|
265 | 265 | 'embedding'=> 'js', |
266 | 266 | ], |
267 | 267 | ], |
@@ -271,90 +271,90 @@ discard block |
||
271 | 271 | [ |
272 | 272 | 'pattern'=> '/^-css @/', |
273 | 273 | 'name'=> 'link', |
274 | - 'default_attributes'=> ['rel'=> 'stylesheet','type'=> 'text/css',], |
|
274 | + 'default_attributes'=> [ 'rel'=> 'stylesheet', 'type'=> 'text/css', ], |
|
275 | 275 | 'link'=> 'href', |
276 | 276 | ], |
277 | 277 | [ |
278 | 278 | 'pattern'=> '/^-css\{>/', |
279 | 279 | 'name'=> 'style', |
280 | - 'default_attributes'=> ['type'=> 'text/css',], |
|
280 | + 'default_attributes'=> [ 'type'=> 'text/css', ], |
|
281 | 281 | 'embedding'=> 'css', |
282 | 282 | ], |
283 | 283 | ], |
284 | 284 | ], |
285 | 285 | 'icon'=> [ |
286 | 286 | 'name'=> 'link', |
287 | - 'default_attributes'=> ['rel'=> 'icon',], |
|
288 | - 'params'=> ['sizes',], |
|
287 | + 'default_attributes'=> [ 'rel'=> 'icon', ], |
|
288 | + 'params'=> [ 'sizes', ], |
|
289 | 289 | 'link'=> 'href', |
290 | 290 | ], |
291 | 291 | 'shortcut'=> [ |
292 | 292 | 'name'=> 'link', |
293 | - 'default_attributes'=> ['rel'=> 'shortcut icon','type'=> 'image/x-icon',], |
|
293 | + 'default_attributes'=> [ 'rel'=> 'shortcut icon', 'type'=> 'image/x-icon', ], |
|
294 | 294 | 'link'=> 'href', |
295 | 295 | ], |
296 | 296 | 'link'=> [ |
297 | 297 | 'name'=> 'link', |
298 | - 'params'=> ['rel',], |
|
298 | + 'params'=> [ 'rel', ], |
|
299 | 299 | 'link'=> 'href', |
300 | 300 | ], |
301 | 301 | 'a'=> [ |
302 | 302 | 'link'=> 'href', |
303 | - 'name_value'=> ['name',], |
|
303 | + 'name_value'=> [ 'name', ], |
|
304 | 304 | 'target'=> 'target', |
305 | 305 | ], |
306 | 306 | 'iframe'=> [ |
307 | 307 | 'link'=> 'src', |
308 | - 'default_attributes'=> ['frameborder'=> '0',], |
|
309 | - 'name_value'=> ['name',], |
|
308 | + 'default_attributes'=> [ 'frameborder'=> '0', ], |
|
309 | + 'name_value'=> [ 'name', ], |
|
310 | 310 | ], |
311 | 311 | 'img'=> [ |
312 | 312 | 'link'=> 'src', |
313 | 313 | 'alt'=> 'alt', |
314 | 314 | ], |
315 | - 'form'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'post',],], |
|
316 | - 'post'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'post',],], |
|
317 | - 'upload'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'post','enctype'=> 'multipart/form-data',],], |
|
318 | - 'get'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'get',],], |
|
315 | + 'form'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'post', ], ], |
|
316 | + 'post'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'post', ], ], |
|
317 | + 'upload'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'post', 'enctype'=> 'multipart/form-data', ], ], |
|
318 | + 'get'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'get', ], ], |
|
319 | 319 | |
320 | - 'input'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'hidden',], 'name_value'=> ['name', 'value', 'form',],], |
|
321 | - 'text'=> ['out'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'text',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], 'in'=> ['svg'=> ['params'=> ['x','y',],],],], |
|
322 | - 'search'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'search',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
323 | - 'password'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'password',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
324 | - 'email'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'email',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
325 | - 'url'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'url',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
326 | - 'tel'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'tel',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
327 | - 'number'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'number',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder', 'params'=> ['min', 'step', 'max',],], |
|
328 | - 'range'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'range',], 'name_value'=> ['name', 'value', 'form',], 'params'=> ['min', 'step', 'max',],], |
|
329 | - 'radio'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'radio',], 'name_value'=> ['name', 'value', 'form',],], |
|
330 | - 'checkbox'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'checkbox',], 'name_value'=> ['name', 'value', 'form',],], |
|
331 | - 'date'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'date',], 'name_value'=> ['name', 'value', 'form',],], |
|
332 | - 'month'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'month',], 'name_value'=> ['name', 'value', 'form',],], |
|
333 | - 'week'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'week',], 'name_value'=> ['name', 'value', 'form',],], |
|
334 | - 'time'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'time',], 'name_value'=> ['name', 'value', 'form',],], |
|
335 | - 'datetime'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'datetime',], 'name_value'=> ['name', 'value', 'form',],], |
|
336 | - 'datetime-local'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'datetime-local',], 'name_value'=> ['name', 'value', 'form',],], |
|
337 | - 'color'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'color',], 'name_value'=> ['name', 'value', 'form',],], |
|
338 | - 'file'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'file',], 'name_value'=> ['name', 'form',], 'params'=> ['accept',],], |
|
320 | + 'input'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'hidden', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
321 | + 'text'=> [ 'out'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'text', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], 'in'=> [ 'svg'=> [ 'params'=> [ 'x', 'y', ], ], ], ], |
|
322 | + 'search'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'search', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
323 | + 'password'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'password', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
324 | + 'email'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'email', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
325 | + 'url'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'url', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
326 | + 'tel'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'tel', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
327 | + 'number'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'number', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', 'params'=> [ 'min', 'step', 'max', ], ], |
|
328 | + 'range'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'range', ], 'name_value'=> [ 'name', 'value', 'form', ], 'params'=> [ 'min', 'step', 'max', ], ], |
|
329 | + 'radio'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'radio', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
330 | + 'checkbox'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'checkbox', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
331 | + 'date'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'date', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
332 | + 'month'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'month', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
333 | + 'week'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'week', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
334 | + 'time'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'time', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
335 | + 'datetime'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'datetime', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
336 | + 'datetime-local'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'datetime-local', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
337 | + 'color'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'color', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
338 | + 'file'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'file', ], 'name_value'=> [ 'name', 'form', ], 'params'=> [ 'accept', ], ], |
|
339 | 339 | |
340 | - 'submit'=> ['name'=> 'button', 'default_attributes'=> ['type'=> 'submit',], 'name_value'=> ['name', 'value','form',], 'link'=> 'formaction', 'target'=> 'formtarget',], |
|
341 | - 'reset'=> ['name'=> 'button', 'default_attributes'=> ['type'=> 'reset',], 'name_value'=> ['form',],], |
|
342 | - 'button'=> ['name'=> 'button', 'default_attributes'=> ['type'=> 'button',],], |
|
340 | + 'submit'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'submit', ], 'name_value'=> [ 'name', 'value', 'form', ], 'link'=> 'formaction', 'target'=> 'formtarget', ], |
|
341 | + 'reset'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'reset', ], 'name_value'=> [ 'form', ], ], |
|
342 | + 'button'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'button', ], ], |
|
343 | 343 | |
344 | - 'textarea'=> ['name'=> 'textarea', 'name_value'=> ['name','value','form',],'alt'=> 'placeholder',], |
|
344 | + 'textarea'=> [ 'name'=> 'textarea', 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
345 | 345 | |
346 | 346 | 'select'=> [ |
347 | - 'name_value'=> ['name', 'value','form',], |
|
347 | + 'name_value'=> [ 'name', 'value', 'form', ], |
|
348 | 348 | 'scope'=> 'select', |
349 | 349 | ], |
350 | 350 | 'datalist'=> [ |
351 | - 'params'=> ['id',], |
|
351 | + 'params'=> [ 'id', ], |
|
352 | 352 | 'scope'=> 'datalist', |
353 | 353 | ], |
354 | 354 | 'optgroup'=> [ |
355 | 355 | 'in'=> [ |
356 | 356 | 'select'=> [ |
357 | - 'name_value'=> ['label',], |
|
357 | + 'name_value'=> [ 'label', ], |
|
358 | 358 | ], |
359 | 359 | ], |
360 | 360 | ], |
@@ -362,20 +362,20 @@ discard block |
||
362 | 362 | 'in'=> [ |
363 | 363 | 'select'=> [ |
364 | 364 | 'scope_function'=> function( $scope ){ |
365 | - if( $scope['value']===$this['value'] ){ |
|
366 | - $this['selected']= 'selected'; |
|
365 | + if( $scope[ 'value' ]===$this[ 'value' ] ){ |
|
366 | + $this[ 'selected' ]='selected'; |
|
367 | 367 | }; |
368 | 368 | }, |
369 | - 'name_value'=> ['value', 'label',], |
|
369 | + 'name_value'=> [ 'value', 'label', ], |
|
370 | 370 | ], |
371 | 371 | 'datalist'=> [ |
372 | - 'name_value'=> ['value',], |
|
372 | + 'name_value'=> [ 'value', ], |
|
373 | 373 | ], |
374 | 374 | ], |
375 | 375 | ], |
376 | 376 | |
377 | 377 | 'param'=> [ |
378 | - 'name_value'=> ['name','value',], |
|
378 | + 'name_value'=> [ 'name', 'value', ], |
|
379 | 379 | ], |
380 | 380 | ]+$svgTags, |
381 | 381 | ], |