本文整理汇总了PHP中EasyBlogHelper::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::getDate方法的具体用法?PHP EasyBlogHelper::getDate怎么用?PHP EasyBlogHelper::getDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::getDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store($updateNulls = false)
{
if (!$this->created) {
$this->created = EasyBlogHelper::getDate()->toMySQL();
}
return parent::store($updateNulls);
}
示例2: bind
/**
* Responsible to perform the blog mappings
*/
public function bind(&$blog)
{
$videoSource = JRequest::getVar('videoSource');
$desc = JRequest::getVar('content');
$title = JRequest::getVar('title', '');
// If title is not set, we use the image name as the title
if ($title == JText::_('COM_EASYBLOG_MICROBLOG_TITLE_OPTIONAL', true) || empty($title)) {
$date = EasyBlogHelper::getHelper('Date')->dateWithOffSet(EasyBlogHelper::getDate()->toMySQL());
$dateString = EasyBlogHelper::getHelper('Date')->toFormat($date, '%d-%m-%Y');
// Define a generic video title
$title = JText::sprintf('COM_EASYBLOG_MICROBLOG_VIDEO_TITLE_GENERIC', $dateString);
}
// Get the default settings
$config = EasyBlogHelper::getConfig();
$width = $config->get('dashboard_video_width');
$height = $config->get('dashboard_video_height');
// Now we need to embed the image URL into the blog content.
$content = '[embed=videolink]{"video":"' . $videoSource . '","width":"' . $width . '","height":"' . $height . '"}[/embed]';
// @task: If user specified some description, append it into the content.
if (!empty($desc)) {
// @task: Replace newlines with <br /> tags since the form is a plain textarea.
$desc = nl2br($desc);
$content .= '<p>' . $desc . '</p>';
}
$blog->set('title', $title);
$blog->set('content', $content);
$blog->set('source', EBLOG_MICROBLOG_VIDEO);
}
示例3: addNotification
/**
* Adds a notification item in JomSocial
*
* @access public
* @param TableBlog $blog The blog table.
*/
public function addNotification($title, $type, $target, $author, $link)
{
jimport('joomla.filesystem.file');
// @since this only works with JomSocial 2.6, we need to test certain files.
$file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'notificationtypes.php';
if (!$this->exists || empty($target) || $target[0] == $author->getId() || !JFile::exists($file)) {
return false;
}
CFactory::load('helpers', 'notificationtypes');
CFactory::load('helpers', 'content');
CFactory::load('libraries', 'notificationtypes');
// @task: Set the necessary parameters first.
$params = EasyBlogHelper::getRegistry('');
$params->set('url', str_replace("administrator/", "", $author->getProfileLink()));
// @task: Obtain model from jomsocial.
$model = CFactory::getModel('Notification');
// @task: Currently we are not using this, so we should just skip this.
$requireAction = 0;
if (!is_array($target)) {
$target = array($target);
}
foreach ($target as $targetId) {
JTable::addIncludePath(JPATH_ROOT . '/components/com_community/tables');
$notification = JTable::getInstance('Notification', 'CTable');
$notification->actor = $author->getId();
$notification->target = $targetId;
$notification->content = $title;
$notification->created = EasyBlogHelper::getDate()->toMySQL();
$notification->params = $params->toString();
$notification->cmd_type = CNotificationTypesHelper::convertNotifId($type);
$notification->type = 0;
$notification->store();
}
return true;
}
示例4: display
function display()
{
JTable::addIncludePath(EBLOG_TABLES);
$document = JFactory::getDocument();
$viewType = $document->getType();
$config = EasyBlogHelper::getConfig();
$id = JRequest::getInt('post_id', 0);
if (!$config->get('main_trackbacks')) {
echo JText::_('Trackback disabled');
return;
}
if ($id == 0) {
echo JText::_('COM_EASYBLOG_TRACKBACK_INVALID_BLOG_ENTRY_PROVIDED');
return;
}
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($id);
header('Content-Type: text/xml');
require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'trackback.php';
$data = JRequest::get('REQUEST');
$trackback = EasyBlogHelper::getTable('Trackback', 'Table');
$trackback->bind($data);
$title = JString::trim($trackback->title);
$excerpt = JString::trim($trackback->excerpt);
$url = JString::trim($trackback->url);
$tb = new EasyBlogTrackback('', '', 'UTF-8');
//@task: We must have at least the important information
if (empty($title)) {
echo $tb->receive(false, JText::_('COM_EASYBLOG_TRACKBACK_INVALID_TITLE_PROVIDED'));
exit;
}
//@task: We must have at least the important information
if (empty($excerpt)) {
echo $tb->receive(false, JText::_('COM_EASYBLOG_TRACKBACK_INVALID_EXCERT_PROVIDED'));
exit;
}
//@task: We must have at least the important information
if (empty($url)) {
echo $tb->receive(false, JText::_('COM_EASYBLOG_TRACKBACK_INVALID_URL_PROVIDED'));
exit;
}
// Check for spams with Akismet
if ($config->get('comment_akismet_trackback')) {
$data = array('author' => $title, 'email' => '', 'website' => JURI::root(), 'body' => $excerpt, 'permalink' => $url);
if (EasyBlogHelper::getHelper('Akismet')->isSpam($data)) {
echo $tb->receive(false, JText::_('COM_EASYBLOG_TRACKBACK_MARKED_AS_SPAM'));
exit;
}
}
$trackback->created = EasyBlogHelper::getDate()->toMySQL();
$trackback->published = '0';
$trackback->ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
if ($trackback->store()) {
echo $tb->receive(true);
exit;
}
echo $tb->receive(false, JText::_('COM_EASYBLOG_ERROR'));
exit;
}
示例5: updateDisplayDate
function updateDisplayDate($eleId, $dateString)
{
$ajax = new Ejax();
$config = EasyBlogHelper::getConfig();
$date = EasyBlogHelper::getDate($dateString);
$now = EasyBlogDateHelper::toFormat($date, $config->get('layout_dateformat'));
$ajax->assign('datetime_' . $eleId . ' .datetime_caption', $now);
return $ajax->send();
}
示例6: getHTML
public static function getHTML()
{
$captcha = EasyBlogHelper::getTable('Captcha', 'Table');
$captcha->created = EasyBlogHelper::getDate()->toMySQL();
$captcha->store();
$theme = new CodeThemes();
$theme->set('id', $captcha->id);
return $theme->fetch('comment.captcha.php');
}
示例7: clear
/**
* Delete the outdated entries.
*/
function clear()
{
$db = EasyBlogHelper::db();
$date = EasyBlogHelper::getDate();
$query = 'DELETE FROM `#__easyblog_captcha` WHERE `created` <= DATE_SUB( ' . $db->Quote($date->toMySQL()) . ', INTERVAL 12 HOUR )';
$db->setQuery($query);
$db->query();
return true;
}
示例8: _buildQuery
private function _buildQuery($userId, $limit = 0, $startdate = '', $isCnt = false)
{
$db = EasyBlogHelper::db();
$dates = $this->_getDateRange($userId, $limit, $startdate);
$this->currentDateRange = $dates;
//$limitQuery = '';
$limitQuery = ' and (a.`created` >= ' . $db->Quote($dates['startdate']) . ' and a.`created` <= ' . $db->Quote($dates['enddate']) . ')';
$query = '';
if ($isCnt) {
$query = ' select COUNT(1) FROM (';
} else {
$query = ' select * FROM (';
}
$operation = '( UNIX_TIMESTAMP( \'' . EasyBlogHelper::getDate()->toMySQL() . '\' ) - UNIX_TIMESTAMP( a.`created`) )';
$query .= ' (select ';
if ($isCnt) {
$query .= ' a.id';
} else {
$query .= ' FLOOR( ' . $operation . ' ) AS minsecdiff,';
$query .= ' FLOOR( ' . $operation . ' / 60 / 60) AS hourdiff,';
$query .= ' FLOOR( ' . $operation . ' / 60 / 60 / 24) AS daydiff,';
$query .= ' a.`id`, a.`actor_id`, a.`target_id`, concat( a.`context_type`, ' . $db->Quote('-') . ', a.`verb`) as `context_type`,';
$query .= ' a.`context_type` as `plain_context_type`, a.`context_id`, a.`verb`, a.`source_id`, a.`created`, a.`uuid`';
}
$query .= ' from `#__easyblog_stream` as a';
$query .= ' INNER JOIN `#__users` as b ON b.id = a.actor_id';
$query .= ' where a.actor_id = ' . $db->Quote($userId);
$query .= $limitQuery;
$query .= ' )';
$query .= ' UNION ';
$query .= ' (select ';
if ($isCnt) {
$query .= ' a.id';
} else {
$query .= ' FLOOR( ' . $operation . ' ) AS minsecdiff,';
$query .= ' FLOOR( ' . $operation . ' / 60 / 60) AS hourdiff,';
$query .= ' FLOOR( ' . $operation . ' / 60 / 60 / 24) AS daydiff,';
$query .= ' a.`id`, a.`actor_id`, a.`target_id`, concat( a.`context_type`, ' . $db->Quote('-') . ', a.`verb`) as `context_type`,';
$query .= ' a.`context_type` as `plain_context_type`, a.`context_id`, a.`verb`, a.`source_id`, a.`created`, a.`uuid`';
}
$query .= ' from `#__easyblog_stream` as a';
$query .= ' INNER JOIN `#__users` as b ON b.id = a.target_id';
$query .= ' where a.target_id = ' . $db->Quote($userId);
$query .= ' and a.actor_id != ' . $db->Quote($userId);
$query .= $limitQuery;
$query .= ' )';
$query .= ' ) as x';
if (!$isCnt) {
$query .= ' order by x.created desc';
}
return $query;
}
示例9: processDate
public static function processDate($timestamp = '')
{
//This gets today's date
if (empty($timestamp)) {
$jdate = EasyBlogHelper::getDate();
$timestamp = $jdate->toUnix();
}
//This puts the day, month, and year in seperate variables
$date['day'] = date('d', $timestamp);
$date['month'] = date('m', $timestamp);
$date['year'] = date('Y', $timestamp);
$date['unix'] = $timestamp;
return $date;
}
示例10: request
function request()
{
$mainframe = JFactory::getApplication();
if (!EasyBlogHelper::isLoggedIn()) {
$mainframe->enqueueMessage(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog', false));
return;
}
$redirect = JRequest::getVar('redirect', '');
$type = JRequest::getCmd('type');
if (!empty($redirect)) {
$redirect = '&redirect=' . $redirect;
}
$userId = JRequest::getVar('id');
// Flickr integration does not require user id.
if (empty($userId)) {
$mainframe->enqueueMessage(JText::_('Error, User not found.'), 'error');
$redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
$this->setRedirect($redirect);
return;
}
$call = JRequest::getWord('call');
$callUri = !empty($call) ? '&call=' . $call . '&id=' . $userId : '&id=' . $userId;
$config = EasyBlogHelper::getConfig();
$key = $config->get('integrations_' . $type . '_api_key');
$secret = $config->get('integrations_' . $type . '_secret_key');
$callback = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&c=oauth&task=grant&type=' . $type . $redirect . $callUri;
$consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback);
$request = $consumer->getRequestToken();
if (empty($request->token) || empty($request->secret)) {
$mainframe->enqueueMessage(JText::_('COM_EASYBLOG_OAUTH_KEY_INVALID'), 'error');
$redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
$this->setRedirect($redirect);
return;
}
$oauth = EasyBlogHelper::getTable('Oauth', 'Table');
$oauth->user_id = $userId;
$oauth->type = $type;
$oauth->created = EasyBlogHelper::getDate()->toMySQL();
// Bind the request tokens
$param = EasyBlogHelper::getRegistry('');
$param->set('token', $request->token);
$param->set('secret', $request->secret);
$oauth->request_token = $param->toString();
$oauth->store();
$this->setRedirect($consumer->getAuthorizationURL($request->token, false, 'popup'));
}
示例11: submitReport
/**
* Process report items.
*
* @access public
* @param null
**/
public function submitReport()
{
JRequest::checkToken() or die('Invalid Token');
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
if (!$my->id && !$config->get('main_reporting_guests')) {
echo JText::_('COM_EASYBLOG_CATEGORIES_FOR_REGISTERED_USERS_ONLY');
exit;
}
$objId = JRequest::getInt('obj_id');
$objType = JRequest::getCmd('obj_type');
$reason = JRequest::getString('reason');
// @task: Ensure that the reason is never empty.
if (empty($reason)) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_REPORT_PLEASE_SPECIFY_REASON'), 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false));
return;
}
$report = EasyBlogHelper::getTable('Report');
$report->set('obj_id', $objId);
$report->set('obj_type', $objType);
$report->set('reason', $reason);
$report->set('created', EasyBlogHelper::getDate()->toMySQL());
$report->set('created_by', $my->id);
$report->set('ip', @$_SERVER['REMOTE_ADDR']);
if (!$report->store()) {
$error = $report->getError();
EasyBlogHelper::setMessageQueue($error, 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false));
return;
}
// @TODO: Configurable report links
switch ($objType) {
case EBLOG_REPORTING_POST:
default:
$blog = EasyBlogHelper::getTable('Blog');
$blog->load($objId);
$report->notify($blog);
$message = JText::_('COM_EASYBLOG_THANKS_FOR_REPORTING');
$redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false);
break;
}
EasyBlogHelper::setMessageQueue($message);
$this->setRedirect($redirect);
}
示例12: vote
public function vote($value, $uid, $type, $elementId)
{
$ajax = new Ejax();
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($uid);
if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
echo 'Invalid Access.';
exit;
}
}
$rating = EasyBlogHelper::getTable('Ratings', 'Table');
// Do not allow guest to vote, or if the voter already voted.
if ($rating->fill($my->id, $uid, $type, JFactory::getSession()->getId()) || $my->id < 1 && !$config->get('main_ratings_guests')) {
// We wouldn't allow user to vote more than once so don't do anything here
$ajax->send();
}
$rating->set('created_by', $my->id);
$rating->set('type', $type);
$rating->set('uid', $uid);
$rating->set('ip', @$_SERVER['REMOTE_ADDR']);
$rating->set('value', (int) $value);
$rating->set('sessionid', JFactory::getSession()->getId());
$rating->set('created', EasyBlogHelper::getDate()->toMySQL());
$rating->set('published', 1);
$rating->store();
$model = EasyBlogHelper::getModel('Ratings');
$ratingValue = $model->getRatingValues($uid, $type);
$total = $ratingValue->total;
$rating = $ratingValue->ratings;
// Assign badge for users that report blog post.
// Only give points if the viewer is viewing another person's blog post.
EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.rate', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_RATED_BLOG'));
$ajax->script('eblog.loader.doneLoading("' . $elementId . '-command .ratings-text")');
$ajax->script('eblog.ratings.update("' . $elementId . '", "' . $type . '" , "' . $rating . '" , "' . JText::_('COM_EASYBLOG_RATINGS_RATED_THANK_YOU') . '");');
$ajax->assign($elementId . ' .ratings-value', '<i></i>' . $total . '<b>√</b>');
if (EasyBlogHelper::isAUPEnabled()) {
$id = AlphaUserPointsHelper::getAnyUserReferreID($my->id);
AlphaUserPointsHelper::newpoints('plgaup_easyblog_rate_blog', $id, '', JText::sprintf('COM_EASYBLOG_AUP_BLOG_RATED'), '');
}
$ajax->send();
}
示例13: bind
/**
* Responsible to perform the blog mappings
*/
public function bind(&$blog)
{
$content = JRequest::getVar('content');
$title = JRequest::getVar('title');
$link = JRequest::getVar('link', '');
// If title is not set, we use the image name as the title
if ($title == JText::_('COM_EASYBLOG_MICROBLOG_TITLE_OPTIONAL', true) || empty($title)) {
$title = $link;
}
if (empty($content)) {
$date = EasyBlogHelper::getHelper('Date')->dateWithOffSet(EasyBlogHelper::getDate()->toMySQL());
$dateString = EasyBlogHelper::getHelper('Date')->toFormat($date, '%d-%m-%Y');
// Define a generic video title
$content = '<p>' . JText::sprintf('COM_EASYBLOG_MICROBLOG_LINK_CONTENT_GENERIC', $dateString) . '</p>';
} else {
// @task: Replace newlines with <br /> tags since the form is a plain textarea.
$content = nl2br($content);
}
$blog->set('title', $title);
$blog->set('content', $content);
$blog->set('source', EBLOG_MICROBLOG_LINK);
}
示例14: updateComment
public function updateComment()
{
$mainframe = JFactory::getApplication();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
$id = JRequest::getInt('commentId');
$post = JRequest::get('POST');
//add here so that other component with the same comment.php jtable file will not get reference.
JTable::addIncludePath(EBLOG_TABLES);
$comment = EasyBlogHelper::getTable('Comment', 'Table');
$comment->load($id);
$redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id, false);
if (($my->id != $comment->created_by || !$acl->rules->delete_comment) && !EasyBlogHelper::isSiteAdmin() && !$acl->rules->manage_comment || $my->id == 0) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_UPDATE_COMMENT'), 'error');
$mainframe->redirect($redirect);
$mainframe->close();
}
$comment->bindPost($post);
if (!$comment->validate('title')) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_COMMENT_TITLE_IS_EMPTY'), 'error');
$mainframe->redirect($redirect);
$mainframe->close();
}
if (!$comment->validate('comment')) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_COMMENT_IS_EMPTY'), 'error');
$mainframe->redirect($redirect);
$mainframe->close();
}
$comment->modified = EasyBlogHelper::getDate()->toMySQL();
if (!$comment->store()) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_COMMENT_FAILED_TO_SAVE'), 'error');
$mainframe->redirect($redirect);
$mainframe->close();
}
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_COMMENT_UPDATED_SUCCESS'), 'success');
$mainframe->redirect($redirect);
$mainframe->close();
}
示例15: request
function request()
{
if (!EasyBlogHelper::isLoggedIn()) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog', false));
return;
}
$redirect = JRequest::getVar('redirect', '');
if (!empty($redirect)) {
$redirect = '&redirect=' . $redirect;
}
$call = JRequest::getWord('call');
$callUri = !empty($call) ? '&call=' . $call : '';
$type = JRequest::getCmd('type');
$config = EasyBlogHelper::getConfig();
$key = $config->get('integrations_' . $type . '_api_key');
$secret = $config->get('integrations_' . $type . '_secret_key');
$callback = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&controller=oauth&task=grant&type=' . $type . $redirect . $callUri, false, true);
$consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback);
$request = $consumer->getRequestToken();
if (empty($request->token) || empty($request->secret)) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_OAUTH_KEY_INVALID'), 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
return;
}
$oauth = EasyBlogHelper::getTable('Oauth', 'Table');
$oauth->user_id = JFactory::getUser()->id;
$oauth->type = $type;
$oauth->created = EasyBlogHelper::getDate()->toMySQL();
// Bind the request tokens
$param = EasyBlogHelper::getRegistry('');
$param->set('token', $request->token);
$param->set('secret', $request->secret);
$oauth->request_token = $param->toString();
$oauth->store();
$this->setRedirect($consumer->getAuthorizationURL($request->token, false, 'popup'));
}