/** * * Load Dynamic CSS inline * * @package Platform * @since 1.2.0 * */ function get_dynamic_css(){ $pagelines_dynamic_css = new PageLinesCSS; $pagelines_dynamic_css->create(); echo '<style type="text/css" id="dynamic-css">'."\n". $pagelines_dynamic_css->css . "\n".'</style>'. "\n"; }
/** * Do Color Math * * @param $oid * @param $o * @param $val * @param string $format * * @uses base_hsl * @uses get_color * @uses get_hsl * @uses load_the_props * @uses set_factory_key * @uses store_set_color * * @internal uses class PageLinesCSS * @internal uses filter 'pl_math_array' * * @return string * @todo confirm if removing the return after "if( ploption('disable_text_shadow') )" is correct */ function do_color_math($oid, $o, $val, $format = 'css') { $default = isset($o['default']) ? $o['default'] : $val; $output = ''; $id = isset($o['id']) ? $o['id'] : null; $math_array = isset($o['math']) ? $o['math'] : array(); $math_array = apply_filters('pl_math_array', $math_array, $oid, $o); if (!empty($math_array)) { // Set the base. // If no option value, use the depends cascade foreach ($o['math'] as $key => $k) { if (!$val) { if (isset($k['depends'])) { foreach ($k['depends'] as $d) { if (isset($d) && !empty($d)) { $base = $d; break; } } } } else { $base = str_replace('#', '', $val); } } // Set the base color $base = isset($base) ? $base : $default; if (isset($id)) { store_set_color($id, $base); } // Set up the base color for editing $math = new PageLinesColor($base, $id); // Process math array foreach ($o['math'] as $key => $k) { $id = isset($k['id']) ? $k['id'] : ''; $difference = isset($k['diff']) ? $k['diff'] : '10%'; if ($k['mode'] == 'mix' || $k['mode'] == 'shadow') { if (isset($k['mixwith']) && is_array($k['mixwith'])) { foreach ($k['mixwith'] as $mkey => $m) { if (isset($m) && !empty($m)) { $mix_color = $m; break; } else { $mix_color = $base; } } } elseif (isset($k['mixwith'])) { $mix_color = $k['mixwith']; } if ($k['mode'] == 'shadow') { //if( ploption('disable_text_shadow') ) /** commented out return as part of if statement */ // return; $difference = $math->get_hsl($mix_color, 'lightness') - $math->base_hsl['lightness']; $difference = $difference > 0 ? 0.1 : -0.2; $k['css_prop'] = $difference < 0 ? array('text-shadow-top') : array('text-shadow'); } $color = $math->get_color($k['mode'], $difference, $mix_color, $id); } else { $color = $math->get_color($k['mode'], $difference, null, $id); } $css = new PageLinesCSS(); if (isset($o['selectors']) && $o['selectors'] != '') { $output .= $css->load_the_props($k['css_prop'], '#' . $color); } else { // If using cssgroups $cssgroup = $k['cssgroup']; if (is_array($cssgroup)) { foreach ($cssgroup as $cgroup) { $css->set_factory_key($cgroup, $css->load_the_props($k['css_prop'], '#' . $color)); } } else { $css->set_factory_key($cssgroup, $css->load_the_props($k['css_prop'], '#' . $color)); } } // Recursion if (isset($k['math'])) { do_color_math($key, $k, $color, $format); } } } return $output; }
/** * * Get Dynamic CSS * * @package PageLines Framework * @since 2.2 * */ function get_dynamic_css() { $pagelines_dynamic_css = new PageLinesCSS(); $pagelines_dynamic_css->typography(); $typography = $pagelines_dynamic_css->css; $pagelines_dynamic_css->css = ''; $pagelines_dynamic_css->layout(); $pagelines_dynamic_css->options(); $out = array('type' => $typography, 'dynamic' => apply_filters('pl-dynamic-css', $pagelines_dynamic_css->css)); return $out; }
function pagelines_build_dynamic_css() { if (is_writable(CORE . '/css/dynamic.css')) { $pagelines_dynamic_css = new PageLinesCSS(); $pagelines_dynamic_css->create(); $lid = @fopen(CORE . '/css/dynamic.css', 'w'); @fwrite($lid, $pagelines_dynamic_css->css); @fclose($lid); } }