Example #1
0
<div class="wrap">
    <h2><?php 
_e('Debug Settings', 'debug');
?>
</h2>
    <?php 
debug_save_setting();
?>
    <form method="post" action="">
        <table class="form-table">
            <tbody>
                <tr>
                    <th><?php 
_e('Get "wp-config.php" for Backup', 'debug');
?>
</th>
                    <td>
                        <input type="submit" name="downloadconfig" id="downloadconfig" class="button button-primary" value="<?php 
_e('Download', 'debug');
?>
">
                    </td>
                </tr>
                <tr>
                    <th scope="row"><?php 
_e('Debug settings', 'debug');
?>
</th>
                    <td>
                        <fieldset>
                            <legend class="screen-reader-text">
Example #2
0
function debug_email_notification_save_setting()
{
    if (isset($_POST['debug_notification']) && !empty($_POST['debug_notification'])) {
        $setting = $_POST['debug_notification'];
        if (isset($setting['enable']) && !empty($setting['enable'])) {
            if (!isset($setting['email']) || empty($setting['email'])) {
                $status = 'error';
                $message = 'Email address is required field.';
            } elseif (!is_email($setting['email'])) {
                $status = 'error';
                $message = 'Please enter a valid email address.';
            } elseif (!isset($setting['subject']) || empty($setting['subject'])) {
                $status = 'error';
                $message = 'Email subject is required field.';
            } else {
                $_POST['debugsetting'] = $_POST['error_reporting'] = $_POST['error_log'] = $_POST['error_script'] = $_POST['error_savequery'] = '1';
                $_POST['display_error'] = '0';
                debug_save_setting();
            }
        } else {
            $status = 'updated';
            $message = 'Notification setting save successfully.';
        }
        update_option('debug_notification', $setting);
    }
    if (isset($_GET['update']) && $_GET['update'] == 1 && $_GET['page'] == 'debug_notification') {
        $status = 'updated';
        $message = 'Notification setting save successfully.';
    }
    if (isset($message) && !empty($message)) {
        echo '<div class="' . $status . ' settings-error"><p><strong>' . __($message, 'debug') . '</strong></p></div>';
    }
}