public function gallery($value = null) { $attachments = array(); if (is_array($value)) { foreach ($value as $gallery) { $gallery = new WT_Gallery($gallery["attachment_type_id"]); $gallery->retrieve(); $attachments = array_merge($attachments, $gallery->get_attachments(array("thumbnail", "large"))); } } return $attachments; }
$tour->db_response("json"); break; case "delete_all_tour": unset($_POST["action"]); if ($_POST["id"]) { $tour = new WT_Tour(); $tour->delete_all(json_decode(stripslashes($_POST["id"])), $_POST["_nonce"]); $tour->db_response("json"); } break; // GALLERY // GALLERY case "get_gallery": $gallery = new WT_Gallery($_POST["gallery_id"]); if (!empty($_POST["gallery_id"])) { $gallery->retrieve(); } else { $gallery->defaults(); } echo json_encode($gallery->db_out(null, 0)); break; case "insert_gallery": $gallery = new WT_Gallery(); $gallery->insert($_POST); $gallery->db_response("json"); break; case "update_gallery": $gallery = new WT_Gallery($_POST["gallery_id"]); $gallery->update($_POST); $gallery->db_response("json"); break;