|"; $anypopupInfo .= "If you like the plugin, please rate it 5 stars".$divisor; $anypopupInfo .= "Support".$divisor; $anypopupInfo .= "How to create a popup"; echo $anypopupInfo; } public static function getMaxOpenPopupId() { $popupsCounterData = get_option('AnypopuppbCounter'); if(!$popupsCounterData) { return 0; } $counters = array_values($popupsCounterData); $maxCount = max($counters); $popupId = array_search($maxCount, $popupsCounterData); $maxPopupData = array( 'popupId' => $popupId, 'maxCount' => $maxCount ); return $maxPopupData; } public static function getPopupMainTableCreationDate() { global $wpdb; $query = $wpdb->prepare('SELECT table_name,create_time FROM information_schema.tables WHERE table_schema="%s" AND table_name="%s"', DB_NAME, $wpdb->prefix.'any_popup'); $results = $wpdb->get_results($query, ARRAY_A); if(empty($results)) { return 0; } $createTime = $results[0]['create_time']; $createTime = strtotime($createTime); update_option('ANYPOPUPInstallDate', $createTime); $diff = time()-$createTime; $days = floor($diff/(60*60*24)); return $days; } public static function shouldOpenReviewPopupForDays() { $shouldOpen = true; $dontShowAgain = get_option('ANYPOPUPCloseReviewPopup'); $periodNextTime = get_option('ANYPOPUPOpenNextTime'); if($dontShowAgain) { return false; } /*When period next time does not exits it means the user is old*/ if(!$periodNextTime) { $usageDays = self::getPopupMainTableCreationDate(); update_option('ANYPOPUPUsageDays', $usageDays); /*When very old user*/ if($usageDays > ANYPOPUP_REVIEW_POPUP_PERIOD && !$dontShowAgain) { return $shouldOpen; } $remainingDays = ANYPOPUP_REVIEW_POPUP_PERIOD - $usageDays; $popupTimeZone = @AnypopupGetData::getPopupTimeZone(); $timeDate = new DateTime('now', new DateTimeZone($popupTimeZone)); $timeDate->modify('+'.$remainingDays.' day'); $timeNow = strtotime($timeDate->format('Y-m-d H:i:s')); update_option('ANYPOPUPOpenNextTime', $timeNow); return false; } $currentData = new DateTime('now'); $timeNow = $currentData->format('Y-m-d H:i:s'); $timeNow = strtotime($timeNow); if($periodNextTime > $timeNow) { return false; } return $shouldOpen; } public static function shouldOpenForMaxOpenPopupMessage() { $counterMaxPopup = self::getMaxOpenPopupId(); if(empty($counterMaxPopup)) { return false; } $dontShowAgain = get_option('ANYPOPUPCloseReviewPopup'); $maxCountDefine = get_option('ANYPOPUPMaxOpenCount'); if(!$maxCountDefine) { $maxCountDefine = ANYPOPUP_SHOW_COUNT; } return $counterMaxPopup['maxCount'] >= $maxCountDefine && !$dontShowAgain; } public static function getPopupUsageDays() { $installDate = get_option('ANYPOPUPInstallDate'); $timeDate = new DateTime('now'); $timeNow = strtotime($timeDate->format('Y-m-d H:i:s')); $diff = $timeNow-$installDate; $days = floor($diff/(60*60*24)); return $days; } public static function getMaxOpenDaysMessage() { $getUsageDays = self::getPopupUsageDays(); $firstHeader = '

Wow! You’ve been using Any Popup on your site for '.$getUsageDays.' days

'; $popupContent = self::getMaxOepnPopupContent($firstHeader, 'days'); $popupContent .= self::showReviewBlockJs(); return $popupContent; } public static function getMaxOpenPopupsMessage() { $counterMaxPopup = self::getMaxOpenPopupId(); $popupTitle = ''; $maxCountDefine = get_option('ANYPOPUPMaxOpenCount'); $popupData = ANYPOPUP::findById($counterMaxPopup['popupId']); if(!empty($counterMaxPopup['maxCount'])) { $maxCountDefine = $counterMaxPopup['maxCount']; } if(!empty($popupData)) { $popupTitle = $popupData->getTitle(); } $firstHeader = '

Wow! Any Popup plugin helped you to share your message via '.$popupTitle.' popup with your users for '.$maxCountDefine.' times!

