Created
May 23, 2012 01:08
-
-
Save lgedeon/2772667 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Complex Media Network Ad Provider for Ad Code manager | |
* | |
* @since 0.2.x | |
*/ | |
class Complex_Media_Network_ACM_Provider extends ACM_Provider { | |
function __construct() { | |
// Default output HTML | |
$this->output_html = '<!-- cmnUNT | Begin ad tag --><script type="text/javascript">cmnUNT(\'%size_type%\', tile_num++);</script><!-- cmnUNT | End ad tag -->'; | |
// Default Ad Tag Ids (you will pass this in your shortcode or template tag) | |
$this->ad_tag_ids = array( | |
array( | |
'tag' => 'head_script', | |
'url_vars' => array( | |
) | |
), | |
array( | |
'tag' => 'header_ads', | |
'url_vars' => array( | |
'size_type' => '3x3', | |
) | |
), | |
array( | |
'tag' => 'fixed_height_side', | |
'url_vars' => array( | |
'size_type' => '300x250', | |
) | |
), | |
array( | |
'tag' => 'variable_height_side', | |
'url_vars' => array( | |
'size_type' => '300x250,300x600', | |
) | |
), | |
array( | |
'tag' => 'wallpaper_takeover', | |
'url_vars' => array( | |
) | |
), | |
); | |
// Only allow ad tags called from following URLS | |
$this->whitelisted_script_urls = array( 'cdn.complexmedianetwork.com' ); | |
// Add more columns as needed. | |
$this->columns = apply_filters( 'acm_provider_columns', array( 'cmnunt_zone' => 'Zone', 'priority' => 'Priority' ) ); | |
parent::__construct(); | |
} | |
/** | |
* Filter the columns that can appear in the list table of ad codes | |
*/ | |
function filter_list_table_columns( $columns ) { | |
return $columns; | |
} | |
} | |
class Complex_Media_Network_ACM_WP_List_Table extends ACM_WP_List_Table { | |
function __construct() { | |
parent::__construct( array( | |
'singular'=> 'complex_media_network_acm_wp_list_table', //Singular label | |
'plural' => 'complex_media_network_acm_wp_list_table', //plural label, also this well be one of the table css class | |
'ajax' => true | |
) ); | |
} | |
/** | |
* This is nuts and bolts of table representation - some columns have been removed because we do not use them in this instance but may in others. | |
*/ | |
function get_columns() { | |
$columns = array( | |
'id' => __( 'ID', 'ad-code-manager' ), | |
//'site_name' => __( 'Site Name', 'ad-code-manager' ), | |
//'cmnunt_subsilo' => __( 'Sub Silo', 'ad-code-manager' ), | |
//'cmnunt_tier' => __( 'Tier', 'ad-code-manager' ), | |
'cmnunt_zone' => __( 'Zone', 'ad-code-manager' ), | |
//'cmnunt_kw' => __( 'Keywords', 'ad-code-manager' ), | |
//'cmnunt_exclude' => __( 'Exclude', 'ad-code-manager' ), | |
'priority' => 'Priority', | |
'conditionals' => 'Conditionals', | |
); | |
return apply_filters( 'acm_list_table_columns', $columns ); | |
} | |
/** | |
* Representation of the site name | |
*/ | |
function column_site_name( $item ) { | |
$output = esc_html( $item['url_vars']['site_name'] ); | |
// $output .= $this->row_actions_output( $item ); | |
return $output; | |
} | |
/** | |
* Representation of cmnunt_subsilo | |
*/ | |
function column_cmnunt_subsilo( $item ) { | |
return sanitize_text_field( $item['url_vars']['cmnunt_subsilo'] ); | |
} | |
/** | |
* Representation of cmnunt_tier | |
*/ | |
function column_cmnunt_tier( $item ) { | |
return sanitize_text_field( $item['url_vars']['cmnunt_tier'] ); | |
} | |
/** | |
* Representation of cmnunt_zone | |
*/ | |
function column_cmnunt_zone( $item ) { | |
return sanitize_text_field( $item['url_vars']['cmnunt_zone'] ) . $this->row_actions_output( $item ); | |
} | |
/** | |
* Representation of cmnunt_kw | |
*/ | |
function column_cmnunt_kw( $item ) { | |
return sanitize_text_field( $item['url_vars']['cmnunt_kw'] ); | |
} | |
/** | |
* Representation of cmnunt_exclude | |
*/ | |
function column_cmnunt_exclude( $item ) { | |
return sanitize_text_field( $item['url_vars']['cmnunt_exclude'] ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment