/**
  * Install all requirements for Download Monitor
  */
 public function install()
 {
     // Init User Roles
     $this->init_user_roles();
     // Setup Taxonomies
     require_once 'class-dlm-taxonomy-manager.php';
     $taxonomy_manager = new DLM_Taxonomy_Manager();
     $taxonomy_manager->setup();
     // Setup Post Types
     require_once 'class-dlm-post-type-manager.php';
     $post_type_manager = new DLM_Post_Type_Manager();
     $post_type_manager->setup();
     // Create Database Table
     $this->install_tables();
     // Directory Protection
     $this->directory_protection();
     // Add endpoints
     require_once 'class-dlm-download-handler.php';
     $dlm_download_handler = new DLM_Download_Handler();
     $dlm_download_handler->add_endpoint();
     // Set default 'No access message'
     $dlm_no_access_error = get_option('dlm_no_access_error', '');
     if ('' === $dlm_no_access_error) {
         update_option('dlm_no_access_error', sprintf(__('You do not have permission to access this download. %sGo to homepage%s', 'download-monitor'), '<a href="' . home_url() . '">', '</a>'));
     }
     // Set the current version
     require_once 'class-dlm-constants.php';
     update_option(DLM_Constants::OPTION_CURRENT_VERSION, DLM_VERSION);
 }
 /**
  * __construct function.
  *
  * @access public
  */
 public function __construct()
 {
     global $wpdb;
     // Setup autoloader
     self::setup_autoloader();
     // Load plugin text domain
     load_textdomain('download-monitor', WP_LANG_DIR . '/download-monitor/download_monitor-' . get_locale() . '.mo');
     load_plugin_textdomain('download-monitor', false, dirname(plugin_basename(DLM_PLUGIN_FILE)) . '/languages');
     // Table for logs
     $wpdb->download_log = $wpdb->prefix . 'download_log';
     // Setup admin classes
     if (is_admin()) {
         // check if multisite and needs to create DB table
         // Setup admin scripts
         $admin_scripts = new DLM_Admin_Scripts();
         $admin_scripts->setup();
         // Setup Main Admin Class
         $dlm_admin = new DLM_Admin();
         $dlm_admin->setup();
         // Customize Admin CPT views
         new DLM_Admin_CPT();
         // Admin Write Panels
         new DLM_Admin_Writepanels();
         // Admin Media Browser
         new DLM_Admin_Media_Browser();
         // Admin Media Insert
         new DLM_Admin_Media_Insert();
         // Upgrade Manager
         $upgrade_manager = new DLM_Upgrade_Manager();
         $upgrade_manager->setup();
     }
     // Setup AJAX handler if doing AJAX
     if (defined('DOING_AJAX')) {
         new DLM_Ajax_Handler();
     }
     // Functions
     include_once 'download-functions.php';
     // Deprecated
     include_once 'deprecated.php';
     // Setup DLM Download Handler
     $download_handler = new DLM_Download_Handler();
     $download_handler->setup();
     // setup no access page endpoints
     $no_access_page_endpoint = new DLM_Download_No_Access_Page_Endpoint();
     $no_access_page_endpoint->setup();
     // Setup shortcodes
     $dlm_shortcodes = new DLM_Shortcodes();
     $dlm_shortcodes->setup();
     // Setup Widgets
     $widget_manager = new DLM_Widget_Manager();
     $widget_manager->setup();
     // Setup Taxonomies
     $taxonomy_manager = new DLM_Taxonomy_Manager();
     $taxonomy_manager->setup();
     // Setup Post Types
     $post_type_manager = new DLM_Post_Type_Manager();
     $post_type_manager->setup();
     // Setup actions
     $this->setup_actions();
 }