1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 -> 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
<?php
/** * RSS Search Hub Service * * PHP version 5 * * @package Ukora * @author Bas Kuis <b@ukora.com> * @copyright 2012 Bas Kuis (http://www.ukora.com) * @license http://creativecommons.org/licenses/by-nc/3.0/ Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) * @link http://www.ukora.com/cms/documentation/ */ class RssSearchHubService implements RssSearchHubServiceInterface {
/** @var RssSearchHubProcedure $RssSearchHubProcedure */ private $RssSearchHubProcedure;
function __construct(){ $this->RssSearchHubProcedure = CoreLogic::getProcedure('RssSearchHubProcedure'); }
public function searchFeeds($SearchSuggestionsContextObject, $search = null, $from = 0, $size = 12){ return $this->RssSearchHubProcedure->searchFeedsFeedlyFirst($SearchSuggestionsContextObject, $search, $from, $size); }
public function searchArticles($SearchSuggestionsContextObject, $search = null, $from = 0, $size = 12){ return $this->RssSearchHubProcedure->searchArticles($SearchSuggestionsContextObject, $search, $from, $size); }
public function loadFeed($url){ return $this->RssSearchHubProcedure->loadFeed($url); }
public function getFeedByUrl($url){ return $this->RssSearchHubProcedure->getFeedByUrl($url); }
public function getFeed($id = null, $pull = false){ return $this->RssSearchHubProcedure->getFeed($id, $pull); }
public function userFeeds(UserObject $userObject){ return $this->RssSearchHubProcedure->getUserFeeds($userObject); }
/** * Total number of saves * * @param RssSearchHubFeedObject $rssSearchHubFeedObject * @return int */ public function savedCount(RssSearchHubFeedObject $rssSearchHubFeedObject){ //<- Fatal Error Uncaught TypeError: Argument 1 passed to RssSearchHubService::savedCount() must be an instance of RssSearchHubFeedObject, null given, called in /var/www/vhosts/werock.com/public/modules/RssSearchHub/actions/RssSearchHubFeedAction.class.php on line 108 and defined in /var/www/vhosts/werock.com/public/modules/RssSearchHub/services/RssSearchHubService.class.php:53 Stack trace: #0 /var/www/vhosts/werock.com/public/modules/RssSearchHub/actions/RssSearchHubFeedAction.class.php(108): RssSearchHubService->savedCount(NULL) #1 /var/www/vhosts/werock.com/public/core/controller/CoreController.class.php(233): RssSearchHubFeedAction->build(Array) #2 /var/www/vhosts/werock.com/public/core/interceptor/CoreInterceptor.class.php(100): CoreController::_routeRequest(Object(CoreControllerObject), Array) #3 /var/www/vhosts/werock.com/public/core/interceptor/CoreInterceptorTrait.class.php(44): CoreInterceptor::process('CoreController', 'routeRequest', 'CoreController', '_routeRequest', Array) #4 /var/www/vhosts/werock.com/public/co try { return $this->RssSearchHubProcedure->getFeedCount($rssSearchHubFeedObject); } catch(Exception $e){ CoreNotification::set('An error occurred. Info: ' . $e->getMessage()); } return 0; }
/** * Is feed saved by user? * * @param RssSearchHubFeedObject $rssSearchHubFeedObject * @return bool */ public function feedSaved(RssSearchHubFeedObject $rssSearchHubFeedObject){ try { return $this->RssSearchHubProcedure->feedSaved($rssSearchHubFeedObject); } catch(UserUnauthorizedException $e){ CoreNotification::set('No authorized users found. Unable to check if feed saved. Info: ' . $e->getMessage(), CoreNotification::ERROR); } catch(Exception $e){ CoreNotification::set('An error occurred. Info: ' . $e->getMessage()); } return false; }
/** * Save a feed * * @param RssSearchHubFeedObject $rssSearchHubFeedObject * @return bool */ public function saveFeed(RssSearchHubFeedObject $rssSearchHubFeedObject){ try { $response = $this->RssSearchHubProcedure->saveFeed($rssSearchHubFeedObject); CoreNotification::set('Feed saved. Go to your <a href="/dashboard">dashboard</a>!', CoreNotification::SUCCESS); return $response; } catch(UserUnauthorizedException $e){ CoreNotification::set('No authorized users found. Unable to save feed. Info: ' . $e->getMessage(), CoreNotification::ERROR); } catch(Exception $e){ CoreNotification::set('Unknown error. Info: ' . $e->getMessage(), CoreNotification::ERROR); } return false; }
/** * Delete a feed * * @param RssSearchHubFeedObject $rssSearchHubFeedObject * @return bool */ public function deleteSavedFeed(RssSearchHubFeedObject $rssSearchHubFeedObject){ try { $response = $this->RssSearchHubProcedure->deleteSavedFeed($rssSearchHubFeedObject); CoreNotification::set('Feed deleted', CoreNotification::SUCCESS); return $response; } catch(UserUnauthorizedException $e){ CoreNotification::set('No authorized users found. Unable to delete feed. Info: ' . $e->getMessage(), CoreNotification::ERROR); } catch(Exception $e){ CoreNotification::set('Unknown error. Info: ' . $e->getMessage(), CoreNotification::ERROR); } return false; }
}
|