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


PHP EB::model方法代码示例

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


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

示例1: display

 public function display($tpl = null)
 {
     // Check for access
     $this->checkAccess('easyblog.manage.subscription');
     $layout = $this->getLayout();
     if (method_exists($this, $layout)) {
         return $this->{$layout}();
     }
     // Set the page heading
     $this->setHeading('COM_EASYBLOG_TITLE_SUBSCRIPTIONS', '', 'fa-bell');
     $filter = $this->app->getUserStateFromRequest('com_easyblog.subscriptions.filter', 'filter', 'site', 'word');
     $search = $this->app->getUserStateFromRequest('com_easyblog.subscriptions.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     $order = $this->app->getUserStateFromRequest('com_easyblog.subscriptions.filter_order', 'filter_order', 'bname', 'cmd');
     $orderDirection = $this->app->getUserStateFromRequest('com_easyblog.subscriptions.filter_order_Dir', 'filter_order_Dir', '', 'word');
     //Get data from the model
     $model = EB::model('Subscriptions');
     $subscriptions = $model->getSubscriptions();
     $pagination = $model->getPagination();
     $this->set('subscriptions', $subscriptions);
     $this->set('pagination', $pagination);
     $this->set('filter', $filter);
     $this->set('filterList', $this->getFilter($filter));
     $this->set('search', $search);
     $this->set('order', $order);
     $this->set('orderDirection', $orderDirection);
     parent::display('subscriptions/default');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:28,代码来源:view.html.php

示例2: updateOrdering

 /**
  * Method to update ordering before a comment is saved.
  **/
 public function updateOrdering()
 {
     $model = EB::model('Comment');
     $latestComment = $model->getLatestComment($this->post_id, $this->parent_id);
     // @rule: Processing child comments
     if ($this->parent_id != 0) {
         $parentComment = EB::table('Comment');
         $parentComment->load($this->parent_id);
         $left = $parentComment->lft + 1;
         $right = $parentComment->lft + 2;
         $nodeVal = $parentComment->lft;
         if (!empty($latestComment)) {
             $left = $latestComment->rgt + 1;
             $right = $latestComment->rgt + 2;
             $nodeVal = $latestComment->rgt;
         }
         $model->updateCommentSibling($this->post_id, $nodeVal);
         $this->lft = $left;
         $this->rgt = $right;
         return true;
     }
     // @rule: Processing new comments
     $left = 1;
     $right = 2;
     if (!empty($latestComment)) {
         $left = $latestComment->rgt + 1;
         $right = $latestComment->rgt + 2;
         $model->updateCommentSibling($this->post_id, $latestComment->rgt);
     }
     $this->lft = $left;
     $this->rgt = $right;
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:36,代码来源:comment.php

示例3: discover

 /**
  * Discovery of language files
  *
  * @since   5.0
  * @access  public
  * @param   string
  * @return  
  */
 public function discover()
 {
     $model = EB::model('Languages');
     $result = $model->discover();
     $this->info->set(JText::_('COM_EASYBLOG_LANGUAGE_DISCOVERED_SUCCESSFULLY'), 'success');
     return $this->app->redirect('index.php?option=com_easyblog&view=languages');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:languages.php

示例4: getItems

 /**
  * Retrieves a list of items from a given uri
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getItems($uri, $includeVariations = false)
 {
     // List down posts from the site
     $model = EB::model('MediaManager');
     $posts = $model->getPosts();
     // Get path and folder
     $folder = $this->getFolderItem($uri);
     // Get the absolute path to the main "articles" folder
     $folderPath = EasyBlogMediaManager::getPath($folder->uri);
     if (!$posts) {
         return $folder;
     }
     // Filegroup is the array where files are stored.
     // Sort arrays are used to speed up file sorting.
     $filegroup = EasyBlogMediaManager::filegroup();
     // The strategy used here is to use a single loop that build:
     // - data that is ready-to-use
     // - sort arrays so sorting becomes cheap.
     // - variations
     $variations = array();
     $total = 0;
     foreach ($posts as $post) {
         // Get the folder path of the article
         $articlePath = $folderPath . '/' . $post->id;
         // Get the uri for the article
         $uri = 'post:' . $post->id;
         $items = parent::getItems($uri);
         $filegroup['folder'][] = $items;
         $total++;
     }
     // Set the folder contents
     $folder->contents = $filegroup;
     $folder->total = $total;
     return $folder;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:43,代码来源:post.php

示例5: 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

示例6: shareSystem

 /**
  * Auto post to social network sites
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function shareSystem(EasyBlogPost &$post, $force = false)
 {
     // Determines if the primary category of this post requires auto posting or not
     $category = $post->getPrimaryCategory();
     if (!$category->autopost) {
         return;
     }
     // Get a list of system oauth clients.
     $model = EB::model('Oauth');
     $clients = $model->getSystemClients();
     foreach ($clients as $client) {
         // If this is a new post, ensure that it respects the settings before auto posting
         if ($post->isNew() && !$this->config->get('integrations_' . $client->type . '_centralized_auto_post') && !$force) {
             continue;
         }
         // If the post is updated, ensure that it respects the settings before auto posting
         if (!$post->isNew() && !$this->config->get('integrations_' . $client->type . '_centralized_send_updates') && !$force) {
             continue;
         }
         $table = EB::table('OAuth');
         $table->bind($client);
         // Push the item now
         $table->push($post);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:33,代码来源:autoposting.php

示例7: display

 public function display($tpl = null)
 {
     // Check for access
     $this->checkAccess('easyblog.manage.feeds');
     $layout = $this->getLayout();
     if (method_exists($this, $layout)) {
         return $this->{$layout}();
     }
     $this->setHeading('COM_EASYBLOG_BLOGS_FEEDS_TITLE', '', 'fa-rss-square');
     $model = EB::model('Feeds');
     $feeds = $model->getData();
     $pagination = $model->getPagination();
     if ($feeds) {
         foreach ($feeds as &$feed) {
             if ($feed->last_import == '0000-00-00 00:00:00') {
                 $feed->import_text = JText::_('COM_EASYBLOG_NEVER');
             } else {
                 $feed->import_text = $feed->last_import;
             }
         }
     }
     $filter_state = $this->app->getUserStateFromRequest('com_easyblog.feeds.filter_state', 'filter_state', '*', 'word');
     $search = $this->app->getUserStateFromRequest('com_easyblog.feeds.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     $this->set('state', JHTML::_('grid.state', $filter_state));
     $this->set('search', $search);
     $this->set('feeds', $feeds);
     $this->set('pagination', $pagination);
     parent::display('feeds/default');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:30,代码来源:view.html.php

示例8: getData

 public static function getData(&$params, $id, $count = 0)
 {
     $model = EB::model('Blog');
     $entries = $model->getRelatedPosts($id, $count);
     $entries = EB::modules()->processItems($entries, $params);
     return $entries;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:7,代码来源:helper.php

示例9: display

 public function display($tmpl = null)
 {
     // Ensure that the user is logged in.
     EB::requireLogin();
     // null = new post
     // 63   = post 63 from post table
     // 63.2 = post 63, revision 2 from history table
     $uid = $this->input->getVar('uid', null);
     // If no id given, create a new post.
     $post = EB::post($uid);
     // Verify access (see function manager())
     if (!$post->canCreate() && !$post->canEdit()) {
         // Do not allow user to access this page if he doesn't have access
         JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_ACCESS_IN_THIS_SECTION'));
         return;
     }
     // If there's no id provided, we will need to create the initial revision for the post.
     if (!$uid) {
         $post->create();
         $uid = $post->uid;
     }
     // Determines if we should show the sidebars by default
     $templateId = $this->input->get('block_template', 0, 'int');
     if (!$post->title) {
         $this->doc->setTitle(JText::_('COM_EASYBLOG_COMPOSER_POST_UNTITLED'));
     }
     $composer = EB::composer();
     // Render default post templates
     $postTemplatesModel = EB::model('Templates');
     $postTemplates = $postTemplatesModel->getPostTemplates($this->my->id);
     $this->set('postTemplates', $postTemplates);
     $this->set('composer', $composer);
     $this->set('post', $post);
     return parent::display('composer/default');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:35,代码来源:view.html.php

示例10: form

 public function form($tpl = null)
 {
     $cids = $this->input->get('cid', array(), 'var');
     $scripts = EB::model('Maintenance')->getItemByKeys($cids);
     $this->set('scripts', $scripts);
     parent::display('maintenance/form');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:7,代码来源:view.html.php

示例11: 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

示例12: store

 /**
  * Override the parent's store behavior
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function store($updateNulls = false)
 {
     // @task: Load language file from the front end.
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     // Clear any previous messages
     $model = EB::model('PostReject');
     $model->clear($this->post_id);
     return parent::store();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:17,代码来源:postreject.php

示例13: display

 public function display($tmpl = null)
 {
     // Get the model
     $model = EB::model('Search');
     $posts = $model->getData();
     $posts = EB::formatter('list', $posts);
     $this->set('posts', $posts);
     return parent::display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:9,代码来源:view.json.php

示例14: suggest

 /**
  * Allows tagging suggestion which is used by the composer
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function suggest()
 {
     // Only logged in users are allowed here
     EB::requireLogin();
     $keyword = $this->input->get('search', '', 'default');
     $model = EB::model('Tags');
     $suggestions = $model->suggest($keyword);
     return $this->ajax->resolve($suggestions);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:17,代码来源:view.ajax.php

示例15: 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


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