Permalink
Browse files

API CHANGE Removed GeoIP functionality from sapphire. This now belong…

…s in a separate "silverstripe-geoip" GitHub repository: https://github.com/silverstripe-labs/silverstripe-geoip
  • Loading branch information...
1 parent d678c12 commit 3d8079c1b55a1f58b365d420759e11235c2ab371 @halkyon halkyon committed with chillu Mar 17, 2011
Showing with 2 additions and 500 deletions.
  1. +2 −1 docs/en/changelogs/3.0.0.md
  2. +0 −35 forms/CountryDropdownField.php
  3. +0 −452 integration/Geoip.php
  4. +0 −12 tests/integration/GeoipTest.php
@@ -142,4 +142,5 @@ Alternatively, you can enforce database usage by setting `SapphireTest->usesData
* `Notifications`: If you make use of this, copy the classes from 2.4 into your project.
* `Archive`, `TarballArchive`: If you make use of these, copy the classes from 2.4 into your project.
* `XML`: Use PHP's built-in SimpleXML instead
- * `DataObjectLog`: There is no replacement for this.
+ * `DataObjectLog`: There is no replacement for this.
+ * `GeoIP`: Moved to separate ["geoip" module](https://github.com/silverstripe-labs/silverstripe-geoip)
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * A simple extension to {@link DropdownField}, pre-configured to list countries.
- * It will default to the country of the current visitor or use the default
- * country code provided using {@link Geoip::set_default_country_code()}.
- *
- * @package forms
- * @subpackage fields-relational
- */
-class CountryDropdownField extends DropdownField {
-
- protected $defaultToVisitorCountry = true;
-
- function __construct($name, $title = null, $source = null, $value = "", $form=null) {
- if(!is_array($source)) $source = Geoip::getCountryDropDown();
- if(!$value) $value = Geoip::visitor_country();
-
- parent::__construct($name, ($title===null) ? $name : $title, $source, $value, $form);
- }
-
- function defaultToVisitorCountry($val) {
- $this->defaultToVisitorCountry = $val;
- }
-
- function Value() {
- $source = $this->getSource();
- if($this->defaultToVisitorCountry && !$this->value || !isset($source[$this->value])) {
- return ($vc = Geoip::visitor_country()) ? $vc : Geoip::get_default_country_code();
- } else {
- return $this->value;
- }
- }
-
-}
Oops, something went wrong.

0 comments on commit 3d8079c

Please sign in to comment.