Completed
Push — 2 ( d7b6ee...12150e )
by Matthew
07:43
created
code/extensions/FoxyStripeSiteConfig.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -2,23 +2,23 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FoxyStripeSiteConfig extends DataExtension{
4 4
 
5
-	private static $db = array(
6
-		'StoreName' => 'Varchar(255)',
7
-		'StoreKey' => 'Varchar(60)',
8
-		'MultiGroup' => 'Boolean',
9
-		'ProductLimit' => 'Int',
10
-		'CartValidation' => 'Boolean',
11
-		'MaxQuantity' => 'Int',
5
+    private static $db = array(
6
+        'StoreName' => 'Varchar(255)',
7
+        'StoreKey' => 'Varchar(60)',
8
+        'MultiGroup' => 'Boolean',
9
+        'ProductLimit' => 'Int',
10
+        'CartValidation' => 'Boolean',
11
+        'MaxQuantity' => 'Int',
12 12
         'CustomSSL' => 'Boolean',
13 13
         'RemoteDomain' => 'Varchar(255)',
14
-	);
14
+    );
15 15
 
16 16
     // Set Default values
17 17
     private static $defaults = array(
18 18
         'ProductLimit' => 10
19 19
     );
20 20
 
21
-	public function updateCMSFields(FieldList $fields){
21
+    public function updateCMSFields(FieldList $fields){
22 22
 
23 23
         // set TabSet names to avoid spaces from camel case
24 24
         $fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe'));
@@ -26,108 +26,108 @@  discard block
 block discarded – undo
26 26
         // settings tab
27 27
         $fields->addFieldsToTab('Root.FoxyStripe.Settings', array(
28 28
             // Store Details
29
-			HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
30
-			LiteralField::create('DetailsIntro', _t(
31
-				'FoxyStripeSiteConfig.DetailsIntro',
29
+            HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
30
+            LiteralField::create('DetailsIntro', _t(
31
+                'FoxyStripeSiteConfig.DetailsIntro',
32 32
                 '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditStore" target="_blank">FoxyCart store settings</a>.'
33 33
             )),
34
-			CheckboxField::create('CustomSSL', 'Use custom SSL'),
34
+            CheckboxField::create('CustomSSL', 'Use custom SSL'),
35 35
             TextField::create('RemoteDomain', 'Store remote domain')
36 36
                 ->setDescription('custom subdomain for FoxyCart')
37 37
                 ->displayIf('CustomSSL')->isChecked()->end(),
38
-			TextField::create('StoreName')
39
-				->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Sub Domain'))
40
-				->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'the sub domain for your FoxyCart store'))
38
+            TextField::create('StoreName')
39
+                ->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Sub Domain'))
40
+                ->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'the sub domain for your FoxyCart store'))
41 41
                 ->hideIf('CustomSSL')->isChecked()->end(),
42 42
 
43
-			// Advanced Settings
44
-			HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3),
45
-			LiteralField::create('AdvancedIntro', _t(
43
+            // Advanced Settings
44
+            HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3),
45
+            LiteralField::create('AdvancedIntro', _t(
46 46
                 'FoxyStripeSiteConfig.AdvancedIntro',
47
-				'<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures" target="_blank">FoxyCart advanced store settings</a>.</p>'
48
-			)),
49
-			ReadonlyField::create('DataFeedLink', _t('FoxyStripeSiteConfig.DataFeedLink', 'FoxyCart DataFeed URL'), self::getDataFeedLink())
50
-				->setDescription(_t('FoxyStripeSiteConfig.DataFeedLinkDescription', 'copy/paste to FoxyCart')),
51
-			CheckboxField::create('CartValidation')
52
-				->setTitle(_t('FoxyStripeSiteConfig.CartValidation', 'Enable Cart Validation'))
53
-				->setDescription(_t(
47
+                '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures" target="_blank">FoxyCart advanced store settings</a>.</p>'
48
+            )),
49
+            ReadonlyField::create('DataFeedLink', _t('FoxyStripeSiteConfig.DataFeedLink', 'FoxyCart DataFeed URL'), self::getDataFeedLink())
50
+                ->setDescription(_t('FoxyStripeSiteConfig.DataFeedLinkDescription', 'copy/paste to FoxyCart')),
51
+            CheckboxField::create('CartValidation')
52
+                ->setTitle(_t('FoxyStripeSiteConfig.CartValidation', 'Enable Cart Validation'))
53
+                ->setDescription(_t(
54 54
                     'FoxyStripeSiteConfig.CartValidationDescription',
55 55
                     'You must <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures#use_cart_validation" target="_blank">enable cart validation</a> in the FoxyCart admin.'
56 56
             )),
57
-			ReadonlyField::create('StoreKey')
58
-				->setTitle(_t('FoxyStripeSiteConfig.StoreKey', 'FoxyCart API Key'))
59
-				->setDescription(_t('FoxyStripeSiteConfig.StoreKeyDescription', 'copy/paste to FoxyCart')),
60
-			ReadonlyField::create('SSOLink', _t('FoxyStripeSiteConfig.SSOLink', 'Single Sign On URL'), self::getSSOLink())
61
-				->setDescription(_t('FoxyStripeSiteConfig.SSOLinkDescription', 'copy/paste to FoxyCart'))
57
+            ReadonlyField::create('StoreKey')
58
+                ->setTitle(_t('FoxyStripeSiteConfig.StoreKey', 'FoxyCart API Key'))
59
+                ->setDescription(_t('FoxyStripeSiteConfig.StoreKeyDescription', 'copy/paste to FoxyCart')),
60
+            ReadonlyField::create('SSOLink', _t('FoxyStripeSiteConfig.SSOLink', 'Single Sign On URL'), self::getSSOLink())
61
+                ->setDescription(_t('FoxyStripeSiteConfig.SSOLinkDescription', 'copy/paste to FoxyCart'))
62 62
         ));
63 63
 
64 64
         // configuration warning
65
-		if(FoxyCart::store_name_warning()!==null){
66
-			$fields->insertBefore(LiteralField::create(
65
+        if(FoxyCart::store_name_warning()!==null){
66
+            $fields->insertBefore(LiteralField::create(
67 67
                 "StoreSubDomainHeaderWarning",
68 68
                 _t(
69 69
                     'FoxyStripeSiteConfig.StoreSubDomainHeadingWarning',
70 70
                     "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
71 71
                 )
72 72
             ), 'StoreDetails');
73
-		}
73
+        }
74 74
 
75 75
         // products tab
76
-		$fields->addFieldsToTab('Root.FoxyStripe.Products', array(
77
-			HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
78
-			CheckboxField::create('MultiGroup')
79
-				->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
80
-				->setDescription(_t(
76
+        $fields->addFieldsToTab('Root.FoxyStripe.Products', array(
77
+            HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
78
+            CheckboxField::create('MultiGroup')
79
+                ->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
80
+                ->setDescription(_t(
81 81
                     'FoxyStripeSiteConfig.MultiGroupDescription',
82 82
                     'Allows products to be shown in multiple Product Groups'
83 83
                 )),
84
-			HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
85
-			NumericField::create('ProductLimit')
86
-				->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
87
-				->setDescription(_t(
84
+            HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
85
+            NumericField::create('ProductLimit')
86
+                ->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
87
+                ->setDescription(_t(
88 88
                     'FoxyStripeSiteConfig.ProductLimitDescription',
89 89
                     'Number of Products to show per page on a Product Group'
90 90
                 )),
91
-			HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
92
-			NumericField::create('MaxQuantity')
93
-				->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
94
-				->setDescription(_t(
91
+            HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
92
+            NumericField::create('MaxQuantity')
93
+                ->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
94
+                ->setDescription(_t(
95 95
                     'FoxyStripeSiteConfig.MaxQuantityDescription',
96 96
                     'Sets max quantity for product form dropdown (add to cart form - default 10)'
97 97
                 ))
98
-		));
98
+        ));
99 99
 
100 100
         // categories tab
101
-		$fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
102
-			HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
103
-			LiteralField::create('CategoryDescrip', _t(
101
+        $fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
102
+            HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
103
+            LiteralField::create('CategoryDescrip', _t(
104 104
                 'FoxyStripeSiteConfig.CategoryDescrip',
105 105
                 '<p>FoxyCart Categories offer a way to give products additional behaviors that cannot be accomplished by product options alone, including category specific coupon codes, shipping and handling fees, and email receipts. <a href="https://wiki.foxycart.com/v/2.0/categories" target="_blank">Learn More</a></p><p>Categories you\'ve created in FoxyStripe must also be created in your <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">FoxyCart Categories</a> admin panel.</p>'
106 106
             )),
107
-			GridField::create(
107
+            GridField::create(
108 108
                 'ProductCategory',
109 109
                 _t('FoxyStripeSiteConfig.ProductCategory', 'FoxyCart Categories'),
110 110
                 ProductCategory::get(),
111 111
                 GridFieldConfig_RecordEditor::create()
112 112
             )
113
-		));
113
+        ));
114 114
 
115 115
         // option groups tab
116
-		$fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
117
-			HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
118
-			LiteralField::create('OptionGroupsDescrip', _t(
116
+        $fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
117
+            HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
118
+            LiteralField::create('OptionGroupsDescrip', _t(
119 119
                 'FoxyStripeSiteConfig.OptionGroupsDescrip',
120 120
                 '<p>Product Option Groups allow you to name a set of product options.</p>'
121 121
             )),
122
-			GridField::create(
122
+            GridField::create(
123 123
                 'OptionGroup',
124 124
                 _t('FoxyStripeSiteConfig.OptionGroup', 'Product Option Groups'),
125 125
                 OptionGroup::get(),
126 126
                 GridFieldConfig_RecordEditor::create()
127 127
             )
128
-		));
128
+        ));
129 129
 
130
-	}
130
+    }
131 131
 
132 132
     private static function getSSOLink() {
133 133
         return Director::absoluteBaseURL()."foxystripe/sso/";
Please login to merge, or discard this patch.
code/controllers/FoxyStripe_Controller.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,37 +2,37 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FoxyStripe_Controller extends Page_Controller {
4 4
 	
5
-	const URLSegment = 'foxystripe';
5
+    const URLSegment = 'foxystripe';
6 6
 
7
-	public function getURLSegment() {
8
-		return self::URLSegment;
9
-	}
7
+    public function getURLSegment() {
8
+        return self::URLSegment;
9
+    }
10 10
 	
11
-	static $allowed_actions = array(
12
-		'index',
11
+    static $allowed_actions = array(
12
+        'index',
13 13
         'sso'
14
-	);
14
+    );
15 15
 	
16
-	public function index() {
17
-	    // handle POST from FoxyCart API transaction
18
-		if ((isset($_POST["FoxyData"]) OR isset($_POST['FoxySubscriptionData']))) {
19
-			$FoxyData_encrypted = (isset($_POST["FoxyData"])) ?
16
+    public function index() {
17
+        // handle POST from FoxyCart API transaction
18
+        if ((isset($_POST["FoxyData"]) OR isset($_POST['FoxySubscriptionData']))) {
19
+            $FoxyData_encrypted = (isset($_POST["FoxyData"])) ?
20 20
                 urldecode($_POST["FoxyData"]) :
21 21
                 urldecode($_POST["FoxySubscriptionData"]);
22
-			$FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(),$FoxyData_encrypted);
23
-			self::handleDataFeed($FoxyData_encrypted, $FoxyData_decrypted);
22
+            $FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(),$FoxyData_encrypted);
23
+            self::handleDataFeed($FoxyData_encrypted, $FoxyData_decrypted);
24 24
 			
25
-			// extend to allow for additional integrations with Datafeed
26
-			$this->extend('addIntegrations', $FoxyData_encrypted);
25
+            // extend to allow for additional integrations with Datafeed
26
+            $this->extend('addIntegrations', $FoxyData_encrypted);
27 27
 			
28
-			return 'foxy';
28
+            return 'foxy';
29 29
 			
30
-		} else {
30
+        } else {
31 31
 			
32
-			return "No FoxyData or FoxySubscriptionData received.";
32
+            return "No FoxyData or FoxySubscriptionData received.";
33 33
 			
34
-		}
35
-	}
34
+        }
35
+    }
36 36
 
37 37
     public function handleDataFeed($encrypted, $decrypted){
38 38
         //handle encrypted & decrypted data
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 
218 218
 
219 219
 
220
-	// Single Sign on integration with FoxyCart
220
+    // Single Sign on integration with FoxyCart
221 221
     public function sso() {
222 222
 
223
-	    // GET variables from FoxyCart Request
223
+        // GET variables from FoxyCart Request
224 224
         $fcsid = $this->request->getVar('fcsid');
225 225
         $timestampNew = strtotime('+30 days');
226 226
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $redirect_complete = 'https://' . $link . '/checkout?fc_auth_token=' . $auth_token .
247 247
             '&fcsid=' . $fcsid . '&fc_customer_id=' . $Member->Customer_ID . '&timestamp=' . $timestampNew;
248 248
 	
249
-	    $this->redirect($redirect_complete);
249
+        $this->redirect($redirect_complete);
250 250
 
251 251
     }
252 252
 	
Please login to merge, or discard this patch.