Alpha.php 848 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Alpha
  4. *
  5. * @package Less
  6. * @subpackage tree
  7. */
  8. class Less_Tree_Alpha extends Less_Tree {
  9. public $value;
  10. public $type = 'Alpha';
  11. public function __construct( $val ) {
  12. $this->value = $val;
  13. }
  14. // function accept( $visitor ){
  15. // $this->value = $visitor->visit( $this->value );
  16. //}
  17. public function compile( $env ) {
  18. if ( is_object( $this->value ) ) {
  19. $this->value = $this->value->compile( $env );
  20. }
  21. return $this;
  22. }
  23. /**
  24. * @see Less_Tree::genCSS
  25. */
  26. public function genCSS( $output ) {
  27. $output->add( "alpha(opacity=" );
  28. if ( is_string( $this->value ) ) {
  29. $output->add( $this->value );
  30. } else {
  31. $this->value->genCSS( $output );
  32. }
  33. $output->add( ')' );
  34. }
  35. public function toCSS() {
  36. return "alpha(opacity=" . ( is_string( $this->value ) ? $this->value : $this->value->toCSS() ) . ")";
  37. }
  38. }