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


PHP EBR类代码示例

本文整理汇总了PHP中EBR的典型用法代码示例。如果您正苦于以下问题:PHP EBR类的具体用法?PHP EBR怎么用?PHP EBR使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: display

 public function display($tmpl = null)
 {
     // Checks if rss is enabled
     if (!$this->config->get('main_rss')) {
         return;
     }
     // Get the archives model
     $model = EB::model('Archive');
     // Get a list of posts
     $posts = $model->getPosts();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Set the link for this feed
     $this->doc->link = EBR::_('index.php?option=com_easyblog&view=archive');
     $this->doc->setTitle(JText::_('COM_EASYBLOG_ARCHIVED_POSTS'));
     $this->doc->setDescription(JText::_('COM_EASYBLOG_ARCHIVED_POSTS_DESC'));
     if (!$posts) {
         return;
     }
     foreach ($posts as $post) {
         $image = '';
         if ($post->getImage('medium', true, true)) {
             $image = '<img src=' . $post->getImage('medium', true, true) . '" alt="' . $post->title . '" />';
         }
         $item = new JFeedItem();
         $item->title = $post->title;
         $item->link = $post->getPermalink();
         $item->description = $image . $post->getIntro();
         $item->date = $post->getCreationDate()->format();
         $item->category = $post->getPrimaryCategory()->getTitle();
         $item->author = $post->author->getName();
         $item->authorEmail = $this->getRssEmail($post->author);
         $this->doc->addItem($item);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:35,代码来源:view.feed.php

示例2: display

 /**
  * Default display method for featured listings
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function display($tmpl = null)
 {
     // Set the meta tags for this page
     EB::setMeta(META_ID_FEATURED, META_TYPE_VIEW);
     // Add the RSS headers on the page
     EB::feeds()->addHeaders('index.php?option=com_easyblog&view=featured');
     // Add breadcrumbs on the site menu.
     $this->setPathway('COM_EASYBLOG_FEATURED_BREADCRUMB');
     // Get the model
     $model = EB::model('Featured');
     // Get a list of featured posts
     $posts = $model->getPosts();
     // Get the pagination
     $pagination = $model->getPagination();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_FEATURED_PAGE_TITLE'));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Get the current url
     $return = EBR::_('index.php?option=com_easyblog', false);
     $this->set('return', $return);
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     parent::display('blogs/featured/default');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:view.html.php

示例3: unsubscribe

 /**
  * @since 3.0
  * Unsubscribe a user with email to a blog post
  *
  * @param	int		Subscription ID
  * @param	int		Blog post ID
  *
  * @return	bool	True on success
  */
 public function unsubscribe()
 {
     $subscriptionId = JRequest::getInt('subscription_id');
     $blogId = JRequest::getInt('blog_id');
     $my = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     $redirect = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $blogId, false);
     // Check variables
     if ($my->id == 0 || !$subscriptionId || !$blogId) {
         EB::info()->set(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
         $mainframe->redirect($redirect);
     }
     // Need to ensure that whatever id passed in is owned by the current browser
     $blogModel = EB::model('Blog');
     $sid = $blogModel->isBlogSubscribedUser($blogId, $my->id, $my->email);
     if ($subscriptionId != $sid) {
         EB::info()->set(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
         $mainframe->redirect($redirect);
     }
     // Proceed to unsubscribe
     $table = EB::table('Subscriptions');
     $table->load($subscriptionId);
     if (!$table->delete()) {
         EB::info()->set(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_FAILED'), 'error');
         $mainframe->redirect($redirect);
     }
     EB::info()->set(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_SUCCESS'), 'success');
     $mainframe->redirect($redirect);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:38,代码来源:entry.php

示例4: load

 public function load($cid)
 {
     static $instances = array();
     if (!isset($instances[$cid])) {
         $this->_item = EB::post($cid);
         if (!$this->_item) {
             return $this->onLoadArticleError($cid);
         }
         $blogger = EB::user($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 = EBR::_($link);
         $this->_item->permalink = $this->prepareLink($link);
         $instances[$cid] = $this->_item;
     }
     $this->_item = $instances[$cid];
     return $this;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:26,代码来源:com_easyblog5.php

示例5: html

 /**
  * Outputs the html code for Twitter button
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function html()
 {
     if (!$this->isEnabled()) {
         return;
     }
     $this->addScript();
     // Get the pinterest button style from the configuration
     $size = $this->getButtonSize();
     $url = EBR::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $this->post->id, false, true);
     // Combine the introtext and the content
     $content = $this->post->intro . $this->post->content;
     // Get the media
     $media = $this->getMedia();
     $contentLength = 350;
     $text = $this->post->intro . $this->post->content;
     $text = nl2br($text);
     $text = strip_tags($text);
     $text = trim(preg_replace('/\\s+/', ' ', $text));
     $text = JString::strlen($text) > $contentLength ? JString::substr($text, 0, $contentLength) . '...' : $text;
     $title = $this->post->title;
     // Urlencode all the necessary properties.
     $url = urlencode($url);
     $text = urlencode($text);
     $media = urlencode($media);
     $placeholder = $this->getPlaceholderId();
     $theme = EB::template();
     $theme->set('size', $size);
     $theme->set('placeholder', $placeholder);
     $theme->set('url', $url);
     $theme->set('title', $title);
     $theme->set('media', $media);
     $theme->set('text', $text);
     $output = $theme->output('site/socialbuttons/pinterest');
     return $output;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:43,代码来源:pinterest.php

示例6: toHTML

 /**
  * Displays the pagination links at the bottom of the page.
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function toHTML($view = 'index', $replace = false)
 {
     // Retrieve the pagination data.
     $data = $this->getData();
     // If there's no pagination at all, skip this
     if (count($data->pages) == $this->get('pages.total') && $this->get('pages.total') == 1 || $this->get('pages.total') == 0) {
         return false;
     }
     $queries = '';
     if (!empty($data) && $replace) {
         $currentPageLink = 'index.php?option=com_easyblog&view=' . $view . $queries;
         foreach ($data->pages as $page) {
             if (!empty($page->link)) {
                 $limitstart = !empty($page->base) ? '&limitstart=' . $page->base : '';
                 $page->link = EBR::_($currentPageLink . $limitstart);
             }
         }
         if (!empty($data->next->link)) {
             $limitstart = !empty($data->next->base) ? '&limitstart=' . $data->next->base : '';
             $data->next->link = EBR::_($currentPageLink . $limitstart);
         }
         if (!empyt($data->previous->link)) {
             $limitstart = !empty($data->previous->base) ? '&limitstart=' . $data->previous->base : '';
             $data->previous->link = EBR::_($currentPageLink . $limitstart);
         }
     }
     $template = EB::template();
     $template->set('data', $data);
     return $template->output('site/blogs/pagination/default');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:pagination.php

示例7: onSearch

 /** 1.5 **/
 public function onSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $plugin = JPluginHelper::getPlugin('search', 'easyblog');
     $params = EB::registry($plugin->params);
     if (!plgSearchEasyblog::exists()) {
         return array();
     }
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys(plgSearchEasyblog::onContentSearchAreas()))) {
             return array();
         }
     }
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $result = plgSearchEasyblog::getResult($text, $phrase, $ordering);
     if (!$result) {
         return array();
     }
     // require_once( EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'router.php' );
     foreach ($result as $row) {
         $row->section = plgSearchEasyblog::getCategory($row->category_id);
         $row->section = JText::sprintf('PLG_EASYBLOG_SEARCH_BLOGS_SECTION', $row->section);
         $row->href = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
         $blog = EB::table('Blog');
         $blog->bind($row);
         if ($blog->getImage()) {
             $row->image = $blog->getImage('frontpage');
         }
     }
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:easyblog.php

示例8: getUnsubscribeLink

 /**
  * Generates the unsubscribe link for the email
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getUnsubscribeLink($data, $external = false)
 {
     $itemId = EBR::getItemId('latest');
     // Generate the unsubscribe hash
     $hash = base64_encode(json_encode($data->export()));
     $link = EBR::getRoutedURL('index.php?option=com_easyblog&task=subscription.unsubscribe&data=' . $hash . '&Itemid=' . $itemId, false, $external);
     return $link;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:subscription.php

示例9: display

 /**
  * Default feed display method
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tmpl = null)
 {
     // Ensure that rss is enabled
     if (!$this->config->get('main_rss')) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_FEEDS_DISABLED'));
     }
     $id = $this->input->get('id', '', 'cmd');
     $category = EB::table('Category');
     $category->load($id);
     // Private category shouldn't allow to access.
     $privacy = $category->checkPrivacy();
     if (!$privacy->allowed) {
         return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_HERE'));
     }
     // Get the nested categories
     $category->childs = null;
     EB::buildNestedCategories($category->id, $category);
     $linkage = '';
     EB::accessNestedCategories($category, $linkage, '0', '', 'link', ', ');
     $catIds = array();
     $catIds[] = $category->id;
     EB::accessNestedCategoriesId($category, $catIds);
     $category->nestedLink = $linkage;
     $model = EB::model('Blog');
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     $posts = $model->getBlogsBy('category', $catIds, $sort);
     $posts = EB::formatter('list', $posts);
     $this->doc->link = EBR::_('index.php?option=com_easyblog&view=categories&id=' . $id . '&layout=listings');
     $this->doc->setTitle($this->escape($category->getTitle()));
     $this->doc->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_CATEGORY_DESC', $this->escape($category->getTitle())));
     if (!$posts) {
         return;
     }
     $uri = JURI::getInstance();
     $scheme = $uri->toString(array('scheme'));
     $scheme = str_replace('://', ':', $scheme);
     foreach ($posts as $post) {
         $image = '';
         if ($post->hasImage()) {
             $image = '<img src="' . $post->getImage('medium', true, true) . '" width="250" align="left" />';
         }
         $item = new JFeedItem();
         $item->title = $this->escape($post->title);
         $item->link = $post->getPermalink();
         $item->description = $image . $post->getIntro();
         // 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 = $post->getCreationDate()->toSql();
         $item->category = $post->getPrimaryCategory()->getTitle();
         $item->author = $post->author->getName();
         $item->authorEmail = $this->getRssEmail($post->author);
         $this->doc->addItem($item);
     }
     // exit;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:64,代码来源:view.feed.php

示例10: getFeedURL

 /**
  * Appends the necessary rss fragments on existing url
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getFeedURL($url, $atom = false, $type = 'site')
 {
     if ($this->config->get('main_feedburner') && $type == 'site' && $this->config->get('main_feedburner_url') != '') {
         return $this->config->get('main_feedburner_url');
     }
     $join = EasyBlogRouter::isSefEnabled() ? '?' : '&';
     // Append the necessary queries
     $url = EBR::_($url) . $join . 'format=feed';
     $url .= $atom ? '&type=atom' : '&type=rss';
     return $url;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:19,代码来源:feeds.php

示例11: getLink

 /**
  * Retrieves the profile link
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getLink()
 {
     // If profile user is not an author for whatever reason it is, we shouldn't display it as a link
     if (!$this->config->get('main_nonblogger_profile')) {
         $isAuthor = EB::isBlogger($this->profile->id);
         if (!$isAuthor) {
             return 'javascript:void(0);';
         }
     }
     $default = EBR::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $this->profile->id);
     return $default;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:20,代码来源:client.php

示例12: unsubscribe

 /**
  * Allows caller to unsubscribe a person given the id of the subscription
  *
  * @since	5.0
  * @access	public
  */
 public function unsubscribe()
 {
     // Default redirection url
     $redirect = EBR::_('index.php?option=com_easyblog&view=subscription', false);
     // Default redirection link should link to the front page if the user isn't logged in
     if ($this->my->guest) {
         $redirect = EBR::_('index.php?option=com_easyblog', false);
     }
     $return = $this->getReturnURL();
     if ($return) {
         $redirect = $return;
     }
     // Get the subscription id
     $id = $this->input->get('id', 0, 'int');
     $subscription = EB::table('Subscriptions');
     // Load up the subscription if id is provided
     if ($id) {
         $subscription->load($id);
         // Verify if the user really has access to unsubscribe for guests
         if (!$subscription->id) {
             return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_TO_PERFORM_ACTION'));
         }
         // Ensure that the registered user is allowed to unsubscribe.
         if ($subscription->user_id && $this->my->id != $subscription->user_id && !EB::isSiteAdmin()) {
             return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_TO_PERFORM_ACTION'));
         }
     } else {
         // Try to get the email and what not from the query
         $data = $this->input->get('data', '', 'raw');
         $data = base64_decode($data);
         $registry = new JRegistry($data);
         $id = $registry->get('sid', '');
         $subscription->load($id);
         // Verify if the user really has access to unsubscribe for guests
         if (!$subscription->id) {
             return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_TO_PERFORM_ACTION'));
         }
         // Get the token from the url and ensure that the token matches
         $token = $registry->get('token', '');
         if ($token != md5($subscription->id . $subscription->created)) {
             JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_TO_PERFORM_ACTION'));
         }
     }
     // Try to delete the subscription
     $state = $subscription->delete();
     // Ensure that the user really owns this item
     if (!$state) {
         $this->info->set($subscription->getError());
         return $this->app->redirect($redirect);
     }
     $this->info->set('COM_EASYBLOG_UNSUBSCRIBED_SUCCESS', 'success');
     return $this->app->redirect($redirect);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:59,代码来源:subscription.php

示例13: _buildQueryLanguage

 public function _buildQueryLanguage()
 {
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $db = EB::db();
     $languageQ = '';
     // @rule: When language filter is enabled, we need to detect the appropriate contents
     $filterLanguage = JFactory::getApplication()->getLanguageFilter();
     if ($filterLanguage) {
         $languageQ .= EBR::getLanguageQuery('AND', 'a.language');
     }
     return $languageQ;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:13,代码来源:featured.php

示例14: moderate

 /**
  * Allows visitor to approve a comment
  *
  * @since	5.0
  * @access	public
  */
 public function moderate()
 {
     // Get the hash key
     $key = $this->input->get('key', '', 'default');
     // Default redirection url
     $redirect = EBR::_('index.php?option=com_easyblog', false);
     if (!$key) {
         $this->info->set('COM_EASYBLOG_NOT_ALLOWED', 'error');
         return $this->app->redirect($redirect);
     }
     // Get the hashkey from the site
     $hashkey = EB::table('Hashkeys');
     $state = $hashkey->loadByKey($key);
     // If the key doesn't exist, it may no longer be a valid request
     if (!$state || !$hashkey->id) {
         $this->info->set('COM_EASYBLOG_NOT_ALLOWED', 'error');
         return $this->app->redirect($redirect);
     }
     // Load the comment now
     $comment = EB::table('Comment');
     $comment->load($hashkey->uid);
     // Get the task to perform
     $task = $this->getTask();
     // Load up the post library
     $post = EB::post($comment->post_id);
     if ($task == 'approve') {
         $comment->published = EBLOG_COMMENT_PUBLISHED;
         // Save the comment now
         $comment->store(true);
         // Process the mails for comments now
         $comment->processEmails(false, $post);
         // Update the sent flag for the comment
         $comment->updateSent();
     }
     if ($task == 'reject') {
         $comment->published = EBLOG_COMMENT_UNPUBLISHED;
         $comment->store(true);
     }
     // Delete the unused hashkey now.
     $hashkey->delete();
     $message = 'COM_EASYBLOG_MODERATE_COMMENT_PUBLISHED_SUCCESS';
     if ($task == 'reject') {
         $message = 'COM_EASYBLOG_MODERATE_COMMENT_UNPUBLISHED_SUCCESS';
     }
     $this->info->set($message, 'success');
     // Get the permalink to the post
     $permalink = $post->getPermalink(false);
     return $this->app->redirect($permalink);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:55,代码来源:comments.php

示例15: request

 function request()
 {
     $mainframe = JFactory::getApplication();
     if (!EasyBlogHelper::isLoggedIn()) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
         $this->setRedirect(EBR::_('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 = EB::table('Oauth');
     $oauth->user_id = $userId;
     $oauth->type = $type;
     $oauth->created = EB::date()->toMySQL();
     // Bind the request tokens
     $param = EB::registry();
     $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'));
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:47,代码来源:oauth.php


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