Пример #1
0
 function detail_trash($post_id)
 {
     parent::detail_trash($post_id);
     $post_type = get_post_type($post_id);
     $detached = array();
     foreach (Conferencer::get_sessions($post_id) as $session) {
         Conferencer::add_meta($session);
         if (in_array($post_type, array('speaker', 'sponsor'))) {
             $type = $post_type . 's';
             if (in_array($post_id, $session->{$type})) {
                 update_post_meta($session->ID, "_conferencer_{$type}", array_diff($session->{$type}, array($post_id)));
                 $detached[] = $session;
             }
         } else {
             if ($session->{$post_type} == $post_id) {
                 update_post_meta($session->ID, "_conferencer_{$post_type}", false);
                 $detached[] = $session;
             }
         }
     }
     foreach ($detached as $session) {
         Conferencer::add_admin_notice("Removed " . get_the_title($post_id) . " from <a href='post.php?post={$session->ID}&action=edit' target='_blank'>{$session->post_title}</a>.");
     }
 }
Пример #2
0
 function save()
 {
     if (isset($_POST['conferencer_cache_settings']) && check_admin_referer('nonce_conferencer_cache')) {
         if (isset($_POST['conferencer_disable_cache'])) {
             update_option('conferencer_caching', false);
             Conferencer::add_admin_notice("Caching disabled.");
         } else {
             if (isset($_POST['conferencer_enable_cache'])) {
                 update_option('conferencer_caching', true);
                 Conferencer::add_admin_notice("Caching enabled.");
             } else {
                 if (isset($_POST['conferencer_clear_cache'])) {
                     Conferencer_Shortcode::clear_cache();
                     Conferencer::add_admin_notice("Cach cleared.");
                 }
             }
         }
         header("Location: " . $_SERVER['REQUEST_URI']);
         die;
     }
 }
Пример #3
0
 function save()
 {
     if (isset($_POST['conferencer_reordering']) && check_admin_referer('nonce_conferencer_reordering_order')) {
         foreach (self::$priority_post_types as $slug => $heading) {
             if (isset($_POST['conferencer_' . $slug . '_id'])) {
                 foreach ($_POST['conferencer_' . $slug . '_id'] as $order => $id) {
                     update_post_meta(intVal($id), '_conferencer_order', $order);
                 }
             }
         }
         Conferencer::add_admin_notice("Ordering saved.");
         header("Location: " . $_SERVER['REQUEST_URI']);
         die;
     }
 }