function wpcw_get_defaults_action() { if (current_user_can('manage_options')) { $section = $_POST['section'] ?: 'discussion'; $data = $_POST['data'] ?: 'tpl'; $defaults = wpcw_get_defaults($section); echo $defaults[$data]; wp_die(); } else { header('HTTP/1.0 403 Forbidden'); } }
function wpcw_field_recent_comments_css_render() { $wpcw_defaults = wpcw_get_defaults('recent-comments'); ?> <textarea rows='25' name='wpcw_recent_comments_css' style="width: 95%;"><?php echo get_option('wpcw_recent_comments_css') ?: $wpcw_defaults['css']; ?> </textarea> <div class="widget-controls"> <button class="button button-reset" data-section="recent-comments" data-item="css">Reset styles</button> <label for="wpcw_recent_comments_use_default_css"> <input id="wpcw_recent_comments_use_default_css" name="wpcw_recent_comments_use_default_css" type="checkbox" <?php checked('on', get_option('wpcw_recent_comments_use_default_css', 'on')); ?> > Use default style </label> </div> <?php }