Subversion Repositories PHPX

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

1
<?php

namespace de\pointedears\css\least;

/**
 * Mix-ins for the LEAST extended CSS parser
 *
 * @author Thomas 'PointedEars' Lahn &lt;php@PointedEars.de&gt;
 */

abstract class Mixins
{
  /**
   * Generates a CSS property declaration whose value is a
   * <code>linear-gradient()</code> function call for
   * supported function name prefixes.
   *
   * @param string $property
   *   Property to be declared
   * @param string $params
   *   Parameters to the <code>linear-gradient()</code> function
   * @param array $prefixes
   *   Pass to override supported function name prefixes
   */

  public static function linear_gradient ($property, $params,
    array $prefixes = array('-moz-', '-o-', '-webkit-', ''))
  {
    ob_start();
    foreach ($prefixes as $prefix)
    {
      echo "{$property}: {$prefix}linear-gradient({$params});\n";
    }
    ob_end_flush();
        }

  /**
   * Generates a CSS property declaration whose value is a
   * <code>radial-gradient()</code> function call for
   * supported function name prefixes.
   *
   * @param string $property
   *   Property to be declared
   * @param string $params
   *   Parameters to the <code>radial-gradient()</code> function
   * @param array $prefixes
   *   Pass to override supported function name prefixes
   */

        public static function radial_gradient ($property, $params,
    array $prefixes = array('-moz-', '-webkit-'))
  {
    ob_start();
    foreach ($prefixes as $prefix)
    {
      echo "{$property}: {$prefix}radial-gradient({$params});\n";
    }
    ob_end_flush();
        }
       
  /**
   * Generates a CSS <code>transition</code> property declaration
   * for supported property name prefixes.
   *
   * @param string $suffix
   *   Property name suffix
   * @param string $value
   *   Property value
   * @param array $prefixes
   *   Pass to override supported property name prefixes
   */

        public static function transition ($suffix, $value,
    array $prefixes = array('-moz-', '-webkit-', ''))
  {
    ob_start();
    foreach ($prefixes as $prefix)
    {
      echo "{$prefix}transition{$suffix}: {$value};\n";
    }
    ob_end_flush();
        }

  /**
   * Generates a CSS <code>@keyframes</code> section for
   * supported keyword prefixes.
   *
   * @param string $name
   *   Animation name as referred by the <code>animation-name</code>
   *   property declaration.
   * @param string $data
   *   Keyframes data
   * @param array $prefixes
   *   Pass to override supported keyword prefixes
   */

        public static function keyframes ($name, $data,
    array $prefixes = array('-moz-', '-webkit-', ''))
  {
    ob_start();
    foreach ($prefixes as $prefix)
    {
      echo "@{$prefix}keyframes {$name} {\n  {$data}\n}\n";
    }
    ob_end_flush();
        }

  /**
   * Generates a CSS <code>animation</code> property declaration
   * for supported property name prefixes.
   *
   * @param string $suffix
   *   Property name suffix
   * @param string $value
   *   Property value
   * @param array $prefixes
   *   Pass to override supported property name prefixes
   */

        public static function animation ($suffix, $value,
    array $prefixes = array('-moz-', '-webkit-', ''))
  {
    ob_start();
    foreach ($prefixes as $prefix)
    {
      echo "{$prefix}animation{$suffix}: {$value};\n";
    }
    ob_end_flush();
        }
}