prefix . "akp_impressions_log"; $sql = "CREATE TABLE IF NOT EXISTS $table_name ( `post_id` int(11) NOT NULL, `ip_address` varchar(20) NOT NULL, `timestamp` int(11) NOT NULL );"; dbDelta($sql); $table_name = $wpdb->prefix . "akp_impressions_expire"; $sql = "CREATE TABLE IF NOT EXISTS $table_name ( `post_id` int(11) NOT NULL, `ip_address` varchar(20) NOT NULL, `expire` int(11) NOT NULL );"; dbDelta($sql); $table_name = $wpdb->prefix . "akp_click_log"; $sql = "CREATE TABLE IF NOT EXISTS $table_name ( `post_id` int(11) NOT NULL, `ip_address` varchar(20) NOT NULL, `timestamp` int(11) NOT NULL );"; dbDelta($sql); $table_name = $wpdb->prefix . "akp_click_expire"; $sql = "CREATE TABLE IF NOT EXISTS $table_name ( `post_id` int(11) NOT NULL, `ip_address` varchar(20) NOT NULL, `expire` int(11) NOT NULL );"; dbDelta($sql); $table_name = $wpdb->prefix . "terms"; $sql = "INSERT INTO $table_name (`name`, `slug`, `term_group`) VALUES ('Sidebar', 'sidebar', '0')"; dbDelta($sql); $term_id = mysql_insert_id(); $table_name = $wpdb->prefix . "term_taxonomy"; $sql = "INSERT INTO $table_name (`term_id`, `taxonomy`, `description`, `parent`, `count`) VALUES ('".$term_id."', 'advert_types', '', '0', '0')"; dbDelta($sql); add_option("apk_db_version", $akp_db_version); } // Register hooks at activation register_activation_hook(__FILE__,'akp_install'); // END INSTALL if (get_option("apk_db_version") != $akp_db_version) { // Execute your upgrade logic here require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $table_name = $wpdb->prefix . "akp_impressions_log"; $sql = "CREATE TABLE IF NOT EXISTS $table_name ( `post_id` int(11) NOT NULL, `ip_address` varchar(20) NOT NULL, `timestamp` int(11) NOT NULL );"; dbDelta($sql); $table_name = $wpdb->prefix . "akp_impressions_expire"; $sql = "CREATE TABLE IF NOT EXISTS $table_name ( `post_id` int(11) NOT NULL, `ip_address` varchar(20) NOT NULL, `expire` int(11) NOT NULL );"; dbDelta($sql); // Then update the version value update_option("apk_db_version", $akp_db_version); } function akp_settings_link($action_links,$plugin_file){ if($plugin_file==plugin_basename(__FILE__)){ $akp_settings_link = '' . __("Settings") . ''; array_unshift($action_links,$akp_settings_link); } return $action_links; } add_filter('plugin_action_links','akp_settings_link',10,2); require_once plugin_dir_path(__FILE__).'includes/widget.php'; require_once plugin_dir_path(__FILE__).'includes/admin_area.php'; require_once plugin_dir_path(__FILE__).'includes/output.php'; require_once plugin_dir_path(__FILE__).'js/adkingpro-js.php'; ?>