/** * Loads a blog post * * @since 4.0 * @access public * @param string * @return */ public function load($id = null, $reset = true) { // Load post from post table $state = parent::load($id); // Posts without doctypes are legacy posts. if (is_null($this->doctype)) { $this->doctype = 'legacy'; } return $state; }
function load($id = null, $loadPostId = false) { if (!$loadPostId) { return parent::load($id); } $db = EasyBlogHelper::db(); $query = 'select `id` from `#__easyblog_autoarticle_map` where `post_id` = ' . $db->Quote($id); $db->setQuery($query); $result = $db->loadResult(); return parent::load($result); }
/** * override load method. * if user record not found in eblog_profile, create one record. * */ function load($appname) { if (!parent::load($appname) && !empty($appname)) { $db = $this->getDBO(); $obj = new stdClass(); $obj->appname = $appname; $obj->description = ''; $obj->created = ''; $obj->modified = ''; $db->insertObject('#__easyblog_apps', $obj); } return parent::load($appname); }
/** * Deprecated. Use @load instead * * @deprecated 4.0 */ public function loadSystemByType($type) { $db = $this->getDBO(); $query = 'SELECT ' . $db->nameQuote('id') . ' FROM ' . $db->nameQuote($this->_tbl) . ' ' . 'WHERE ' . $db->nameQuote('type') . '=' . $db->Quote($type) . ' ' . 'AND ' . $db->nameQuote('system') . '=' . $db->Quote(1); $db->setQuery($query); $result = $db->loadResult(); if (empty($result)) { $this->id = 0; $this->type = $type; return $this; } return parent::load($result); }
function load($id) { $db = $this->getDBO(); $query = 'select `id` FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl); $query .= ' where user_id = ' . $db->Quote($id); $db->setQuery($query); $result = $db->loadResult(); if (empty($result)) { $this->user_id = $id; return $this; } else { return parent::load($result); } }
function load($id = null, $reset = true) { $db = $this->getDBO(); $query = 'select `id` FROM ' . $db->nameQuote($this->_tbl); $query .= ' where user_id = ' . $db->Quote($id); $db->setQuery($query); $result = $db->loadResult(); if (empty($result)) { $this->user_id = $id; return $this; } else { return parent::load($result, $reset); } }
/** * override load method. * if user record not found in eblog_profile, create one record. * */ function load($id) { if (!parent::load($id) && $id != 0) { $db = $this->getDBO(); $obj = new stdClass(); $obj->app_id = ''; $obj->user_id = ''; $obj->created = ''; $obj->modified = ''; $obj->published = ''; $obj->ordering = ''; $db->insertObject('#__easyblog_userapps', $obj); } return parent::load($id); }
function load($key = null, $permalink = false) { if (!$permalink) { return parent::load($key); } $db = $this->getDBO(); $query = 'SELECT a.`id` FROM ' . $this->_tbl . ' as a ' . 'WHERE a.`permalink` = ' . $db->Quote($key); $db->setQuery($query); $id = $db->loadResult(); // Try replacing ':' to '-' since Joomla replaces it if (!$id) { $query = 'SELECT a.`id` FROM ' . $this->_tbl . ' as a ' . 'WHERE a.`permalink` = ' . $db->Quote(JString::str_ireplace(':', '-', $key)); $db->setQuery($query); $id = $db->loadResult(); } return parent::load($id); }
function load($id, $isUrl = false, $postId = '') { if (!$isUrl) { return parent::load($id); } else { $url = $id; } $db = EasyBlogHelper::db(); $query = 'SELECT * FROM #__easyblog_trackback_sent WHERE `url`=' . $db->Quote($url) . ' AND `post_id`=' . $db->Quote($postId); $db->setQuery($query); $result = $db->loadObject(); if ($result) { $this->id = $result->id; $this->post_id = $result->post_id; $this->url = $result->url; $this->sent = $result->sent; return true; } return false; }
public function load($key = null, $permalink = false) { if (!$permalink) { if (EB::cache()->exists($key, 'team')) { return parent::bind(EB::cache()->get($key, 'team')); } return parent::load($key); } $db = $this->getDBO(); $query = 'SELECT id FROM ' . $this->_tbl . ' ' . 'WHERE `alias`=' . $db->Quote($key); $db->setQuery($query); $id = $db->loadResult(); // Try replacing ':' to '-' since Joomla replaces it if (!$id) { $query = 'SELECT id FROM ' . $this->_tbl . ' ' . 'WHERE `alias`=' . $db->Quote(JString::str_ireplace(':', '-', $key)); $db->setQuery($query); $id = $db->loadResult(); } return parent::load($id); }
function load($id = null, $loadByTitle = false) { if (!$loadByTitle) { static $titles = null; if (!isset($titles[$id])) { $titles[$id] = parent::load($id); } return $titles[$id]; } static $tags = null; if (!isset($tags[$id])) { $db = EasyBlogHelper::db(); $query = 'SELECT *'; $query .= ' FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_tag'); $query .= ' WHERE (' . EasyBlogHelper::getHelper('SQL')->nameQuote('title') . ' = ' . $db->Quote(JString::str_ireplace(':', '-', $id)); $query .= ' OR ' . EasyBlogHelper::getHelper('SQL')->nameQuote('title') . ' = ' . $db->Quote(JString::str_ireplace('-', ' ', $id)) . ' '; $query .= ' OR ' . EasyBlogHelper::getHelper('SQL')->nameQuote('alias') . ' = ' . $db->Quote(JString::str_ireplace(':', '-', $id)) . ')'; $query .= ' LIMIT 1'; $db->setQuery($query); $result = $db->loadObject(); if ($result) { $this->id = $result->id; $this->title = $result->title; $this->created_by = $result->created_by; $this->alias = $result->alias; $this->created = $result->created; $this->status = $result->status; $this->published = $result->published; $this->ordering = $result->ordering; $tags[$id] = clone $this; } else { $tags[$id] = false; } } else { parent::bind($tags[$id]); } return $tags[$id]; }
/** * override load method. * if user record not found in eblog_profile, create one record. * */ function load($id = null, $reset = true) { static $users = null; $id = $id == '0' ? null : $id; if (is_null($id)) { $this->bind(JFactory::getUser(0)); return $this; } if (empty($id)) { // When the id is null or 0 $this->bind(JFactory::getUser()); return $this; } if (!isset($users[$id])) { if (!parent::load($id) && $id != 0) { $obj = $this->_createDefault($id); $this->bind($obj); } $users[$id] = clone $this; } $this->user = JFactory::getUser($id); $this->bind($users[$id]); return $users[$id]; }
/** * Loads a blog post * * @since 4.0 * @access public * @param string * @return */ public function load($id = null, $reset = true) { // Load post from post table $state = parent::load($id); return $state; }
/** * Given a permalink, find the post id and load the post. * * @since 5.0 * @access public * @param string * @return */ public function loadByPermalink($permalink) { $db = EB::db(); // Try to look for the permalink $query = 'SELECT a.`id` FROM ' . $this->_tbl . ' as a ' . 'WHERE a.`permalink` = ' . $db->Quote($permalink); $db->setQuery($query); $id = $db->loadResult(); // Try replacing ':' to '-' since Joomla replaces it if (!$id) { $permalink = JString::str_ireplace(':', '-', $permalink); $query = 'SELECT a.`id` FROM ' . $this->_tbl . ' as a ' . 'WHERE a.`permalink` = ' . $db->Quote($permalink); $db->setQuery($query); $id = $db->loadResult(); } return parent::load($id); }
/** * override load method. * if user record not found in eblog_profile, create one record. * */ function load($id) { if (!parent::load($id) && $id != 0) { $db = $this->getDBO(); $obj = new stdClass(); $obj->refer_id = ''; $obj->param_name = ''; $obj->param_value = ''; $obj->param_value_type = ''; $obj->params = ''; $obj->param_type = ''; $obj->created = ''; $obj->modified = ''; $obj->published = ''; $obj->ordering = ''; $db->insertObject('#__easyblog_users', $obj); } return parent::load($id); }