Changeset 2991088
- Timestamp:
- 11/07/2023 05:57:05 PM (2 years ago)
- Location:
- ads-by-datafeedrcom
- Files:
-
- 2 added
- 2 deleted
- 14 edited
- 1 copied
-
assets/screenshot-1.jpg (modified) (1 prop) (previous)
-
assets/screenshot-2.jpg (modified) (1 prop) (previous)
-
assets/screenshot-3.jpg (modified) (1 prop) (previous)
-
assets/screenshot-4.jpg (modified) (1 prop) (previous)
-
assets/screenshot-5.jpg (modified) (1 prop) (previous)
-
assets/screenshot-6.jpg (modified) (1 prop) (previous)
-
assets/screenshot-7.jpg (modified) (1 prop) (previous)
-
assets/screenshot-8.jpg (modified) (1 prop) (previous)
-
tags/1.2.0 (copied) (copied from ads-by-datafeedrcom/trunk)
-
tags/1.2.0/dfads.php (modified) (3 diffs)
-
tags/1.2.0/inc/dfads.class.php (modified) (5 diffs)
-
tags/1.2.0/inc/functions.php (added)
-
tags/1.2.0/lib/metabox (deleted)
-
tags/1.2.0/readme.txt (modified) (3 diffs)
-
trunk/dfads.php (modified) (3 diffs)
-
trunk/inc/dfads.class.php (modified) (5 diffs)
-
trunk/inc/functions.php (added)
-
trunk/lib/metabox (deleted)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ads-by-datafeedrcom/assets/screenshot-1.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
ads-by-datafeedrcom/assets/screenshot-2.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
ads-by-datafeedrcom/assets/screenshot-3.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
ads-by-datafeedrcom/assets/screenshot-4.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
ads-by-datafeedrcom/assets/screenshot-5.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
ads-by-datafeedrcom/assets/screenshot-6.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
ads-by-datafeedrcom/assets/screenshot-7.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
ads-by-datafeedrcom/assets/screenshot-8.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
ads-by-datafeedrcom/tags/1.2.0/dfads.php
r2489876 r2991088 4 4 Plugin URI: https://www.datafeedr.com/ 5 5 Description: Randomly display any type of advertisement anywhere on your site. Add rotating banner ads, Google Adsense, videos, text links and more to your sidebar, widget areas, posts and pages. 6 Version: 1. 1.37 Tested up to: 5.76 Version: 1.2.0 7 Tested up to: 6.3.3-alpha 8 8 Author: datafeedr.com 9 9 Author URI: https://www.datafeedr.com/ 10 10 11 Copyright 202 1Ads by datafeedr.com11 Copyright 2023 Ads by datafeedr.com 12 12 13 13 This program is free software; you can redistribute it and/or modify … … 30 30 define( 'DFADS_CONTEXT', 'dfads' ); 31 31 define( 'DFADS_DOCS_URL', 'http://www.datafeedr.com/dfads/' ); 32 define( 'DFADS_VERSION', '1. 1.3' );32 define( 'DFADS_VERSION', '1.2.0' ); 33 33 34 34 /** 35 35 * Require necessary files. 36 36 */ 37 require_once( DFADS_PLUGIN_PATH . 'inc/functions.php' ); 37 38 require_once( DFADS_PLUGIN_PATH . 'inc/cpt.class.php' ); 38 39 require_once( DFADS_PLUGIN_PATH . 'inc/dfads.class.php' ); … … 66 67 */ 67 68 function dfads_ajax_load_ads(){ 68 echo dfads( $_REQUEST ); 69 70 $request = $_REQUEST; 71 72 $user_signature = trim( $request['signature'] ?? '' ); 73 74 if ( empty( $user_signature ) ) { 75 die( 'Missing signature' ); 76 } 77 78 unset( $request['signature'] ); 79 80 $allowed_params = array_keys( DFADS::get_default_params() ); 81 82 foreach ( $request as $k => $v ) { 83 84 // These are added here: DFADS::get_javascript(); 85 if ( in_array( $k, [ '_block_id', 'action' ] ) ) { 86 continue; 87 } 88 89 // Remove any other keys provided that aren't allowed. 90 if ( ! in_array( $k, $allowed_params, true ) ) { 91 unset( $request[ $k ] ); 92 } 93 } 94 95 $known_signature = dfads_hash_hmac( serialize( $request ) ); 96 97 if ( ! hash_equals( $known_signature, $user_signature ) ) { 98 die( 'Invalid signature' ); 99 } 100 101 echo dfads( $request ); 69 102 die; 70 103 } 104 71 105 add_action('wp_ajax_nopriv_dfads_ajax_load_ads', 'dfads_ajax_load_ads'); 72 106 add_action('wp_ajax_dfads_ajax_load_ads', 'dfads_ajax_load_ads'); -
ads-by-datafeedrcom/tags/1.2.0/inc/dfads.class.php
r2003040 r2991088 30 30 $this->update_impression_count( $ads ); 31 31 32 // Return user's own callback function .33 if ( function_exists( $this->args['callback_function'] ) ) {32 // Return user's own callback function if exists and is allowed. 33 if ( function_exists( $this->args['callback_function'] ) && in_array( $this->args['callback_function'], dfads_allowed_callback_functions(), true ) ) { 34 34 return call_user_func_array($this->args['callback_function'], array( $ads, $this->args )); 35 35 } … … 65 65 } 66 66 67 $defaults = array ( 68 'groups' => '-1', 69 'limit' => '-1', 70 'orderby' => 'random', 71 'order' => 'ASC', 72 'container_id' => '', 73 'container_html' => 'div', 74 'container_class' => '', 75 'ad_html' => 'div', 76 'ad_class' => '', 77 'callback_function' => '', 78 'return_javascript' => '', 79 ); 67 $defaults = $this->get_default_params(); 80 68 81 69 $this->args = wp_parse_args( $new_args, $defaults ); … … 277 265 $args['_block_id'] = $id; 278 266 $args['container_html'] = 'none'; // Set to 'none' so we don't display the container HTML twice. 267 $args['action'] = 'dfads_ajax_load_ads'; 268 269 // Sign the request. 270 $signature = dfads_hash_hmac( serialize( $args ) ); 271 $args['signature'] = $signature; 279 272 280 273 return ' … … 282 275 <script> 283 276 (function($) { 284 $("#' .$id .'").load("'.admin_url( 'admin-ajax.php?action=dfads_ajax_load_ads&'.http_build_query( $args ) ).'" );277 $("#' . $id . '").load("' . admin_url( 'admin-ajax.php?' . http_build_query( $args ) ) . '" ); 285 278 })( jQuery ); 286 279 </script> 287 280 <noscript>'.dfads( http_build_query( $args ) ).'</noscript> 288 281 '; 289 290 282 } 291 283 … … 361 353 return $randomString; 362 354 } 355 356 public static function get_default_params() { 357 return array( 358 'groups' => '-1', 359 'limit' => '-1', 360 'orderby' => 'random', 361 'order' => 'ASC', 362 'container_id' => '', 363 'container_html' => 'div', 364 'container_class' => '', 365 'ad_html' => 'div', 366 'ad_class' => '', 367 'callback_function' => '', 368 'return_javascript' => '', 369 ); 370 } 363 371 } -
ads-by-datafeedrcom/tags/1.2.0/readme.txt
r2489876 r2991088 4 4 Tags: ads, random ads, rotating ads, datafeedr, advertisements, advertising, banner ads, banners, adsense, google adsense 5 5 Requires at least: 3.5 6 Tested up to: 5.77 Stable tag: 1. 1.36 Tested up to: 6.3.3-alpha 7 Stable tag: 1.2.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 16 16 17 17 You have full control over how many ads get displayed as well as their sort order. 18 19 **Important** 20 21 As of version 1.2.0, all custom callback functions (ie. `callback_function`) need to be returned by the `dfads_allowed_callback_functions()` function. To do this, add your allowed custom callback functions like this: 22 23 ``` 24 add_filter( 'dfads_allowed_callback_functions', function ( array $functions ) { 25 $functions[] = 'my_first_custom_callback_function'; 26 $functions[] = 'my_second_custom_callback_function'; 27 28 return $functions; 29 } ); 30 ``` 18 31 19 32 [youtube http://www.youtube.com/watch?v=tPL8ND0nh4o] … … 100 113 == Changelog == 101 114 115 = 1.2.0 - 2023/11/07 = 116 * Added signed requests for ad blocks rendered via Javascript. 117 102 118 = 1.1.3 - 2020/03/08 = 103 119 * Updated jQuery for upgrade. -
ads-by-datafeedrcom/trunk/dfads.php
r2489876 r2991088 4 4 Plugin URI: https://www.datafeedr.com/ 5 5 Description: Randomly display any type of advertisement anywhere on your site. Add rotating banner ads, Google Adsense, videos, text links and more to your sidebar, widget areas, posts and pages. 6 Version: 1. 1.37 Tested up to: 5.76 Version: 1.2.0 7 Tested up to: 6.3.3-alpha 8 8 Author: datafeedr.com 9 9 Author URI: https://www.datafeedr.com/ 10 10 11 Copyright 202 1Ads by datafeedr.com11 Copyright 2023 Ads by datafeedr.com 12 12 13 13 This program is free software; you can redistribute it and/or modify … … 30 30 define( 'DFADS_CONTEXT', 'dfads' ); 31 31 define( 'DFADS_DOCS_URL', 'http://www.datafeedr.com/dfads/' ); 32 define( 'DFADS_VERSION', '1. 1.3' );32 define( 'DFADS_VERSION', '1.2.0' ); 33 33 34 34 /** 35 35 * Require necessary files. 36 36 */ 37 require_once( DFADS_PLUGIN_PATH . 'inc/functions.php' ); 37 38 require_once( DFADS_PLUGIN_PATH . 'inc/cpt.class.php' ); 38 39 require_once( DFADS_PLUGIN_PATH . 'inc/dfads.class.php' ); … … 66 67 */ 67 68 function dfads_ajax_load_ads(){ 68 echo dfads( $_REQUEST ); 69 70 $request = $_REQUEST; 71 72 $user_signature = trim( $request['signature'] ?? '' ); 73 74 if ( empty( $user_signature ) ) { 75 die( 'Missing signature' ); 76 } 77 78 unset( $request['signature'] ); 79 80 $allowed_params = array_keys( DFADS::get_default_params() ); 81 82 foreach ( $request as $k => $v ) { 83 84 // These are added here: DFADS::get_javascript(); 85 if ( in_array( $k, [ '_block_id', 'action' ] ) ) { 86 continue; 87 } 88 89 // Remove any other keys provided that aren't allowed. 90 if ( ! in_array( $k, $allowed_params, true ) ) { 91 unset( $request[ $k ] ); 92 } 93 } 94 95 $known_signature = dfads_hash_hmac( serialize( $request ) ); 96 97 if ( ! hash_equals( $known_signature, $user_signature ) ) { 98 die( 'Invalid signature' ); 99 } 100 101 echo dfads( $request ); 69 102 die; 70 103 } 104 71 105 add_action('wp_ajax_nopriv_dfads_ajax_load_ads', 'dfads_ajax_load_ads'); 72 106 add_action('wp_ajax_dfads_ajax_load_ads', 'dfads_ajax_load_ads'); -
ads-by-datafeedrcom/trunk/inc/dfads.class.php
r2003040 r2991088 30 30 $this->update_impression_count( $ads ); 31 31 32 // Return user's own callback function .33 if ( function_exists( $this->args['callback_function'] ) ) {32 // Return user's own callback function if exists and is allowed. 33 if ( function_exists( $this->args['callback_function'] ) && in_array( $this->args['callback_function'], dfads_allowed_callback_functions(), true ) ) { 34 34 return call_user_func_array($this->args['callback_function'], array( $ads, $this->args )); 35 35 } … … 65 65 } 66 66 67 $defaults = array ( 68 'groups' => '-1', 69 'limit' => '-1', 70 'orderby' => 'random', 71 'order' => 'ASC', 72 'container_id' => '', 73 'container_html' => 'div', 74 'container_class' => '', 75 'ad_html' => 'div', 76 'ad_class' => '', 77 'callback_function' => '', 78 'return_javascript' => '', 79 ); 67 $defaults = $this->get_default_params(); 80 68 81 69 $this->args = wp_parse_args( $new_args, $defaults ); … … 277 265 $args['_block_id'] = $id; 278 266 $args['container_html'] = 'none'; // Set to 'none' so we don't display the container HTML twice. 267 $args['action'] = 'dfads_ajax_load_ads'; 268 269 // Sign the request. 270 $signature = dfads_hash_hmac( serialize( $args ) ); 271 $args['signature'] = $signature; 279 272 280 273 return ' … … 282 275 <script> 283 276 (function($) { 284 $("#' .$id .'").load("'.admin_url( 'admin-ajax.php?action=dfads_ajax_load_ads&'.http_build_query( $args ) ).'" );277 $("#' . $id . '").load("' . admin_url( 'admin-ajax.php?' . http_build_query( $args ) ) . '" ); 285 278 })( jQuery ); 286 279 </script> 287 280 <noscript>'.dfads( http_build_query( $args ) ).'</noscript> 288 281 '; 289 290 282 } 291 283 … … 361 353 return $randomString; 362 354 } 355 356 public static function get_default_params() { 357 return array( 358 'groups' => '-1', 359 'limit' => '-1', 360 'orderby' => 'random', 361 'order' => 'ASC', 362 'container_id' => '', 363 'container_html' => 'div', 364 'container_class' => '', 365 'ad_html' => 'div', 366 'ad_class' => '', 367 'callback_function' => '', 368 'return_javascript' => '', 369 ); 370 } 363 371 } -
ads-by-datafeedrcom/trunk/readme.txt
r2489876 r2991088 4 4 Tags: ads, random ads, rotating ads, datafeedr, advertisements, advertising, banner ads, banners, adsense, google adsense 5 5 Requires at least: 3.5 6 Tested up to: 5.77 Stable tag: 1. 1.36 Tested up to: 6.3.3-alpha 7 Stable tag: 1.2.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 16 16 17 17 You have full control over how many ads get displayed as well as their sort order. 18 19 **Important** 20 21 As of version 1.2.0, all custom callback functions (ie. `callback_function`) need to be returned by the `dfads_allowed_callback_functions()` function. To do this, add your allowed custom callback functions like this: 22 23 ``` 24 add_filter( 'dfads_allowed_callback_functions', function ( array $functions ) { 25 $functions[] = 'my_first_custom_callback_function'; 26 $functions[] = 'my_second_custom_callback_function'; 27 28 return $functions; 29 } ); 30 ``` 18 31 19 32 [youtube http://www.youtube.com/watch?v=tPL8ND0nh4o] … … 100 113 == Changelog == 101 114 115 = 1.2.0 - 2023/11/07 = 116 * Added signed requests for ad blocks rendered via Javascript. 117 102 118 = 1.1.3 - 2020/03/08 = 103 119 * Updated jQuery for upgrade.
Note: See TracChangeset
for help on using the changeset viewer.