Changeset 2983037
- Timestamp:
- 10/24/2023 11:28:55 AM (2 years ago)
- Location:
- nativerent/trunk
- Files:
-
- 7 edited
-
includes/class-apicore.php (modified) (1 diff)
-
includes/class-maintenance.php (modified) (3 diffs)
-
includes/class-optimization-handler.php (modified) (3 diffs)
-
nativerent-bootstrap.php (modified) (2 diffs)
-
nativerent.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
static/content.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nativerent/trunk/includes/class-apicore.php
r2964096 r2983037 59 59 $method = ( isset( $options['requestMethod'] ) ) ? $options['requestMethod'] : 'POST'; 60 60 $args = array(); 61 $headers = array(); 61 $headers = array( 62 'Connection' => 'keep-alive', 63 ); 62 64 63 65 $request_url = self::get_api_host() . $path . $command; -
nativerent/trunk/includes/class-maintenance.php
r2974729 r2983037 13 13 14 14 use const INPUT_GET; 15 use const NATIVERENT_API_V1_PARAM;16 15 17 16 defined( 'ABSPATH' ) || exit; … … 21 20 */ 22 21 class Maintenance { 22 const API_PARAM = 'NativeRentAPIv1'; 23 23 24 24 /** … … 26 26 */ 27 27 public static function init() { 28 // API handlers.29 if ( is set( $_GET[ NATIVERENT_API_V1_PARAM ]) ) {30 self::handle_v1_api( filter_input( INPUT_GET, NATIVERENT_API_V1_PARAM ));28 $action = self::get_action_name(); 29 if ( is_string( $action ) ) { 30 self::handle_v1_api( $action ); 31 31 } 32 } 33 34 /** 35 * Getting API method name. 36 * 37 * @return string|null 38 */ 39 private static function get_action_name() { 40 // Getting API method by GET param value. 41 if ( isset( $_GET[ self::API_PARAM ] ) ) { 42 $action = filter_input( INPUT_GET, self::API_PARAM ); 43 if ( is_string( $action ) ) { 44 return $action; 45 } 46 } 47 48 // Trying to get a method from the HTTP header. 49 $header_name = strtoupper( 'HTTP_X_' . self::API_PARAM ); 50 if ( isset( $_SERVER[ $header_name ] ) ) { 51 $action = filter_input( INPUT_SERVER, $header_name ); 52 if ( is_string( $action ) ) { 53 return $action; 54 } 55 } 56 57 return null; 32 58 } 33 59 -
nativerent/trunk/includes/class-optimization-handler.php
r2964096 r2983037 20 20 * @var array 21 21 */ 22 public static $scripts_patterns = array( 23 'nativerent', 24 'window.NRent(AdUnits|Counter|Plugin)', 25 'nativerent-integration-head', 26 ); 22 public static $scripts_patterns 23 = array( 24 'nativerent', 25 'window.NRent(AdUnits|Counter|Plugin)', 26 'nativerent-integration-head', 27 ); 27 28 28 29 /** … … 32 33 // WP Rocket. 33 34 add_filter( 'rocket_exclude_js', array( __CLASS__, 'exclude_js' ) ); 34 add_filter( 'rocket_excluded_inline_js_content', array( __CLASS__, 'exclude_inline_js_wp_rocket' ) );35 35 add_filter( 'rocket_exclude_defer_js', array( __CLASS__, 'exclude_js' ) ); 36 36 add_filter( 'rocket_delay_js_exclusions', array( __CLASS__, 'exclude_js' ) ); 37 add_filter( 'rocket_excluded_inline_js_content', array( __CLASS__, 'exclude_js' ) ); 37 38 38 39 // LiteSpeed Cache. … … 45 46 * Excludes JS files from minification/combine 46 47 * 47 * @param array $scripts Array of JS patterns to be excluded. 48 * @return array 48 * @param string[]|null $scripts Array of JS patterns to be excluded. 49 * 50 * @return string[] 49 51 */ 50 52 public static function exclude_js( $scripts = array() ) { 51 return array_merge( $scripts, self::$scripts_patterns ); 53 return ! is_array( $scripts ) 54 ? self::$scripts_patterns 55 : array_merge( $scripts, self::$scripts_patterns ); 52 56 } 53 54 57 } -
nativerent/trunk/nativerent-bootstrap.php
r2974729 r2983037 31 31 define( 'NATIVERENT_PLUGIN_MAX_PRIORITY', PHP_INT_MAX ); 32 32 } 33 // API param names.34 if ( ! defined( 'NATIVERENT_API_V1_PARAM' ) ) {35 define( 'NATIVERENT_API_V1_PARAM', 'NativeRentAPIv1' );36 }37 33 // Get param name for updating expired auth data. 38 34 if ( ! defined( 'NATIVERENT_PARAM_AUTH' ) ) { 39 35 define( 'NATIVERENT_PARAM_AUTH', '_nrpluginauth' ); 40 }41 // Interval in seconds for running self check cron job.42 if ( ! defined( 'NATIVERENT_SELF_CHECK_INTERVAL' ) ) {43 $_nsci_sec = getenv( 'NATIVERENT_SELF_CHECK_INTERVAL' );44 define( 'NATIVERENT_SELF_CHECK_INTERVAL', is_numeric( $_nsci_sec ) ? $_nsci_sec : ( 3 * 60 * 60 ) );45 unset( $_nsci_sec );46 36 } 47 37 // Interval in seconds for running auto-update monetizations. … … 53 43 // Plugin version. 54 44 if ( ! defined( 'NATIVERENT_PLUGIN_VERSION' ) ) { 55 define( 'NATIVERENT_PLUGIN_VERSION', '1.8. 3' );45 define( 'NATIVERENT_PLUGIN_VERSION', '1.8.4' ); 56 46 } 57 47 -
nativerent/trunk/nativerent.php
r2974729 r2983037 6 6 * Plugin URI: https://wordpress.org/plugins/nativerent/ 7 7 * Description: Релевантная реклама для ваших читателей. Рекламодатели сервиса платят в 2-3 раза больше за 1 тыс. показов страниц, чем привычные рекламные сетки. Страница выкупается полностью, на ней размещается максимум четыре рекламных блока, которые выглядят нативно в стиле сайта. 8 * Version: 1.8. 38 * Version: 1.8.4 9 9 * Requires at least: 4.9 10 * Tested up to: 6.3 10 * Tested up to: 6.3.2 11 11 * Requires PHP: 5.6.20 12 12 * Author: Native Rent -
nativerent/trunk/readme.txt
r2974729 r2983037 5 5 Plugin URI: https://wordpress.org/plugins/nativerent/ 6 6 Requires at least: 4.9 7 Tested up to: 6.3 7 Tested up to: 6.3.2 8 8 Requires PHP: 5.6.20 9 Stable tag: 1.8. 39 Stable tag: 1.8.4 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
nativerent/trunk/static/content.js
r2974729 r2983037 22 22 } 23 23 24 function calcOffsetTop(el) { 25 return (el.getBoundingClientRect().top + window.pageYOffset) 26 } 27 24 28 function contentIntegration() { 25 29 if (window.NRentContentIntegrated === true) { … … 43 47 var adUnit = window.NRentAdUnits[i] 44 48 var anchor = undefined 49 var dataPlacementAttr = true 45 50 46 51 switch (adUnit.autoSelector) { … … 71 76 case 'body': { 72 77 anchor = window.document.body 78 dataPlacementAttr = false 73 79 break 74 80 } 75 81 case '': { 76 82 try { 83 dataPlacementAttr = false 77 84 var customSelector = decodeURIComponent(adUnit.selector) 78 85 if (!/^body[^a-z0-9]/i.test(customSelector)) { … … 106 113 (window.NRentCounter.options || window.NRentCounter || {id: 'undefined'}).id + '-' + i 107 114 115 if (dataPlacementAttr) { 116 adUnit.element.setAttribute( 117 'data-placement', 118 (typeof adUnit.insert === 'string' && adUnit.insert !== '' ? adUnit.insert : 'after') 119 ) 120 } 121 108 122 switch (adUnit.insert) { 109 123 case 'after': { … … 144 158 } 145 159 146 var distance = ( adUnit.element.offsetTop - previousAdUnit.element.offsetTop)160 var distance = (calcOffsetTop(adUnit.element) - calcOffsetTop(previousAdUnit.element)) 147 161 if (window.document.body.clientHeight > minDistance && distance < minDistance) { 148 162 logger.log(
Note: See TracChangeset
for help on using the changeset viewer.