</td> <td> <input type="button" name="mg_set_style" id="mg_set_style" value="<?php _e('Set', 'mg_ml'); ?> " class="button-secondary" /> </td> </tr> <tr> <td class="lcwp_label_td"><?php _e("Preview", 'mg_ml'); ?> </td> <td class="lcwp_field_td" colspan="2"> <?php $styles = mg_predefined_styles(); foreach ($styles as $style => $val) { echo '<img src="' . MG_URL . '/img/pred_styles_demo/' . $val['preview'] . '" class="mg_styles_preview" alt="' . $style . '" style="display: none;" />'; } ?> </td> </tr> </table> <h3><?php _e("Grid Layout", 'mg_ml'); ?> </h3> <table class="widefat lcwp_table"> <tr>
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; }