Esempio n. 1
0
 /**
  * Install.
  *
  * @param bool $inc_post_types
  * @param bool $inc_endpoints
  */
 public function activate($inc_post_types = true, $inc_endpoints = true)
 {
     // Setup the database tables.
     $this->setup_tables();
     // Setup the user roles and capabilities.
     $this->setup_roles();
     // Post types and taxonomies.
     if ($inc_post_types || $inc_endpoints) {
         if ($inc_post_types) {
             Edr_PostTypes::register_post_types();
             Edr_PostTypes::register_taxonomies();
         }
         if ($inc_endpoints) {
             IB_Educator_Main::add_rewrite_endpoints();
         }
         flush_rewrite_rules();
     }
     // Setup email templates.
     $this->setup_email_templates();
     // Schedule cron events.
     $this->schedule_events();
     // Setup tax settings.
     $this->setup_taxes();
     // Do version specific updates.
     $current_version = get_option('ib_educator_version');
     if ($current_version) {
         if (version_compare($current_version, '1.4.3', '<=')) {
             $this->update_1_4_4();
         }
         if (version_compare($current_version, '1.5', '<=')) {
             $this->update_1_6();
         }
     }
     /**
      * Plugin activation hook.
      */
     do_action('ib_educator_activation');
     // Update the plugin version in database.
     update_option('ib_educator_version', IBEDUCATOR_VERSION);
 }