Skip to content

Commit ce1f83d

Browse files
committed
Merge branch 'develop' into trunk
2 parents 15c85f3 + 899de54 commit ce1f83d

18 files changed

Lines changed: 214 additions & 54 deletions

File tree

.github/workflows/lint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- trunk
8+
pull_request:
9+
branches:
10+
- develop
11+
12+
jobs:
13+
eslint:
14+
name: eslint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: install node v12
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: 12
22+
- name: npm install
23+
run: npm install
24+
- name: eslint
25+
uses: icrawl/action-eslint@v1
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
with:
29+
custom-glob: assets
30+
phpcs:
31+
name: phpcs
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
- name: Set PHP version
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: '7.3'
40+
coverage: none
41+
tools: composer:v1
42+
- name: composer install
43+
run: composer install
44+
- name: PHPCS check
45+
uses: chekalsky/phpcs-action@v1
46+
with:
47+
phpcs_bin_path: './vendor/bin/phpcs .'

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
push:
7+
branches:
8+
- develop
9+
- trunk
10+
pull_request:
11+
branches:
12+
- develop
13+
14+
jobs:
15+
phpunit:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- uses: getong/mariadb-action@v1.1
23+
24+
- name: Set PHP version
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: '7.3'
28+
coverage: none
29+
tools: composer:v1
30+
31+
- name: Install dependencies
32+
run: composer install
33+
34+
- name: PHPUnit
35+
run: './vendor/bin/phpunit'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ Session.vim
2424
# Windows
2525
Thumbs.db
2626
Desktop.ini
27+
28+
*.cache

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file, per [the Ke
44

55
## [Unreleased] - TBD
66

7+
## [1.0.3] - 2021-03-09
8+
### Added
9+
- Custom callback and `avc_refresh_callback` filter to be used when an ad slot is ready for refresh (props [@darylldoyle](https://github.com/darylldoyle) via [#34](https://github.com/10up/Ad-Refresh-Control/pull/34)).
10+
- Linting and testing GitHub Actions (props [@jeffpaul](https://github.com/jeffpaul), [@dinhtungdu](https://github.com/dinhtungdu) via [#24](https://github.com/10up/Ad-Refresh-Control/pull/24)).
11+
12+
### Changed
13+
- Bump WordPress version "tested up to" 5.7 (props [@darylldoyle](https://github.com/darylldoyle) via [#32](https://github.com/10up/Ad-Refresh-Control/issues/32)).
14+
15+
### Fixed
16+
- Issue within `viewabilityHandler()` where it was calling `initializeSlotData()` and passing the individual slot instead of the expected event (props [@darylldoyle](https://github.com/darylldoyle) via [#34](https://github.com/10up/Ad-Refresh-Control/pull/34)).
17+
18+
### Security
19+
- Bump `ini` from 1.3.5 to 1.3.8 (props [@dependabot](https://github.com/apps/dependabot) via [#33](https://github.com/10up/Ad-Refresh-Control/pull/33)).
20+
721
## [1.0.2] - 2020-11-17
822
### Added
923
- Support for additional exclusion rules - line item ID, ad unit size, and ad slot ID (props [@elliott-stocks](https://github.com/elliott-stocks), [@davidrgreen](https://github.com/davidrgreen) via [#22](https://github.com/10up/Ad-Refresh-Control/pull/22)).
@@ -36,6 +50,7 @@ All notable changes to this project will be documented in this file, per [the Ke
3650
- Initial public release! 🎉
3751

3852
[Unreleased]: https://github.com/10up/Ad-Refresh-Control/compare/trunk...develop
53+
[1.0.3]: https://github.com/10up/Ad-Refresh-Control/compare/1.0.2...1.0.3
3954
[1.0.2]: https://github.com/10up/Ad-Refresh-Control/compare/1.0.1...1.0.2
4055
[1.0.1]: https://github.com/10up/Ad-Refresh-Control/compare/v1.0.0...1.0.1
4156
[1.0.0]: https://github.com/10up/Ad-Refresh-Control/releases/tag/v1.0.0

CONTRIBUTING.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ The `develop` branch is the development branch which means it contains the next
3737
1. Merge: Make a non-fast-forward merge from your release branch to `develop` (or merge the pull request), then do the same for `develop` into `trunk` (`git checkout trunk && git merge --no-ff develop`). `trunk` contains the stable development version.
3838
1. Test: While still on the `trunk` branch, test for functionality locally.
3939
1. Push: Push your `trunk` branch to GitHub (e.g. `git push origin trunk`).
40-
1. Release: Create a [new release](/releases/new), naming the tag and the release with the new version number, and targeting the `trunk` branch. Paste the changelog from `CHANGELOG.md` into the body of the release and include a link to the closed issues on the milestone (e.g. `https://github.com/10up/ad-refresh-control/milestone/#?closed=1`).
41-
1. SVN: Wait for the [GitHub Action](/actions) to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes.
40+
1. Release: Create a [new release](https://github.com/10up/Ad-Refresh-Control/releases/new), naming the tag and the release with the new version number, and targeting the `trunk` branch. Paste the changelog from `CHANGELOG.md` into the body of the release and include a link to the closed issues on the milestone (e.g. `https://github.com/10up/ad-refresh-control/milestone/#?closed=1`).
41+
1. SVN: Wait for the [GitHub Action](https://github.com/10up/Ad-Refresh-Control/actions) to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes.
4242
1. Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/ad-refresh-control/. This may take a few minutes.
43-
1. Close milestone: Edit the [X.Y.Z milestone](/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description` field), then close the milestone.
44-
1. Punt incomplete items: If any open issues or PRs which were milestoned for `X.Y.Z` do not make it into the release, update their milestone to `X.Y.Z+1`, `X.Y+1.0`, `X+1.0.0` or `Future Release`.
45-
1. Version bump (again): In the `develop` branch (`cd ../ && git checkout develop`) bump the version number in `ad-refresh-control.php`, `package.json`, and `readme.txt` to `X.Y.(Z+1)-dev`. It's okay if the next release might be a different version number; that change can be handled right before release in the first step, as might also be the case with `@since` annotations.
43+
1. Close milestone: Edit the [milestone](https://github.com/10up/Ad-Refresh-Control/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description` field), then close the milestone.
44+
1. Punt incomplete items: If any open issues or PRs which were milestoned for `X.Y.Z` do not make it into the release, update their milestone to `X.Y.Z+1`, `X.Y+1.0`, `X+1.0.0` or `Future Release`.

CREDITS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The following individuals are responsible for curating the list of issues, respo
1010

1111
Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.
1212

13-
[10up (@10up)](https://github.com/10up), [Gary Thayer (@gthayer)](https://github.com/gthayer), [David Green (@davidrgreen)](https://github.com/davidrgreen), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Jackie Kjome (@JackieKjome)](https://github.com/JackieKjome), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabotg), [Elliott Stocks (@elliott-stocks)](https://github.com/elliott-stocks), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen).
13+
[10up (@10up)](https://github.com/10up), [Gary Thayer (@gthayer)](https://github.com/gthayer), [David Green (@davidrgreen)](https://github.com/davidrgreen), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Jackie Kjome (@JackieKjome)](https://github.com/JackieKjome), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabotg), [Elliott Stocks (@elliott-stocks)](https://github.com/elliott-stocks), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Daryll Doyle (@darylldoyle)](https://github.com/darylldoyle), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu).
1414

1515
## Libraries
1616

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Enable Active View refresh for Google Ad Manager ads without needing to modify any code.
44
5-
[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Release Version](https://img.shields.io/github/release/10up/ad-refresh-control.svg)](https://github.com/10up/ad-refresh-control/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v5.5.1%20tested-success.svg) [![GPLv2 License](https://img.shields.io/github/license/10up/ad-refresh-control.svg)](https://github.com/10up/ad-refresh-control/blob/develop/LICENSE.md)
5+
[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Release Version](https://img.shields.io/github/release/10up/ad-refresh-control.svg)](https://github.com/10up/ad-refresh-control/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v5.7%20tested-success.svg) [![GPLv2 License](https://img.shields.io/github/license/10up/ad-refresh-control.svg)](https://github.com/10up/ad-refresh-control/blob/develop/LICENSE.md)
66

77
## Background & Purpose
88

ad-refresh-control.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Ad Refresh Control
44
* Plugin URI: https://github.com/10up/Ad-Refresh-Control
55
* Description: Enable Active View refresh for Google Ad Manager ads without needing to modify any code.
6-
* Version: 1.0.2
6+
* Version: 1.0.3
77
* Requires at least: 4.9
88
* Requires PHP: 7.0
99
* Author: 10up
@@ -17,7 +17,7 @@
1717
*/
1818

1919
// Useful global constants.
20-
define( 'AD_REFRESH_CONTROL_VERSION', '1.0.2' );
20+
define( 'AD_REFRESH_CONTROL_VERSION', '1.0.3' );
2121
define( 'AD_REFRESH_CONTROL_URL', plugin_dir_url( __FILE__ ) );
2222
define( 'AD_REFRESH_CONTROL_PATH', plugin_dir_path( __FILE__ ) );
2323
define( 'AD_REFRESH_CONTROL_INC', AD_REFRESH_CONTROL_PATH . 'includes/' );

assets/js/frontend/components/gpt-active-view-refresh.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const sizesToExclude = window.AdRefreshControl.sizesToExclude || []; // Do not t
66
const slotIdsToExclude = window.AdRefreshControl.slotIdsToExclude || []; // Do not trigger active view refresh for the given slot IDs.
77
const refreshInterval = ( window.AdRefreshControl.refreshInterval || 30 ) * 1000;
88
const maximumRefreshes = window.AdRefreshControl.maximumRefreshes || 10;
9+
const refreshCallback = window.AdRefreshControl.refreshCallback || false;
910
let browserFocus = true;
1011
const adsData = [];
1112

@@ -36,7 +37,11 @@ const checkForAdsReadyToRefresh = () => {
3637
}
3738

3839
if ( 0 < slotsToRefresh.length ) {
39-
googletag.pubads().refresh( slotsToRefresh );
40+
if ( refreshCallback && 'function' === typeof window[refreshCallback] ) {
41+
window[refreshCallback]( slotsToRefresh );
42+
} else {
43+
googletag.pubads().refresh( slotsToRefresh );
44+
}
4045
}
4146

4247
setTimeout( checkForAdsReadyToRefresh, 500 );
@@ -73,7 +78,7 @@ const viewabilityHandler = ( event ) => {
7378

7479
const slotID = event.slot.getSlotElementId();
7580
if ( 'undefined' === typeof adsData[ slotID ] ) {
76-
initializeSlotData( event.slot );
81+
initializeSlotData( event );
7782
}
7883

7984
adsData[ slotID ].viewability = inViewPercentage;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"require-dev": {
2929
"phpunit/phpunit": "^8.2",
30-
"10up/wp_mock": "dev-master",
30+
"10up/wp_mock": "0.4.2",
3131
"10up/phpcs-composer": "dev-master"
3232
},
3333
"scripts": {

0 commit comments

Comments
 (0)