Skip to content

Commit 41528d9

Browse files
GaryJonesclaude
andcommitted
docs: add PHPDoc documentation for all hooks
Add comprehensive PHPDoc documentation for all 24 filters and 2 actions in the Ad Code Manager plugin, improving discoverability and developer experience. Documented filters include: - Configuration: acm_register_provider_slug, acm_provider_slug, acm_whitelisted_script_urls, acm_whitelisted_conditionals, acm_logical_operator, acm_manage_ads_cap, acm_ad_tag_ids, acm_ad_code_args - Rendering: acm_output_html, acm_output_tokens, acm_output_html_after_tokens_processed, acm_disable_ad_rendering, acm_wrapper_classes (already documented in #188) - Matching: acm_display_ad_codes_without_conditionals, acm_conditional_args, acm_reset_postdata_before_match, acm_matching_ad_code_cache_expiration - Admin: acm_list_table_columns, acm_list_table_per_page, acm_validate_ad_code, acm_allowed_get_posts_args, acm_ad_code_count - Other: acm_default_url, acm_should_do_robotstxt, acm_robotstxt_disallow Documented actions: - acm_tag: Displays an ad tag on the frontend - acm_options_form: Fires in the options form Fixes #157 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a24f6d7 commit 41528d9

File tree

4 files changed

+248
-55
lines changed

4 files changed

+248
-55
lines changed

src/class-acm-provider.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ public function __construct() {
3333
);
3434
}
3535
/**
36-
* Configuration filter: acm_ad_code_args
36+
* Filters the ad code arguments/fields for a provider.
37+
*
38+
* This filter is also applied in the main Ad_Code_Manager class after
39+
* provider instantiation. It allows modification of the fields displayed
40+
* in the admin UI for this provider's ad codes.
41+
*
42+
* @since 0.1
43+
*
44+
* @param array $ad_code_args Array of field configurations.
3745
*/
3846
$this->ad_code_args = apply_filters( 'acm_ad_code_args', $this->ad_code_args );
3947

@@ -44,6 +52,17 @@ public function __construct() {
4452
}
4553

4654
if ( ! empty( $this->crawler_user_agent ) ) {
55+
/**
56+
* Filters whether to add robots.txt rules for ad crawlers.
57+
*
58+
* When a provider has a crawler_user_agent defined, this filter
59+
* controls whether rules are added to robots.txt for that crawler.
60+
*
61+
* @since 0.1
62+
*
63+
* @param bool $should_do Whether to add robots.txt rules. Default true.
64+
* @param ACM_Provider $provider The provider instance.
65+
*/
4766
$should_do_robotstxt = apply_filters( 'acm_should_do_robotstxt', true, $this );
4867

4968
if ( true === $should_do_robotstxt ) {
@@ -63,6 +82,18 @@ public function action_do_robotstxt() {
6382
$disallowed[] = '';
6483
}
6584

85+
/**
86+
* Filters the disallowed paths for ad crawlers in robots.txt.
87+
*
88+
* Allows modification of which paths should be disallowed for the
89+
* ad network's crawler in the robots.txt file.
90+
*
91+
* @since 0.1
92+
*
93+
* @param array $disallowed Array of paths to disallow. Default array('')
94+
* or array('/') if blog is not public.
95+
* @param ACM_Provider $provider The provider instance.
96+
*/
6697
$disallowed = apply_filters( 'acm_robotstxt_disallow', $disallowed, $this );
6798

6899
// If we have no disallows to add, don't add anything (including User-agent).

src/class-acm-wp-list-table.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ function __construct( $params = array() ) {
2525
* @return array $columns, the array of columns to use with the table
2626
*/
2727
function get_columns() {
28+
/**
29+
* Filters the columns displayed in the ad codes list table.
30+
*
31+
* Allows providers to customise which columns appear in the admin list table.
32+
* Note: 'cb', 'id', 'priority', 'operator', and 'conditionals' are required
33+
* and will be added automatically if missing.
34+
*
35+
* @since 0.1.3
36+
*
37+
* @param array $columns Associative array of column IDs and labels.
38+
*/
2839
$columns = apply_filters(
2940
'acm_list_table_columns',
3041
array(
@@ -34,7 +45,7 @@ function get_columns() {
3445
'priority' => __( 'Priority', 'ad-code-manager' ),
3546
'operator' => __( 'Logical Operator', 'ad-code-manager' ),
3647
'conditionals' => __( 'Conditionals', 'ad-code-manager' ),
37-
)
48+
)
3849
);
3950
// Fail-safe for misconfiguration
4051
$required_before = array(
@@ -83,7 +94,13 @@ function prepare_items() {
8394
// Number of elements in your table?
8495
$totalitems = count( $this->items ); // return the total number of affected rows
8596

86-
// How many to display per page?
97+
/**
98+
* Filters the number of ad codes displayed per page in the list table.
99+
*
100+
* @since 0.1.3
101+
*
102+
* @param int $per_page Number of ad codes per page. Default 25.
103+
*/
87104
$perpage = apply_filters( 'acm_list_table_per_page', 25 );
88105

89106
// Which page is this?

0 commit comments

Comments
 (0)