'; $popupContent = self::getMaxOepnPopupContent($firstHeader, 'count'); $popupContent .= self::showReviewBlockJs(); return $popupContent; } public static function showReviewBlockJs() { ob_start(); ?>
$popupContent
"; echo $popupContent; }, 1); } public static function openReviewPopup() { wp_register_script('anypopup_colorbox', ANYPOPUP_APP_POPUP_URL . '/javascript/jquery.anypopupcolorbox-min.js', array('jquery'), ANYPOPUP_VERSION); wp_enqueue_script('anypopup_colorbox'); wp_register_style('anypopup_colorbox_theme', ANYPOPUP_APP_POPUP_URL . "/style/anypopupcolorbox/anypopupthemes.css", array(), ANYPOPUP_VERSION); wp_enqueue_style('anypopup_colorbox_theme'); $ajaxNonce = wp_create_nonce("anypopupAnyPopupReview"); echo ""; } public static function getMaxOepnPopupContent($firstHeader, $type) { $ajaxNonce = wp_create_nonce("anypopupAnyPopupReview"); ob_start(); ?>

This is really great for your website score.

Have your input in the development of our plugin, and we’ll provide better conversions for your site!
Leave your 5-star positive review and help us go further to the perfection!

 
.*?<\/iframe>)/'; return preg_replace($pattern, '', $anypopupData); } public static function getPopupsDataList($restrictParams = array()) { $orderBy = 'id DESC'; $popupsData = ANYPOPUP::findAll($orderBy); $dataList = array(); foreach ($popupsData as $popupData) { if(empty($popupData)) { continue; } $title = $popupData->getTitle(); $type = $popupData->getType(); $id = $popupData->getId(); if(is_array($restrictParams)) { if(isset($restrictParams['type']) && $type == $restrictParams['type']) { continue; } if(isset($restrictParams['id']) && $id == $restrictParams['id']) { continue; } } $dataList[$id] = $title.' - '.$type; } return $dataList; } public static function popupTablesDeleteSatus() { global $wpdb; $st = $wpdb->prepare("SELECT * FROM ". $wpdb->prefix ."anypopup_settings WHERE id = %d",1); $arr = $wpdb->get_row($st,ARRAY_A); if(empty($arr)) { return true; } $options = json_decode($arr['options'], true); $deleteStatus = ($options['tables-delete-status'] == 'on' ? true: false); return $deleteStatus; } public static function addReview() { $ajaxNonce = wp_create_nonce("anypopupAnyPopupReview"); ob_start(); ?>

If you have any difficulties in using the options, please follow the link to Knowledge Base

Upgrade NOW

Want to upgrade to PRO version?
Just click on "Upgrade NOW".

Follow us

+ Don’t show again.'; ?>
format('Y-m-d H:i:s')); $startTime = '1513343100'; $endData = '1515369540'; $currentUser = wp_get_current_user(); $niceName = ''; if (!empty($currentUser)) { $niceName = $currentUser->nickname; } if(!($timeNow > $startTime && $timeNow < $endData) || $newYearShow) { return $reviewPanel; } ob_start(); ?>

Hi

Merry Christmas and Happy New Year

Take your 25% sale right now!

Don’t show again
NOTE: Shortcodes doesn\'t work inside the HTML Popup. Please use Shortcode Popup instead.'; return $notice; } public static function createSelectBox($data, $selectedValue, $attrs) { $attrString = ''; $selected = ''; if(!empty($attrs) && isset($attrs)) { foreach ($attrs as $attrName => $attrValue) { $attrString .= ''.$attrName.'="'.$attrValue.'" '; } } $selectBox = ''; return $selectBox; } public static function anypopupCreateRadioElements($radioElements, $checkedValue) { $content = ''; for ($i = 0; $i < count($radioElements); $i++) { $checked = ''; $br = ''; $radioElement = @$radioElements[$i]; $name = @$radioElement['name']; $label = @$radioElement['label']; $value = @$radioElement['value']; $brValue = @$radioElement['newline']; $additionalHtml = @$radioElement['additionalHtml']; $labelId = 'anypopup-select-'.$name.'-'.$i; if($checkedValue == $value) { $checked = 'checked'; } if($brValue) { $br = "
"; } $content .= '