コード例 #1
0
ファイル: ajax.php プロジェクト: hurtzi/Marino-Pardo-WEB-
function mg_set_predefined_style()
{
    if (!isset($_POST['lcwp_nonce']) || !wp_verify_nonce($_POST['lcwp_nonce'], 'lcwp_nonce')) {
        die('Cheating?');
    }
    if (!isset($_POST['style'])) {
        die('data is missing');
    }
    $style = $_POST['style'];
    require_once MG_DIR . '/functions.php';
    $style_data = mg_predefined_styles($style);
    // additive settings if is a fresh installation
    if (!get_option('mg_item_width')) {
        $style_data['mg_item_width'] = 70;
        $style_data['mg_item_maxwidth'] = 960;
    }
    // set option values
    foreach ($style_data as $opt => $val) {
        if ($opt != 'preview') {
            if (!get_option($opt)) {
                add_option($opt, '255', '', 'yes');
            }
            update_option($opt, $val);
        }
    }
    if (!get_option('mg_inline_css')) {
        mg_create_frontend_css();
    }
    die;
}
コード例 #2
0
ファイル: settings.php プロジェクト: hurtzi/Marino-Pardo-WEB-
                foreach ($val as $arr_val) {
                    $fdata[$key][] = stripslashes($arr_val);
                }
            }
            if ($fdata[$key] === false) {
                delete_option($key);
            } else {
                if (!get_option($key)) {
                    add_option($key, '255', '', 'yes');
                }
                update_option($key, $fdata[$key]);
            }
        }
        // create frontend.css else print error
        if (!get_option('mg_inline_css')) {
            if (!mg_create_frontend_css()) {
                update_option('mg_inline_css', 1);
                echo '<div class="updated"><p>' . __('An error occurred during dynamic CSS creation. The code will be used inline anyway', 'mg_ml') . '</p></div>';
            } else {
                delete_option('mg_inline_css');
            }
        }
        echo '<div class="updated"><p><strong>' . __('Options saved.', 'mg_ml') . '</strong></p></div>';
    }
} else {
    // Normal page display
    $fdata['mg_cells_margin'] = get_option('mg_cells_margin', 5);
    $fdata['mg_cells_img_border'] = get_option('mg_cells_img_border', 3);
    $fdata['mg_cells_radius'] = get_option('mg_cells_radius', 2);
    $fdata['mg_cells_border'] = get_option('mg_cells_border');
    $fdata['mg_cells_shadow'] = get_option('mg_cells_shadow');
コード例 #3
0
function mg_init_custom_css()
{
    include_once MG_DIR . '/functions.php';
    // create custom CSS
    if (!mg_create_frontend_css()) {
        update_option('mg_inline_css', 1);
    } else {
        delete_option('mg_inline_css');
    }
    // hack for non-latin characters (FROM v1.11)
    if (!get_option('mg_non_latin_char')) {
        if (mg_cust_opt_exists()) {
            delete_option('mg_non_latin_char');
        } else {
            add_option('mg_non_latin_char', '1', '', 'yes');
        }
    }
    // update sliders (for versions < 1.3)
    mg_update_img_sliders();
}