Permalink
Browse files

Adding publicly available XML for accessing license key for a domain.

  • Loading branch information...
1 parent ac6a654 commit 8740aadde3a30bc64573b83b27373777d026a840 @frankmullenger committed Jan 31, 2012
Showing with 39 additions and 3 deletions.
  1. +1 −0 LICENSE.md
  2. +2 −3 _config.php
  3. +36 −0 code/admin/ShopSettings.php
View
1 LICENSE.md
@@ -28,6 +28,7 @@ You are NOT permitted to
* Use the Software in more than one instance or location (URL, domain, subdomain, etc.);
* Modify the software and/or create applications and modules which allow the Software to function in more than one instance or location (URL, domain, subdomain, etc.);
* Modify and/or remove attribution notices or labels displayed in the admin area of the Software.
+* Modify and/or remove swipestripe.xml or prevent swipestripe.xml from being publicly available.
* Copy the Software and install that single program for simultaneous use on multiple machines;
* Swipe Stripe does not provide update files for modified versions of the software. A version of the software is considered modified if some files are modified in the folder swipestripe or other swipestripe folders, or the structure and integrity of files and folders has been tampered with. The current conditions apply to modifications made by the licensee or a third party, as well as to modifications made by Swipe Stripe upon an agreement with the licensee.
View
5 _config.php
@@ -13,8 +13,7 @@
//Rules for product links
Director::addRules(50, array(
//'product//$ID' => 'Product_Controller',
- 'product//$ID/$Action' => 'Product_Controller'
+ 'product//$ID/$Action' => 'Product_Controller',
+ 'swipestripe.xml' => 'ShopSettings_Controller'
));
-//TODO is this necessary?
-LeftAndMain::require_css('swipestripe/css/ShopAdmin.css');
View
36 code/admin/ShopSettings.php
@@ -27,6 +27,15 @@ class ShopSettings extends DataObjectDecorator {
public static function set_license_key($key) {
self::$license_key = $key;
}
+
+ /**
+ * Get the license key
+ *
+ * @return String License key
+ */
+ public static function get_license_key() {
+ return self::$license_key;
+ }
/**
* Add database fields for shop settings like emails etc.
@@ -96,4 +105,31 @@ function updateCMSFields(FieldSet &$fields) {
//$fields->addFieldToTab('Root.Shop.Emails.Signature', new HtmlEditorField('EmailSignature', 'Signature for all emails', 15));
}
+}
+
+/**
+ * Controller to display a shop settings such as the license key publicly.
+ *
+ * @author Frank Mullenger <frankmullenger@gmail.com>
+ * @copyright Copyright (c) 2011, Frank Mullenger
+ * @package swipestripe
+ * @subpackage admin
+ * @version 1.0
+ */
+class ShopSettings_Controller extends Page_Controller {
+
+ public function init() {
+
+ header ("content-type: text/xml");
+ $licenseKey = ShopSettings::get_license_key();
+ $xml = <<<EOS
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<SwipeStripe>
+ <License>$licenseKey</License>
+</SwipeStripe>
+EOS;
+ echo $xml;
+ exit;
+ }
+
}

0 comments on commit 8740aad

Please sign in to comment.