Changeset 1854131
- Timestamp:
- 04/06/2018 12:48:10 PM (8 years ago)
- Location:
- prime-ads/trunk
- Files:
-
- 5 edited
-
inc/services/AdsHelper.php (modified) (3 diffs)
-
inc/services/Migration.php (modified) (1 diff)
-
jci/functions.js (modified) (4 diffs)
-
prime-ads.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
prime-ads/trunk/inc/services/AdsHelper.php
r1853454 r1854131 57 57 public $screenWidth = array(); 58 58 public $screenWidthInPx; 59 public $adblockDetected = 0; 59 60 60 61 public $notIncludeAds = false; … … 152 153 if($i > 0) $sql .= " UNION"; 153 154 154 $sql .= " SELECT id, tags, in_rubrics, ex_rubrics, in_posts, ex_posts, min_lenght, country, region, city, resolutions, by_timetable, days_of_week, from_time, to_time, not_show, is_active, position, position_not_in_timetable, shows*shows_ratio as shows, '" . $this->_functions[$i] . "' as method, ((`from_time`<`to_time` AND `from_time`<=" . $hour . " AND `to_time`>" . $hour . ") OR (`from_time`>`to_time` AND ((`from_time`<=" . $hour . " AND " . $hour . "<=23) OR (`to_time`>" . $hour . " AND " . $hour . ">=0))) OR (`from_time`=`to_time`)) as time_exp FROM " . $wpdb->prefix . $this->_tables[$i];155 $sql .= " SELECT id, tags, in_rubrics, ex_rubrics, in_posts, ex_posts, min_lenght, country, region, city, resolutions,adblock_only, by_timetable, days_of_week, from_time, to_time, not_show, is_active, position, position_not_in_timetable, shows*shows_ratio as shows, '" . $this->_functions[$i] . "' as method, ((`from_time`<`to_time` AND `from_time`<=" . $hour . " AND `to_time`>" . $hour . ") OR (`from_time`>`to_time` AND ((`from_time`<=" . $hour . " AND " . $hour . "<=23) OR (`to_time`>" . $hour . " AND " . $hour . ">=0))) OR (`from_time`=`to_time`)) as time_exp FROM " . $wpdb->prefix . $this->_tables[$i]; 155 156 } 156 157 … … 199 200 } 200 201 201 $sql .= " order by by_timetable DESC, IF(tags !='',0,1),IF(in_rubrics !='',0,1),IF(in_posts !='',0,1),IF(country !='',0,1),IF(region !='',0,1),IF(city !='',0,1),shows limit 1"; 202 if(!$this->adblockDetected) 203 $sql .= ' and `adblock_only`=0'; 204 205 $sql .= " order by"; 206 if($this->adblockDetected) $sql .=" adblock_only DESC, "; 207 208 $sql.= " by_timetable DESC, IF(tags !='',0,1),IF(in_rubrics !='',0,1),IF(in_posts !='',0,1),IF(country !='',0,1),IF(region !='',0,1),IF(city !='',0,1),shows limit 1"; 202 209 $itemProps = $wpdb->get_row($sql); 203 210 if(!$itemProps) return ''; -
prime-ads/trunk/inc/services/Migration.php
r1849088 r1854131 212 212 return '2.1.8'; 213 213 } 214 215 if($ver == '2.1.8'){ 216 $wpdb->query("ALTER TABLE `" . $wpdb->prefix . "ads_code_block` ADD `adblock_only` TINYINT NOT NULL DEFAULT '0'"); 217 218 $wpdb->query("ALTER TABLE `" . $wpdb->prefix . "ads_text_block` ADD `adblock_only` TINYINT NOT NULL DEFAULT '0'"); 219 220 $wpdb->query("ALTER TABLE `" . $wpdb->prefix . "ads_simple_tizer_group` ADD `adblock_only` TINYINT NOT NULL DEFAULT '0'"); 221 222 $wpdb->query("ALTER TABLE `" . $wpdb->prefix . "ads_comment` ADD `adblock_only` TINYINT NOT NULL DEFAULT '0'"); 223 224 $wpdb->query("ALTER TABLE `" . $wpdb->prefix . "ads_adsense_block` ADD `adblock_only` TINYINT NOT NULL DEFAULT '0'"); 225 226 update_option('ads-db-verison', '2.2.1'); 227 return '2.2.1'; 228 } 214 229 } 215 230 } -
prime-ads/trunk/jci/functions.js
r1747413 r1854131 1 //AdBlock Detect 2 (function(root, factory) { 3 /* istanbul ignore next */ 4 if (typeof define === 'function' && define.amd) { 5 define([], factory); 6 } else if (typeof module === 'object' && module.exports) { 7 module.exports = factory(); 8 } else { 9 root.adblockDetect = factory(); 10 } 11 12 }(this, function() { 13 function adblockDetect(callback, options) { 14 options = merge(adblockDetect.defaults, options || {}); 15 16 var testNode = createNode(options.testNodeClasses, options.testNodeStyle); 17 var runsCounter = 0; 18 var adblockDetected = false; 19 20 var testInterval = setInterval(function() { 21 22 runsCounter++; 23 adblockDetected = isNodeBlocked(testNode); 24 25 if (adblockDetected || runsCounter === options.testRuns) { 26 clearInterval(testInterval); 27 testNode.parentNode && testNode.parentNode.removeChild(testNode); 28 callback(adblockDetected); 29 } 30 }, options.testInterval); 31 } 32 33 function createNode(testNodeClasses, testNodeStyle) { 34 var document = window.document; 35 var testNode = document.createElement('div'); 36 37 testNode.innerHTML = ' '; 38 testNode.setAttribute('class', testNodeClasses); 39 testNode.setAttribute('style', testNodeStyle); 40 41 document.body.appendChild(testNode); 42 43 return testNode; 44 } 45 46 function isNodeBlocked(testNode) { 47 return testNode.offsetHeight === 0 || 48 !document.body.contains(testNode) || 49 testNode.style.display === 'none' || 50 testNode.style.visibility === 'hidden' 51 ; 52 } 53 54 function merge(defaults, options) { 55 var obj = {}; 56 57 for (var key in defaults) { 58 obj[key] = defaults[key]; 59 options.hasOwnProperty(key) && (obj[key] = options[key]); 60 } 61 62 return obj; 63 } 64 65 adblockDetect.defaults = { 66 testNodeClasses: 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links', 67 testNodeStyle: 'height: 10px !important; font-size: 20px; color: transparent; position: absolute; bottom: 0; left: -10000px;', 68 testInterval: 51, 69 testRuns: 4 70 }; 71 72 return adblockDetect; 73 })); 74 // end AdblockDetect 75 1 76 var closed_blocks = Cookies.get('closed_blocks'); 2 77 if(!closed_blocks) closed_blocks = []; 78 79 var loaderStarted = false; 80 3 81 function linkCount(obj){ 4 82 jQuery.ajax({ … … 58 136 59 137 if(positions.length > 0){ 138 adblockDetect(function(adblockDetected) { 139 loadBlocks(adblockDetected); 140 }); 141 142 // если не сработала загзрузка после определения адблока 143 setTimeout(function(){ 144 if(!loaderStarted) loadBlocks(false); 145 }, 1000); 146 } 147 148 function loadBlocks(adblockDetected){ 149 if(loaderStarted) return; 150 loaderStarted = true; 60 151 $.ajax({ 61 152 type: 'POST', … … 65 156 id: positions, 66 157 width: $(window).width(), 158 adblockDetected: adblockDetected ? 1 : 0, 67 159 cache: false, 68 160 }, … … 89 181 }); 90 182 } 91 92 183 }); -
prime-ads/trunk/prime-ads.php
r1853454 r1854131 3 3 Plugin Name: Prime Ads 4 4 Description: Вывод рекламы с сервиса Prime Ads 5 Version: 2.2. 05 Version: 2.2.1 6 6 Author: Proffit 7 7 Author URI: http://proffit.guru/ … … 19 19 use AdsNS\SxGeo\SxGeo; 20 20 21 define('ADS_VERSION', '2.2. 0');22 define('ADS_DB_VERSION', '2. 1.8');21 define('ADS_VERSION', '2.2.1'); 22 define('ADS_DB_VERSION', '2.2.1'); 23 23 define('ADS_PATH', realpath(__DIR__)); 24 24 define('ADS_SERVICE_URL', get_option('ads-service-url', 'http://primeads.ru/')); … … 215 215 wp_enqueue_script('prma-cookie', $upload_dir['baseurl'] . '/' . $folder . '/js.cookie.js', array('jquery'), "2.1.3", true); 216 216 wp_enqueue_script('prma-script', $upload_dir['baseurl'] . '/' . $folder . '/script.js', array('jquery', 'prma-functions'), "1.0.0", false); 217 wp_enqueue_script('prma-functions', $upload_dir['baseurl'] . '/' . $folder . '/functions.js', array('jquery', 'prma-cookie'), "1.0. 1", false);217 wp_enqueue_script('prma-functions', $upload_dir['baseurl'] . '/' . $folder . '/functions.js', array('jquery', 'prma-cookie'), "1.0.2", false); 218 218 wp_enqueue_script('prma-fixed', $upload_dir['baseurl'] . '/' . $folder . '/jquery-scrolltofixed.js', array('jquery'), "1.0.7", true); 219 219 wp_enqueue_script('prma-flip', $upload_dir['baseurl'] . '/' . $folder . '/jquery.flip.min.js', array('jquery'), "1.0.20", true); … … 273 273 $this->_adsHelper->getPostAndCat(); 274 274 $this->_adsHelper->screenWidthInPx = intVal($_POST['width']); 275 $this->_adsHelper->adblockDetected = intVal($_POST['adblockDetected']); 275 276 echo json_encode($this->_adsHelper->generatePositionContentByPositionId($_POST['id'])); 276 277 $this->_adsHelper->screenWidth = false; -
prime-ads/trunk/readme.txt
r1853454 r1854131 7 7 Requires at least: 4.0 8 8 Tested up to: 4.7 9 Stable tag: 2.2. 09 Stable tag: 2.2.1 10 10 11 11 Ответная часть сервиса монитизации Prime Ads (http://primeads.ru)
Note: See TracChangeset
for help on using the changeset viewer.