a3_lessc_formatter_classic

The WooCommerce Dynamic Gallery LITE a3 lessc formatter classic class.

Defined (1)

The class is defined in the following location(s).

/admin/less/lib/lessc.inc.php  
  1. class a3_lessc_formatter_classic { 
  2. public $indentChar = " "; 
  3.  
  4. public $break = "\n"; 
  5. public $open = " {"; 
  6. public $close = "}"; 
  7. public $selectorSeparator = ", "; 
  8. public $assignSeparator = ":"; 
  9.  
  10. public $openSingle = " { "; 
  11. public $closeSingle = " }"; 
  12.  
  13. public $disableSingle = false; 
  14. public $breakSelectors = false; 
  15.  
  16. public $compressColors = false; 
  17.  
  18. public function __construct() { 
  19. $this->indentLevel = 0; 
  20.  
  21. public function indentStr($n = 0) { 
  22. return str_repeat($this->indentChar, max($this->indentLevel + $n, 0)); 
  23.  
  24. public function property($name, $value) { 
  25. return $name . $this->assignSeparator . $value . ";"; 
  26.  
  27. protected function isEmpty($block) { 
  28. if (empty($block->lines)) { 
  29. foreach ($block->children as $child) { 
  30. if (!$this->isEmpty($child)) return false; 
  31.  
  32. return true; 
  33. return false; 
  34.  
  35. public function block($block) { 
  36. if ($this->isEmpty($block)) return; 
  37.  
  38. $inner = $pre = $this->indentStr(); 
  39.  
  40. $isSingle = !$this->disableSingle && 
  41. is_null($block->type) && count($block->lines) == 1; 
  42.  
  43. if (!empty($block->selectors)) { 
  44. $this->indentLevel++; 
  45.  
  46. if ($this->breakSelectors) { 
  47. $selectorSeparator = $this->selectorSeparator . $this->break . $pre; 
  48. } else { 
  49. $selectorSeparator = $this->selectorSeparator; 
  50.  
  51. echo $pre . 
  52. implode($selectorSeparator, $block->selectors); 
  53. if ($isSingle) { 
  54. echo $this->openSingle; 
  55. $inner = ""; 
  56. } else { 
  57. echo $this->open . $this->break; 
  58. $inner = $this->indentStr(); 
  59.  
  60.  
  61. if (!empty($block->lines)) { 
  62. $glue = $this->break.$inner; 
  63. echo $inner . implode($glue, $block->lines); 
  64. if (!$isSingle && !empty($block->children)) { 
  65. echo $this->break; 
  66.  
  67. foreach ($block->children as $child) { 
  68. $this->block($child); 
  69.  
  70. if (!empty($block->selectors)) { 
  71. if (!$isSingle && empty($block->children)) echo $this->break; 
  72.  
  73. if ($isSingle) { 
  74. echo $this->closeSingle . $this->break; 
  75. } else { 
  76. echo $pre . $this->close . $this->break; 
  77.  
  78. $this->indentLevel--;