diff --git a/.github/workflows/changelog.js b/.github/workflows/changelog.js
deleted file mode 100644
index 853c495..0000000
--- a/.github/workflows/changelog.js
+++ /dev/null
@@ -1,52 +0,0 @@
-// Replaces the `` comment in the README.md with the release notes from GitHub.
-// Usage locally:
-// TOKEN=... GITHUB_REPOSITORY='Automattic/ad-code-manager' node .github/workflows/changelog.js
-// Where TOKEN is a personal GitHub token that has access to the repo: https://github.com/settings/tokens
-// In a GitHub Workflow, TOKEN can be passed the special ${{ secrets.GITHUB_TOKEN }} token.
-
-const github = require('@actions/github');
-const semver = require('semver');
-const replace = require('replace-in-file');
-
-const filename = process.argv[2] || 'README.md';
-const myToken = process.env.TOKEN;
-
-async function run() {
- const api = new github.GitHub(myToken);
-
- const { data: releases } = await api.repos.listReleases( github.context.repo );
-
- let published = releases.filter( release =>
- ! release.draft && ! release.prerelease
- );
-
- let sorted = published.sort( ( a, b ) =>
- semver.rcompare( semver.coerce( a.tag_name ), semver.coerce( b.tag_name ) )
- );
-
- let changelog = sorted.reduce( ( changelog, release ) =>
- `${changelog}
-
-### ${release.tag_name}
-
-${release.body}`
- , '## Changelog' );
-
- try {
- const results = await replace( {
- files: filename,
- from: '',
- to: changelog,
- } );
-
- if ( results.filter( result => ! result.hasChanged ).length ) {
- console.error( 'No replacements made' );
- process.exitCode = 1;
- }
- } catch( exception ) {
- console.error( exception );
- process.exitCode = 1;
- }
-}
-
-run();
diff --git a/.github/workflows/cs-lint.yml b/.github/workflows/cs-lint.yml
index c67f4da..a12f1cf 100644
--- a/.github/workflows/cs-lint.yml
+++ b/.github/workflows/cs-lint.yml
@@ -21,10 +21,10 @@ jobs:
strategy:
matrix:
- php: ['7.1', '8.1']
+ php: ['7.4', '8.2']
experimental: [false]
include:
- - php: '8.2'
+ - php: '8.3'
experimental: true
fail-fast: false
@@ -49,20 +49,13 @@ jobs:
uses: korelstar/xmllint-problem-matcher@v1
- name: Checkout code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
- if: ${{ matrix.php < 8.2 }}
uses: ramsey/composer-install@v2
- - name: Install Composer dependencies for PHP >= 8.2
- if: ${{ matrix.php >= 8.2 }}
- uses: ramsey/composer-install@v2
- with:
- composer-options: --ignore-platform-reqs
-
# Lint PHP.
- name: Lint PHP against parse errors
run: composer lint-ci --no-interaction | cs2pr
@@ -70,7 +63,7 @@ jobs:
# Needed as runs-on: system doesn't have xml-lint by default.
# @link https://github.com/marketplace/actions/xml-lint
- name: Lint phpunit.xml.dist
- if: ${{ matrix.php >= 7.3 }}
+ if: ${{ matrix.php >= 8.0 }}
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./phpunit.xml.dist
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index b855ab4..2514c54 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -5,22 +5,18 @@ on:
# Allow manually triggering the workflow.
workflow_dispatch:
+
jobs:
tag:
name: New tag
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
- name: Checkout repository
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Install Dependencies
run: npm install
- - name: Populate Changelog
- run: node .github/workflows/changelog.js
- env:
- TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
diff --git a/.github/workflows/integrations.yml b/.github/workflows/integrations.yml
index 5aaceea..365bdfd 100644
--- a/.github/workflows/integrations.yml
+++ b/.github/workflows/integrations.yml
@@ -11,47 +11,58 @@ on:
# Allow manually triggering the workflow.
workflow_dispatch:
+# Cancels all previous workflow runs for the same branch that have not yet completed.
+concurrency:
+ # The concurrency group contains the workflow name and the branch name.
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
test:
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
env:
WP_VERSION: ${{ matrix.wordpress }}
strategy:
- # PHP 7.1 uses PHPUnit 7.5.20
- # PHP 7.2 uses PHPUnit 8.5.21
- # PHP 7.3 uses PHPUnit 9.5.10
- # PHP 7.4 uses PHPUnit 9.5.10
- # PHP 8.0 uses PHPUnit 9.5.10
- # PHP 8.1 uses PHPUnit 9.5.10
- # PHP 8.2 uses PHPUnit 9.5.10
- # Key:
- # - coverage: Whether to run the tests with code coverage.
- # - experimental: Whether the build is "allowed to fail".
matrix:
- php: ['7.2', '7.3', '7.4', '8.0', '8.1']
- wordpress: ['5.5', '5.6', '5.7', '5.8', '5.9']
- experimental: [false]
- coverage: [none]
+ php: [ '7.4', '8.2' ]
+ wordpress: [ '5.7', '6.3' ]
+ allowed_failure: [false]
+ coverage: [false]
include:
- - php: '7.1'
- wordpress: '5.8.3'
- experimental: false
- coverage: none
+ # Check upcoming WP.
+ - php: '8.2'
+ wordpress: 'trunk'
+ allowed_failure: true
+ coverage: false
+ # Check upcoming PHP.
+ - php: '8.3'
+ wordpress: 'latest'
+ allowed_failure: true
+ coverage: false
+ # Code coverage on latest PHP and WP.
+ - php: '8.2'
+ wordpress: 'latest'
+ allowed_failure: false
+ coverage: true
+ exclude:
+ # WordPress 5.7 doesn't support PHP 8.2.
+ - php: '8.2'
+ wordpress: '5.7'
fail-fast: false
- continue-on-error: ${{ matrix.experimental }}
+ continue-on-error: ${{ matrix.allowed_failure }}
+
steps:
- name: Checkout code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- extensions: ${{ matrix.extensions }}
- coverage: ${{ matrix.coverage }}
+ coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
@@ -60,14 +71,7 @@ jobs:
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install Composer dependencies
- if: ${{ matrix.php < 8.2 }}
- uses: ramsey/composer-install@v2
-
- - name: Install Composer dependencies for PHP >= 8.2
- if: ${{ matrix.php >= 8.2 }}
uses: ramsey/composer-install@v2
- with:
- composer-options: --ignore-platform-reqs
- name: Start MySQL Service
run: sudo systemctl start mysql.service
@@ -80,4 +84,17 @@ jobs:
run: composer prepare-ci --no-interaction
- name: Run integration tests
+ if: ${{ matrix.coverage == false }}
run: composer test --no-interaction
+
+ - name: Run integration tests with code coverage
+ if: ${{ matrix.coverage == true }}
+ run: composer coverage-ci --no-interaction
+
+ - name: Send coverage report to Codecov
+ if: ${{ success() && matrix.coverage == true }}
+ uses: codecov/codecov-action@v3
+ with:
+ files: ./clover.xml
+ fail_ci_if_error: true
+ verbose: true
diff --git a/.gitignore b/.gitignore
index 5c3cc78..7838f5a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
-/.phpunit.result.cache
+/.phpunit.cache
+/clover.xml
/composer.lock
/package-lock.json
/vendor
diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist
index 066364b..42011f8 100644
--- a/.phpcs.xml.dist
+++ b/.phpcs.xml.dist
@@ -30,7 +30,7 @@
-
+
@@ -39,7 +39,7 @@
-
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..9c73d48
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,176 @@
+# Changelog for Ad Code Manager
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [0.7.0] - 2023-09-09
+
+This version requires WordPress 5.7 and PHP 7.4 as a minimum. There are no new features.
+
+### Changed
+- #165 Increase minimum WP and PHP supported versions.
+- #166 Improve spelling, punctuation, and grammar in comments and visible strings.
+
+### Maintenance
+- #164 Composer: Update to VIPCS 3.
+- #167 Add CHANGELOG.md
+
+## [0.6.0] - 2022-03-21
+
+This version requires WordPress 5.5 and PHP 7.1 as a minimum.
+
+### Added
+- Added link to the Settings page from the plugin page to make it easier to find after plugin activation.
+- Allow filtering the TTL for matching ad codes. Props @dlh01.
+
+### Changed
+- Increased minimum WordPress version to WP 5.5.
+- Increased minimum PHP version to PHP 7.1.
+- Moved the settings page from the Tools menu to the Settings menu to make it more intuitive to find.
+- Refactored `action_acm_tag()` method to a method that returned the tag and another that echoed the returned tag.
+- Added check for post types when deleting ad codes. Props @rbcorrales.
+- Changed the assignment of $unit_sizes_output to an array. Props @victorholt.
+
+### Fixed
+- Fixed internationalization of PHP strings. Props @christianc1, @shantanu2704, and @trepmal.
+- Fixed PHP 7 incompatibilities. Props @swissspidy, @shantanu2704, @alexiskulash, and @jonathanstegall.
+- Fixed broken tests and workflows.
+
+### Maintenance
+- Remove parsing of readme.txt into contextual help with a Markdown parsing library.
+- Improved some coding standards.
+- Moved and reorganised many classes and how they are initialized.
+- Refreshed screenshots.
+- Moved previously-linked configuration guidance into Readme.
+- Reorganised documentation sections.
+- Refreshed the on-page contextual help.
+- Added GitHub workflow to push the plugin to WordPress.org.
+- Added script to more easily bump version numbers.
+- Added script to populate release notes into Readme changelog for WordPress.org.
+- Added dependabot configuration file.
+- Added `.gitattributes` file.
+- Added `LICENSE` file.
+
+## [0.5] - 2016-04-13
+
+### Added
+- Added support for flex sized DFP Async ads.
+- Added `robots.txt` entries for provider's crawlers.
+- New Italian translation. Props @sniperwolf.
+
+### Fixed
+- Prevent global `$post` pollution if ad code is getting rendered inside a loop.
+
+### Maintenance
+- Using PHP5 constructs when initializing the widget.
+
+## [0.4.1] - 2013-04-27
+
+### Changed
+- Disabled rendering of ads on preview to avoid crawling errors. Props @paulgibbs.
+
+### Fixed
+- Corrected "medium rectangle" ad size for DFP Async Provider. Props @NRG-R9T.
+
+## [0.4] - 2013-03-19
+
+### Added
+- New filter `acm_output_html_after_tokens_processed` for rare cases where you might want to filter HTML after the tokens are processed.
+
+### Changed
+- Streamlined configuration for Doubleclick for Publishers Async and Google AdSense.
+- Faster, cleaner JavaScript. Props @jeremyfelt and @carldanley.
+
+## [0.3] - 2012-10-26
+
+### Added
+- Conditional operator logic can be set on an ad code by ad code basis. Props @jtsternberg.
+
+### Fixed
+- If an ad tag doesn't need a URL, ignore the allowlist check.
+- Make sure that all providers list tables call `parent::get_columns()` to avoid conflicts with filters.
+
+### Maintenance
+- Coding standards cleanup.
+
+## [0.2.3] - 2012-06-12
+
+### Added
+- Allow columns to be optional when creating and editing ad codes, introduced new filter `acm_ad_code_args`.
+
+### Removed
+- Remove `acm_provider_columns` filter.
+
+## [0.2.2] - 2012-06-05
+
+### Added
+- New Google Ad Sense provider. Props @ethitter.
+- Bulk delete action added for the `WP_List_Table` of ad codes. Delete more ad codes in one go.
+- New `acm_register_provider_slug` for registering a provider that's included outside the plugin (e.g. a theme).
+
+### Fixed
+- Instantiate the WP List Table on the view, instead of on admin_init, to reduce conflicts with other list tables.
+
+## [0.2.1] - 2012-05-15
+
+### Changed
+- Flush the cache whenever an ad code is created or deleted so you don't have to wait for a timeout with a persistent cache.
+
+### Fixed
+- Default to priority 10 when querying for ad codes if there is no priority set.
+
+## [0.2] - 2012-05-07
+
+### Added
+- Added in-plugin contextual help.
+- Implemented priority for ad code (allows to workaround ad code conflicts if any).
+- Implemented the `[acm-tag]` shortcode.
+- Implemented ACM Widget. Props @jtsternberg.
+
+### Changed
+- UI reworked from the ground up to look and work much more like the WordPress admin (using `WP_List_Table`).
+- Abstracted ad network logic, so users can integrate other ad networks. Pull requests to add support to the plugin are always welcome.
+- Initial loading of the ad codes is now cached using object cache.
+
+### Fixed
+- Enable using ad codes with empty filters using a filter.
+- Setting the logical operator from OR to AND did not seem to result in the expected behaviour for displaying ads.
+- Remove logical operator check when a conditional for an ad code is empty.
+
+## [0.1.3] - 2012-02-14
+
+### Changed
+
+- UI cleanup for the admin, including styling and information on applying conditionals.
+
+## [0.1.2] - 2012-02-10
+
+### Added
+- Readme with full description and examples.
+
+### Fixed
+- Save the proper value when editing actions.
+
+## [0.1.1] - 2012-01-19
+
+Bug fix release.
+
+## 0.1 - 2012-01-18
+
+Initial release.
+
+[0.7.0]: https://github.com/Automattic/ad-code-manager/compare/0.6.0...0.7.0
+[0.6.0]: https://github.com/Automattic/ad-code-manager/compare/0.5...0.6.0
+[0.5]: https://github.com/Automattic/ad-code-manager/compare/0.4.1...0.5
+[0.4.1]: https://github.com/Automattic/ad-code-manager/compare/0.4...0.4.1
+[0.4]: https://github.com/Automattic/ad-code-manager/compare/0.3...0.4
+[0.3]: https://github.com/Automattic/ad-code-manager/compare/0.2.3...0.3
+[0.2.3]: https://github.com/Automattic/ad-code-manager/compare/0.2.2...0.2.3
+[0.2.2]: https://github.com/Automattic/ad-code-manager/compare/0.2.1...0.2.2
+[0.2.1]: https://github.com/Automattic/ad-code-manager/compare/0.2...0.2.1
+[0.2]: https://github.com/Automattic/ad-code-manager/compare/0.1.3...0.2
+[0.1.3]: https://github.com/Automattic/ad-code-manager/compare/0.1.2...0.1.3
+[0.1.2]: https://github.com/Automattic/ad-code-manager/compare/0.1.1...0.1.2
+[0.1.1]: https://github.com/Automattic/ad-code-manager/compare/0.1...0.1.1
diff --git a/README.md b/README.md
index a42f475..7ca9200 100644
--- a/README.md
+++ b/README.md
@@ -1,37 +1,37 @@
# Ad Code Manager
-Stable tag: 0.6.0
-Requires at least: 5.5
+Stable tag: 0.7.0
+Requires at least: 5.7
Tested up to: 5.9
-Requires PHP: 7.1
+Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: advertising, ad codes, ads, adsense, dfp, doubleclick for publishers
Contributors: rinatkhaziev, jeremyfelt, danielbachhuber, carldanley, zztimur, automattic, doejo
-Manage your ad codes through the WordPress admin in a safe and easy way.
+Manage your ad codes through the WordPress admin safely and easily.
## Description
Ad Code Manager gives non-developers an interface in the WordPress admin for configuring your complex set of ad codes.
-Some code-level configuration may be necessary to set up Ad Code Manager. Ad tags must be added (via `do_action()`) to your theme's template files where you'd like ads to appear. Alternatively, you can incorporate ad tags into your website with our widget and our shortcode. Check out the configuration guide below for the full details.
+Some code-level configuration may be necessary to set up Ad Code Manager. Ad tags must be added (via `do_action()`) to your theme's template files where you'd like ads to appear. Alternatively, you can incorporate ad tags into your website with our widget and shortcode. Check out the configuration guide below for the full details.
-A common set of parameters must also be defined for your ad provider. This includes the tag IDs used by your template, the default URL for your ad provider, and the default HTML surrounding that URL. Ad Code Manager comes with support for Google Doubleclick For Publishers (and Async), and Google AdSense. All the logic is abstracted, however, so configuring a different provider is relatively easy. Check `providers/doubleclick-for-publishers.php` for an idea of how to extend ACM to suit your needs.
+A common set of parameters must also be defined for your ad provider. This includes the tag IDs used by your template, the default URL for your ad provider, and the default HTML surrounding that URL. Ad Code Manager supports Google DoubleClick For Publishers (and Async), and Google AdSense. All the logic is abstracted, however, so configuring a different provider is relatively easy. Check `providers/doubleclick-for-publishers.php` for an idea of how to extend ACM to suit your needs.
-Once this configuration is in place, the Ad Code Manager admin interface will allow you to add new ad codes, modify the parameters for your script URL, and define conditionals to determine when the ad code appears. Conditionals are core WordPress functions like is_page(), is_category(), or your own custom functions that evaluate certain expression and then return true or false.
+Once this configuration is in place, the Ad Code Manager admin interface will allow you to add new ad codes, modify the parameters for your script URL, and define conditionals to determine when the ad code appears. Conditionals are core WordPress functions like is_page(), is_category(), or your own custom functions that evaluate certain expressions and then return true or false.
[Fork the plugin on Github](https://github.com/Automattic/Ad-Code-Manager) and [follow our development blog](http://adcodemanager.wordpress.com/).
## Installation
-The plugin requires PHP 7.1 or later. It is also test on WordPress 5.5 and later, though it may run on older versions.
+The plugin requires PHP 7.4 or later. It is also tested WordPress 5.7 and later, though it may run on older versions.
Since the plugin is in its early stages, there are a couple additional configuration steps:
1. Upload `ad-code-manager` to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
-3. Incorporate ad tags in your theme template with `do_action( 'acm_tag', 'slot' )`. Also you can use `[acm-tag id="slot"]` shortcode or ACM Widget.
+3. Incorporate ad tags in your theme template with `do_action( 'acm_tag', 'slot' );`. Also, you can use `[acm-tag id="slot"]` shortcode or ACM Widget.
4. Implement filters to make the plugin work with your provider.
5. Configure your ad codes in the WordPress admin (Tools -> Ad Code Manager).
@@ -51,11 +51,11 @@ Since the plugin is in its early stages, there are a couple additional configura
## Configure Ad Code Manager to manage the advertisements on your site
-Ad Code Manager is a VIP-sponsored plugin designed to make it easier to manage the ad codes used to display advertisements on your site. There's a little bit of work you'll need to do up front, however, in order to integrate Ad Code Manager with your theme.
+Ad Code Manager is a VIP-sponsored plugin designed to make managing the ad codes used to display advertisements on your site easier. There's a little bit of work you'll need to do upfront to integrate Ad Code Manager with your theme.
-The high-level idea behind Ad Code Manager is that it gives non-developers an admin interface to manage your ad codes. It then permits users to (optionally) target specific ad codes using conditionals like `is_home()` and `is_single()`. Ad codes are associated with positions in the theme through the use of ad tags.
+The high-level idea behind Ad Code Manager is that it gives non-developers an admin interface to manage ad codes. It then permits users to (optionally) target specific ad codes using conditionals like `is_home()` and `is_single()`. Ad codes are associated with positions in the theme through the use of ad tags.
-Currently, Ad Code Manager easily integrates with Google Doubleclick For Publishers Async and Google AdSense. Other ad providers are supported with additional configuration.
+Currently, Ad Code Manager easily integrates with Google DoubleClick For Publishers Async and Google AdSense. Other ad providers are supported with additional configuration.
### Google AdSense and DoubleClick For Publishers Async
@@ -65,11 +65,11 @@ Let's use AdSense as our first example. You'll want to incorporate some of the d
do_action( 'acm_tag', '728x90_leaderboard' );
~~~
-Once you've done so, you can select the "Google AdSense" provider in the admin. Ad codes can be registered against ad tags (positions) by choosing the ad tag from the drop down, entering the tag ID and publisher ID, and hitting "Add New Ad Code".
+Once done, you can select the "Google AdSense" provider in the admin. Ad codes can be registered against ad tags (positions) by choosing the ad tag from the drop-down, entering the tag ID and publisher ID, and hitting "Add New Ad Code".
And like that, your 728x90 leaderboard will appear on your site.
-The Google AdSense configuration comes with many of Google's suggested sizes. Additional ad tags can be registered by the way of filtering:
+The Google AdSense configuration comes with many of Google's suggested sizes. Additional ad tags can be registered by way of filtering:
~~~php
add_filter( 'acm_ad_tag_ids', 'acmx_filter_ad_tag_ids' );
@@ -88,13 +88,13 @@ function acmx_filter_ad_tag_ids( $ids ) {
}
~~~
-Keep in mind that you'll still need to incorporate a `do_action( 'acm_tag', '100x100_smallsquare' );` in your theme in order to display the ad tag.
+Keep in mind that you'll still need to incorporate a `do_action( 'acm_tag', '100x100_smallsquare' );` in your theme to display the ad tag.
If you choose Google DFP Async as your provider, you'll likely need to register additional ad tags, as we only package two default ad tags.
### Custom Ad Provider Implementations
-As mentioned previously, other ad code providers are supported with additional configuration. Here's an example of the different filters you would use to configure the older version of Google Doubleclick For Publishers:
+As mentioned previously, other ad code providers are supported with additional configuration. Here's an example of the different filters you would use to configure the older version of Google DoubleClick For Publishers:
~~~php
/**
@@ -240,10 +240,10 @@ There are some filters which allow you to easily customize the output of the plu
### `acm_ad_tag_ids`
-Ad tag ids are used as a parameter when adding tags to your theme (e.g. `do_action( 'acm_tag', 'my_top_leaderboard' )`). The `url_vars` defined as part of each tag here will also be used to replace tokens in your default URL.
+Ad tag IDs are used as a parameter when adding tags to your theme (e.g. `do_action( 'acm_tag', 'my_top_leaderboard' )`). The `url_vars` defined as part of each tag here will also be used to replace tokens in your default URL.
Arguments:
-* array $tag_ids array of default tag ids
+* array $tag_ids array of default tag IDs
Example usage: Add a new ad tag called 'my_top_leaderboard'
@@ -267,7 +267,7 @@ function my_acm_ad_tag_ids( $tag_ids ) {
Set the default tokenized URL used when displaying your ad tags. This filter is required.
Arguments:
-* string $url The tokenized url of Ad Code
+* string $url The tokenized URL of Ad Code
Example usage: Set your default ad code URL
@@ -282,7 +282,7 @@ function my_acm_default_url( $url ) {
### `acm_output_html`
-The HTML outputted by the `do_action( 'acm_tag', 'ad_tag_id' );` call in your theme. Support multiple ad formats ( e.g. JavaScript ad tags, or simple HTML tags ) by adjusting the HTML rendered for a given ad tag.
+The HTML outputted by the `do_action( 'acm_tag', 'ad_tag_id' );` call in your theme. Support multiple ad formats (e.g. JavaScript or simple HTML tags) by adjusting the HTML rendered for a given ad tag.
The `%url%` token used in this HTML will be filled in with the URL defined with `acm_default_url`.
@@ -311,7 +311,7 @@ function my_acm_output_html( $output_html, $tag_id ) {
### `acm_register_provider_slug`
-Ad Code Manager has a built-in list of providers that it gathers by scanning the 'providers' directory used by the plugin. Additional providers can be added by placing the appropriate files in that directory, or by using the `acm_register_provider_slug` filter to register those that may be included as part of your theme or another plugin.
+Ad Code Manager has a built-in list of providers that it gathers by scanning the 'providers' directory used by the plugin. Additional providers can be added by placing the appropriate files in that directory or using the `acm_register_provider_slug` filter to register those that may be included as part of your theme or another plugin.
When using this plugin, you are defining the provider slug as part of the existing object as well as an array of classes associated with that provider slug.
@@ -339,7 +339,7 @@ A security filter to define a safelist for which ad code script URLs can be adde
Arguments:
* array $whitelisted_urls Existing whitelisted ad code URLs
-Example usage: Allow Doubleclick for Publishers ad codes to be used
+Example usage: Allow DoubleClick for Publishers ad codes to be used
~~~php
add_filter( 'acm_whitelisted_script_urls', 'my_acm_safelisted_script_urls' );
@@ -351,11 +351,11 @@ function my_acm_safelisted_script_urls( $safelisted_urls ) {
### `acm_output_tokens`
-Output tokens can be registered depending on the needs of your setup. Tokens defined here will be replaced in the ad tag's tokenized URL in addition to the tokens already registered with your tag id.
+Output tokens can be registered depending on the needs of your setup. Tokens defined here will be replaced in the ad tag's tokenized URL in addition to the tokens already registered with your tag ID.
Arguments:
* array $output_tokens Any existing output tokens
-* string $tag_id Unique tag id
+* string $tag_id Unique tag ID
* array $code_to_display Ad Code that matched conditionals
Example usage: Test to determine whether you're in test or production by passing ?test=on query argument
@@ -433,7 +433,7 @@ add_filter( 'acm_display_ad_codes_without_conditionals', '__return_true' );
### `acm_provider_slug`
-By default, we use our bundled doubleclick_for_publishers config (check it in `/providers/doubleclick-for-publishers.php`). If you want to add your own flavor of DFP or even implement configuration for some another ad network, you'd have to apply a filter to correct the slug.
+By default, we use our bundled doubleclick_for_publishers config (check it in `/providers/doubleclick-for-publishers.php`). If you want to add your own flavor of DFP or even implement configuration for another ad network, you'd have to apply a filter to correct the slug.
Example usage:
@@ -448,8 +448,8 @@ add_filter(
### `acm_logical_operator`
-By default, logical operator is set to "OR", that is, ad code will be displayed if at least one conditional returns true.
-You can change it to "AND", so that ad code will be displayed only if ALL of the conditionals match.
+By default, the logical operator is set to "OR", that is, ad code will be displayed if at least one conditional returns true.
+You can change it to "AND", so that the ad code will be displayed only if ALL the conditionals match.
Example usage:
@@ -464,7 +464,7 @@ add_filter(
### `acm_manage_ads_cap`
-By default, user has to have `manage_options` cap. This filter comes in handy, if you want to relax the requirements.
+By default, the user has to have `manage_options` cap. This filter comes in handy if you want to relax the requirements.
Example usage:
@@ -479,7 +479,7 @@ add_filter(
### `acm_allowed_get_posts_args`
-This filter is only for edge cases. Most likely you won't have to touch it. Allows to include additional query args for `Ad_Code_Manager->get_ad_codes()` method.
+This filter is only for edge cases. Most likely, you won't have to touch it. Allows to include additional query args for `Ad_Code_Manager->get_ad_codes()` method.
Example usage:
@@ -494,7 +494,7 @@ add_filter(
### `acm_ad_code_count`
-By default, the total number of ad codes to get is 50, which is reasonable for any small to mid-sized site. However, in some certain cases you would want to increase the limit. This will affect `Ad_Code_Manager->get_ad_codes()` `numberposts` query argument.
+By default, the total number of ad codes to get is 50, which is reasonable for any small to mid-sized site. However, in certain cases, you would want to increase the limit. This will affect `Ad_Code_Manager->get_ad_codes()` `numberposts` query argument.
Example usage:
@@ -529,7 +529,7 @@ function my_acm_list_table_columns( $columns ) {
### `acm_ad_code_args`
-This filter comes in pair with previous one, it should return array of ad network specific parameters. E.g. in `acm_list_table_columns` example we have 'id', 'name', 'priority', 'conditionals'. All of them except 'name' are generic for Ad Code Manager. Hence, `acm_provider_columns` should return only "name".
+This filter comes in pair with the previous one. It should return an array of ad network-specific parameters. E.g. in `acm_list_table_columns` example, we have 'id', 'name', 'priority', and 'conditionals'. All of them except 'name' are generic for Ad Code Manager. Hence, `acm_provider_columns` should return only "name".
"editable" and "required" indicate whether this field should be editable and required.
@@ -551,4 +551,6 @@ function my_acm_ad_code_args( $args ) {
}
~~~
-
+### Change Log
+
+[View the change log](https://github.com/Automattic/ad-code-manager/blob/master/CHANGELOG.md).
diff --git a/ad-code-manager.php b/ad-code-manager.php
index e744b9b..e169219 100644
--- a/ad-code-manager.php
+++ b/ad-code-manager.php
@@ -11,15 +11,15 @@
* Plugin Name: Ad Code Manager
* Plugin URI: https://wordpress.org/plugins/ad-code-manager/
* Description: Easy ad code management.
- * Version: 0.6.0
+ * Version: 0.7.0
* Author: Automattic and contributors
* Author URI: https://github.com/Automattic/ad-code-manager/graphs/contributors
* Text Domain: ad-code-manager
* License: GPL-2.0-or-later
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* GitHub Plugin URI: https://github.com/Automattic/ad-code-manager/
- * Requires PHP: 7.1
- * Requires WP: 5.5.0
+ * Requires PHP: 7.4
+ * Requires WP: 5.7
*/
declare(strict_types=1);
@@ -30,7 +30,7 @@
use Automattic\AdCodeManager\UI\Contextual_Help;
use Automattic\AdCodeManager\UI\Plugin_Actions;
-const AD_CODE_MANAGER_VERSION = '0.6.0';
+const AD_CODE_MANAGER_VERSION = '0.7.0';
const AD_CODE_MANAGER_FILE = __FILE__;
require_once __DIR__ . '/src/class-acm-provider.php';
diff --git a/composer.json b/composer.json
index 66a3d51..75d6011 100644
--- a/composer.json
+++ b/composer.json
@@ -11,15 +11,13 @@
}
],
"require": {
- "php": ">=7.1",
+ "php": ">=7.4",
"composer/installers": "^1.0 || ^2.0"
},
"require-dev": {
- "automattic/vipwpcs": "^2.2",
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7",
+ "automattic/vipwpcs": "^3",
"php-parallel-lint/php-parallel-lint": "^1.0",
"phpcompatibility/phpcompatibility-wp": "^2.1",
- "wp-coding-standards/wpcs": "^2.3.0",
"yoast/wp-test-utils": "^1"
},
"config": {
@@ -33,7 +31,7 @@
"@php ./vendor/bin/phpcbf"
],
"coverage": [
- "@php ./vendor/bin/phpunit --coverage-html ./build/coverage-html"
+ "@php ./vendor/bin/phpunit --coverage-html ./.phpunit.cache/coverage-html"
],
"coverage-ci": [
"@php ./vendor/bin/phpunit"
diff --git a/package.json b/package.json
index 1dda002..8600377 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ad-code-manager",
- "version": "0.6.0",
+ "version": "0.7.0",
"description": "Easy ad code management.",
"license": "GPL-2.0-or-later",
"author": "Automattic",
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 5539a2e..98803cd 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,32 +1,33 @@
-
-
-
-
-
-
-
-
- ./tests/Integration
-
-
-
-
- src
- ad-code-manager.php
-
+
+
+
+ tests/Integration
+
+
+
+
+
+ src
+
+
-
+
diff --git a/src/Providers/class-doubleclick-for-publishers.php b/src/Providers/class-doubleclick-for-publishers.php
index cc7fe89..bd5fe04 100644
--- a/src/Providers/class-doubleclick-for-publishers.php
+++ b/src/Providers/class-doubleclick-for-publishers.php
@@ -1,6 +1,6 @@
output_html = '';
@@ -91,7 +91,7 @@ function __construct() {
'singular' => 'doubleclick_for_publishers_acm_wp_list_table', // Singular label
'plural' => 'doubleclick_for_publishers_acm_wp_list_table', // plural label, also this well be one of the table css class
'ajax' => true,
- )
+ )
);
}
diff --git a/src/UI/class-contextual-help.php b/src/UI/class-contextual-help.php
index c9f3622..f8f1c30 100644
--- a/src/UI/class-contextual-help.php
+++ b/src/UI/class-contextual-help.php
@@ -50,10 +50,10 @@ public function render( WP_Screen $screen ): void {
ob_start();
?>
-
+
- - <?php do_action( \'acm_tag\', $tag_id ) ?>', 'ad-code-manager' ) ); ?>
+ - <?php do_action( \'acm_tag\', $tag_id ); ?>', 'ad-code-manager' ) ); ?>
- [acm-tag id="tag_id"]', 'ad-code-manager' ) ); ?>
@@ -63,13 +63,13 @@ public function render( WP_Screen $screen ): void {
ob_start();
?>
-
+
- is_home
- - Settings > Reading.', 'ad-code-manager' ) ); ?>
+ - Settings > Reading.', 'ad-code-manager' ) ); ?>
- is_front_page
- - Settings > Reading > Front page displays is set to "Your latest posts", or when Settings > Reading > Front page displays is set to "A static page" and the "Front Page" value is the current Page being displayed.', 'ad-code-manager' ) ); ?>
+ - Settings > Reading > Front page displays is set to "Your latest posts", or when Settings > Reading > Front page displays is set to "A static page" and the "Front Page" value is the current page displayed.', 'ad-code-manager' ) ); ?>
- is_category
diff --git a/tests/Integration/UI/PluginActionsTest.php b/tests/Integration/UI/PluginActionsTest.php
index 728a381..b76037d 100644
--- a/tests/Integration/UI/PluginActionsTest.php
+++ b/tests/Integration/UI/PluginActionsTest.php
@@ -22,6 +22,15 @@ final class PluginActionsTest extends TestCase {
* Check that plugins screen will add a hook to change the plugin action links.
*
* @covers \Automattic\AdCodeManager\UI\Plugin_Actions::run
+ * @uses ACM_Provider::__construct
+ * @uses Ad_Code_Manager::action_init
+ * @uses Ad_Code_Manager::action_load_providers
+ * @uses Ad_Code_Manager::get_ad_codes
+ * @uses Ad_Code_Manager::get_option
+ * @uses Ad_Code_Manager::get_options
+ * @uses Ad_Code_Manager::register_acm_post_type
+ * @uses Ad_Code_Manager::register_ad_codes
+ * @uses Doubleclick_For_Publishers_ACM_Provider::__construct
* @group ui
*/
public function test_plugins_screen_has_filter_to_add_a_settings_action_link(): void {
@@ -36,6 +45,15 @@ public function test_plugins_screen_has_filter_to_add_a_settings_action_link():
*
* @covers Automattic\AdCodeManager\UI\Plugin_Actions::run
* @covers Automattic\AdCodeManager\UI\Plugin_Actions::add_plugin_meta_links
+ * @uses ACM_Provider::__construct
+ * @uses Ad_Code_Manager::action_init
+ * @uses Ad_Code_Manager::action_load_providers
+ * @uses Ad_Code_Manager::get_ad_codes
+ * @uses Ad_Code_Manager::get_option
+ * @uses Ad_Code_Manager::get_options
+ * @uses Ad_Code_Manager::register_acm_post_type
+ * @uses Ad_Code_Manager::register_ad_codes
+ * @uses Doubleclick_For_Publishers_ACM_Provider::__construct
* @group ui
*/
public function test_plugins_screen_adds_a_settings_action_link(): void {