本文整理汇总了PHP中EasyBlogHelper::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::getTable方法的具体用法?PHP EasyBlogHelper::getTable怎么用?PHP EasyBlogHelper::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::getTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tmpl = null)
{
$config = EasyBlogHelper::getConfig();
$id = JRequest::getInt('id');
$team = EasyBlogHelper::getTable('TeamBlog');
$team->load($id);
if ($team->access != EBLOG_TEAMBLOG_ACCESS_EVERYONE) {
return;
}
$model = $this->getModel('Blog');
$posts = $model->getBlogsBy('teamblog', $team->id);
$weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
$weever->set('description', JText::sprintf('COM_EASYBLOG_FEEDS_TEAMBLOGS_DESC', $team->title));
$weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=teamblog&id=' . $id . '&format=weever', false, true));
$weever->set('thisPage', 1);
$weever->set('lastPage', 1);
if ($posts) {
foreach ($posts as $post) {
$blog = EasyBlogHelper::getTable('Blog');
$blog->load($post->id);
$weever->addChild($blog);
}
}
$weever->toJSON(true, JRequest::getVar('callback'));
}
示例2: store
public function store()
{
$isNew = empty($this->id) ? true : false;
$state = parent::store();
if ($state && $isNew) {
$blog = EasyBlogHelper::getTable('Blog');
$blog->load($this->post_id);
$profile = EasyBlogHelper::getTable('Profile');
$profile->load($blog->created_by);
$obj = new stdClass();
$obj->blogtitle = $blog->title;
$obj->blogauthor = $profile->getName();
$obj->subscribername = $this->fullname;
$obj->subscriberemail = $this->email;
$activity = new stdClass();
$activity->actor_id = empty($this->user_id) ? '0' : $this->user_id;
$activity->target_id = $blog->created_by;
$activity->context_type = 'post';
$activity->context_id = $this->post_id;
$activity->verb = 'subscribe';
$activity->source_id = $this->id;
$activity->uuid = serialize($obj);
EasyBlogHelper::activityLog($activity);
}
return $state;
}
示例3: getHTML
/**
* Retrieves the html codes for the ratings.
*
* @param int $uid The unique id for the item that is being rated
* @param string $type The unique type for the item that is being rated
* @param string $command A textual representation to request user to vote for this item.
* @param string $element A dom element id.
**/
public function getHTML($uid, $type, $command, $elementId, $disabled = false)
{
$config = EasyBlogHelper::getConfig();
if (!$config->get('main_ratings')) {
return false;
}
$language = JFactory::getLanguage();
$language->load('com_easyblog', JPATH_ROOT);
// Add ratings to the page
$document = JFactory::getDocument();
$rating = EasyBlogHelper::getTable('Ratings', 'Table');
$my = JFactory::getUser();
$hash = $my->id > 0 ? '' : JFactory::getSession()->getId();
$voted = $rating->fill($my->id, $uid, $type, $hash);
$locked = $voted || $my->id < 1 && !$config->get('main_ratings_guests') || $disabled;
$model = EasyBlogHelper::getModel('Ratings');
$ratingValue = $model->getRatingValues($uid, $type);
$theme = new CodeThemes();
$theme->set('voted', $voted);
$theme->set('elementId', $elementId);
$theme->set('rating', $ratingValue->ratings);
$theme->set('total', $ratingValue->total);
$theme->set('locked', $locked);
$theme->set('command', $command);
$theme->set('uid', $uid);
$theme->set('type', $type);
return $theme->fetch('ratings.form.php');
}
示例4: store
public function store()
{
// @task: Load language file from the front end.
JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
$this->clear($this->draft_id);
// @rule: Send notification to the author of the post.
$draft = EasyBlogHelper::getTable('Draft');
$draft->load($this->draft_id);
$author = EasyBlogHelper::getTable('Profile');
$author->load($draft->created_by);
$data['blogTitle'] = $draft->title;
$data['blogAuthor'] = $author->getName();
$data['blogAuthorAvatar'] = $author->getAvatar();
$data['blogEditLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id, false, true);
$data['blogAuthorEmail'] = $author->user->email;
$data['rejectMessage'] = $this->message;
// If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
$sh404exists = EasyBlogRouter::isSh404Enabled();
if (JFactory::getApplication()->isAdmin() && $sh404exists) {
$data['blogEditLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id;
}
$emailTitle = JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_REJECTED');
$obj = new StdClass();
$obj->unsubscribe = false;
$obj->email = $author->user->email;
$emails = array($obj);
$notification = EasyBlogHelper::getHelper('Notification');
$notification->send($emails, $emailTitle, 'email.blog.rejected', $data);
return parent::store();
}
示例5: display
function display($tpl = null)
{
// @rule: Test for user access if on 1.6 and above
if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
if (!JFactory::getUser()->authorise('easyblog.manage.comment', 'com_easyblog')) {
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
JFactory::getApplication()->close();
}
}
//initialise variables
$document = JFactory::getDocument();
$user = JFactory::getUser();
$mainframe = JFactory::getApplication();
//Load pane behavior
jimport('joomla.html.pane');
$commentId = JRequest::getVar('commentid', '');
$comment = EasyBlogHelper::getTable('Comment', 'Table');
$comment->load($commentId);
$this->comment = $comment;
// Set default values for new entries.
if (empty($comment->created)) {
$date = EasyBlogDateHelper::getDate();
$now = EasyBlogDateHelper::toFormat($date);
$comment->created = $now;
$comment->published = true;
}
$this->assignRef('comment', $comment);
parent::display($tpl);
}
示例6: display
/**
* Generates a random captcha image
*
**/
function display($cachable = false, $urlparams = false)
{
// @TODO: Run some cleaning query here to clear the database.
JTable::addIncludePath(EBLOG_TABLES);
$id = JRequest::getInt('captcha-id', '');
$captcha = EasyBlogHelper::getTable('Captcha', 'Table');
// clearing the oudated keys.
$captcha->clear();
// load the captcha records.
$captcha->load($id);
if (!$captcha->id) {
return false;
}
// @task: Generate a very random integer and take only 5 chars max.
$hash = JString::substr(md5(rand(0, 9999)), 0, 5);
$captcha->response = $hash;
$captcha->store();
// Captcha width and height
$width = 100;
$height = 20;
$image = ImageCreate($width, $height);
$white = ImageColorAllocate($image, 255, 255, 255);
$black = ImageColorAllocate($image, 0, 0, 0);
$gray = ImageColorAllocate($image, 204, 204, 204);
ImageFill($image, 0, 0, $white);
ImageString($image, 5, 30, 3, $hash, $black);
ImageRectangle($image, 0, 0, $width - 1, $height - 1, $gray);
imageline($image, 0, $height / 2, $width, $height / 2, $gray);
imageline($image, $width / 2, 0, $width / 2, $height, $gray);
header('Content-type: image/jpeg');
ImageJpeg($image);
ImageDestroy($image);
exit;
}
示例7: sendOnPageLoad
function sendOnPageLoad($max = 5)
{
$db = EasyBlogHelper::db();
$config = EasyBlogHelper::getConfig();
$sendHTML = $config->get('main_mailqueuehtmlformat', 0);
// Delete existing mails that has already been sent.
$query = 'DELETE FROM ' . $db->nameQuote('#__easyblog_mailq') . ' WHERE ' . $db->nameQuote('status') . '=' . $db->Quote(1) . ' AND DATEDIFF(NOW(), `created`) >= 7';
$db->setQuery($query);
$db->Query();
$query = 'SELECT `id` FROM `#__easyblog_mailq` WHERE `status` = 0';
$query .= ' ORDER BY `created` ASC';
$query .= ' LIMIT ' . $max;
$db->setQuery($query);
$result = $db->loadObjectList();
if (!empty($result)) {
foreach ($result as $mail) {
$mailq = EasyBlogHelper::getTable('MailQueue', 'Table');
$mailq->load($mail->id);
// update the status to 1 == proccessed
$mailq->status = 1;
if ($mailq->store()) {
// Send emails out.
if (EasyBlogHelper::getJoomlaVersion() >= '3.0') {
$mail = JFactory::getMailer();
$mail->sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $sendHTML);
} else {
JUtility::sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $sendHTML);
}
}
}
}
}
示例8: load
public function load($cid)
{
static $instances = array();
if (!isset($instances[$cid])) {
$this->_item = EasyBlogHelper::getTable('Blog', 'Table');
if (!$this->_item->load($cid)) {
return $this->onLoadArticleError($cid);
}
$blogger = EasyBlogHelper::getTable('Profile', 'Table');
$blogger->load($this->_item->created_by);
$this->_item->blogger = $blogger;
$link = 'index.php?option=com_easyblog&view=entry&id=' . $this->getContentId();
// forcefully get item id if request is ajax
$format = JRequest::getString('format', 'html');
if ($format === 'ajax') {
$itemid = JRequest::getInt('pageItemId');
if (!empty($itemid)) {
$link .= '&Itemid=' . $itemid;
}
}
$link = EasyBlogRouter::_($link);
$this->_item->permalink = $this->prepareLink($link);
$instances[$cid] = $this->_item;
}
$this->_item = $instances[$cid];
return $this;
}
示例9: get
public function get()
{
$input = JFactory::getApplication()->input;
$model = EasyBlogHelper::getModel('Blog');
$category = EasyBlogHelper::getTable('Category', 'Table');
$id = $input->get('id', null, 'INT');
$search = $input->get('search', null, 'STRING');
$posts = array();
if (!isset($id)) {
$categoriesmodel = EasyBlogHelper::getModel('Categories');
$categories = $categoriesmodel->getCategoryTree('ordering');
$this->plugin->setResponse($categories);
return;
}
$category->load($id);
// private category shouldn't allow to access.
$privacy = $category->checkPrivacy();
if (!$category->id || !$privacy->allowed) {
$this->plugin->setResponse($this->getErrorResponse(404, 'Category not found'));
return;
}
$catIds = array();
$catIds[] = $category->id;
EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
$sorting = $this->plugin->params->get('sorting', 'latest');
$rows = $model->getBlogsBy('category', $catIds, $sorting, 0, EBLOG_FILTER_PUBLISHED, $search);
foreach ($rows as $k => $v) {
$item = EasyBlogHelper::getHelper('SimpleSchema')->mapPost($v, '', 100, array('text'));
$item->isowner = $v->created_by == $this->plugin->get('user')->id ? true : false;
$posts[] = $item;
}
$this->plugin->setResponse($posts);
}
示例10: form
public function form($tpl = null)
{
JHTML::_('behavior.modal', 'a.modal');
$feed = EasyBlogHelper::getTable('Feed', 'Table');
JToolBarHelper::title(JText::_('COM_EASYBLOG_BLOGS_FEEDS_CREATE_NEW_TITLE'), 'feeds');
JToolBarHelper::custom('save', 'save.png', 'save_f2.png', 'COM_EASYBLOG_SAVE', false);
JToolbarHelper::cancel();
$cid = JRequest::getVar('cid', '', 'REQUEST');
if (!empty($cid)) {
$feed->load($cid);
}
$post = JRequest::get('POST');
if (!empty($post)) {
$feed->bind($post);
}
$categoryName = '';
$authorName = '';
if (!empty($feed->item_category)) {
$categoryName = $feed->getCategoryName();
}
if (!empty($feed->item_creator)) {
$author = JFactory::getUser($feed->item_creator);
$authorName = $author->name;
}
$params = EasyBlogHelper::getRegistry($feed->params);
$this->assignRef('params', $params);
$this->assignRef('feed', $feed);
$this->assignRef('categoryName', $categoryName);
$this->assignRef('authorName', $authorName);
parent::display($tpl);
}
示例11: __construct
public function __construct()
{
$my = JFactory::getUser();
// @rule: Test if the user is already associated with Flickr
$this->oauth = EasyBlogHelper::getTable('Oauth');
$this->oauth->loadByUser($my->id, EBLOG_OAUTH_FLICKR);
}
示例12: display
/**
* Displays the files and folders that are in the media manager.
*/
public function display($tpl = null)
{
$config = EasyBlogHelper::getConfig();
$document = JFactory::getDocument();
$my = JFactory::getUser();
$app = JFactory::getApplication();
$profile = EasyBlogHelper::getTable('Profile');
$profile->load($my->id);
if ($my->id <= 0) {
echo JText::_('COM_EASYBLOG_NOT_ALLOWED');
exit;
}
$user = JFactory::getUser();
$document->setTitle(JText::_('COM_EASYBLOG_MEDIA_MANAGER'));
// Only allow admin to impersonate anyone.
if (EasyBlogHelper::isSiteAdmin()) {
$user = JFactory::getUser(JRequest::getVar('blogger_id', $my->id));
}
$debug = $config->get('debug_javascript') || JRequest::getVar('ebjsdebug') == 1 ? 'true' : 'false';
$theme = new CodeThemes(true);
$theme->set('debug', $debug);
$theme->set('session', JFactory::getSession());
$theme->set('blogger_id', $user->id);
// @rule: Test if the user is already associated with Flickr
$oauth = EasyBlogHelper::getTable('Oauth');
$associated = $oauth->loadByUser($my->id, EBLOG_OAUTH_FLICKR);
$theme->set('flickrAssociated', $associated);
echo $theme->fetch('media.php');
}
示例13: remove
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
// @task: Check for acl rules.
$this->checkAccess('mail');
$mails = JRequest::getVar('cid', '', 'POST');
$message = '';
$type = 'info';
if (empty($mails)) {
$message = JText::_('COM_EASYBLOG_NO_MAIL_ID_PROVIDED');
$type = 'error';
} else {
$table = EasyBlogHelper::getTable('MailQueue', 'Table');
foreach ($mails as $id) {
$table->load($id);
if (!$table->delete()) {
$message = JText::_('COM_EASYBLOG_SPOOLS_DELETE_ERROR');
$type = 'error';
$this->setRedirect('index.php?option=com_easyblog&view=spools', $message, $type);
return;
}
}
$message = JText::_('COM_EASYBLOG_SPOOLS_DELETE_SUCCESS');
}
$this->setRedirect('index.php?option=com_easyblog&view=spools', $message);
}
示例14: save
function save()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
// @task: Check for acl rules.
$this->checkAccess('trackback');
$mainframe = JFactory::getApplication();
$message = '';
$type = 'message';
if (JRequest::getMethod() != 'POST') {
$mainframe->redirect('index.php?option=com_easyblog&view=trackbacks', JText::_('COM_EASYBLOG_TRACKBACKS_INVALID_REQUEST'), 'error');
$mainframe->close();
}
$post = JRequest::get('POST');
$my = JFactory::getUser();
$id = JRequest::getInt('id', 0);
JTable::addIncludePath(EBLOG_TABLES);
$trackback = EasyBlogHelper::getTable('Trackback', 'Table');
$trackback->load($id);
$trackback->bind($post);
if (!$trackback->store()) {
$mainframe->redirect('index.php?option=com_easyblog&view=trackbacks', JText::_('COM_EASYBLOG_TRACKBACKS_SAVE_ERROR'), 'error');
$mainframe->close();
}
$mainframe->redirect('index.php?option=com_easyblog&view=trackbacks', JText::_('COM_EASYBLOG_TRACKBACKS_SAVE_SUCCESS'));
$mainframe->close();
}
示例15: display
function display($tmpl = null)
{
$config = EasyBlogHelper::getConfig();
$jConfig = EasyBlogHelper::getJConfig();
if (!$config->get('main_rss')) {
return;
}
$model = $this->getModel('Featured');
$data = $model->getFeaturedBlog();
$document = JFactory::getDocument();
$document->link = EasyBlogRouter::_('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)) {
for ($i = 0; $i < count($data); $i++) {
$row =& $data[$i];
$profile = EasyBlogHelper::getTable('Profile', 'Table');
$profile->load($row->created_by);
$created = EasyBlogDateHelper::dateWithOffSet($row->created);
$formatDate = true;
if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
$langCode = EasyBlogStringHelper::getLangCode();
if ($langCode != 'en-GB' || $langCode != 'en-US') {
$formatDate = false;
}
}
// $row->created = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat();
$row->created = $created->toMySQL();
if ($config->get('main_rss_content') == 'introtext') {
$row->text = !empty($row->intro) ? $row->intro : $row->content;
//read more for feed
$row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>';
} else {
$row->text = $row->intro . $row->content;
}
$row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text);
$row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text);
$category = EasyBlogHelper::getTable('Category', 'Table');
$category->load($row->category_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 = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
$item->description = $row->text;
$item->date = $row->created;
$item->category = $category->title;
$item->author = $profile->getName();
if ($jConfig->get('feed_email') == 'author') {
$item->authorEmail = $profile->user->email;
} else {
$item->authorEmail = $jConfig->get('mailfrom');
}
$document->addItem($item);
}
}
}