From 3602405ec0dbc576fce09ff9e865ba2404622080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 11 Jul 2014 16:03:59 +0200 Subject: WHAT. A. BIG. REFACTOR. + new license (we moved to MIT one) --- inc/3rdparty/FlattrItem.class.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'inc/3rdparty/FlattrItem.class.php') 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 @@ + * @copyright 2013 + * @license http://opensource.org/licenses/MIT see COPYING file + */ +class FlattrItem +{ public $status; public $urltoflattr; public $flattrItemURL; public $numflattrs; - public function checkItem($urltoflattr,$id) { - $this->cacheflattrfile($urltoflattr, $id); + public function checkItem($urltoflattr, $id) + { + $this->_cacheflattrfile($urltoflattr, $id); $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); if($flattrResponse != FALSE) { $result = json_decode($flattrResponse); - if (isset($result->message)){ + if (isset($result->message)) { if ($result->message == "flattrable") { $this->status = FLATTRABLE; } } - elseif (is_object($result) && $result->link) { + elseif (is_object($result) && $result->link) { $this->status = FLATTRED; $this->flattrItemURL = $result->link; $this->numflattrs = $result->flattrs; @@ -33,7 +40,8 @@ class FlattrItem { } } - private function cacheflattrfile($urltoflattr, $id) { + private function _cacheflattrfile($urltoflattr, $id) + { if (!is_dir(CACHE . '/flattr')) { mkdir(CACHE . '/flattr', 0777); } -- cgit v1.2.3 From d259f73665170d2c54771d3726d7a150c8317c34 Mon Sep 17 00:00:00 2001 From: tcitworld Date: Thu, 17 Jul 2014 15:34:55 +0200 Subject: camelCase for FlattrItem class --- inc/3rdparty/FlattrItem.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'inc/3rdparty/FlattrItem.class.php') diff --git a/inc/3rdparty/FlattrItem.class.php b/inc/3rdparty/FlattrItem.class.php index 5cf9e5fc..97c92fd3 100644 --- a/inc/3rdparty/FlattrItem.class.php +++ b/inc/3rdparty/FlattrItem.class.php @@ -11,13 +11,13 @@ class FlattrItem { public $status; - public $urltoflattr; + public $urlToFlattr; public $flattrItemURL; - public $numflattrs; + public $numFlattrs; - public function checkItem($urltoflattr, $id) + public function checkItem($urlToFlattr, $id) { - $this->_cacheflattrfile($urltoflattr, $id); + $this->_cacheflattrfile($urlToFlattr, $id); $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); if($flattrResponse != FALSE) { $result = json_decode($flattrResponse); @@ -29,7 +29,7 @@ class FlattrItem elseif (is_object($result) && $result->link) { $this->status = FLATTRED; $this->flattrItemURL = $result->link; - $this->numflattrs = $result->flattrs; + $this->numFlattrs = $result->flattrs; } else { $this->status = NOT_FLATTRABLE; @@ -40,7 +40,7 @@ class FlattrItem } } - private function _cacheflattrfile($urltoflattr, $id) + private function _cacheFlattrFile($urlToFlattr, $id) { if (!is_dir(CACHE . '/flattr')) { mkdir(CACHE . '/flattr', 0777); @@ -48,10 +48,10 @@ class FlattrItem // 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 if ((!file_exists(CACHE . "/flattr/".$id.".cache")) || (time() - filemtime(CACHE . "/flattr/".$id.".cache") > 86400)) { - $askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr); + $askForFlattr = Tools::getFile(FLATTR_API . $urlToFlattr); $flattrCacheFile = fopen(CACHE . "/flattr/".$id.".cache", 'w+'); fwrite($flattrCacheFile, $askForFlattr); fclose($flattrCacheFile); } } -} \ No newline at end of file +} -- cgit v1.2.3 From ccd0b381b69a36fe369d3a73dce6ca64c8deef99 Mon Sep 17 00:00:00 2001 From: tcitworld Date: Thu, 17 Jul 2014 15:42:59 +0200 Subject: camelCase for FlattrItem class (following) --- inc/3rdparty/FlattrItem.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/3rdparty/FlattrItem.class.php') diff --git a/inc/3rdparty/FlattrItem.class.php b/inc/3rdparty/FlattrItem.class.php index 97c92fd3..ef8c62f7 100644 --- a/inc/3rdparty/FlattrItem.class.php +++ b/inc/3rdparty/FlattrItem.class.php @@ -17,7 +17,7 @@ class FlattrItem public function checkItem($urlToFlattr, $id) { - $this->_cacheflattrfile($urlToFlattr, $id); + $this->_cacheFlattrFile($urlToFlattr, $id); $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); if($flattrResponse != FALSE) { $result = json_decode($flattrResponse); -- cgit v1.2.3