Changeset 2117416
- Timestamp:
- 07/04/2019 08:54:17 AM (7 years ago)
- Location:
- realbig-media/trunk
- Files:
-
- 4 edited
-
asyncBlockInserting.js (modified) (6 diffs)
-
readyAdGather.js (modified) (1 diff)
-
realbigForWP.php (modified) (7 diffs)
-
textEditing.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
realbig-media/trunk/asyncBlockInserting.js
r2115464 r2117416 25 25 // } 26 26 27 if (typeof endedSc === 'undefined') { 28 var endedSc = false; 29 } 30 if (typeof endedCc === 'undefined') { 31 var endedCc = false; 32 } 33 34 // "sc" in variables - mark for shortcode variable 27 35 function shortcodesInsert() { 28 let gatheredBlocks = document.querySelectorAll(' percentPointerClass');36 let gatheredBlocks = document.querySelectorAll('.percentPointerClass.scMark'); 29 37 let scBlockId = -1; 30 38 let scAdId = -1; … … 33 41 let okStates = ['done','refresh-wait','no-block','fetched']; 34 42 let scContainer; 43 let scRepeatFuncLaunch = false; 35 44 36 45 if (gatheredBlocks&&gatheredBlocks.length > 0) { 37 46 for (let i = 0; i < gatheredBlocks.length; i++) { 38 47 gatheredBlockChild = gatheredBlocks[i].children[0]; 39 scAdId = -1; 48 if (!gatheredBlockChild) { 49 continue; 50 } 51 scAdId = -3; 52 blockStatus = null; 53 scContainer = null; 40 54 41 55 scAdId = gatheredBlockChild.getAttribute('data-aid'); 42 56 blockStatus = gatheredBlockChild.getAttribute('data-state'); 43 57 44 if (blockStatus&&okStates.includes(blockStatus)&&scAdId > 0) { 45 scContainer = document.querySelector('.shortcodes[data-id='+scAdId+']'); 46 47 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 48 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 49 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 50 51 // scBlockId = gatheredBlockChild.getAttribute('data-id'); 52 } 53 } 58 if (scAdId > 0) { 59 if (blockStatus&&okStates.includes(blockStatus)) { 60 scContainer = gatheredBlocks[i].parentElement.querySelector('.shortcodes[data-id="'+scAdId+'"]'); 61 if (scContainer) { 62 if (blockStatus=='no-block') { 63 gatheredBlockChild.innerHTML = ''; 64 } else { 65 gatheredBlockChild.innerHTML = scContainer.innerHTML; 66 } 67 scContainer.remove(); 68 } 69 gatheredBlocks[i].classList.remove('scMark'); 70 } else { 71 scRepeatFuncLaunch = true; 72 } 73 } else if (scAdId == -3||scAdId === null) { 74 scRepeatFuncLaunch = true; 75 } 76 } 77 78 if (scRepeatFuncLaunch) { 79 // console.log('shortcodes-alert'); 80 setTimeout(function () { 81 shortcodesInsert(); 82 }, 100); 83 } 84 } else { 85 endedSc = true; 86 } 87 } 88 89 function clearUnsuitableCache(cuc_cou) { 90 let scAdId = -1; 91 let ccRepeat = false; 92 93 let gatheredBlocks = document.querySelectorAll('.percentPointerClass .content_rb'); 94 95 if (gatheredBlocks&&gatheredBlocks.length > 0) { 96 for (let i = 0; i < gatheredBlocks.length; i++) { 97 if (gatheredBlocks[i]['dataset']['aid']&&gatheredBlocks[i]['dataset']['aid'] < 0) { 98 if ((gatheredBlocks[i]['dataset']["state"]=='no-block')||(['done','fetched','refresh-wait'].includes(gatheredBlocks[i]['dataset']["state"]))) { 99 gatheredBlocks[i]['innerHTML'] = ''; 100 } else { 101 ccRepeat = true; 102 } 103 } else if (!gatheredBlocks[i]['dataset']['aid']) { 104 ccRepeat = true; 105 } 106 } 107 if (cuc_cou < 50) { 108 if (ccRepeat) { 109 // console.log('cache-alert:'+cuc_cou); 110 setTimeout(function () { 111 clearUnsuitableCache(cuc_cou+1); 112 }, 100); 113 } 114 } else { 115 endedCc = true; 116 } 117 } else { 118 endedCc = true; 54 119 } 55 120 } … … 392 457 window.addEventListener('load', function () { 393 458 if (repeat = true) { 459 // console.log('async-blocks-alert'); 394 460 setTimeout(function () { 395 461 asyncBlocksInsertingFunction(blockSettingArray, contentLength) … … 404 470 function asyncFunctionLauncher() { 405 471 if (window.jsInputerLaunch !== undefined&&jsInputerLaunch == 15) { 406 // if () {407 472 asyncBlocksInsertingFunction(blockSettingArray, contentLength); 408 // } 473 if (!endedSc) { 474 shortcodesInsert(); 475 } 476 if (!endedCc) { 477 // clearUnsuitableCache(0); 478 } 409 479 } else { 480 // console.log('wait-async-blocks-launch-alert'); 410 481 setTimeout(function () { 411 482 asyncFunctionLauncher(); 412 }, 50) 483 }, 50); 413 484 } 414 485 } … … 491 562 } 492 563 if (repeatSearch == 1) { 564 // console.log('insertings-alert'); 493 565 setTimeout(function () { 494 566 asyncInsertingsInsertingFunction(insertingsArray); 495 }, 50)567 }, 100) 496 568 } 497 569 } … … 501 573 asyncInsertingsInsertingFunction(insertingsArray); 502 574 } else { 575 // console.log('insertings-launch-alert'); 503 576 setTimeout(function () { 504 577 insertingsFunctionLaunch(); 505 }, 50)578 }, 100) 506 579 } 507 580 } -
realbig-media/trunk/readyAdGather.js
r2115464 r2117416 56 56 } 57 57 58 clearUnsuitableCache();58 // clearUnsuitableCache(); 59 59 60 60 blocks = JSON.stringify(blocks); 61 61 sendReadyBlocksNew(blocks); 62 }63 }64 65 function clearUnsuitableCache() {66 let gatheredBlocks = document.querySelectorAll('.percentPointerClass .content_rb');67 68 if (gatheredBlocks&&gatheredBlocks.length > 0) {69 for (let i = 0; i < gatheredBlocks; i++) {70 if ((gatheredBlocks[i]['dataset']["state"]=='no-block')||(['done','fetched'].includes(gatheredBlocks[i]['dataset']["state"])&&gatheredBlocks[i]['dataset']['aid'] < 0)) {71 gatheredBlocks[i]['innerHTML'] = '';72 }73 }74 62 } 75 63 } -
realbig-media/trunk/realbigForWP.php
r2115464 r2117416 14 14 Plugin name: Realbig Media 15 15 Description: Плагин для монетизации от RealBig.media 16 Version: 0.1.26. 6916 Version: 0.1.26.70 17 17 Author: Realbig Team 18 18 License: GPLv2 or later … … 153 153 $GLOBALS['realbigForWP_version'] = $pluginData['Version']; 154 154 } else { 155 $GLOBALS['realbigForWP_version'] = '0.1.26. 69';155 $GLOBALS['realbigForWP_version'] = '0.1.26.70'; 156 156 } 157 157 $lastSuccessVersionGatherer = get_option('realbig_status_gatherer_version'); … … 518 518 // $rotatorUrl = $prefix."://".$getDomain."/".$getRotator.".min.js"; 519 519 520 if (!empty($GLOBALS[' kill_rb'])&&$GLOBALS['kill_rb']==2) {520 if (!empty($GLOBALS['dev_mode'])&&!empty($GLOBALS['kill_rb'])&&$GLOBALS['kill_rb']==2) { 521 521 $rotatorUrl = "HTTPS://ex.ua"; 522 522 } else { … … 669 669 // } 670 670 671 //if (empty(apply_filters('wp_doing_cron', defined('DOING_CRON')&&DOING_CRON))&&!is_admin()) {671 if (empty(apply_filters('wp_doing_cron', defined('DOING_CRON')&&DOING_CRON))&&!is_admin()) { 672 672 // $penyok_stoparik = 0; 673 // 673 674 674 // function test_sc_oval_exec() { 675 675 // return '<div style="width: 100px; height: 20px; border: 1px solid black; background-color: #0033cc; border-radius: 30%;"></div>'; 676 676 // } 677 677 // add_shortcode('test_sc_oval', 'test_sc_oval_exec'); 678 // 679 //add_filter('the_content', 'RFWP_activateShortCodes', 502);680 //}678 679 add_filter('the_content', 'RFWP_activateShortCodes', 502); 680 } 681 681 /************* end blocks for text ************************************************************************************/ 682 682 /************* adding insertings in text *****************************************************/ … … 775 775 $rotatorResponce = wp_safe_remote_head($rotatorUrl, ['timeout' => 1]); 776 776 777 $cachedBlocks = ''; 778 // if (!is_array($rotatorResponce)||(!empty($rotatorResponce['response']['code'])&&$rotatorResponce['response']['code']!=200)) { 779 // ?><!--<script>console.log('using cache')</script>--><?php 780 $mobileCheck = RFWP_wp_is_mobile(); 781 $GLOBALS['rb_mobile_check'] = $mobileCheck; 782 if (!empty($mobileCheck)) { 783 $cachedBlocks = get_posts(['post_type' => 'rb_block_mobile_new','numberposts' => 100]); 784 } else { 785 $cachedBlocks = get_posts(['post_type' => 'rb_block_desktop_new','numberposts' => 100]); 786 } 777 $cachedBlocks = ''; 778 if (!is_array($rotatorResponce)||(!empty($rotatorResponce['response']['code'])&&$rotatorResponce['response']['code']!=200)) { 779 // ?><!--<script>console.log('using cache')</script>--><?php 780 $mobileCheck = RFWP_wp_is_mobile(); 781 $GLOBALS['rb_mobile_check'] = $mobileCheck; 782 if (!empty($mobileCheck)) { 783 $cachedBlocks = get_posts(['post_type' => 'rb_block_mobile_new','numberposts' => 100]); 784 } else { 785 $cachedBlocks = get_posts(['post_type' => 'rb_block_desktop_new','numberposts' => 100]); 786 } 787 788 // $cachedBlocks = null; 789 } 790 787 791 $shortcodesGathered = get_posts(['post_type' => 'rb_shortcodes','numberposts' => -1]); 788 789 792 $shortcodes = []; 790 793 foreach ($shortcodesGathered AS $k=>$item) { 791 if (empty($shortcodes[$item->post_excerpt])) {792 $shortcodes[$item->post_excerpt] = [];794 if (empty($shortcodes[$item->post_excerpt])) { 795 $shortcodes[$item->post_excerpt] = []; 793 796 } 794 $shortcodes[$item->post_excerpt][$item->post_title] = $item;797 $shortcodes[$item->post_excerpt][$item->post_title] = $item; 795 798 } 796 $shortcodes = null; 797 798 // $cachedBlocks = null; 799 // } 799 // $shortcodes = null; 800 800 801 801 if (!empty($content)) { … … 805 805 } 806 806 require_once (dirname(__FILE__)."/textEditing.php"); 807 // $content = RFWP_addIcons($fromDb, $content, 'content', null, null, $shortcodes); 807 808 $content = RFWP_addIcons($fromDb, $content, 'content', $cachedBlocks, null, $shortcodes); 808 809 … … 832 833 833 834 function RFWP_activateShortCodes($content) { 834 $penyok_stoparik = 0;835 // $penyok_stoparik = 0; 835 836 $content = do_shortcode($content); 836 837 return $content; -
realbig-media/trunk/textEditing.php
r2115464 r2117416 351 351 352 352 $fromDb[$k]->text = "<div class='percentPointerClass marked ".$shortcodesMark." coveredAd' data-id='".$item['id']."' style='clear:both;'>".$elementText."</div>".$shortcodesText; 353 $elementText = "<div class='percentPointerClass ' data-id='".$item['id']."' style='clear:both;'>".$elementText."</div>".$shortcodesText;353 $elementText = "<div class='percentPointerClass ".$shortcodesMark."' data-id='".$item['id']."' style='clear:both;'>".$elementText."</div>".$shortcodesText; 354 354 355 355 $editedContent = preg_replace( '~(<blockquote[^>]*?\>)~i', '<bq_mark_begin>$1', $editedContent, -1); … … 533 533 } 534 534 } 535 536 function RFWP_wp_cache_gathering($cachedBlocks) { 537 $scriptString = ''; 538 } 535 539 536 540 function RFWP_wp_is_mobile_old() {
Note: See TracChangeset
for help on using the changeset viewer.