public function testLess() { $expected = "height: 24px;\n"; $this->expectOutputString($expected); $less = '@base:24px;height:@base'; $pless = new PagelinesLess(); print $pless->raw_less($less); }
/** * * Get compiled/cached CSS * * @package PageLines DMS * @since 2.2 */ function get_compiled_custom() { if (!pl_draft_mode() && is_array($a = get_transient('pagelines_custom_css'))) { return $a; } else { $start_time = microtime(true); $custom = stripslashes(pl_setting('custom_less')); $pless = new PagelinesLess(); $custom = $pless->raw_less($custom, 'custom'); $end_time = microtime(true); $a = array('custom' => $custom, 'c_time' => round($end_time - $start_time, 5), 'time' => time()); if (strpos($custom, 'PARSE ERROR') === false) { set_transient('pagelines_custom_css', $a, $this->ctimeout); set_transient('pagelines_custom_css_backup', $a, $this->btimeout); return $a; } else { pl_less_save_last_error($custom, false); return get_transient('pagelines_custom_css_backup'); } } }
/** * * Get compiled/cached CSS * * @package PageLines Framework * @since 2.2 */ function get_compiled_custom() { if (is_array($a = get_transient('pagelines_custom_css'))) { return $a; } else { $start_time = microtime(true); build_pagelines_layout(); $custom = stripslashes(ploption('customcss')); $pless = new PagelinesLess(); $custom = $pless->raw_less($custom, 'custom'); $end_time = microtime(true); $a = array('custom' => $custom, 'c_time' => round($end_time - $start_time, 5), 'time' => time()); if (strpos($custom, 'PARSE ERROR') === false) { set_transient('pagelines_custom_css', $a, self::AGE_LIMIT_COMPILED); set_transient('pagelines_custom_css_backup', $a, self::AGE_LIMIT_BACKUP); return $a; } else { return get_transient('pagelines_custom_css_backup'); } } }