/**
  * Finds +mixins
  *
  * @author Anthony Short
  * @param $string
  * @return array
  */
 public static function find_mixins($string)
 {
     return Scaffold_Utils::match('/\\+(([0-9a-zA-Z_-]*?)(\\((.*?)\\))?)\\;/xs', $string);
 }
Example #2
0
 function testMatch()
 {
     $string = "The quick brown fox jumps over the lazy dog.";
     $this->assertEqual(count(Scaffold_Utils::match('/The/', $string)), 1);
     $this->assertEqual(count(Scaffold_Utils::match('/Lazy/', $string, 1)), 'L');
 }
 /**
  * Replaces all of the constants in a CSS string
  * with the constants defined in the member variable $constants
  * using PHP's interpolation.
  */
 public static function replace($css)
 {
     // START - Modified by Webligo Developments
     # Strip SVN Keywords
     $css = preg_replace('/[$][a-z]+?[:].+?[$]/i', '', $css);
     //preg_match('/[$][a-z]+?[:].+?[$]/i', $css, $m);
     // END - Modified by Webligo Developments
     # Pull the constants into the local scope as variables
     extract(self::$constants, EXTR_SKIP);
     # Remove unset variables from the string, so errors aren't thrown
     foreach (array_unique(Scaffold_Utils::match('/\\{?\\$([A-Za-z0-9_-]+)\\}?/', $css, 1)) as $value) {
         if (!isset(${$value})) {
             Scaffold::error('Missing constant - ' . $value);
         }
     }
     $css = stripslashes(eval('return "' . addslashes($css) . '";'));
     # Replace the variables within the string like a normal PHP string
     return $css;
 }
Example #4
0
 /**
  * Replaces all of the constants in a CSS string
  * with the constants defined in the member variable $constants
  * using PHP's interpolation.
  */
 public static function replace($css)
 {
     # Pull the constants into the local scope as variables
     extract(self::$constants, EXTR_SKIP);
     # Remove unset variables from the string, so errors aren't thrown
     foreach (array_unique(Scaffold_Utils::match('/\\{?\\$([A-Za-z0-9_-]+)\\}?/', $css, 1)) as $value) {
         if (!isset(${$value})) {
             Scaffold::error('Missing constant - ' . $value);
         }
     }
     $css = stripslashes(eval('return "' . addslashes($css) . '";'));
     # Replace the variables within the string like a normal PHP string
     return $css;
 }