Permalink
Browse files

Implemented acm_provider_columns filter, fixed a bug in column_name m…

…ethod of wp-list-table

* acm_provider_columns is basically all custom columns without id, priority and conditionals
  • Loading branch information...
1 parent 27ae825 commit 082bb20a4803e36a20cbdf4ee39359d07e8e699f @rinatkhaziev rinatkhaziev committed Apr 26, 2012
Showing with 4 additions and 3 deletions.
  1. +2 −1 ad-code-manager.php
  2. +1 −1 common/lib/acm-wp-list-table.php
  3. +1 −1 providers/doubleclick-for-publishers.php
View
@@ -130,6 +130,7 @@ function action_load_providers() {
// Instantiate one that we need
if ( isset( $this->providers->{$this->current_provider_slug} ) ) {
$this->current_provider = new $this->providers->{$this->current_provider_slug}['provider'];
+ $this->current_provider->columns = apply_filters( 'acm_provider_columns', $this->current_provider->columns );
}
// Nothing to do without a provider
@@ -245,7 +246,7 @@ function ad_code_post_actions() {
'priority' => intval( $_POST['priority'] ),
);
foreach ( $this->current_provider->columns as $slug => $title ) {
- $ad_code_vals[$slug] = sanitize_text_field( $_POST[ $slug] );
+ $ad_code_vals[$slug] = sanitize_text_field( $_POST[$slug] );
}
switch ( $_POST['oper'] ) {
@@ -136,7 +136,7 @@ function column_default( $item, $column_name ) {
*
*/
function column_name( $item ) {
- $output = esc_html( $item['name'] );
+ $output = isset($item['name']) ? esc_html( $item['name'] ) : esc_html( $item['url_vars']['name'] );
$output .= $this->row_actions_output( $item );
return $output;
}
@@ -60,7 +60,7 @@ function __construct() {
// Only allow ad tags called from following URLS
$this->whitelisted_script_urls = array( 'ad.doubleclick.net' );
- $this->columns = array( 'site_name' => 'Site Name', 'zone1' => 'zone1' );
+ $this->columns = apply_filters( 'acm_provider_columns', array( 'site_name' => 'Site Name', 'zone1' => 'zone1' ) );
parent::__construct();
}

0 comments on commit 082bb20

Please sign in to comment.