copyAd($id); } // Single } else { $id = intval($_REQUEST['ad']); if ($id) { check_admin_referer( "copy_ad_$id" ); $advman_engine->copyAd($id); } } } } // Delete if( 'delete' === $action ) { if (!empty($_REQUEST['ad'])) { // Bulk if (is_array($_REQUEST['ad'])) { $ids = $_REQUEST['ad']; foreach ($ids as $id) { $id = intval($id); $advman_engine->deleteAd($id); } // Single } else { $id = intval($_REQUEST['ad']); if ($id) { $advman_engine->deleteAd($id); } } } } $url = remove_query_arg(array('action', 'ad', '_wpnonce')); wp_redirect($url); } } function process() { global $advman_list_table; echo '

' . __('Ads', 'advman'); if ( ! empty( $_REQUEST['s'] ) ) printf( ' ' . __('Search results for “%s”', 'advman') . '', get_search_query() ); echo '

'; $advman_list_table->views(); $advman_list_table->prepare_items(); ?>
search_box( 'search', 'ad' ); ?>
display(); ?>
'; echo '.wp-list-table .column-id { width: 5%; }'; echo '.wp-list-table .column-name { width: 20%; }'; echo '.wp-list-table .column-type { width: 15%; }'; echo '.wp-list-table .column-format { width: 15%; }'; echo '.wp-list-table .column-active { width: 10%; }'; echo '.wp-list-table .column-def { width: 10%; }'; echo '.wp-list-table .column-stats { width: 10%; }'; echo '.wp-list-table .column-date { width: 15%; }'; echo ''; } /** * Add contextual help for ad list screen */ function add_contextual_help() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '

' . __('This screen provides access to all of your ads. Each ad is listed in the table below. You can customize the display of this screen to suit your workflow.') . '

' ) ); get_current_screen()->add_help_tab( array( 'id' => 'screen-content', 'title' => __('Screen Content'), 'content' => '

' . __('You can customize the display of this screen’s contents in a number of ways:') . '

' . '' ) ); get_current_screen()->add_help_tab( array( 'id' => 'action-links', 'title' => __('Available Actions'), 'content' => '

' . __('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:') . '

' . '' ) ); get_current_screen()->add_help_tab( array( 'id' => 'bulk-actions', 'title' => __('Bulk Actions'), 'content' => '

' . __('You can also perform actions on multiple ads at once. Select the ads you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply. Use the checkbox in the header to select or deselect all items.') . '

' . '' ) ); get_current_screen()->set_help_sidebar( '

' . __('For more information:') . '

' . '

' . __('Plugin Page') . '

' . '

' . __('Support Forums') . '

' ); } function add_options() { $option = 'per_page'; $args = array( 'label' => 'Ads', 'default' => 10, 'option' => 'ads_per_page' ); add_screen_option( $option, $args ); } } ?>