Plugin Directory

Changeset 2974729


Ignore:
Timestamp:
10/04/2023 12:08:55 PM (2 years ago)
Author:
nativerentplugin
Message:

1.8.3

Location:
nativerent/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • nativerent/trunk/admin/class-settings.php

    r2964096 r2974729  
    548548                                    esc_html_e(
    549549                                        'Расположение блока влияет на эффективность рекламных кампаний. Рекламодатели выбирают сайты, у которых выше видимость блоков и CTR.',
     550                                        'nativerent'
     551                                    );
     552                                    ?>
     553                                    <br/>
     554                                    <?php
     555                                    esc_html_e(
     556                                        'В длинных статьях, где расстояние между блоками очень большое, автоматически могут быть встроены до двух дополнительных блоков, дублирующих верхний или нижний блок.',
    550557                                        'nativerent'
    551558                                    );
     
    658665                                        <?php
    659666                                        esc_html_e(
    660                                             'При каждой загрузке страницы отображается только один из форматов всплывающего блока',
     667                                            'При каждой загрузке страницы отображается только один из форматов всплывающего блока.',
    661668                                            'nativerent'
    662669                                        );
  • nativerent/trunk/admin/static/main.css

    r2964096 r2974729  
    128128    padding-top: 0px;
    129129    padding-left: 0px;
     130}
     131
     132div.NativeRentAdmin_description p {
     133    font-size: 1em;
    130134}
    131135
  • nativerent/trunk/includes/class-api.php

    r2964096 r2974729  
    359359        self::_response( array( 'result' => 1 ) );
    360360    }
     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    }
    361398}
  • nativerent/trunk/includes/class-maintenance.php

    r2964096 r2974729  
    5353                break;
    5454
     55            case 'updateAdUnitsConfig':
     56                API::update_ad_units_config();
     57                break;
     58
    5559            case 'vars':
    5660                API::vars();
  • nativerent/trunk/nativerent-bootstrap.php

    r2964096 r2974729  
    5353// Plugin version.
    5454if ( ! defined( 'NATIVERENT_PLUGIN_VERSION' ) ) {
    55     define( 'NATIVERENT_PLUGIN_VERSION', '1.8.1' );
     55    define( 'NATIVERENT_PLUGIN_VERSION', '1.8.3' );
    5656}
    5757
  • nativerent/trunk/nativerent.php

    r2964096 r2974729  
    66 * Plugin URI:        https://wordpress.org/plugins/nativerent/
    77 * Description:       Релевантная реклама для ваших читателей. Рекламодатели сервиса платят в 2-3 раза больше за 1 тыс. показов страниц, чем привычные рекламные сетки. Страница выкупается полностью, на ней размещается максимум четыре рекламных блока, которые выглядят нативно в стиле сайта.
    8  * Version:           1.8.1
     8 * Version:           1.8.3
    99 * Requires at least: 4.9
    1010 * Tested up to:      6.3
  • nativerent/trunk/readme.txt

    r2964096 r2974729  
    77Tested up to:      6.3
    88Requires PHP:      5.6.20
    9 Stable tag:        1.8.1
     9Stable tag:        1.8.3
    1010License:           GPLv2 or later
    1111License URI:       https://www.gnu.org/licenses/gpl-2.0.html
  • nativerent/trunk/static/content.js

    r2964096 r2974729  
    1919        error: function () {
    2020            console.error.apply(null, arguments)
    21         },
     21        }
    2222    }
    2323
     
    2727        }
    2828
    29         var contentBlock = window.document.querySelector('.nativerent-content-integration')
     29        var contentBlock = Array.from(window.document.querySelectorAll('.nativerent-content-integration')).pop()
    3030        if (contentBlock == null) {
    3131            return false
     
    3636        var articleWidth = article.clientWidth
    3737        var minDistance = (articleWidth < 500 ? 150 : 100)
     38        var paragraphs = article.querySelectorAll('p')
     39        var titles = article.querySelectorAll('h2')
    3840
    3941        for (var i = 0; i < window.NRentAdUnits.length; i++) {
     
    4143                var adUnit = window.NRentAdUnits[i]
    4244                var anchor = undefined
     45
    4346                switch (adUnit.autoSelector) {
    4447                    case 'firstParagraph': {
    45                         anchor = article.querySelector('.nativerent-content-integration ~ p')
     48                        anchor = paragraphs[0]
    4649                        break
    4750                    }
    4851                    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)]
    5153                        break
    5254                    }
    5355                    case 'lastParagraph': {
    54                         anchor = article.querySelector('.nativerent-content-integration ~ p:last-of-type')
     56                        anchor = paragraphs[paragraphs.length - 1]
    5557                        break
    5658                    }
    5759                    case 'firstTitle': {
    58                         anchor = article.querySelector('.nativerent-content-integration ~ h2:first-of-type')
     60                        anchor = titles[0]
    5961                        break
    6062                    }
    6163                    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)]
    6465                        break
    6566                    }
    6667                    case 'lastTitle': {
    67                         anchor = article.querySelector('.nativerent-content-integration ~ h2:last-of-type')
     68                        anchor = titles[titles.length - 1]
    6869                        break
    6970                    }
     
    9192                    }
    9293                }
     94                logger.debug("NRentPlugin: placement info", adUnit, anchor)
    9395
    9496                if (anchor == null || typeof anchor !== 'object') {
     
    127129                    (window.NtgbManager = window.NtgbManager || []).push({
    128130                        renderTo: adUnit.element.id,
    129                         position: 'ntgb',
     131                        position: 'ntgb'
    130132                    })
    131133
     
    133135                    if (i === 1 || i === 2) {
    134136                        var previousAdUnit = window.NRentAdUnits[i - 1]
     137                        console.log(window.NRentAdUnits)
    135138                        if (previousAdUnit.element === undefined) {
    136139                            logger.log(
     
    154157                        renderTo: adUnit.element.id,
    155158                        position: adUnit.type,
    156                         settings: adUnit.settings,
     159                        settings: adUnit.settings
    157160                    })
    158161                }
     
    160163            } catch (error) {
    161164                logger.error(error)
    162                 continue
    163165            }
    164166        }
     
    233235                logger.error(e)
    234236                logger.error('NRentPlugin: Failed to unblock element', blockedElement)
    235                 continue
    236237            }
    237238        }
     
    274275            verbose: verbose,
    275276            loadingTimeout: LOADING_TIMEOUT_MS,
    276             checkTimeout: checkTimeout,
     277            checkTimeout: checkTimeout
    277278        }
    278279    }
Note: See TracChangeset for help on using the changeset viewer.