Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/class-acm-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ public function __construct() {
);
}
/**
* Configuration filter: acm_ad_code_args
* Filters the ad code arguments/fields for a provider.
*
* This filter is also applied in the main Ad_Code_Manager class after
* provider instantiation. It allows modification of the fields displayed
* in the admin UI for this provider's ad codes.
*
* @since 0.1
*
* @param array $ad_code_args Array of field configurations.
*/
$this->ad_code_args = apply_filters( 'acm_ad_code_args', $this->ad_code_args );

Expand All @@ -44,6 +52,17 @@ public function __construct() {
}

if ( ! empty( $this->crawler_user_agent ) ) {
/**
* Filters whether to add robots.txt rules for ad crawlers.
*
* When a provider has a crawler_user_agent defined, this filter
* controls whether rules are added to robots.txt for that crawler.
*
* @since 0.1
*
* @param bool $should_do Whether to add robots.txt rules. Default true.
* @param ACM_Provider $provider The provider instance.
*/
$should_do_robotstxt = apply_filters( 'acm_should_do_robotstxt', true, $this );

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

/**
* Filters the disallowed paths for ad crawlers in robots.txt.
*
* Allows modification of which paths should be disallowed for the
* ad network's crawler in the robots.txt file.
*
* @since 0.1
*
* @param array $disallowed Array of paths to disallow. Default array('')
* or array('/') if blog is not public.
* @param ACM_Provider $provider The provider instance.
*/
$disallowed = apply_filters( 'acm_robotstxt_disallow', $disallowed, $this );

// If we have no disallows to add, don't add anything (including User-agent).
Expand Down
21 changes: 19 additions & 2 deletions src/class-acm-wp-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ function __construct( $params = array() ) {
* @return array $columns, the array of columns to use with the table
*/
function get_columns() {
/**
* Filters the columns displayed in the ad codes list table.
*
* Allows providers to customise which columns appear in the admin list table.
* Note: 'cb', 'id', 'priority', 'operator', and 'conditionals' are required
* and will be added automatically if missing.
*
* @since 0.1.3
*
* @param array $columns Associative array of column IDs and labels.
*/
$columns = apply_filters(
'acm_list_table_columns',
array(
Expand All @@ -34,7 +45,7 @@ function get_columns() {
'priority' => __( 'Priority', 'ad-code-manager' ),
'operator' => __( 'Logical Operator', 'ad-code-manager' ),
'conditionals' => __( 'Conditionals', 'ad-code-manager' ),
)
)
);
// Fail-safe for misconfiguration
$required_before = array(
Expand Down Expand Up @@ -83,7 +94,13 @@ function prepare_items() {
// Number of elements in your table?
$totalitems = count( $this->items ); // return the total number of affected rows

// How many to display per page?
/**
* Filters the number of ad codes displayed per page in the list table.
*
* @since 0.1.3
*
* @param int $per_page Number of ad codes per page. Default 25.
*/
$perpage = apply_filters( 'acm_list_table_per_page', 25 );

// Which page is this?
Expand Down
Loading