/** * Main installation method of the plugin */ function install_plugin() { $this->o = get_option('gd-star-rating'); $this->i = get_option('gd-star-rating-import'); $this->g = get_option('gd-star-rating-gfx'); $this->wpr8 = get_option('gd-star-rating-wpr8'); if ($this->o["build"] < $this->default_options["build"]) { if (is_object($this->g)) { $this->g = $this->gfx_scan(); update_option('gd-star-rating-gfx', $this->g); } gdDBInstallGDSR::delete_tables(STARRATING_PATH); gdDBInstallGDSR::create_tables(STARRATING_PATH); gdDBInstallGDSR::upgrade_tables(STARRATING_PATH); gdDBInstallGDSR::alter_tables(STARRATING_PATH); $this->o["database_upgrade"] = date("r"); GDSRDB::insert_default_templates(STARRATING_PATH); GDSRDB::insert_extras_templates(STARRATING_PATH); GDSRDB::insert_extras_templates(STARRATING_XTRA_PATH, false); GDSRDB::update_default_templates(STARRATING_PATH); $this->o = gdFunctionsGDSR::upgrade_settings($this->o, $this->default_options); $this->o["version"] = $this->default_options["version"]; $this->o["date"] = $this->default_options["date"]; $this->o["status"] = $this->default_options["status"]; $this->o["build"] = $this->default_options["build"]; update_option('gd-star-rating', $this->o); } if (!is_array($this->o)) { update_option('gd-star-rating', $this->default_options); $this->o = get_option('gd-star-rating'); gdDBInstallGDSR::create_tables(STARRATING_PATH); } if (!is_array($this->i)) { update_option('gd-star-rating-import', $this->default_import); $this->i = get_option('gd-star-rating-import'); } else { $this->i = gdFunctionsGDSR::upgrade_settings($this->i, $this->default_import); update_option('gd-star-rating-import', $this->i); } if (!is_object($this->g)) { $this->g = $this->gfx_scan(); update_option('gd-star-rating-gfx', $this->g); } if (!is_object($this->wpr8)) { update_option('gd-star-rating-wpr8', $this->default_wpr8); $this->wpr8 = get_option('gd-star-rating-wpr8'); } else { $this->wpr8 = gdFunctionsGDSR::upgrade_settings($this->wpr8, $this->default_wpr8); update_option('gd-star-rating-wpr8', $this->wpr8); } $this->use_nonce = $this->o["use_nonce"] == 1; define("STARRATING_VERSION", $this->o["version"] . '_' . $this->o["build"]); define("STARRATING_DEBUG_ACTIVE", $this->o["debug_active"]); define("STARRATING_STARS_GENERATOR", $this->o["gfx_generator_auto"] == 0 ? "DIV" : "GFX"); $this->t = GDSRDB::get_database_tables(); }