From 852f382aca896d2cd3c9ffd801a5c6b621b57336 Mon Sep 17 00:00:00 2001
From: Hugo Locurcio
Date: Thu, 11 Jun 2020 10:36:38 +0200
Subject: [PATCH] Store Patreon plugin inside the repository
This removes the need to initialize a (broken) submodule URL
to get a local copy of the website running.
The plugin was cloned from https://github.com/pcvonz/oc-patreongoalstatus-plugin
(commit 5d685ddc9bbb522d668f7906185f24b1319da3b3).
---
.gitattributes | 1 +
.gitignore | 1 +
README.md | 2 +-
plugins/paulvonzimmerman/patreon | 1 -
plugins/paulvonzimmerman/patreon/.gitignore | 5 +
plugins/paulvonzimmerman/patreon/Plugin.php | 28 ++++
plugins/paulvonzimmerman/patreon/README.md | 29 ++++
.../patreon/assets/css/error.css | 3 +
.../patreon/assets/css/goal.css | 80 +++++++++++
.../assets/images/become_a_patron_button.png | Bin 0 -> 2488 bytes
.../patreon/assets/images/patreon.png | Bin 0 -> 2234 bytes
.../patreon/assets/js/goal.js | 19 +++
.../patreon/assets/patreon_white.png | Bin 0 -> 2464 bytes
plugins/paulvonzimmerman/patreon/bower.json | 20 +++
.../patreon/components/Goal.php | 84 +++++++++++
.../patreon/components/goal/_goal.htm | 21 +++
.../patreon/components/goal/default.htm | 1 +
.../paulvonzimmerman/patreon/composer.json | 5 +
.../paulvonzimmerman/patreon/composer.lock | 54 ++++++++
.../patreon/controllers/Register.php | 130 ++++++++++++++++++
.../controllers/register/_patreonstatus.htm | 11 ++
.../controllers/register/config_form.yaml | 0
.../patreon/controllers/register/index.htm | 25 ++++
.../paulvonzimmerman/patreon/lang/en/lang.php | 6 +
.../patreon/models/Settings.php | 16 +++
.../patreon/models/settings/fields.yaml | 20 +++
plugins/paulvonzimmerman/patreon/plugin.yaml | 17 +++
.../paulvonzimmerman/patreon/screenshot.png | Bin 0 -> 2988 bytes
...le_create_paul_patreon_system_settings.php | 28 ++++
.../patreon/updates/version.yaml | 7 +
30 files changed, 612 insertions(+), 2 deletions(-)
create mode 100644 .gitattributes
delete mode 160000 plugins/paulvonzimmerman/patreon
create mode 100644 plugins/paulvonzimmerman/patreon/.gitignore
create mode 100755 plugins/paulvonzimmerman/patreon/Plugin.php
create mode 100644 plugins/paulvonzimmerman/patreon/README.md
create mode 100644 plugins/paulvonzimmerman/patreon/assets/css/error.css
create mode 100644 plugins/paulvonzimmerman/patreon/assets/css/goal.css
create mode 100644 plugins/paulvonzimmerman/patreon/assets/images/become_a_patron_button.png
create mode 100644 plugins/paulvonzimmerman/patreon/assets/images/patreon.png
create mode 100644 plugins/paulvonzimmerman/patreon/assets/js/goal.js
create mode 100644 plugins/paulvonzimmerman/patreon/assets/patreon_white.png
create mode 100644 plugins/paulvonzimmerman/patreon/bower.json
create mode 100644 plugins/paulvonzimmerman/patreon/components/Goal.php
create mode 100644 plugins/paulvonzimmerman/patreon/components/goal/_goal.htm
create mode 100644 plugins/paulvonzimmerman/patreon/components/goal/default.htm
create mode 100644 plugins/paulvonzimmerman/patreon/composer.json
create mode 100644 plugins/paulvonzimmerman/patreon/composer.lock
create mode 100755 plugins/paulvonzimmerman/patreon/controllers/Register.php
create mode 100644 plugins/paulvonzimmerman/patreon/controllers/register/_patreonstatus.htm
create mode 100644 plugins/paulvonzimmerman/patreon/controllers/register/config_form.yaml
create mode 100755 plugins/paulvonzimmerman/patreon/controllers/register/index.htm
create mode 100755 plugins/paulvonzimmerman/patreon/lang/en/lang.php
create mode 100644 plugins/paulvonzimmerman/patreon/models/Settings.php
create mode 100755 plugins/paulvonzimmerman/patreon/models/settings/fields.yaml
create mode 100755 plugins/paulvonzimmerman/patreon/plugin.yaml
create mode 100644 plugins/paulvonzimmerman/patreon/screenshot.png
create mode 100644 plugins/paulvonzimmerman/patreon/updates/builder_table_create_paul_patreon_system_settings.php
create mode 100644 plugins/paulvonzimmerman/patreon/updates/version.yaml
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..eca2149217
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+plugins/* linguist-vendored
diff --git a/.gitignore b/.gitignore
index b98fcbda65..e18eda1b82 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
# Git stuff
!.gitattributes
+!.gitmodules
!.gitignore
# October CMS
diff --git a/README.md b/README.md
index 140f798a3d..12bb435af2 100644
--- a/README.md
+++ b/README.md
@@ -45,11 +45,11 @@ You can use the standard `docker exec -it godotengine-org--[php|mariadb] [comman
### Setting up the theme
- Log into the October backend and change the frontend theme from the Settings tab.
-- You may need to install the [October Patreon](https://github.com/pcvonz/oc-patreongoalstatus-plugin) plugin.
- While examining the frontpage, you'll notice that nothing is styled; this is
because we need to compile the CSS from our SCSS. Make sure you have Node.js
installed.
- Change directory into `themes/godotengine` then run `yarn install && yarn build`.
+- Change directory into `plugins/paulvonzimmerman/patreon` then run `composer install`.
- You should now have approximately what's in production. The only missing
pieces are everything that's stored in the production database
(devblog entries and featured games).
diff --git a/plugins/paulvonzimmerman/patreon b/plugins/paulvonzimmerman/patreon
deleted file mode 160000
index 5d685ddc9b..0000000000
--- a/plugins/paulvonzimmerman/patreon
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 5d685ddc9bbb522d668f7906185f24b1319da3b3
diff --git a/plugins/paulvonzimmerman/patreon/.gitignore b/plugins/paulvonzimmerman/patreon/.gitignore
new file mode 100644
index 0000000000..b656135dbf
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/.gitignore
@@ -0,0 +1,5 @@
+vendor
+bower_components
+*.swo
+*.swp
+composer.phar
diff --git a/plugins/paulvonzimmerman/patreon/Plugin.php b/plugins/paulvonzimmerman/patreon/Plugin.php
new file mode 100755
index 0000000000..65507a308a
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/Plugin.php
@@ -0,0 +1,28 @@
+ 'Goal'
+ ];
+ }
+
+ public function registerSettings()
+ {
+ return [
+ 'settings' => [
+ 'label' => 'Patreon Settings',
+ 'description' => 'Set your patreon client_id and client_secret',
+ 'icon' => 'icon-money',
+ 'class' => 'PaulVonZimmerman\Patreon\Models\Settings',
+ 'order' => 0,
+ 'keywords' => 'security location',
+ 'permissions' => ['paulvonzimmerman.patreon.access_settings']
+ ]
+ ];
+ }
+}
diff --git a/plugins/paulvonzimmerman/patreon/README.md b/plugins/paulvonzimmerman/patreon/README.md
new file mode 100644
index 0000000000..5806c77279
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/README.md
@@ -0,0 +1,29 @@
+# October patreon
+
+
+
+## Setup
+
+### Logging in to Patreon
+Once the plugin is installed a new tab will appear in the backend menu. This tab contains the instructions on how to connect your patreon account. Here is the general gist of those instructions:
+
+- Register a Patreon application [here](https://www.patreon.com/platform/documentation/clients)
+- Go to the settings page of your October website and set your client_secret and client_id. The settings page also includes options to set the refresh time (how often the plugin will refresh the data from patreon, very important to set that) and the link to your patreon.
+- Set the "redirect_url" of your patreon application, the plugin will provide the link in the patreon tab, set it in your patreon application settings.
+- Finally, click the connect application button to connect your patreon to your website.
+
+### Adding the goal component to a page
+### Regular page (not a partial)
+- Navigate to the CMS section of the october backend
+- Click the page you want to add the component to
+- Click components in the left sidebar
+- Click the patreon drop down
+- Click "Goal Component"
+- add: {% component 'Goal' %} wherver you want the component to show up.
+
+### Partial (usually your header, footer, etc.)
+- The steps are the same as adding it to a regular page, except you need to add the {% scripts %} tag and {% styles %} tag to the top of the page.
+
+### Adding to a partial:
+
+If you add this component to a partial, be sure to include the `{% scripts %}` and `{% styles %}` tags.
diff --git a/plugins/paulvonzimmerman/patreon/assets/css/error.css b/plugins/paulvonzimmerman/patreon/assets/css/error.css
new file mode 100644
index 0000000000..f32b9f81b3
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/assets/css/error.css
@@ -0,0 +1,3 @@
+div.patreon-row:nth-child(2) {
+ display: none;
+}
diff --git a/plugins/paulvonzimmerman/patreon/assets/css/goal.css b/plugins/paulvonzimmerman/patreon/assets/css/goal.css
new file mode 100644
index 0000000000..0c4c53c74b
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/assets/css/goal.css
@@ -0,0 +1,80 @@
+#goal a {
+ display: flex;
+ justify-content: flex-start;
+}
+.goalContainer {
+ width: 100%;
+ background-color: #052D49;
+ height: 16.5px;
+ border-top: 2px solid #052D49;
+ border-bottom: 2px solid #052D49;
+}
+.percentageBar {
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+.goalContainer div div {
+ font-weight: bold;
+ color: #F96854;
+ font-size: 12px;
+}
+
+.patreon {
+ width: 180px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ background-color: #F96854;
+ box-sizing: border-box;
+ padding: 6px 6px 2px 6px;
+ transition: border .2s;
+ border-bottom: 4px solid #F96854;
+ height: 50px;
+}
+
+a:hover > .patreon {
+ border-bottom: 4px solid #052D49;
+}
+
+.patreon-row {
+ height: 50%;
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+}
+
+.patreon-brand {
+ background-image: url('../images/become_a_patron_button.png');
+ background-size: 130px;
+ background-repeat: no-repeat;
+ width: 100%;
+ height: 100%;
+}
+
+.patreon-uppercase {
+ font-weight: bold;
+ color: white;
+ text-transform: uppercase;
+ font-size: 10px;
+ margin: 0;
+ padding: 10px;
+}
+
+#goal {
+ width: 100%;
+}
+
+a.patreonLink {
+ display: inline-block;
+ padding: 0;
+ height: auto;
+ margin-left: 30px;
+}
+
+a.patreonLink:hover {
+ text-decoration: none;
+}
+
diff --git a/plugins/paulvonzimmerman/patreon/assets/images/become_a_patron_button.png b/plugins/paulvonzimmerman/patreon/assets/images/become_a_patron_button.png
new file mode 100644
index 0000000000000000000000000000000000000000..5bc69d70c73e81a7ed624e29afe154fc2bc5be03
GIT binary patch
literal 2488
zcmV;p2}kycP)J4-}=qT#bKJYBaD{ZM143;`U()_#pOyR!T!C)*!f29|-Jy%;_I{=dm+8`(Os+
zV@~o*cJBS%-#O=d9>4QDzpQl4yNCug=!;6p@&~E4AMYvr$myM3rw_ZW;w#siWGWdE
zJzJ5nC|w9|qC64o;~^HrB
zN`#eU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3NvZLL=Yc1Dt#1xr5KvE{Hk=A~2xn@hVo7@Y<
zwg)wM%)?c?x$%W#y__PB?A+E|gRG+H)Sz+Wa!;FcE@}RJZ4H|AbvHSK#gmI~K8fhi
z4zK=+w=wbVfQ-r;q?M+rRKv03$QsByn?Ka*Zjx_BJVje?93X4e$+reKwBQE8S7=XU
zo~DGEVvBv|)Tbn2Q^YxedG}1#^1em>GPkWV^f?k|9yRcI&qNL`x6XYYGO@GEOr}t#
z)JD9>o8#cRS?d;@#?^&jsvvb3KDK?W#9N+c{u$at?2zyaLb|J^phWZpny&)bz8~Px
v#14XfhDyKoDzpuKZg)Wsa{B+VIDNT%TD**`_tgde8357B(X#fG|CRp$IEe`U
literal 0
HcmV?d00001
diff --git a/plugins/paulvonzimmerman/patreon/assets/js/goal.js b/plugins/paulvonzimmerman/patreon/assets/js/goal.js
new file mode 100644
index 0000000000..57952854bf
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/assets/js/goal.js
@@ -0,0 +1,19 @@
+window.onload = function () {
+ var pBar = document.querySelector(".goalContainer .percentageBar");
+ var pBarP = document.querySelector(".goalContainer > .percentageBar > div");
+
+ var goal = document.getElementById('goal').dataset.percentage;
+ function animate (time) {
+ requestAnimationFrame(animate);
+ TWEEN.update(time);
+ }
+ requestAnimationFrame(animate);
+ var start = {x: 0};
+ var tween = new TWEEN.Tween(start)
+ .to({x: goal}, 500)
+ .onUpdate( function () {
+ pBarP.innerHTML = Math.round(start.x) + "%";
+ pBar.style.backgroundImage = 'linear-gradient(90deg, white '+start.x+'%, #052D49 '+start.x+'%)';
+ })
+ .start();
+};
diff --git a/plugins/paulvonzimmerman/patreon/assets/patreon_white.png b/plugins/paulvonzimmerman/patreon/assets/patreon_white.png
new file mode 100644
index 0000000000000000000000000000000000000000..e70b9255436638c9b0ccc22fa5775756da7b7aeb
GIT binary patch
literal 2464
zcmd6p`#;l*AICo%W9Bv@Ax-6ei42JorX;c|#!#`ATVlk_
zB^{R{VXo8VxJB&be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r%pjk^lb_X37%W>Kn=x=8{2!`}IvMfl{Rw-NZepaqH&^qN7e
z)~EhNTC9!=dRPYWf<_8;0l`zfezuF7Uf0Yee|~EdF8&spC*ES$86x`dPm9f!wfLO4W-@h7#em`Ib7uYd#Y4^iNo<#FInPN_?2bZ_;P3^HWcK1^XD%L
zL@X|7o`i93csJP@r1w&fZddLI8eoZd^^LgMkHy4w#>89q6$swpUVWDlq9qu9LKXD$
zLV5h6KUZ}yw7DPOdW0;@9mPEvZr2p@)sF>gqGjC>ka0)x-g8MKnmMOqP7I1=ElRKJ
z?rf_~NRru%RV6D!hlFPgu@=Kc9D))q@o2BH9v42!&@6!LsC91NJV2$^mc!_E5O|I*
zzYwKr3NWXzw_G7mYURCG+~)vjH8VXY`T&p3u-DBbFz+X{@t^AlT-^Szh2wkzyN1Wk
zwU?~yi{3%lww$m4-MXETbqZ;14HA)}omG2f!iyoh)1IS&tD*J|u~4dZ`xP_^crjB}
z^&4*Le*byyDUj7iJNLcg#5N(crVE&ySJJk99!QkVb$rXKt!I(AmIT0%8ns~pZhmR7
z1yPWMmxJFA@s`1(l57N6"
+ ],
+ "description": "",
+ "main": "",
+ "license": "MIT",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ],
+ "dependencies": {
+ "tween.js": "tweenjs#^16.6.0"
+ }
+}
diff --git a/plugins/paulvonzimmerman/patreon/components/Goal.php b/plugins/paulvonzimmerman/patreon/components/Goal.php
new file mode 100644
index 0000000000..23950ddc21
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/components/Goal.php
@@ -0,0 +1,84 @@
+ 'Goal Component',
+ 'description' => "Adds a small widget that displays the percentage complete of a patreon campaign."
+ ];
+ }
+ private function patreonRequest()
+ {
+ $register_client = new \Patreon\API(Settings::get('access_token'));
+ $campaign_response = $register_client->fetch_campaign();
+
+ // Handle access_token expiring:
+ if (isset($campaign_response['errors'])) {
+ $oauth_client = new \Patreon\OAuth(Settings::get('client_id'), Settings::get('client_secret'));
+ // Get a fresher access token
+ $tokens = $oauth_client->refresh_token(Settings::get('refresh_token'), null);
+ // echo Settings::get('refresh_token').'';
+ if (isset($tokens['access_token'])) {
+ // Set new token
+ $access_token = $tokens['access_token'];
+ Settings::set('refresh_token', $tokens['refresh_token']);
+ Settings::set('access_token', $access_token);
+ } else {
+ // print_r($tokens);
+ $this->addCss('/plugins/paulvonzimmerman/patreon/assets/css/error.css');
+ return false;
+ }
+ }
+ $included = $campaign_response['included'];
+ if ($included != null) {
+ foreach ($included as $obj) {
+ if ($obj["type"] == "goal") {
+ $goal = $obj;
+ // Grab the first goal that is less than 100%
+ // If none are less than 100%, it'll pull latest entry from settings
+ if($goal['attributes']['completed_percentage'] < 100) {
+ // Set new goal amount (in case of update)
+ $this->update_goal_amount($goal['attributes']['amount_cents']);
+
+ Settings::set('completed_percentage', $goal['attributes']['completed_percentage']);
+ break;
+ }
+ }
+ }
+ }
+ }
+ public function update_goal_amount($cents)
+ {
+ Settings::set('amount_cents', '$'.number_format($cents / 100, 2, '.', ','));
+ }
+ public function init()
+ {
+ $this->page['patreon_url'] = Settings::get('patreon_url');
+ $refresh_time = Settings::get('refresh_time');
+ // Make sure refresh time is never 0
+ if ( $refresh_time == '' || $refresh_time < 5) {
+ $refresh_time = 5;
+ }
+ if ((Settings::get('time_since_last_update') + $refresh_time * 60) < time()) {
+ $this->patreonRequest();
+ Settings::set('time_since_last_update', time());
+ }
+ $this->page['amount_cents'] = Settings::get('amount_cents');
+ $this->page['goalPercentage'] = Settings::get('completed_percentage');
+ }
+ public function onRun()
+ {
+ $this->addCss('/plugins/paulvonzimmerman/patreon/assets/css/goal.css');
+ $this->addJs('/plugins/paulvonzimmerman/patreon/bower_components/tween.js/src/Tween.js');
+ $this->addJs('/plugins/paulvonzimmerman/patreon/assets/js/goal.js');
+ }
+ public function defineProperties()
+ {
+ return [];
+ }
+}
diff --git a/plugins/paulvonzimmerman/patreon/components/goal/_goal.htm b/plugins/paulvonzimmerman/patreon/components/goal/_goal.htm
new file mode 100644
index 0000000000..e38eb3fa9f
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/components/goal/_goal.htm
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
{{ goalPercentage }}%
+
+
+
+
{{ amount_cents }}
+
+
+
+
+
diff --git a/plugins/paulvonzimmerman/patreon/components/goal/default.htm b/plugins/paulvonzimmerman/patreon/components/goal/default.htm
new file mode 100644
index 0000000000..a004693530
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/components/goal/default.htm
@@ -0,0 +1 @@
+{% partial 'Goal::_goal' %}
diff --git a/plugins/paulvonzimmerman/patreon/composer.json b/plugins/paulvonzimmerman/patreon/composer.json
new file mode 100644
index 0000000000..98bcdfa8ff
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "patreon/patreon": "^0.1.0"
+ }
+}
diff --git a/plugins/paulvonzimmerman/patreon/composer.lock b/plugins/paulvonzimmerman/patreon/composer.lock
new file mode 100644
index 0000000000..c05ff8aef1
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/composer.lock
@@ -0,0 +1,54 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "3b481eedd85a1ad734a913541f0da1c7",
+ "packages": [
+ {
+ "name": "patreon/patreon",
+ "version": "0.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Patreon/patreon-php.git",
+ "reference": "2283c1295cafd49d509da7ac878db9489d2fe913"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Patreon/patreon-php/zipball/2283c1295cafd49d509da7ac878db9489d2fe913",
+ "reference": "2283c1295cafd49d509da7ac878db9489d2fe913",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Patreon": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "David Kettler",
+ "email": "david@patreon.com"
+ }
+ ],
+ "description": "Interact with the Patreon API via OAuth",
+ "time": "2015-12-16T19:34:11+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": []
+}
diff --git a/plugins/paulvonzimmerman/patreon/controllers/Register.php b/plugins/paulvonzimmerman/patreon/controllers/Register.php
new file mode 100755
index 0000000000..d256c1a1bc
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/controllers/Register.php
@@ -0,0 +1,130 @@
+pageTitle = 'Patreon';
+ $this->client_id = Settings::get('client_id');
+ $this->client_secret = Settings::get('client_secret');
+ $this->redirect_uri = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
+ $this->creator_id = 'test';
+ $this->actual_link = $actual_link = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]".'/backend/PaulVonZimmerman/patreon/register';
+ $this->vars['redirect_uri'] = $this->actual_link;
+ $this->vars['url'] = 'http://www.patreon.com/oauth2/authorize?response_type=code&client_id='.$this->client_id.'&redirect_uri='.$this->actual_link;
+ $this->vars['status'] = 'Retrieving status... ';
+ $this->vars['short_description'] = 'waiting..';
+ $this->vars['detail'] = 'Shouldn’t take but a moment.';
+ $this->vars['class'] = 'info';
+ $this->vars['icon'] = 'info';
+ }
+ public function index()
+ {
+ }
+ public function onLoad()
+ {
+ if (isset($_GET['code'])) {
+ $oauth_client = new \Patreon\OAuth($this->client_id, $this->client_secret);
+ $tokens = $oauth_client->get_tokens($_GET['code'], $this->actual_link);
+ // Unset access_token could happen if they refresh right after
+ // getting an access token (?code is still set);
+ if (isset($tokens['access_token'])) {
+ $access_token = $tokens['access_token'];
+ $refresh_token = $tokens['refresh_token'];
+ Settings::set('refresh_token', $refresh_token);
+ Settings::set('access_token', $access_token);
+
+ $register_client = new \Patreon\API(Settings::get('access_token'));
+ $patron_response = $register_client->fetch_campaign();
+ $patron = $patron_response['data'];
+ $string = json_encode($patron);
+ $included = $patron_response['included'];
+ $goal = null;
+ if ($included != null) {
+ foreach ($included as $obj) {
+ if ($obj["type"] == "goal") {
+ $pledge = $obj;
+ $amount_cents = $pledge['attributes']['amount_cents'];
+ $amount_dollars = $amount_cents / 100;
+ $amount_cents = $amount_cents % 100;
+ if ($amount_cents < 9) {
+ $amount_cents = '0'.$amount_cents;
+ }
+ Settings::set('amount_cents', '$'.$amount_dollars.'.'.$amount_cents);
+ break;
+ }
+ }
+ }
+ }
+ }
+ if(Settings::get('access_token') != null) {
+ $register_client = new \Patreon\API(Settings::get('access_token'));
+ $campaign_response = $register_client->fetch_campaign();
+
+ // Handle access_token expiring:
+ if (isset($campaign_response['errors'])) {
+ $oauth_client = new \Patreon\OAuth(Settings::get('client_id'), Settings::get('client_secret'));
+ // Get a fresher access token
+ $tokens = $oauth_client->refresh_token(Settings::get('refresh_token'), null);
+ if (isset($tokens['access_token'])) {
+ // Set new token
+ $access_token = $tokens['access_token'];
+ Settings::set('refresh_token', $tokens['refresh_token']);
+ Settings::set('access_token', $access_token);
+ } else {
+ $this->vars['status'] = 'Error';
+ $this->vars['short_description'] = $campaign_response['errors'][0]['code_name'];
+ $this->vars['detail'] = $campaign_response['errors'][0]['detail'];
+ $this->vars['class'] = 'danger';
+ $this->vars['icon'] = 'warning';
+ }
+ }
+ if (isset($campaign_response['errors'])) {
+ $this->vars['status'] = 'Error';
+ $this->vars['short_description'] = $campaign_response['errors'][0]['code_name'];
+ $this->vars['detail'] = $campaign_response['errors'][0]['detail'];
+ $this->vars['class'] = 'danger';
+ $this->vars['icon'] = 'warning';
+ }
+ elseif (isset($campaign_response['data'])) {
+ $this->vars['status'] = 'Connection Successful';
+ $this->vars['short_description'] = 'Successful response from Patreon!';
+ $this->vars['detail'] = 'Now connected to: '.$campaign_response['data'][0]['attributes']['creation_name'].'Goals:
';
+ $this->vars['class'] = 'success';
+ $this->vars['icon'] = 'check';
+ $included = $campaign_response['included'];
+ $goal = null;
+ if ($included != null) {
+ foreach ($included as $obj) {
+ if ($obj["type"] == "goal") {
+ $pledge = $obj;
+ $this->vars['detail'] = $this->vars['detail'].'- '.$pledge['attributes']['description'];
+ }
+ }
+ }
+ $this->vars['detail'] = $this->vars['detail'].'
';
+ }
+ }
+ else {
+ $this->vars['status'] = 'Access token not set.';
+ $this->vars['short_description'] = 'Did you complete step four?';
+ $this->vars['detail'] = 'October Patreon couldn’t find an access token.';
+ $this->vars['class'] = 'danger';
+ $this->vars['icon'] = 'warning';
+ }
+ }
+}
diff --git a/plugins/paulvonzimmerman/patreon/controllers/register/_patreonstatus.htm b/plugins/paulvonzimmerman/patreon/controllers/register/_patreonstatus.htm
new file mode 100644
index 0000000000..c37fcfb68e
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/controllers/register/_patreonstatus.htm
@@ -0,0 +1,11 @@
+
+
diff --git a/plugins/paulvonzimmerman/patreon/controllers/register/config_form.yaml b/plugins/paulvonzimmerman/patreon/controllers/register/config_form.yaml
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/plugins/paulvonzimmerman/patreon/controllers/register/index.htm b/plugins/paulvonzimmerman/patreon/controllers/register/index.htm
new file mode 100755
index 0000000000..0a458a1442
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/controllers/register/index.htm
@@ -0,0 +1,25 @@
+ Patreon
+
+ - Register a Patreon application here .
+ - Go to the settings page and set your client_secret and client_id .
+ -
+
copy this url:
+ = $redirect_uri ?>
+
And set it as the redirect_uri of your Patreon application.
+
+ Click here to connect your patreon
+
+
+
+
+= $this->makePartial('patreonstatus')?>
+
+
+
+
diff --git a/plugins/paulvonzimmerman/patreon/lang/en/lang.php b/plugins/paulvonzimmerman/patreon/lang/en/lang.php
new file mode 100755
index 0000000000..282b92b949
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/lang/en/lang.php
@@ -0,0 +1,6 @@
+ [
+ 'name' => 'patreon',
+ 'description' => 'Provides a component that displays the percentage complete of a patreon campaign',
+ ]
+];
diff --git a/plugins/paulvonzimmerman/patreon/models/Settings.php b/plugins/paulvonzimmerman/patreon/models/Settings.php
new file mode 100644
index 0000000000..7a1716f246
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/models/Settings.php
@@ -0,0 +1,16 @@
+=)Pm-xIjG2Ll0RRAI1ASdHvNn*z
z7(_{48C&P<$U=|Qw+qc*ViRW#QQeTvt7@i
zGYAFICzi;;!*ZiR)mR%XU5U%3V%R$-dTO921KpOaih5bGpDYs&zKBuWxA{6?P9-MB
zpiN0HKzVgPo?83)f=Wo_xs$@ap;-efd^E!NVwy0wG!(Jlxm2VgOJuvFi|-TGEUoHA
z=Z{FW(Dr60HYD^=x-cft41gIJvm`jdqPC*qrdU&WiFYYRb4D8x^REr331HBob+v!)
z(2_VxK@Q?0~)>9yN9*e@)aik%if+}g2l$b5EDyxTrlG9+L49CJm
zJ>s~CMmMf^yw^GhIVn`Qlq(?rHWN~iEqlfY_0|G1X)y<)b4@cy+HTI}D~^lrl32IK
zMbyQBy!sPCddns{^%MzJSh2sF63vJJh{EVyDy8ExPepvzY5Waw@iDh*)KPgYRsdj1
z`8<8`)=IpB-iUw}zD&4ai@6o;*yv>tVy8NcGBma|5oB7v0_6@pA#)&My^=9buMdr9WVlvWx@mkso
z%hwXXa`QpE70%#PAD+8@1T
zH|sI_^^w`|E>v(TW;plR7iklJv@{OisP6l`GQ`_HPzPe8&5mM(@4pxCC`jmWA+T*V
zog;8C#0%%uTB}r{Kz|%(r6E~UxuV|P6umf+*#VbpD9){zsTwCaGUMot=kS@|}_Y(3+on-
z!~UzSo{p^)O=WqGhIvUqWjd*`7V8+D1*|Q;yZS1`eFo{@Lx=%g?`}O){s=3TDA!OO
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09HZ~(Tc40%*VC?q)@~A1}8Xz;d
a)hL(*&I#{L7~$E1A#
literal 0
HcmV?d00001
diff --git a/plugins/paulvonzimmerman/patreon/updates/builder_table_create_paul_patreon_system_settings.php b/plugins/paulvonzimmerman/patreon/updates/builder_table_create_paul_patreon_system_settings.php
new file mode 100644
index 0000000000..23f4012645
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/updates/builder_table_create_paul_patreon_system_settings.php
@@ -0,0 +1,28 @@
+engine = 'InnoDB';
+ $table->string('access_token')->nullable();
+ $table->string('refresh_token')->nullable();
+ $table->integer('completed_percentage')->nullable();
+ $table->string('client_secret')->nullable();
+ $table->integer('refresh_time')->nullable()->default(30);
+ $table->integer('time_since_last_update')->nullable();
+ $table->string('client_id')->nullable();
+ $table->integer('amount_cents')->nullable();
+ });
+ }
+
+ public function down()
+ {
+ Schema::dropIfExists('paulvonzimmerman_patreon_system_settings');
+ }
+}
diff --git a/plugins/paulvonzimmerman/patreon/updates/version.yaml b/plugins/paulvonzimmerman/patreon/updates/version.yaml
new file mode 100644
index 0000000000..d0f72e5d7e
--- /dev/null
+++ b/plugins/paulvonzimmerman/patreon/updates/version.yaml
@@ -0,0 +1,7 @@
+1.0.1: 'First version of Demo'
+1.0.2:
+ - 'Created table paulvonzimmerman_patreon_system_settings'
+ - builder_table_create_paulvonzimmerman_patreon_system_settings.php
+1.0.3:
+ - 'Add supuport for multiple goals'
+ - 'Added commas to the amount displayed in the component'