Exemplo n.º 1
0
<?php

list($name, $option) = $this->get_setting_bases(__FILE__);
?>

<?php 
include_once dirname(__FILE__) . '/media_queries.php';
$wtfdivi011_media_queries = wtfdivi011_media_queries();
if (isset($option['customcss'])) {
    // Output each enabled CSS block
    foreach (wtfdivi011_html_checkbox_vals($option['customcss']['enabled']) as $k => $enabled) {
        if ($k == 0) {
            continue;
        }
        // ignore template block
        if ($enabled) {
            // === build the media query === //
            $media_query = $option['customcss']['mediaqueries'][$k] == 'all' ? '' : $wtfdivi011_media_queries[$option['customcss']['mediaqueries'][$k]]['css'];
            // === build the selector === //
            // apply the body classes
            $selector = 'body';
            foreach (array('user', 'device', 'browser', 'pagetype', 'elegantthemes') as $selection) {
                $selector .= $option['customcss'][$selection][$k] == 'all' ? '' : '.' . $option['customcss'][$selection][$k];
            }
            // === build the CSS === //
            $css = trim($option['customcss']['css'][$k]);
            $css = $this->minify_css($css);
            $css_rules = array_filter(explode("}", $css));
            // break into individual css rules
            foreach ($css_rules as $id => $rule) {
                // get selectors for the rule
Exemplo n.º 2
0
/../../../core/img/delete.png'); color:#c06; float:right; margin-right:-24px; }
a.wtfdivi011_add { background-image:url('<?php 
echo addslashes(htmlentities(plugin_dir_url(__FILE__)));
?>
/../../../core/img/icon_plus_alt2.png'); }
</style>

<?php 
// set up a blank custom css box if none exists
if (empty($option['customcss']['css'])) {
    $option['customcss']['css'] = array('');
    $option['customcss']['enabled'] = array(1);
    $option['customcss']['mediaqueries'] = array('all');
} else {
    // fix checkbox vals
    $option['customcss']['enabled'] = wtfdivi011_html_checkbox_vals($option['customcss']['enabled']);
}
foreach ($option['customcss']['css'] as $k => $v) {
    // user select
    $selected_user = isset($option['customcss']['user'][$k]) ? $option['customcss']['user'][$k] : 'all';
    $options_user = array('all' => 'All users', 'logged-in' => 'Logged in users', 'not-logged-in' => 'Non logged in users');
    // device select
    $selected_device = isset($option['customcss']['device'][$k]) ? $option['customcss']['device'][$k] : 'all';
    $options_device = array('all' => 'Any device', 'windows' => 'Windows', 'mac' => 'Mac', 'linux' => 'Linux', 'iphone' => 'iPhone', "android" => "Android", "mobile" => "Mobiles", "tablet" => "Tablets", "desktop" => "Desktops");
    // browser select
    $selected_browser = isset($option['customcss']['device'][$k]) ? $option['customcss']['device'][$k] : 'all';
    $options_browser = array('all' => 'Any browser', 'chrome' => 'Google Chrome', 'gecko' => 'Firefox', 'ie' => 'Internet Explorer', 'lynx' => 'Lynx', 'opera' => 'Opera', 'safari' => 'Safari');
    // media query select
    $selected_mq = isset($option['customcss']['mediaqueries'][$k]) ? $option['customcss']['mediaqueries'][$k] : 'all';
    $options_mq = array();
    foreach ($media_queries as $slug => $data) {