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


PHP EB::date方法代码示例

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


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

示例1: reportBlog

 public function reportBlog()
 {
     $app = JFactory::getApplication();
     // Get the composite keys
     $log_user = $this->plugin->get('user')->id;
     $id = $app->input->get('id', 0, 'int');
     $type = $app->input->get('type', '', 'POST');
     $reason = $app->input->get('reason', '', 'STRING');
     if (!$reason) {
         $message = "Reason is empty";
         $final_result['message'] = $message;
         $final_result['status'] = false;
         return $final_result;
     }
     $report = EB::table('Report');
     $report->obj_id = $id;
     $report->obj_type = $type;
     $report->reason = $reason;
     $report->created = EB::date()->toSql();
     $report->created_by = $log_user;
     $state = $report->store();
     if (!$state) {
         $message = "Cant store your report";
         $final_result['message'] = $message;
         $final_result['status'] = false;
         return $final_result;
     }
     // Notify the site admin when there's a new report made
     $post = EB::post($id);
     $report->notify($post);
     $final_result['message'] = "Report logged successfully!";
     $final_result['status'] = true;
     return $final_result;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:34,代码来源:report.php

示例2: grant

 /**
  * Method to process redirections from google
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function grant()
 {
     // Get the oauth client
     $client = EB::oauth()->getClient('Facebook');
     // Get the code that facebook provided
     $code = $this->input->get('code', '', 'default');
     // Determines if this is a system request
     $system = $this->input->get('system', false, 'bool');
     // Exchange the code for an access token
     $result = $client->exchangeToken($code);
     // Load the Facebook oauth table
     $oauth = EB::table('OAuth');
     if ($system) {
         $oauth->load(array('type' => 'facebook', 'system' => true));
     } else {
         $oauth->load(array('type' => 'facebook', 'user_id' => $this->my->id, 'system' => false));
     }
     $oauth->created = EB::date()->toSql();
     $oauth->expires = $result->expires;
     $oauth->access_token = json_encode($result);
     $oauth->store();
     // Since the page that is redirected to here is a popup, we need to close the window
     $this->info->set(JText::_('COM_EASYBLOG_AUTOPOSTING_FACEBOOK_AUTHORIZED_SUCCESS'), 'success');
     echo '<script type="text/javascript">window.opener.doneLogin();window.close();</script>';
     exit;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:facebook.php

示例3: store

 public function store($updateNulls = false)
 {
     if (!$this->created) {
         $this->created = EB::date()->toMySQL();
     }
     return parent::store($updateNulls);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:7,代码来源:feed.php

示例4: authorize

 /**
  * Retrieves the authorization url and redirect accordingly
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function authorize()
 {
     // Get the client
     $client = EB::oauth()->getClient('LinkedIn');
     // Determines if this is for the centralized section
     $system = $this->input->get('system', false, 'bool');
     // Get the user id
     $userId = $this->input->get('userId', null, 'default');
     if (is_null($userId)) {
         $userId = $this->my->id;
     }
     // Get the redirection url
     $token = $client->getRequestToken();
     $url = $client->getAuthorizeURL($token->token);
     // Because twitter is being a PITA, we need to store these request tokens locally first.
     // Create a new table for record
     $table = EB::table('OAuth');
     if ($system) {
         $table->load(array('type' => 'linkedin', 'system' => true));
     } else {
         $table->load(array('type' => 'linkedin', 'user_id' => $userId, 'system' => false));
     }
     $table->user_id = $userId;
     $table->type = 'linkedin';
     $table->created = EB::date()->toSql();
     if ($system) {
         $table->system = 1;
     }
     // Store the request tokens here
     $table->request_token = json_encode($token);
     $table->store();
     $this->app->redirect($url);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:41,代码来源:linkedin.php

示例5: join

 /**
  * Processes requests to join the team
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function join()
 {
     // Check for request forgeries
     EB::checkToken();
     // Only allow registered users
     EB::requireLogin();
     $return = $this->input->get('return', '', 'default');
     if ($return) {
         $return = base64_decode($return);
     }
     // Default return url
     if (!$return) {
         $return = EB::_('index.php?option=com_easyblog&view=teamblog', false);
     }
     // Get the team data
     $id = $this->input->get('id', 0, 'int');
     $team = EB::table('TeamBlog');
     $team->load($id);
     if (!$id || !$team->id) {
         $this->info->set('COM_EASYBLOG_TEAMBLOG_INVALID_ID_PROVIDED', 'error');
         return $this->app->redirect($return);
     }
     $model = EB::model('TeamBlogs');
     $isMember = $model->isMember($team->id, $this->my->id);
     // Check if the user already exists
     if ($isMember) {
         $this->info->set('COM_EASYBLOG_TEAMBLOG_ALREADY_MEMBER', 'error');
         return $this->app->redirect($return);
     }
     // If the user is a site admin, they are free to do whatever they want
     if (EB::isSiteAdmin()) {
         $map = EB::table('TeamBlogUsers');
         $map->user_id = $this->my->id;
         $map->team_id = $team->id;
         $map->store();
         $this->info->set('COM_EASYBLOG_TEAMBLOG_REQUEST_JOINED', 'success');
     } else {
         // Create a new request
         $request = EB::table('TeamBlogRequest');
         $request->team_id = $team->id;
         $request->user_id = $this->my->id;
         $request->ispending = true;
         $request->created = EB::date()->toSql();
         // If request was already made previously, skip this
         if ($request->exists()) {
             $this->info->set('COM_EASYBLOG_TEAMBLOG_REQUEST_ALREADY_SENT', 'error');
             return $this->app->redirect($return);
         }
         // Store the request now
         $state = $request->store();
         if (!$state) {
             $this->info->set($request->getError(), 'error');
             return $this->app->redirect($return);
         }
         // Send moderation emails
         $request->sendModerationEmail();
         $this->info->set('COM_EASYBLOG_TEAMBLOG_REQUEST_SENT', 'success');
     }
     return $this->app->redirect($return);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:68,代码来源:teamblogs.php

示例6: getPostsHistory

 /**
  * Retrieve stats for blog posts created the past week
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPostsHistory()
 {
     // Get dbo
     $db = EB::db();
     // Get the past 7 days
     $today = EB::date();
     $dates = array();
     for ($i = 0; $i < 7; $i++) {
         $date = EB::date('-' . $i . ' day');
         $dates[] = $date->format('Y-m-d');
     }
     // Reverse the dates
     $dates = array_reverse($dates);
     // Prepare the main result
     $result = new stdClass();
     $result->dates = $dates;
     $result->count = array();
     $i = 0;
     foreach ($dates as $date) {
         $query = array();
         $query[] = 'SELECT COUNT(1) FROM ' . $db->quoteName('#__easyblog_post');
         $query[] = 'WHERE DATE_FORMAT(' . $db->quoteName('created') . ', GET_FORMAT(DATE, "ISO")) =' . $db->Quote($date);
         $query[] = 'AND ' . $db->quoteName('published') . '=' . $db->Quote(EASYBLOG_POST_PUBLISHED);
         $query[] = 'AND ' . $db->quoteName('state') . '=' . $db->Quote(EASYBLOG_POST_NORMAL);
         $query = implode(' ', $query);
         $db->setQuery($query);
         $total = $db->loadResult();
         $result->count[$i] = $total;
         $i++;
     }
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:40,代码来源:stats.php

示例7: getLatestComment

 static function getLatestComment(&$params)
 {
     $mainframe = JFactory::getApplication();
     $db = EB::db();
     $count = (int) trim($params->get('count', 5));
     $showprivate = $params->get('showprivate', true);
     $query = 'SELECT ' . $db->qn('b.title') . ' as `blog_title`, ' . $db->qn('b.created_by') . ' as `author_id`, ' . $db->qn('b.category_id') . ' as `category_id`, a.*';
     $query .= ' from `#__easyblog_comment` as a';
     $query .= '   left join `#__easyblog_post` as b';
     $query .= '   on a.`post_id` = b.`id`';
     $query .= ' where b.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= ' and b.`state` = ' . $db->Quote(EASYBLOG_POST_NORMAL);
     $query .= ' and a.`published`=' . $db->Quote('1');
     $query .= ' and b.`source_id` = ' . $db->Quote('0');
     if (!$showprivate) {
         $query .= ' and b.`access` = ' . $db->Quote('0');
     }
     $query .= ' order by a.`created` desc';
     $query .= ' limit ' . $count;
     $db->setQuery($query);
     $result = $db->loadObjectList();
     if (count($result) > 0) {
         for ($i = 0; $i < count($result); $i++) {
             $row =& $result[$i];
             $row->author = EB::user($row->created_by);
             $date = EB::date($row->created)->dateWithOffSet();
             $row->dateString = EB::date($row->created)->toFormat(JText::_('DATE_FORMAT_LC3'));
         }
     }
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:31,代码来源:helper.php

示例8: store

 /**
  * Override the implementation of store
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function store($updateNulls = false)
 {
     // Check if creation date have been set
     if (!$this->created) {
         $this->created = EB::date()->toSql();
     }
     return parent::store($updateNulls);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:featured.php

示例9: getHTML

 public static function getHTML()
 {
     $captcha = EB::table('Captcha');
     $captcha->created = EB::date()->toMySQL();
     $captcha->store();
     $theme = EB::template();
     $theme->set('id', $captcha->id);
     return $theme->output('site/comments/captcha');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:9,代码来源:captcha.php

示例10: clear

 /**
  * Delete the outdated entries.
  */
 function clear()
 {
     $db = EasyBlogHelper::db();
     $date = EB::date();
     $query = 'DELETE FROM `#__easyblog_captcha` WHERE `created` <= DATE_SUB( ' . $db->Quote($date->toMySQL()) . ', INTERVAL 12 HOUR )';
     $db->setQuery($query);
     $db->query();
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:12,代码来源:captcha.php

示例11: execute

 /**
  * Default method to format normal posts
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function execute()
 {
     // Result
     $result = array();
     // Cache data and preload posts
     if ($this->cache) {
         EB::cache()->insert($this->items);
     }
     // Preload all featured posts for posts
     $featuredItems = array();
     // Do a simple test to see if preload featured items is require or not
     if (!isset($this->items[0]->featured)) {
         $featuredItems = $this->preloadFeaturedItems();
     }
     $i = 0;
     foreach ($this->items as $item) {
         // Load up the post library
         $post = EB::post();
         $post->load($item->id);
         // Get the list of categories for this particular blog post
         $post->category = $post->getPrimaryCategory();
         $post->categories = $post->getCategories();
         // @Assign dynamic properties that must exist everytime formatBlog is called
         // We can't rely on ->author because CB plugins would mess things up.
         $post->author = $post->getAuthor();
         // Determines if the blog post is featured
         if (isset($item->featured)) {
             $post->isFeatured = $item->featured;
         } else {
             if (isset($featuredItems[$post->id])) {
                 $post->isFeatured = $featuredItems[$post->id];
             } else {
                 $post->isFeatured = 0;
             }
         }
         // Password verifications
         $this->password($post);
         // Get custom fields
         $post->fields = $post->getCustomFields();
         // Format microblog postings
         if ($post->posttype) {
             $this->formatMicroblog($post);
         } else {
             $post->posttype = 'standard';
         }
         // Assign tags to the custom properties.
         $post->tags = $post->getTags();
         // Prepare nice date for the list
         $post->date = EB::date($post->created)->format(JText::_('DATE_FORMAT_LC'));
         $result[] = $post;
         $i++;
     }
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:62,代码来源:list.php

示例12: getCurrentDate

 public static function getCurrentDate()
 {
     //This gets today's date
     $jdate = EB::date();
     $now = $jdate->toUnix();
     //This puts the day, month, and year in seperate variables
     $date['day'] = date('d', $now);
     $date['month'] = date('m', $now);
     $date['year'] = date('Y', $now);
     return $date;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:11,代码来源:helper.php

示例13: date

 /**
  * Formats a given date string with a given date format
  *
  * @since   1.0
  * @access  public
  * @param   string      The current timestamp
  * @param   string      The language string format or the format for Date
  * @param   bool        Determine if it should be using the appropriate offset or GMT
  * @return  
  */
 public static function date($timestamp, $format = '', $withOffset = true)
 {
     // Get the current date object based on the timestamp provided.
     $date = EB::date($timestamp, $withOffset);
     // If format is not provided, we should use DATE_FORMAT_LC2 by default.
     $format = empty($format) ? 'DATE_FORMAT_LC2' : $format;
     // Get the proper format.
     $format = JText::_($format);
     $dateString = $date->format($format);
     return $dateString;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:21,代码来源:string.php

示例14: display

 function display($tmpl = null)
 {
     if (!$this->config->get('main_rss')) {
         return;
     }
     $model = EB::model('Blog');
     $data = $model->getFeaturedBlog();
     $document = JFactory::getDocument();
     $document->link = EBR::_('index.php?option=com_easyblog&view=featured');
     $document->setTitle(JText::_('COM_EASYBLOG_FEEDS_FEATURED_TITLE'));
     $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_FEATURED_DESC', JURI::root()));
     if (empty($data)) {
         return;
     }
     $uri = JURI::getInstance();
     $scheme = $uri->toString(array('scheme'));
     $scheme = str_replace('://', ':', $scheme);
     foreach ($data as $row) {
         $blog = EB::table('Blog');
         $blog->load($row->id);
         $profile = EB::user($row->created_by);
         $created = EB::date($row->created);
         $row->created = $created->toSql();
         if ($this->config->get('main_rss_content') == 'introtext') {
             $row->text = !empty($row->intro) ? $row->intro : $row->content;
             //read more for feed
             $row->text .= '<br /><a href=' . EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>';
         } else {
             $row->text = $row->intro . $row->content;
         }
         $row->text = EB::videos()->strip($row->text);
         $row->text = EB::adsense()->stripAdsenseCode($row->text);
         $category = EB::table('Category');
         // Get primary category
         $primaryCategory = $blog->getPrimaryCategory();
         $category->load($primaryCategory->id);
         // Assign to feed item
         $title = $this->escape($row->title);
         $title = html_entity_decode($title);
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
         $item->description = $row->text;
         // replace the image source to proper format so that feed reader can view the image correctly.
         $item->description = str_replace('src="//', 'src="' . $scheme . '//', $item->description);
         $item->description = str_replace('href="//', 'href="' . $scheme . '//', $item->description);
         $item->date = $row->created;
         $item->category = $category->getTitle();
         $item->author = $profile->getName();
         $item->authorEmail = $this->getRssEmail($profile);
         $document->addItem($item);
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:54,代码来源:view.feed.php

示例15: execute

 public function execute()
 {
     if ($this->cache) {
         //preload posts information
         EB::cache()->insert($this->items);
     }
     // For featured items we wouldn't want to process comments
     $comment = true;
     // For featured items we want to remove featured image
     $removeFeaturedImage = true;
     // For featured items we do not want to load videos
     $video = false;
     // For featured items we do not want to process gallery
     $gallery = false;
     // Ensure that the content does not exceed the introtext limit for featured items
     $contentLimit = $this->config->get('layout_featured_intro_limit');
     $result = array();
     foreach ($this->items as &$item) {
         $blog = EB::post($item->id);
         // Load the author's profile
         $author = EB::user($blog->created_by);
         // @Assign dynamic properties that must exist everytime formatBlog is called
         // We can't rely on ->author because CB plugins would mess things up.
         $blog->author = $author;
         $blog->blogger = $author;
         // Password verifications
         $this->password($blog);
         // Format microblog postings
         if ($blog->posttype) {
             $this->formatMicroblog($blog);
         }
         // Detect if content requires read more link
         $blog->readmore = $this->hasReadmore($blog);
         // // Truncate content
         // $this->truncate($blog);
         // EB::truncateContent($blog, $loadVideo, $frontpage, $loadGallery);
         // Format the content for the featured items
         if (empty($blog->intro)) {
             $blog->intro = $blog->content;
         }
         // We wouldn't want to display html codes in the content
         $blog->intro = strip_tags($blog->intro);
         // Get the content length
         $length = JString::strlen($blog->intro);
         if ($length > $contentLimit) {
             $blog->intro = JString::substr($blog->intro, 0, $contentLimit);
         }
         // Prepare nice date for the featured area
         $blog->date = EB::date($blog->created)->format(JText::_('DATE_FORMAT_LC'));
         $result[] = $blog;
     }
     return $result;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:53,代码来源:featured.php


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