当前位置: 首页>>代码示例>>PHP>>正文


PHP JFBCFactory::cache方法代码示例

本文整理汇总了PHP中JFBCFactory::cache方法的典型用法代码示例。如果您正苦于以下问题:PHP JFBCFactory::cache方法的具体用法?PHP JFBCFactory::cache怎么用?PHP JFBCFactory::cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JFBCFactory的用法示例。


在下文中一共展示了JFBCFactory::cache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getData

 public function getData($path, array $parameters = array())
 {
     $key = JFBCFactory::config()->get('meetup_widget_api_key');
     $parameters = array_merge($this->parameters, $parameters, array('key' => $key));
     if (preg_match_all('/:([a-z]+)/', $path, $matches)) {
         foreach ($matches[0] as $i => $match) {
             if (isset($parameters[$matches[1][$i]])) {
                 $path = str_replace($match, $parameters[$matches[1][$i]], $path);
                 unset($parameters[$matches[1][$i]]);
             } else {
                 if (JFBCFactory::config()->get('facebook_display_errors')) {
                     JFBCFactory::log("Meetup Widget Error: Missing parameter '" . $matches[1][$i] . "' for path '" . $path . "'.", 'error');
                 }
             }
         }
     }
     $url = self::BASE . $path . '?' . http_build_query($parameters);
     $data = JFBCFactory::cache()->get('meetup.widget.' . $url);
     if ($data === false) {
         $response = $this->getURL($url);
         if ($response && isset($response->results)) {
             $data = $response->results;
             JFBCFactory::cache()->store($data, 'meetup.widget.' . $url);
         }
     }
     return $data;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:27,代码来源:widget.php

示例2: getFeed

 function getFeed()
 {
     $feedHtml = JFBCFactory::cache()->get('sourcecoast.rss');
     if ($feedHtml === false) {
         $curl = curl_init();
         curl_setopt_array($curl, array(CURLOPT_URL => 'http://feeds.sourcecoast.com/sourcecoast-blog', CURLOPT_USERAGENT => 'spider', CURLOPT_TIMEOUT => 120, CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_ENCODING => 'UTF-8'));
         $data = curl_exec($curl);
         $errorCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
         curl_close($curl);
         if ($data && !empty($data) && $errorCode == 200) {
             $xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA);
             if ($xml) {
                 $feedHtml = '<h4>Recent News from SourceCoast</h4>';
                 for ($i = 0; $i < 4; $i++) {
                     if (isset($xml->channel->item[$i])) {
                         $item = $xml->channel->item[$i];
                         $date = JFactory::getDate($item->pubDate);
                         $dateStr = $date->format(JText::_('DATE_FORMAT_LC4'));
                         $feedHtml .= '<p><a href="' . $item->link . '">' . $item->title . '</a> <span><em>' . $dateStr . '</em></span></p>';
                     }
                 }
             }
         }
         JFBCFactory::cache()->store($feedHtml, 'sourcecoast.rss');
     }
     return $feedHtml;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:27,代码来源:view.html.php

示例3: getAvatarUrl

 function getAvatarUrl($providerId, $nullForDefault = true, $params = null)
 {
     $nullString = $nullForDefault ? 'null' : 'notnull';
     $avatarUrl = JFBCFactory::cache()->get('windowslive.avatar.' . $nullString . '.' . $providerId);
     if ($avatarUrl === false) {
         $avatarUrl = "https://apis.live.net/v5.0/{$providerId}/picture";
         JFBCFactory::cache()->store($avatarUrl, 'windowslive.avatar.' . $nullString . '.' . $providerId);
     }
     return $avatarUrl;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:10,代码来源:windowslive.php

示例4: getProfileUrl

 function getProfileUrl($providerUserId)
 {
     $profileUrl = JFBCFactory::cache()->get('instagram.profile.' . $providerUserId);
     $token = $this->provider->client->getToken();
     if (!empty($token)) {
         //instragram token includes user data
         //get username from token
         $user = (array) $token['user'];
         $profileUrl = 'https://instagram.com/' . $user['username'];
         JFBCFactory::cache()->store($profileUrl, 'instagram.profile.' . $providerUserId);
     }
     return $profileUrl;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:13,代码来源:instagram.php

示例5: getAvatarUrl

 function getAvatarUrl($providerUserId, $nullForDefault = false, $params = null)
 {
     $avatarUrl = JFBCFactory::cache()->get('twitter.avatar.' . $providerUserId);
     if ($avatarUrl === false) {
         $profile = $this->fetchProfile($providerUserId, array('profile_image_url', 'default_profile_image'));
         if (!$profile->get('default_profile_image', true)) {
             $avatarUrl = $profile->get('profile_image_url', null);
         } else {
             $avatarUrl = null;
         }
         JFBCFactory::cache()->store($avatarUrl, 'twitter.avatar.' . $providerUserId);
     }
     return $avatarUrl;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:14,代码来源:twitter.php

示例6: getProfileUrl

 function getProfileUrl($providerUserId)
 {
     $profileUrl = JFBCFactory::cache()->get('github.profile.' . $providerUserId);
     if ($profileUrl === false) {
         $profile = $this->fetchProfile('user', 'login');
         $username = $profile->get('login');
         $profileUrl = 'https://github.com/' . $username;
         if (!$profileUrl) {
             $profileUrl = null;
         }
         JFBCFactory::cache()->store($profileUrl, 'github.profile.' . $providerUserId);
     }
     return $profileUrl;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:14,代码来源:github.php

示例7: getAvatarUrl

 function getAvatarUrl($userId, $nullForDefault = true, $params = null)
 {
     $nullString = $nullForDefault ? 'null' : 'notnull';
     $avatarUrl = JFBCFactory::cache()->get('yahoo.avatar.' . $nullString . '.' . $userId);
     if ($avatarUrl === false) {
         $response = $this->fetchProfile($userId, "image");
         $image = $response->get('image', null);
         $avatarUrl = $image->imageUrl;
         if ($nullForDefault && (!$avatarUrl || strpos($avatarUrl, 'https://s.yimg.com/dg/users'))) {
             $avatarUrl = null;
         }
         JFBCFactory::cache()->store($avatarUrl, 'yahoo.avatar.' . $nullString . '.' . $userId);
     }
     return $avatarUrl;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:15,代码来源:yahoo.php

示例8: getStream

 public function getStream($stream)
 {
     $pageId = $this->options->get('page_id');
     if (!$pageId || $pageId == '--') {
         return;
     }
     $feed = JFBCFactory::cache()->get('facebook.page.stream.' . $pageId);
     if ($feed === false) {
         $params = array();
         $params['access_token'] = $this->options->get('access_token');
         //NOTE: Uncomment to use user access token instead of page access token
         //$params['access_token'] = JFBCFactory::usermap()->getUserAccessToken($this->options->get('user_id'), 'facebook');
         $feed = $this->provider->api($pageId . '/feed?fields=message,from,updated_time,name,link,picture,caption,description,comments', $params, true, 'GET');
         JFBCFactory::cache()->store($feed, 'facebook.page.stream.' . $pageId);
     }
     if ($feed['data']) {
         foreach ($feed['data'] as $data) {
             if (array_key_exists('from', $data) && array_key_exists('message', $data) && ($this->options->get('show_admin_only') == 0 || $data['from']['id'] == $pageId)) {
                 $post = new JFBConnectPost();
                 if (isset($data['actions'][0])) {
                     $post->link = $data['actions'][0]['link'];
                 } else {
                     $ids = explode("_", $data['id']);
                     $idIndex = count($ids) - 1;
                     $post->link = 'https://www.facebook.com/' . $pageId . '/posts/' . $ids[$idIndex];
                 }
                 $post->message = array_key_exists('message', $data) ? $data['message'] : "";
                 $post->authorID = $data['from']['id'];
                 $post->authorScreenName = $data['from']['name'];
                 $post->updatedTime = array_key_exists('updated_time', $data) ? $data['updated_time'] : "";
                 $post->thumbTitle = array_key_exists('name', $data) ? $data['name'] : "";
                 $post->thumbLink = array_key_exists('link', $data) ? $data['link'] : "";
                 $post->thumbPicture = array_key_exists('picture', $data) ? $data['picture'] : "";
                 $post->thumbCaption = array_key_exists('caption', $data) ? $data['caption'] : "";
                 $post->thumbDescription = array_key_exists('description', $data) ? $data['description'] : "";
                 $post->comments = array_key_exists('comments', $data) ? $data['comments'] : "";
                 $stream->addPost($post);
             }
         }
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:41,代码来源:page.php

示例9: getAvatarUrl

 function getAvatarUrl($providerUserId, $nullForDefault = true, $params = null)
 {
     $nullString = $nullForDefault ? 'null' : 'notnull';
     $avatarUrl = JFBCFactory::cache()->get('meetup.avatar.' . $nullString . '.' . $providerUserId);
     if ($avatarUrl === false) {
         //get token from the usermap
         $token = $this->provider->client->getToken();
         if (empty($token)) {
             $token = $this->getUserAccessToken($providerUserId);
             $this->provider->client->setToken($token);
         }
         //meetup doesnt return photo if avatar is not available
         $profile = $this->fetchProfile($providerUserId, '', 'photo');
         $avatarUrl = $profile->get('photo.thumb_link');
         if (!$avatarUrl) {
             $avatarUrl = null;
         }
         JFBCFactory::cache()->store($avatarUrl, 'meetup.avatar.' . $providerUserId);
     }
     return $avatarUrl;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:21,代码来源:meetup.php

示例10: getStream

 public function getStream($stream)
 {
     $user = $this->options->get('user_id');
     if (!$user) {
         return;
     }
     $feed = JFBCFactory::cache()->get('twitter.stream.' . $user);
     if ($feed === false) {
         $accessToken = JFBCFactory::usermap()->getUserAccessToken($user, 'twitter');
         if (!$accessToken) {
             return;
         }
         $params = array();
         $params['oauth_token'] = $accessToken->key;
         $this->provider->client->setToken((array) $accessToken);
         $path = $this->provider->options->get('api.url') . 'statuses/user_timeline.json';
         $feedResponse = $this->provider->client->oauthRequest($path, 'GET', $params);
         if ($feedResponse->code != 200) {
             return array();
         }
         $feed = json_decode($feedResponse->body);
         JFBCFactory::cache()->store($feed, 'twitter.stream.' . $user);
     }
     if ($feed) {
         foreach ($feed as $data) {
             $post = new JFBConnectPost($this);
             $tweet = $data->retweeted ? $data->retweeted_status : $data;
             $post->message = isset($tweet->text) ? $tweet->text : "";
             $post->authorScreenName = '@' . $tweet->user->screen_name;
             $post->authorName = $tweet->user->name;
             $post->authorImage = $tweet->user->profile_image_url_https;
             $post->updatedTime = isset($data->created_at) ? $data->created_at : "";
             $post->thumbLink = isset($tweet->entities->urls[0]) ? $tweet->entities->urls[0]->expanded_url : "";
             $post->link = 'https://twitter.com/' . $tweet->user->screen_name . '/status/' . $data->id_str;
             $stream->addPost($post);
         }
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:38,代码来源:stream.php

示例11: getData

 public function getData()
 {
     try {
         $key = strtolower($this->systemName) . '.' . strtolower($this->provider->systemName);
         $key .= '.' . strtolower(str_replace(' ', '_', $this->name)) . '.' . md5($this->options->toString());
         //add caching capability
         $this->response = JFBCFactory::cache()->get($key);
         if ($this->response === false) {
             $data = $this->query();
             if ($data->code == 200) {
                 $this->response = json_decode($data->body, true);
                 if (is_array($this->response)) {
                     $this->response = (object) $this->response;
                 }
                 // Perform the curl Request and get $response
                 JFBCFactory::cache()->store($this->response, $key);
             }
         }
     } catch (Exception $e) {
         if (JFBCFactory::config()->get('facebook_display_errors')) {
             JFBCFactory::log($e->getMessage());
         }
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:24,代码来源:oembed.php

示例12: getSocialAvatar

 function getSocialAvatar($registerType, $profileLink)
 {
     $html = "";
     if ($this->params->get('enableProfilePic') == 'social' && $this->isJFBConnectInstalled) {
         $userId = $this->user->get('id');
         $html = JFBCFactory::cache()->get('sclogin.avatar.' . $userId);
         if ($html === false) {
             foreach ($this->providers as $provider) {
                 $html = $this->getProviderAvatar($provider, $this->user);
                 if ($html != "") {
                     JFBCFactory::cache()->store($html, 'sclogin.avatar.' . $userId);
                     break;
                 }
             }
         }
     } else {
         $html = $this->getJoomlaAvatar($registerType, $profileLink, $this->user);
     }
     if ($html != "") {
         $html = '<div id="scprofile-pic">' . $html . '</div>';
     }
     return $html;
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:23,代码来源:helper.php

示例13: getAvatarUrl

 function getAvatarUrl($providerUserId, $nullForDefault = false, $params = null)
 {
     if (!$params) {
         $params = new JRegistry();
     }
     $width = $params->get('width', 300);
     $nullString = $nullForDefault ? 'null' : 'notnull';
     $avatarUrl = JFBCFactory::cache()->get('google.avatar.' . $nullString . '.' . $providerUserId . '.' . $width);
     if ($avatarUrl === false) {
         $profile = $this->fetchProfile($providerUserId, 'image');
         $avatarUrl = $profile->get('image.url', null);
         // Check for default image
         if ($avatarUrl) {
             if ($nullForDefault) {
                 $http = new JHttp();
                 $avatar = $http->get($avatarUrl);
                 if ($avatar->code == 200 && $avatar->headers['Content-Length'] == 946) {
                     $avatarUrl = null;
                 }
             }
             if ($avatarUrl) {
                 $avatarUrl = str_replace("?sz=50", "?sz=" . $width, $avatarUrl);
             }
             // get a suitably large image to be resized
             JFBCFactory::cache()->store($avatarUrl, 'google.avatar.' . $nullString . '.' . $providerUserId . '.' . $width);
         }
     }
     return $avatarUrl;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:29,代码来源:google.php

示例14: getAvatarUrl

 function getAvatarUrl($providerId, $nullForDefault = true, $params = null)
 {
     $nullString = $nullForDefault ? 'null' : 'notnull';
     $avatarUrl = JFBCFactory::cache()->get('vk.avatar.' . $nullString . '.' . $providerId);
     if ($avatarUrl === false) {
         $data = $this->fetchProfile($providerId, "photo_big");
         $avatarUrl = $data->get('photo_big', null);
         if ($nullForDefault && (!$avatarUrl || strpos($avatarUrl, 'vk.com/images/camera_'))) {
             $avatarUrl = null;
         }
         JFBCFactory::cache()->store($avatarUrl, 'vk.avatar.' . $nullString . '.' . $providerId);
     }
     return $avatarUrl;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:14,代码来源:vk.php

示例15: buildListOfTagsToReplace

 private function buildListOfTagsToReplace()
 {
     $tagsToReplace = JFBCFactory::cache()->get('system.alleasytags');
     if ($tagsToReplace === false) {
         $providers = JFBCFactory::getAllWidgetProviderNames();
         $tagsToReplace = array();
         foreach ($providers as $provider) {
             $widgets = JFBCFactory::getAllWidgets($provider);
             foreach ($widgets as $widget) {
                 $tagsToReplace[strtolower($widget->tagName)] = array('provider' => $provider, 'widget' => $widget->systemName);
             }
         }
         //Manually add SCLinkedinLogin, since JLinkedLogin is the actual tag
         $tagsToReplace['sclinkedinlogin'] = array('provider' => 'linkedin', 'widget' => 'login');
         //Tags like JFBCShare and JFBCRecommendations need to come up after JFBCShareDialog and JFBCRecommendationsBar
         $tagsToReplace = array_reverse($tagsToReplace);
         JFBCFactory::cache()->store($tagsToReplace, 'system.alleasytags');
     }
     $this->tagsToReplace = $tagsToReplace;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:20,代码来源:jfbcsystem.php


注:本文中的JFBCFactory::cache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。