Changeset 2974729
- Timestamp:
- 10/04/2023 12:08:55 PM (2 years ago)
- Location:
- nativerent/trunk
- Files:
-
- 8 edited
-
admin/class-settings.php (modified) (2 diffs)
-
admin/static/main.css (modified) (1 diff)
-
includes/class-api.php (modified) (1 diff)
-
includes/class-maintenance.php (modified) (1 diff)
-
nativerent-bootstrap.php (modified) (1 diff)
-
nativerent.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
static/content.js (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nativerent/trunk/admin/class-settings.php
r2964096 r2974729 548 548 esc_html_e( 549 549 'Расположение блока влияет на эффективность рекламных кампаний. Рекламодатели выбирают сайты, у которых выше видимость блоков и CTR.', 550 'nativerent' 551 ); 552 ?> 553 <br/> 554 <?php 555 esc_html_e( 556 'В длинных статьях, где расстояние между блоками очень большое, автоматически могут быть встроены до двух дополнительных блоков, дублирующих верхний или нижний блок.', 550 557 'nativerent' 551 558 ); … … 658 665 <?php 659 666 esc_html_e( 660 'При каждой загрузке страницы отображается только один из форматов всплывающего блока ',667 'При каждой загрузке страницы отображается только один из форматов всплывающего блока.', 661 668 'nativerent' 662 669 ); -
nativerent/trunk/admin/static/main.css
r2964096 r2974729 128 128 padding-top: 0px; 129 129 padding-left: 0px; 130 } 131 132 div.NativeRentAdmin_description p { 133 font-size: 1em; 130 134 } 131 135 -
nativerent/trunk/includes/class-api.php
r2964096 r2974729 359 359 self::_response( array( 'result' => 1 ) ); 360 360 } 361 362 /** 363 * Updating some adUnitsConfig props. 364 * 365 * @return void 366 * @api POST updateAdUnitsConfig 367 */ 368 public static function update_ad_units_config() { 369 $request = self::_get_request(); 370 if ( ! self::is_valid_site_id( $request ) ) { 371 self::_response( array( 'result' => 0 ) ); 372 373 return; 374 } 375 376 $payload = isset( $request['adUnitsConfig'] ) ? $request['adUnitsConfig'] : array(); 377 if ( ! empty( $payload ) ) { 378 // Safe patching config. 379 $fillable_props = array( 'insert', 'autoSelector', 'customSelector' ); 380 $config = Options::get_adunits_config(); 381 foreach ( $config as $unit => $opts ) { 382 if ( 'popupTeaser' === $unit ) { 383 continue; 384 } 385 foreach ( $fillable_props as $prop ) { 386 if ( array_key_exists( $unit, $payload ) && array_key_exists( $prop, $payload[ $unit ] ) ) { 387 $config[ $unit ][ $prop ] = sanitize_text_field( wp_unslash( $payload[ $unit ][ $prop ] ) ); 388 } 389 } 390 } 391 if ( Options::update_adunits_config( $config ) ) { 392 Cache_Actions::need_to_clear_cache(); 393 }; 394 } 395 396 self::_response( array( 'result' => 1 ) ); 397 } 361 398 } -
nativerent/trunk/includes/class-maintenance.php
r2964096 r2974729 53 53 break; 54 54 55 case 'updateAdUnitsConfig': 56 API::update_ad_units_config(); 57 break; 58 55 59 case 'vars': 56 60 API::vars(); -
nativerent/trunk/nativerent-bootstrap.php
r2964096 r2974729 53 53 // Plugin version. 54 54 if ( ! defined( 'NATIVERENT_PLUGIN_VERSION' ) ) { 55 define( 'NATIVERENT_PLUGIN_VERSION', '1.8. 1' );55 define( 'NATIVERENT_PLUGIN_VERSION', '1.8.3' ); 56 56 } 57 57 -
nativerent/trunk/nativerent.php
r2964096 r2974729 6 6 * Plugin URI: https://wordpress.org/plugins/nativerent/ 7 7 * Description: Релевантная реклама для ваших читателей. Рекламодатели сервиса платят в 2-3 раза больше за 1 тыс. показов страниц, чем привычные рекламные сетки. Страница выкупается полностью, на ней размещается максимум четыре рекламных блока, которые выглядят нативно в стиле сайта. 8 * Version: 1.8. 18 * Version: 1.8.3 9 9 * Requires at least: 4.9 10 10 * Tested up to: 6.3 -
nativerent/trunk/readme.txt
r2964096 r2974729 7 7 Tested up to: 6.3 8 8 Requires PHP: 5.6.20 9 Stable tag: 1.8. 19 Stable tag: 1.8.3 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
nativerent/trunk/static/content.js
r2964096 r2974729 19 19 error: function () { 20 20 console.error.apply(null, arguments) 21 } ,21 } 22 22 } 23 23 … … 27 27 } 28 28 29 var contentBlock = window.document.querySelector('.nativerent-content-integration')29 var contentBlock = Array.from(window.document.querySelectorAll('.nativerent-content-integration')).pop() 30 30 if (contentBlock == null) { 31 31 return false … … 36 36 var articleWidth = article.clientWidth 37 37 var minDistance = (articleWidth < 500 ? 150 : 100) 38 var paragraphs = article.querySelectorAll('p') 39 var titles = article.querySelectorAll('h2') 38 40 39 41 for (var i = 0; i < window.NRentAdUnits.length; i++) { … … 41 43 var adUnit = window.NRentAdUnits[i] 42 44 var anchor = undefined 45 43 46 switch (adUnit.autoSelector) { 44 47 case 'firstParagraph': { 45 anchor = article.querySelector('.nativerent-content-integration ~ p')48 anchor = paragraphs[0] 46 49 break 47 50 } 48 51 case 'middleParagraph': { 49 var p = article.querySelectorAll('.nativerent-content-integration ~ p') 50 anchor = p[Math.floor(p.length / 2)] 52 anchor = paragraphs[Math.floor(paragraphs.length / 2)] 51 53 break 52 54 } 53 55 case 'lastParagraph': { 54 anchor = article.querySelector('.nativerent-content-integration ~ p:last-of-type')56 anchor = paragraphs[paragraphs.length - 1] 55 57 break 56 58 } 57 59 case 'firstTitle': { 58 anchor = article.querySelector('.nativerent-content-integration ~ h2:first-of-type')60 anchor = titles[0] 59 61 break 60 62 } 61 63 case 'middleTitle': { 62 var h2 = article.querySelectorAll('.nativerent-content-integration ~ h2') 63 anchor = h2[Math.floor(h2.length / 2)] 64 anchor = titles[Math.floor(titles.length / 2)] 64 65 break 65 66 } 66 67 case 'lastTitle': { 67 anchor = article.querySelector('.nativerent-content-integration ~ h2:last-of-type')68 anchor = titles[titles.length - 1] 68 69 break 69 70 } … … 91 92 } 92 93 } 94 logger.debug("NRentPlugin: placement info", adUnit, anchor) 93 95 94 96 if (anchor == null || typeof anchor !== 'object') { … … 127 129 (window.NtgbManager = window.NtgbManager || []).push({ 128 130 renderTo: adUnit.element.id, 129 position: 'ntgb' ,131 position: 'ntgb' 130 132 }) 131 133 … … 133 135 if (i === 1 || i === 2) { 134 136 var previousAdUnit = window.NRentAdUnits[i - 1] 137 console.log(window.NRentAdUnits) 135 138 if (previousAdUnit.element === undefined) { 136 139 logger.log( … … 154 157 renderTo: adUnit.element.id, 155 158 position: adUnit.type, 156 settings: adUnit.settings ,159 settings: adUnit.settings 157 160 }) 158 161 } … … 160 163 } catch (error) { 161 164 logger.error(error) 162 continue163 165 } 164 166 } … … 233 235 logger.error(e) 234 236 logger.error('NRentPlugin: Failed to unblock element', blockedElement) 235 continue236 237 } 237 238 } … … 274 275 verbose: verbose, 275 276 loadingTimeout: LOADING_TIMEOUT_MS, 276 checkTimeout: checkTimeout ,277 checkTimeout: checkTimeout 277 278 } 278 279 }
Note: See TracChangeset
for help on using the changeset viewer.