예제 #1
0
<?php

if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
    die('You are not allowed to call this page directly.');
}
// Form submitted, check the data
if (isset($_POST['frm_es_display']) && $_POST['frm_es_display'] == 'yes') {
    $did = isset($_GET['did']) ? $_GET['did'] : '0';
    es_cls_security::es_check_number($did);
    $es_success = '';
    $es_success_msg = FALSE;
    // First check if ID exist with requested ID
    $result = es_cls_notification::es_notification_count($did);
    if ($result != '1') {
        ?>
<div class="error fade"><p><strong><?php 
        _e('Oops, selected details doesnt exist.', 'email-subscribers');
        ?>
</strong></p></div><?php 
    } else {
        // Form submitted, check the action
        if (isset($_GET['ac']) && $_GET['ac'] == 'del' && isset($_GET['did']) && $_GET['did'] != '') {
            //	Just security thingy that wordpress offers us
            check_admin_referer('es_form_show');
            //	Delete selected record from the table
            es_cls_notification::es_notification_delete($did);
            //	Set success message
            $es_success_msg = TRUE;
            $es_success = __('Selected record was successfully deleted.', 'email-subscribers');
        }
    }
 public static function es_notifications_default()
 {
     $result = es_cls_notification::es_notification_count(0);
     if ($result == 0) {
         $form["es_note_group"] = "Public";
         $form["es_note_status"] = "Enable";
         $form["es_note_templ"] = "1";
         $listcategory = "";
         $args = array('hide_empty' => 0, 'orderby' => 'name', 'order' => 'ASC');
         $categories = get_categories($args);
         $total = count($categories);
         $i = 1;
         foreach ($categories as $category) {
             $listcategory = $listcategory . " ##" . $category->cat_name . "## ";
             if ($i < $total) {
                 $listcategory = $listcategory . "--";
             }
             $i = $i + 1;
         }
         $form["es_note_cat"] = $listcategory;
         es_cls_notification::es_notification_ins($form, "insert");
     }
     return true;
 }