'Large Leaderboard (970x90)', '728x90' => 'Leaderboard (728x90)', '468x60' => 'Banner (468x60)', '336x280' => 'Large Rectangle (336x280)', '320x100' => 'Large Mobile Banner (320x100)', '320x50' => 'Mobile Banner (320x50)', '300x600' => 'Large Skyscraper (300x600)', '300x250' => 'Medium Rectangle (300x250)', '250x250' => 'Square (250x250)', '234x60' => 'Half Banner (234x60)', '200x200' => 'Small Square (200x200)', '180x150' => 'Small Rectangle (180x150)', '160x600' => 'Wide Skyscraper (160x600)', '125x125' => 'Button (125x125)', '120x600' => 'Skyscraper (120x600)', '120x240' => 'Vertical Banner (120x240)', # Google Adsense Link Unit Sizes '728x15' => 'Displays 4 links (728x15)', '468x15' => 'Displays 4 links (468x15)', '200x90' => 'Displays 3 links (200x90)', '180x90' => 'Displays 3 links (180x90)', '160x90' => 'Displays 3 links (160x90)', '120x90' => 'Displays 3 links (120x90)', ); if(!class_exists('AmazingAds')) { class AmazingAds { var $adsizes,$amads_option=array(); //constants const CAPABILITY = 'manage_options'; const VERSION = '0.0.5'; const VERSION_FIELD_NAME = 'amAdsmanager_var'; const post_type ="amAdsMananger"; //Constructer public function __construct() { global $adsizes; $this->adsizes =$adsizes; //action hooks add_action( 'admin_init', array( &$this,'amads_init_admin') ); add_action('load-widgets.php',array(&$this,'enqueue_script') ); add_action( 'after_setup_theme', array( &$this, 'setup_amAds' ) ); add_action('widgets_init',array(&$this,'amads_widget')); add_action( 'manage_posts_custom_column', array( &$this, 'posts_custom_column' ), 10, 2 ); add_action( 'save_post', array( &$this,'update_custom_meta_fields' ) ); add_action( 'add_meta_boxes', array( &$this, 'add_custom_box' ) ); add_action('admin_head',array(&$this,'getamadsData')); add_action('init',array(&$this,'front_style')); add_action( 'admin_menu', array( &$this,'add_amAds_sub_pages' ) ); //filters add_filter( 'manage_amadsmananger_posts_columns', array( &$this, 'add_custom_columns' ) ); add_filter('post_updated_messages', array( &$this, 'amadsmananger_updated_messages' ) ); add_filter( "mce_external_plugins", array( &$this, 'amads_add_tinymce_plugin' ) ); add_filter( 'mce_buttons', array( &$this, 'amads_register_my_tc_button' ) ); add_filter('the_content', array( &$this, 'amads_a_content' )); add_filter('the_content', array( &$this, 'amads_b_content' )); // shortcodes add_shortcode( 'amads', array( &$this, 'amads_shortcode' ) ); } // setup custom post type public function setup_amAds(){ //CUSTOM POST TYPES $amAd_labels = array( 'name' => _x('All Ads', 'post type general name'), 'singular_name' => _x('All Ads', 'post type singular name'), 'add_new' => _x('Add New Ads', 'amAds'), 'add_new_item' => __('Add New Ads'), 'edit_item' => __('Edit Ads'), 'new_item' => __('New Ads'), 'all_items' => __('All Ads'), 'view_item' => __('View Ads'), 'search_items' => __('Search Ads'), 'not_found' => __('No Ads found'), 'not_found_in_trash' => __('No Tracks found in Trash'), 'parent_item_colon' => '', 'menu_name' => 'Amazing Ads Manager' ); $amAd_args = array( 'labels' => $amAd_labels, 'public' => false, 'show_ui' => true, 'show_in_menu' => true, 'has_archive' => true, 'hierarchical' => false, 'menu_icon' => plugins_url('/assets/images/icon.png', __FILE__ ), 'supports' => array('title', 'custom_fields'), 'register_meta_box_vo' => array(&$this, 'add_meta_boxes') ); register_post_type( AmazingAds::post_type, $amAd_args ); } /* * amadsDisplay * @param int $id,limit string $size,$order * @since 0.0.4 */ public function amadsDisplay($size,$order,$limit){ //set limit to 1 as default $limit=(!empty($limit)||!int($limit))? $limit:1; // default size $size=(!empty($size))? $size:'320x100'; if($order=="rand"){ $amads_args = array( 'post_type' => 'amadsmananger', 'orderby' => 'rand', 'meta_key' => 'ad_sizes', 'showposts'=>$limit, 'meta_value' => $size, 'post_status'=>'publish' ); } if($order=="DESC"){ $amads_args = array( 'post_type' => 'amadsmananger', 'order' => 'DESC', 'meta_key' => 'ad_sizes', 'showposts'=>$limit, 'meta_value' => $size, 'post_status'=>'publish' ); } if($order=="ASC"){ $amads_args = array( 'post_type' => 'amadsmananger', 'order' => 'ASC', 'meta_key' => 'ad_sizes', 'showposts'=>$limit, 'meta_value' => $size, 'post_status'=>'publish' ); }?>
amads_option=get_option(AmazingAds::post_type); if($this->amads_option['amads-bppc-e']==true){ $newcontent=$this->amadsDisplay($this->amads_option['amads-as'],$this->amads_option['amads-adot'],$this->amads_option['amads-limit']); return $newcontent.$amads_data_content; }else { return $amads_data_content; } } /* * amads_after_content * @param bigtext $amads_data_content * @since 0.0.4 */ public function amads_a_content($amads_data_content){ //global $post; $this->amads_option=get_option(AmazingAds::post_type); if($this->amads_option['amads-appc-e']==true){ $newcontent=$this->amadsDisplay($this->amads_option['amads-aas'],$this->amads_option['amads-aadot'],$this->amads_option['amads-alimit']); return $amads_data_content.$newcontent; }else { return $amads_data_content; } } /* * settingDefault * @param null * @since 0.0.4 */ public function settingDefault(){ return $default=array( 'amads-bppc-e' =>'', 'amads-limit' =>'', 'amads-adot' => '', 'amads-as' => '', 'amads-appc-e' =>'', 'amads-alimit' =>'', 'amads-aadot' => '', 'amads-aas' => '' ); } //initialize from style public function front_style(){ if(is_admin()){ wp_enqueue_style('amads-admin-style', plugins_url('/assets/css/amads.css', __FILE__)); } else { wp_enqueue_style('amads-front-style', plugins_url('/assets/css/amads-front.css', __FILE__)); } } function my_admin_error_notice() { $class = "update-nag"; $message = "This plugin will not work properly with this WordPress version, Update your WordPress to latest version"; echo"$message