mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
WHAT. A. BIG. REFACTOR. + new license (we moved to MIT one)
This commit is contained in:
parent
6400371ff9
commit
3602405ec0
20 changed files with 930 additions and 771 deletions
26
inc/3rdparty/FlattrItem.class.php
vendored
26
inc/3rdparty/FlattrItem.class.php
vendored
|
@ -1,25 +1,32 @@
|
|||
<?php
|
||||
/*
|
||||
* Class for Flattr querying
|
||||
*/
|
||||
class FlattrItem {
|
||||
/**
|
||||
* wallabag, self hostable application allowing you to not miss any content anymore
|
||||
*
|
||||
* @category wallabag
|
||||
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
|
||||
* @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);
|
||||
}
|
||||
|
|
34
inc/3rdparty/Session.class.php
vendored
34
inc/3rdparty/Session.class.php
vendored
|
@ -309,4 +309,38 @@ class Session
|
|||
|
||||
return true; // User is not banned.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tells if a param exists in session
|
||||
*
|
||||
* @param $name name of the param to test
|
||||
* @return bool
|
||||
*/
|
||||
public static function isInSession($name)
|
||||
{
|
||||
return (isset($_SESSION[$name]) ? : FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns param in session
|
||||
*
|
||||
* @param $name name of the param to return
|
||||
* @return mixed param or null
|
||||
*/
|
||||
public static function getParam($name)
|
||||
{
|
||||
return (self::isInSession($name) ? $_SESSION[$name] : NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store value in session
|
||||
*
|
||||
* @param $name name of the variable to store
|
||||
* @param $value value to store
|
||||
*/
|
||||
public static function setParam($name, $value)
|
||||
{
|
||||
$_SESSION[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue