static function init() { global $advman_engine, $advman_list; $advman_list = new Advman_Template_Table_List(); //Detect when a bulk action is being triggered... $action = OX_Tools::sanitize_request_var('action'); // Perform actions if ($action) { $ads = Advman_Tools::get_current_ads(); if ($ads) { if (count($ads) == 1) { // If there is a single ad selected, then perform the action on that ad. Notice messages and workflow are different in this case foreach ($ads as $ad) { Advman_Admin::ad_action($action, $ad); } } else { // These are bulk actions switch ($action) { case 'copy': foreach ($ads as $ad) { if ($ad) { $advman_engine->copyAd($ad->id); } } Advman_Admin::add_notice('advman-notice-once', __("Ads copied"), false); break; case 'delete': foreach ($ads as $ad) { if ($ad) { $advman_engine->deleteAd($ad->id); } } Advman_Admin::add_notice('advman-notice-once', __("Ads deleted"), false); break; } } } else { $ad = Advman_Tools::get_current_ad(); if ($ad) { Advman_Admin::ad_action($action, $ad); } } $url = remove_query_arg(array('action', 'ad', 'network', '_wpnonce')); wp_redirect($url); } }
static function admin_footer_text($default_text) { $addition = ''; $page = OX_Tools::sanitize_request_var('page'); if (stristr($page, 'advman-') !== false) { $addition = " | <span id='footer-thankyou'>" . __("Ads by <a href='http://wordpress.org/plugins/advertising-manager/'>Advertising Manager</a>", "advman") . " </span><span style='font-size:x-small;color:silver'>v" . ADVMAN_VERSION . "</span>"; } return $default_text . $addition; }
static function get_current_ads() { global $advman_engine; $ads = false; $targets = OX_Tools::sanitize_request_var('ad'); if (is_array($targets)) { $ads = array(); foreach ($targets as $target) { $ads[$target] = $advman_engine->getAd($target); } } return $ads; }