本文整理汇总了PHP中SugarFeed::getTimeLapse方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarFeed::getTimeLapse方法的具体用法?PHP SugarFeed::getTimeLapse怎么用?PHP SugarFeed::getTimeLapse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarFeed
的用法示例。
在下文中一共展示了SugarFeed::getTimeLapse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLatestUpdates
/**
* @deprecated This is a depreciated method and will be removed in version 7.3.
*/
public function getLatestUpdates($maxTime, $maxEntries)
{
$td = $GLOBALS['timedate'];
try {
if (!$this->setupFacebookLib()) {
// FIXME: Translate
return array('success' => FALSE, 'errorMessage' => 'Facebook does not have the required libraries.');
}
$fbMessages = $this->fb->api('/me/home?limit=' . $maxEntries);
} catch (FacebookApiException $e) {
// We should ask user about second login to facebook because our access_token is dead.
if ($e->getType() == 'OAuthException' && !empty($this->eapmBean->id)) {
return array('success' => true, 'messages' => array(array('ID' => create_guid(), 'sort_key' => time(), 'NAME' => translate('LBL_ERR_OAUTH_FACEBOOK_1', 'EAPM') . ' <a href="#" onclick="window.open(\'index.php?module=EAPM&refreshParentWindow=1&closeWhenDone=1&action=QuickSave&application=Facebook\',\'EAPM\');">' . translate('LBL_ERR_OAUTH_FACEBOOK_2', 'EAPM') . '</a>.')));
}
$GLOBALS['log']->error('Facebook Error: ' . $e->getMessage());
return array('success' => FALSE, 'errorMessage' => translate('LBL_ERR_FACEBOOK', 'EAPM'));
}
if (!isset($fbMessages['data'][0])) {
return array('success' => TRUE, 'messages' => array());
}
$messages = array();
foreach ($fbMessages['data'] as $message) {
if (empty($message['message'])) {
continue;
}
$unix_time = strtotime($message['created_time']);
$fake_record = array();
$fake_record['sort_key'] = $unix_time;
$fake_record['ID'] = create_guid();
$fake_record['DATE_ENTERED'] = $td->to_display_date_time(gmdate('Y-m-d H:i:s', $unix_time));
$fake_record['NAME'] = $message['from']['name'] . '</b>';
if (!empty($message['message'])) {
$fake_record['NAME'] .= ' ' . $message['message'];
}
if (!empty($message['picture'])) {
$fake_record['NAME'] .= '<br><!--not_in_theme!--><img src="' . $message['picture'] . '" height=50>';
}
$fake_record['NAME'] .= '<br><div class="byLineBox"><span class="byLineLeft">' . SugarFeed::getTimeLapse($fake_record['DATE_ENTERED']) . ' </span><div class="byLineRight"> </div></div>';
$fake_record['IMAGE_URL'] = "https://graph.facebook.com/" . $message['from']['id'] . '/picture';
$messages[] = $fake_record;
}
return array('success' => TRUE, 'messages' => $messages);
}
示例2: testgetTimeLapse
public function testgetTimeLapse()
{
$result = SugarFeed::getTimeLapse('2016-01-15 11:16:02');
$this->assertTrue(isset($result));
$this->assertGreaterThan(0, strlen($result));
}