diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-07-11 16:03:59 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-07-11 16:03:59 +0200 |
commit | 3602405ec0dbc576fce09ff9e865ba2404622080 (patch) | |
tree | 45f9de611f4936091b0ed29a6a21fa4fef9b330b /inc/3rdparty/FlattrItem.class.php | |
parent | 6400371ff93782d25cdbd50aa224c70145b3890a (diff) | |
download | wallabag-3602405ec0dbc576fce09ff9e865ba2404622080.tar.gz wallabag-3602405ec0dbc576fce09ff9e865ba2404622080.tar.zst wallabag-3602405ec0dbc576fce09ff9e865ba2404622080.zip |
WHAT. A. BIG. REFACTOR. + new license (we moved to MIT one)
Diffstat (limited to 'inc/3rdparty/FlattrItem.class.php')
-rw-r--r-- | inc/3rdparty/FlattrItem.class.php | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/inc/3rdparty/FlattrItem.class.php b/inc/3rdparty/FlattrItem.class.php index 711b4ee0..5cf9e5fc 100644 --- a/inc/3rdparty/FlattrItem.class.php +++ b/inc/3rdparty/FlattrItem.class.php | |||
@@ -1,25 +1,32 @@ | |||
1 | <?php | 1 | <?php |
2 | /* | 2 | /** |
3 | * Class for Flattr querying | 3 | * wallabag, self hostable application allowing you to not miss any content anymore |
4 | */ | 4 | * |
5 | class FlattrItem { | 5 | * @category wallabag |
6 | * @author Nicolas Lœuillet <nicolas@loeuillet.org> | ||
7 | * @copyright 2013 | ||
8 | * @license http://opensource.org/licenses/MIT see COPYING file | ||
9 | */ | ||
6 | 10 | ||
11 | class FlattrItem | ||
12 | { | ||
7 | public $status; | 13 | public $status; |
8 | public $urltoflattr; | 14 | public $urltoflattr; |
9 | public $flattrItemURL; | 15 | public $flattrItemURL; |
10 | public $numflattrs; | 16 | public $numflattrs; |
11 | 17 | ||
12 | public function checkItem($urltoflattr,$id) { | 18 | public function checkItem($urltoflattr, $id) |
13 | $this->cacheflattrfile($urltoflattr, $id); | 19 | { |
20 | $this->_cacheflattrfile($urltoflattr, $id); | ||
14 | $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); | 21 | $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); |
15 | if($flattrResponse != FALSE) { | 22 | if($flattrResponse != FALSE) { |
16 | $result = json_decode($flattrResponse); | 23 | $result = json_decode($flattrResponse); |
17 | if (isset($result->message)){ | 24 | if (isset($result->message)) { |
18 | if ($result->message == "flattrable") { | 25 | if ($result->message == "flattrable") { |
19 | $this->status = FLATTRABLE; | 26 | $this->status = FLATTRABLE; |
20 | } | 27 | } |
21 | } | 28 | } |
22 | elseif (is_object($result) && $result->link) { | 29 | elseif (is_object($result) && $result->link) { |
23 | $this->status = FLATTRED; | 30 | $this->status = FLATTRED; |
24 | $this->flattrItemURL = $result->link; | 31 | $this->flattrItemURL = $result->link; |
25 | $this->numflattrs = $result->flattrs; | 32 | $this->numflattrs = $result->flattrs; |
@@ -33,7 +40,8 @@ class FlattrItem { | |||
33 | } | 40 | } |
34 | } | 41 | } |
35 | 42 | ||
36 | private function cacheflattrfile($urltoflattr, $id) { | 43 | private function _cacheflattrfile($urltoflattr, $id) |
44 | { | ||
37 | if (!is_dir(CACHE . '/flattr')) { | 45 | if (!is_dir(CACHE . '/flattr')) { |
38 | mkdir(CACHE . '/flattr', 0777); | 46 | mkdir(CACHE . '/flattr', 0777); |
39 | } | 47 | } |