adsns_options ) $this->adsns_activate(); if ( ! is_admin() ) { add_filter( 'the_content', array( $this, 'adsns_content' ) ); add_filter( 'comment_id_fields', array( $this, 'adsns_comments' ) ); } } /* Show ads after comment form */ function adsns_end_comment_ad() { global $adsns_count; if ( ! is_feed() && $adsns_count < $this->adsns_options['max_ads'] && $adsns_count < $this->adsns_options['max_homepostads'] ) { echo '
%s
%s %s', __( 'Please note:', 'adsense-plugin' ), sprintf( '%s', __( "Select ad block to display in the widget you can on the plugin settings page in the 'Widget' tab.", 'adsense-plugin' ) ) ); ?>
' . __( 'Settings', 'adsense-plugin' ) . ''; array_unshift( $links, $settings_link ); } } return $links; } function adsns_register_plugin_links( $links, $file ) { if ( $file == 'adsense-plugin/adsense-plugin.php' ) { if ( ! is_network_admin() ) $links[] = '' . __( 'Settings', 'adsense-plugin' ) . ''; $links[] = '' . __( 'FAQ', 'adsense-plugin' ) . ''; $links[] = '' . __( 'Support', 'adsense-plugin' ) . ''; } return $links; } /* add help tab */ function adsns_add_tabs() { $screen = get_current_screen(); $args = array( 'id' => 'adsns', 'section' => '200538919' ); bws_help_tab( $screen, $args ); } function adsns_loop_start( $content ) { global $wp_query; if ( is_main_query() && $content === $wp_query ) { $this->adsns_is_main_query = true; } } function adsns_loop_end( $content ) { $this->adsns_is_main_query = false; } } /* Class */ } if ( ! class_exists( 'Adsns_List_Table' ) ) { if ( ! class_exists( 'WP_List_Table' ) ) { require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); } class Adsns_List_Table extends WP_List_Table { public $adsns_table_data, $adsns_table_adunits, $adsns_adunit_positions, $adsns_adunit_positions_pro; private $include_inactive_ads, $adsns_options, $item_counter; function __construct( $options ) { $this->include_inactive_ads = $options['include_inactive_ads']; $this->item_counter = 0; parent::__construct( array( 'singular' => __( 'item', 'adsense-plugin' ), 'plural' => __( 'items', 'adsense-plugin' ), 'ajax' => false, ) ); } function get_columns() { $columns = array( 'cb' => __( 'Display', 'adsense-plugin' ), 'name' => __( 'Name', 'adsense-plugin' ), 'code' => __( 'Id', 'adsense-plugin' ), 'summary' => __( 'Type / Size', 'adsense-plugin' ), 'status' => __( 'Status', 'adsense-plugin' ), 'position' => __( 'Position', 'adsense-plugin' ) ); if ( ! $this->adsns_adunit_positions ) { unset( $columns['position'] ); } return $columns; } function usort_reorder( $a, $b ) { $orderby = ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'name'; $order = ( ! empty( $_GET['order'] ) ) ? $_GET['order'] : 'asc'; $result = strcasecmp( $a[$orderby], $b[$orderby] ); return ( $order === 'asc' ) ? $result : -$result; } function get_sortable_columns() { $sortable_columns = array( 'name' => array( 'name',false ), 'code' => array( 'code',false ), 'summary' => array( 'summary', false ), 'status' => array( 'status', false ) ); return $sortable_columns; } /** * Add necessary css classes depending on item status * @param array $item The current item data. * @return void */ function single_row( $item ) { $row_class = isset( $item['status_value'] ) && 'INACTIVE' == $item['status_value'] ? 'adsns_inactive' : ''; if ( '1' != $this->include_inactive_ads ) { if ( isset( $item['status_value'] ) && 'INACTIVE' != $item['status_value'] ) { if ( $this->item_counter%2 == 0 ) { $row_class .= ( '' == $row_class ) ? 'adsns_table_row_odd' : ' adsns_table_row_odd'; } $this->item_counter++; } elseif ( isset( $item['status_value'] ) && 'INACTIVE' == $item['status_value'] ) { $row_class .= ( '' == $row_class ) ? 'hidden' : ' hidden'; } } else { if ( $this->item_counter%2 == 0 ) { $row_class .= ( '' == $row_class ) ? 'adsns_table_row_odd' : ' adsns_table_row_odd'; } $this->item_counter++; } $row_class = ( '' != $row_class ) ? ' class="' . $row_class . '"' : ''; echo "