File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class DynamicCSSCompiler
3131 /**
3232 * @var array The list of dynamic styles paths to compile
3333 */
34- private $ styles = array ();
34+ private $ stylesheets = array ();
3535
3636 /**
3737 * Returns the *Singleton* instance of this class.
@@ -62,21 +62,28 @@ public function init()
6262 *
6363 * @param type $path The absolute path to the dynamic style
6464 */
65- public function enqueue_style ( $ path )
65+ public function enqueue_style ( $ path, $ print )
6666 {
67- $ this ->styles [] = $ path ;
67+ $ this ->stylesheets [] = array (
68+ 'path ' => $ path ,
69+ 'print ' => $ print
70+ );
6871 }
6972
7073 /**
71- * Parse all styles in $this->styles and print them
74+ * Parse all styles in $this->stylesheets and print them if the flag 'print'
75+ * is set to true
7276 */
7377 public function print_compiled_style ()
7478 {
7579 ob_start ();
76- foreach ( $ this ->styles as $ style )
80+ foreach ( $ this ->stylesheets as $ style )
7781 {
78- include $ style ;
79- echo "\n" ;
82+ if ( true === $ style ['print ' ] )
83+ {
84+ include $ style ;
85+ echo "\n" ;
86+ }
8087 }
8188 $ css = $ this ->parse_css ( ob_get_clean () );
8289 include 'style.phtml ' ;
You can’t perform that action at this time.
0 commit comments