sgRenderPopupScript($args['id']); return "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=" . $args['id'] . ">" . $content . "</a>"; } else { sgRenderPopupOpen($args['id']); } } add_shortCode('sg_popup', 'sgShowShortCode'); function sgAutoloadPopup($args) { $popupId = SGPopup::findById($args['id']); if (!$popupId) { return; } sgRenderPopupOpen($args['id']); } add_shortCode('sg_autoload_popup', 'sgAutoloadPopup'); function sgRenderPopupOpen($popupId) { sgRenderPopupScript($popupId); echo "<script>\r\n\tsgAddEvent(window, 'load',function() {\r\n\t\t\tsgOnScrolling = (SG_POPUP_DATA [{$popupId}]['onScrolling']) ? SG_POPUP_DATA [{$popupId}]['onScrolling']: ''; ;\r\n\t\t\tbeforeScrolingPrsent = (SG_POPUP_DATA [{$popupId}]['onScrolling']) ? SG_POPUP_DATA [{$popupId}]['beforeScrolingPrsent']: '';\r\n\t\t\tautoClosePopup = (SG_POPUP_DATA [{$popupId}]['autoClosePopup']) ? SG_POPUP_DATA [{$popupId}]['autoClosePopup']: '';\r\n\t\t\tpopupClosingTimer = (SG_POPUP_DATA [{$popupId}]['popupClosingTimer']) ? SG_POPUP_DATA [{$popupId}]['popupClosingTimer']: '';\r\n\t\t\tsgPoupFrontendObj = new SGPopup();\r\n\t\t\tif(sgOnScrolling) {\r\n\t\t\t\tsgPoupFrontendObj.onScrolling({$popupId});\r\n\t\t\t}\r\n\t\t\telse {\r\n\r\n\t\t\t\tsgPoupFrontendObj.showPopup({$popupId},true);\r\n\t\t\t}\r\n\t\t});\r\n\t\tfunction sgAddEvent(element, eventName, fn) {\r\n\t\t\tif (element.addEventListener)\r\n\t\t\t\telement.addEventListener(eventName, fn, false);\r\n\t\t\telse if (element.attachEvent)\r\n\t\t\t\telement.attachEvent('on' + eventName, fn);\r\n\t\t}\r\n\t\t\t</script>"; } function sgOnloadPopup() { $page = get_queried_object_id(); $popup = "sg_promotional_popup"; $popupId = SGPopup::getPagePopupId($page, $popup); if (!$popupId) { return; } sgRenderPopupOpen($popupId); }
ob_start(); $obj = SGPopup::findById($args['id']); if (!$obj) { return $content; } if (!empty($content)) { sgRenderPopupScript($args['id']); echo "<a href='javascript:void(0)' class='sg-show-popup' data-sgpopupid=" . $args['id'] . ">" . $content . "</a>"; } else { echo sgRenderPopupOpen($args['id']); } $shortcodeContent = ob_get_contents(); ob_end_clean(); return $shortcodeContent; } add_shortCode('sg_popup', 'sgShowShortCode'); function sgRenderPopupOpen($popupId) { sgRenderPopupScript($popupId); echo "<script type=\"text/javascript\">\n\n\t\t\tsgAddEvent(window, 'load',function() {\n\t\t\t\tsgOnScrolling = (SG_POPUP_DATA [{$popupId}]['onScrolling']) ? SG_POPUP_DATA [{$popupId}]['onScrolling']: ''; ;\n\t\t\t\tbeforeScrolingPrsent = (SG_POPUP_DATA [{$popupId}]['onScrolling']) ? SG_POPUP_DATA [{$popupId}]['beforeScrolingPrsent']: '';\n\t\t\t\tautoClosePopup = (SG_POPUP_DATA [{$popupId}]['autoClosePopup']) ? SG_POPUP_DATA [{$popupId}]['autoClosePopup']: '';\n\t\t\t\tpopupClosingTimer = (SG_POPUP_DATA [{$popupId}]['popupClosingTimer']) ? SG_POPUP_DATA [{$popupId}]['popupClosingTimer']: '';\n\t\t\t\tsgPoupFrontendObj = new SGPopup();\n\t\t\t\tif(sgOnScrolling) {\n\t\t\t\t\tsgPoupFrontendObj.onScrolling({$popupId});\n\t\t\t\t}\n\t\t\t\telse {\n\n\t\t\t\t\tsgPoupFrontendObj.showPopup({$popupId},true);\n\t\t\t\t}\n\t\t\t});\n\t\t</script>"; } function sgOnloadPopup() { $sgOnloadPopupId = get_option('SG_POPUP_ONLOAD_ID'); if ($sgOnloadPopupId) { sgRenderPopupOpen($sgOnloadPopupId); } $page = get_queried_object_id(); $popup = "sg_promotional_popup"; $popupId = SGPopup::getPagePopupId($page, $popup); if (!$popupId) {