function mg_deeplink_snapshot() { if (!get_option('mg_disable_dl') && isset($_REQUEST['_escaped_fragment_'])) { $val = explode('=', $_REQUEST['_escaped_fragment_']); // detect if is calling MG item and its id if (is_array($val) && count($val) == 2 && $val[0] == 'mg_ld') { if (get_post_status((int) $val[1]) == 'publish') { // get lightbox contents ob_start(); mg_lightbox($val[1], false, false); $contents = ob_get_clean(); echo ' <div id="mg_full_overlay" class="google_crawler" style="display: block;"> <div id="mg_overlay_content"> ' . $contents . ' </div> </div> <div id="mg_full_overlay_wrap" class="google_crawler"></div>'; echo ' <script type="text/javascript"> jQuery("html, body").css("overflow", "hidden"); </script>'; } } } }
function mg_ajax_lightbox() { if (isset($_POST['mg_lb']) && $_POST['mg_lb'] == 'mg_lb_content') { include_once MG_DIR . '/functions.php'; header('Content-Type: text/html; charset=utf-8'); if (!isset($_POST['pid']) || !filter_var($_POST['pid'], FILTER_VALIDATE_INT)) { die('item id is missing'); } $pid = addslashes($_POST['pid']); $prev = isset($_POST['prev_id']) ? (int) $_POST['prev_id'] : false; $next = isset($_POST['next_id']) ? (int) $_POST['next_id'] : false; mg_lightbox($pid, $prev, $next); die; } }