Example #1
0
 * ================================================================= */
?>

<?php 
include_once 'header.php';
?>

	<h1><?php 
_e('Add New', GET_NOTIFIED_TEXT_DOMAIN);
?>
</h1>

	<?php 
$notification_db = new GNT_Notification_DB();
if (isset($_GET['id'])) {
    $notification = $notification_db->get_data_from_id($_GET['id']);
} else {
    $notification = $notification_db->default_data();
}
?>

	<form method="post">

		<table class="form-table">
			<tbody>

			<!-- Name -->

			<tr>
				<th scope="row"><label for="<?php 
echo GET_NOTIFIED_PREFIX;
Example #2
0
/**
 * Display on the Contents of the Add New Page
 *
 * @access public
 * @return void
 */
function gnt_add_new_content()
{
    $notification_db = new GNT_Notification_DB();
    // Save a Notification
    if (isset($_POST['submit']) && check_admin_referer('save-notification')) {
        // Edit
        if (isset($_GET['action']) && $_GET['action'] == 'edit') {
            $data = $notification_db->get_data_from_id($_GET['id']);
            $data['name'] = isset($_POST[GET_NOTIFIED_PREFIX . 'name']) ? $notification_db->clean_data($_POST[GET_NOTIFIED_PREFIX . 'name']) : 'My Notification';
            $notification_db->update_data($_GET['id'], $data);
        } else {
            $data['name'] = isset($_POST[GET_NOTIFIED_PREFIX . 'name']) ? $notification_db->clean_data($_POST[GET_NOTIFIED_PREFIX . 'name']) : 'My Notification';
            $notification_db->add_data($data);
        }
    }
    include GET_NOTIFIED_PLUGIN_DIR . 'views/add-new-page.php';
}