aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/FlattrItem.class.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-07-17 16:06:53 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-07-17 16:06:53 +0200
commit93edcab52edbae5671948e6e7c3cdd6511e16862 (patch)
tree620353f418a332d4756a9e1b716e88af5c892da8 /inc/3rdparty/FlattrItem.class.php
parent4e067ceabd705201a16b4c92cf4b23f3b990326c (diff)
parentccd0b381b69a36fe369d3a73dce6ca64c8deef99 (diff)
downloadwallabag-93edcab52edbae5671948e6e7c3cdd6511e16862.tar.gz
wallabag-93edcab52edbae5671948e6e7c3cdd6511e16862.tar.zst
wallabag-93edcab52edbae5671948e6e7c3cdd6511e16862.zip
Merge pull request #764 from tcitworld/refactor
Refactor Flattr class.
Diffstat (limited to 'inc/3rdparty/FlattrItem.class.php')
-rw-r--r--inc/3rdparty/FlattrItem.class.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/inc/3rdparty/FlattrItem.class.php b/inc/3rdparty/FlattrItem.class.php
index 5cf9e5fc..ef8c62f7 100644
--- a/inc/3rdparty/FlattrItem.class.php
+++ b/inc/3rdparty/FlattrItem.class.php
@@ -11,13 +11,13 @@
11class FlattrItem 11class FlattrItem
12{ 12{
13 public $status; 13 public $status;
14 public $urltoflattr; 14 public $urlToFlattr;
15 public $flattrItemURL; 15 public $flattrItemURL;
16 public $numflattrs; 16 public $numFlattrs;
17 17
18 public function checkItem($urltoflattr, $id) 18 public function checkItem($urlToFlattr, $id)
19 { 19 {
20 $this->_cacheflattrfile($urltoflattr, $id); 20 $this->_cacheFlattrFile($urlToFlattr, $id);
21 $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); 21 $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache");
22 if($flattrResponse != FALSE) { 22 if($flattrResponse != FALSE) {
23 $result = json_decode($flattrResponse); 23 $result = json_decode($flattrResponse);
@@ -29,7 +29,7 @@ class FlattrItem
29 elseif (is_object($result) && $result->link) { 29 elseif (is_object($result) && $result->link) {
30 $this->status = FLATTRED; 30 $this->status = FLATTRED;
31 $this->flattrItemURL = $result->link; 31 $this->flattrItemURL = $result->link;
32 $this->numflattrs = $result->flattrs; 32 $this->numFlattrs = $result->flattrs;
33 } 33 }
34 else { 34 else {
35 $this->status = NOT_FLATTRABLE; 35 $this->status = NOT_FLATTRABLE;
@@ -40,7 +40,7 @@ class FlattrItem
40 } 40 }
41 } 41 }
42 42
43 private function _cacheflattrfile($urltoflattr, $id) 43 private function _cacheFlattrFile($urlToFlattr, $id)
44 { 44 {
45 if (!is_dir(CACHE . '/flattr')) { 45 if (!is_dir(CACHE . '/flattr')) {
46 mkdir(CACHE . '/flattr', 0777); 46 mkdir(CACHE . '/flattr', 0777);
@@ -48,10 +48,10 @@ class FlattrItem
48 48
49 // if a cache flattr file for this url already exists and it's been less than one day than it have been updated, see in /cache 49 // if a cache flattr file for this url already exists and it's been less than one day than it have been updated, see in /cache
50 if ((!file_exists(CACHE . "/flattr/".$id.".cache")) || (time() - filemtime(CACHE . "/flattr/".$id.".cache") > 86400)) { 50 if ((!file_exists(CACHE . "/flattr/".$id.".cache")) || (time() - filemtime(CACHE . "/flattr/".$id.".cache") > 86400)) {
51 $askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr); 51 $askForFlattr = Tools::getFile(FLATTR_API . $urlToFlattr);
52 $flattrCacheFile = fopen(CACHE . "/flattr/".$id.".cache", 'w+'); 52 $flattrCacheFile = fopen(CACHE . "/flattr/".$id.".cache", 'w+');
53 fwrite($flattrCacheFile, $askForFlattr); 53 fwrite($flattrCacheFile, $askForFlattr);
54 fclose($flattrCacheFile); 54 fclose($flattrCacheFile);
55 } 55 }
56 } 56 }
57} \ No newline at end of file 57}