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


PHP EB::db方法代码示例

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


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

示例1: editors

 /**
  * Retrieves the dropdown list for editors on the site
  *
  * @since   5.0
  * @access  public
  * @param   string
  * @return  
  */
 public static function editors($element, $selected = null, $composer = false)
 {
     $db = EB::db();
     $query = array();
     $query[] = 'SELECT ' . $db->qn('element') . ' AS ' . $db->qn('value') . ',' . $db->qn('name') . ' AS ' . $db->qn('text');
     $query[] = 'FROM ' . $db->qn('#__extensions');
     $query[] = 'WHERE ' . $db->qn('folder') . '=' . $db->Quote('editors');
     $query[] = 'AND ' . $db->qn('type') . '=' . $db->Quote('plugin');
     $query[] = 'AND ' . $db->qn('enabled') . '=' . $db->Quote(1);
     $query[] = 'ORDER BY ' . $db->qn('ordering') . ',' . $db->qn('name');
     $query = implode(' ', $query);
     $db->setQuery($query);
     $editors = $db->loadObjectList();
     $lang = JFactory::getLanguage();
     for ($i = 0; $i < count($editors); $i++) {
         $editor = $editors[$i];
         $lang->load($editor->text . '.sys', JPATH_ADMINISTRATOR, null, false, false);
         $editor->text = JText::_($editor->text);
     }
     $theme = EB::template();
     $theme->set('composer', $composer);
     $theme->set('element', $element);
     $theme->set('selected', $selected);
     $theme->set('editors', $editors);
     $output = $theme->output('admin/html/form.editors');
     return $output;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:form.php

示例2: getGuestCount

 public static function getGuestCount()
 {
     $id = JRequest::getVar('id');
     $view = JRequest::getVar('view');
     $db = EB::db();
     $query = '';
     if ($view == 'entry') {
         $query = 'select cont(1) from `#__easyblog_subscriptions` as a';
         $query .= ' where (';
         // entry
         $query .= ' (a.`uid` = ' . $db->Quote($id) . ' AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_ENTRY) . ') OR';
         // category
         $query .= ' (a.`uid` IN (select pc.`category_id` from `#__easyblog_post_category` as pc where pc.`post_id` = ' . $db->Quote($id) . ' ) AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_CATEGORY) . ') OR';
         // teamblog
         $query .= ' (a.`uid` IN (select pc.`source_id` from `#__easyblog_post` as p where p.`id` = ' . $db->Quote($id) . ' and p.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_TEAM) . ' ) AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_TEAMBLOG) . ')';
         $query .= ')';
         $query .= ' AND a.`user_id` = ' . $db->Quote('0');
     } else {
         if ($view == 'categories' && $id) {
             $query = 'select count(1) from `#__easyblog_subscriptions` as a';
             $query .= ' where a.`uid` = ' . $db->Quote($id);
             $query .= ' and a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_CATEGORY);
             $query .= ' AND a.`user_id` = ' . $db->Quote('0');
         } else {
             if ($view == 'teamblog') {
                 $query = 'select count(1) from `#__easyblog_subscriptions` as a';
                 $query .= ' where a.`uid` = ' . $db->Quote($id);
                 $query .= ' and a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_TEAMBLOG);
                 $query .= ' AND a.`user_id` = ' . $db->Quote('0');
             }
         }
     }
     $db->setQuery($query);
     return (int) $db->loadResult();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:helper.php

示例3: main

 public function main()
 {
     $state = true;
     $db = EB::db();
     // lets check if there is any default category assigned or not.
     $query = "select a.`id` from `#__easyblog_category` as a where a.`published` = 1 and a.`default` = 1";
     $db->setQuery($query);
     $result = $db->loadResult();
     if (!$result) {
         $query = "select a.`id`, count(b.`id`) as `cnt` from `#__easyblog_category` as a";
         $query .= " left join `#__easyblog_post_category` as b on a.`id` = b.`category_id`";
         $query .= " where a.`published` = 1";
         $query .= " group by a.`id`";
         $query .= " order by cnt desc";
         $query .= " limit 1";
         $db->setQuery($query);
         $id = $db->loadResult();
         // now we make sure no other categories which previously marked as default but its unpublished.
         $update = "update `#__easyblog_category` set `default` = 0";
         $db->setQuery($update);
         // now let update this category as default category
         $update = "update `#__easyblog_category` set `default` = 1 where `id` = " . $db->Quote($id);
         $db->setQuery($update);
         $state = $db->query();
     }
     return $state;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:27,代码来源:MakePrimaryCategory.php

示例4: execute

 /**
  * Synchronizes database tables
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function execute()
 {
     // Load foundry
     $this->engine();
     // Get this installation version
     $version = $this->getInstalledVersion();
     // Get previous version installed
     $previous = $this->getPreviousVersion('dbversion');
     $affected = '';
     if ($previous !== false) {
         // lets run the db scripts sync if needed.
         $db = EB::db();
         $affected = $db->sync($previous);
     }
     // Update the version in the database to the latest now
     $config = EB::table('Configs');
     $config->load(array('name' => 'dbversion'));
     $config->name = 'dbversion';
     $config->params = $version;
     // Save the configuration
     $config->store($config->name);
     // If the previous version is empty, we can skip this altogether as we know this is a fresh installation
     if (!empty($affected)) {
         $this->setInfo(JText::sprintf('COM_EASYBLOG_INSTALLATION_MAINTENANCE_DB_SYNCED', $version));
     } else {
         $this->setInfo(JText::sprintf('COM_EASYBLOG_INSTALLATION_MAINTENANCE_DB_NOTHING_TO_SYNC', $version));
     }
     return $this->output();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:37,代码来源:install.sync.php

示例5: clear

 /**
  * Clear any existing post reject messages
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function clear($postId)
 {
     $db = EB::db();
     $query = 'DELETE FROM ' . $db->quoteName('#__easyblog_post_rejected') . ' WHERE ' . $db->quoteName('post_id') . '=' . $db->Quote($postId);
     $db->setQuery($query);
     return $db->Query();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:postreject.php

示例6: purge

 public function purge()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // @task: Check for acl rules.
     $this->checkAccess('migrator');
     $layout = $this->input->get('layout', '', 'cmd');
     $db = EB::db();
     $sql = $db->sql();
     $mapping = array('joomla' => 'com_content', 'wordpressjoomla' => 'com_wordpress', 'wordpress' => 'xml_wordpress', 'k2' => 'com_k2', 'zoo' => 'com_zoo', 'blogger' => 'xml_blogger');
     $component = '';
     if ($layout) {
         //let map the layout with component.
         if (isset($mapping[$layout]) && $mapping[$layout]) {
             $component = $mapping[$layout];
         }
     }
     if ($component) {
         // delete only associated records from the component.
         $query = 'delete from ' . $db->nameQuote('#__easyblog_migrate_content') . ' where ' . $db->nameQuote('component') . ' = ' . $db->Quote($component);
     } else {
         // truncate all
         $query = 'TRUNCATE TABLE ' . $db->nameQuote('#__easyblog_migrate_content');
     }
     $db->setQuery($query);
     $db->Query();
     $link = 'index.php?option=com_easyblog&view=migrators';
     if ($layout) {
         $link .= '&layout=' . $layout;
     }
     if ($db->getError()) {
         JFactory::getApplication()->redirect($link, JText::_('COM_EASYBLOG_PURGE_ERROR'), 'error');
     }
     JFactory::getApplication()->redirect($link, JText::_('COM_EASYBLOG_PURGE_SUCCESS'));
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:migrators.php

示例7: clearPendingMessages

 /**
  * Removes any pending messages for post rejects
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function clearPendingMessages($id)
 {
     $db = EB::db();
     $query = 'DELETE FROM ' . $db->nameQuote('#__easyblog_post_rejected') . ' WHERE ' . $db->quoteName('post_id') . '=' . $db->Quote($draft_id);
     $db->setQuery($query);
     return $db->Query();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:moderate.php

示例8: main

 public function main()
 {
     $db = EB::db();
     $query = "DROP TABLE IF EXISTS `#__easyblog_stream`";
     $db->setQuery($query);
     $state = $db->query();
     return $state;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:8,代码来源:DropEasyBlogStream.php

示例9: isTableDraftsExists

 public function isTableDraftsExists()
 {
     $db = EB::db();
     $query = "SHOW TABLES LIKE '%_easyblog_site_subscription'";
     $db->setQuery($query);
     $result = $db->loadResult();
     return $result ? true : false;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:8,代码来源:MigrateSubscriptions.php

示例10: getChildCategories

 public static function getChildCategories(&$result, $params, &$categories, $level = 1)
 {
     $db = EB::db();
     $my = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     $order = $params->get('order', 'popular');
     $sort = $params->get('sort', 'desc');
     $count = (int) trim($params->get('count', 0));
     $hideEmptyPost = $params->get('hideemptypost', '0');
     $language = EB::getCurrentLanguage();
     foreach ($result as $row) {
         if ($row->parent_id == 0) {
             $categories[$row->id] = $row;
             $categories[$row->id]->childs = array();
         } else {
             $categories[$row->id] = $row;
             $categories[$row->id]->childs = array();
         }
         $query = 'SELECT ' . $db->qn('a.id') . ', ' . $db->qn('a.title') . ', ' . $db->qn('a.parent_id') . ', ' . $db->qn('a.alias') . ', ' . $db->qn('a.avatar') . ', COUNT(b.`id`) AS `cnt`' . ' , ' . $db->quote($level) . ' AS level' . ' FROM ' . $db->qn('#__easyblog_category') . ' AS `a`' . ' LEFT JOIN ' . $db->qn('#__easyblog_post_category') . ' AS pc' . ' ON a.`id` = pc.`category_id`' . ' LEFT JOIN ' . $db->qn('#__easyblog_post') . ' AS b' . ' ON b.`id` = pc.`post_id`' . ' AND b.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED) . ' AND b.`state` = ' . $db->Quote(EASYBLOG_POST_NORMAL);
         $query .= ' WHERE a.`published` = 1';
         $query .= ' AND a.`parent_id`=' . $db->Quote($row->id);
         if ($language) {
             $query .= 'AND(';
             $query .= ' a.' . $db->quoteName('language') . '=' . $db->Quote($language);
             $query .= ' OR';
             $query .= ' a.' . $db->quoteName('language') . '=' . $db->Quote('');
             $query .= ' OR';
             $query .= ' a.' . $db->quoteName('language') . '=' . $db->Quote('*');
             $query .= ')';
         }
         if (!$hideEmptyPost) {
             $query .= ' GROUP BY a.`id` ';
         } else {
             $query .= ' GROUP BY a.`id` HAVING (COUNT(b.`id`) > 0)';
         }
         if ($order == 'ordering') {
             $orderBy = ' ORDER BY `lft` ' . $sort;
         }
         if ($order == 'popular') {
             $orderBy = ' ORDER BY `cnt` ' . $sort;
         }
         if ($order == 'alphabet') {
             $orderBy = ' ORDER BY a.`title` ' . $sort;
         }
         if ($order == 'latest') {
             $orderBy = ' ORDER BY a.`created` ' . $sort;
         }
         $query .= $orderBy;
         $db->setQuery($query);
         $records = $db->loadObjectList();
         if ($records) {
             modEasyBlogCategoriesHelper::getChildCategories($records, $params, $categories[$row->id]->childs, ++$level);
             // foreach ($records as $childrec) {
             // 	$categories[$row->id]->cnt += $childrec->cnt;
             // }
         }
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:58,代码来源:helper.php

示例11: main

 public function main()
 {
     $db = EB::db();
     $query = array();
     $query[] = 'UPDATE ' . $db->qn('#__easyblog_post') . ' SET ' . $db->qn('doctype') . '=' . $db->Quote('legacy');
     $query[] = 'WHERE ' . $db->qn('doctype') . '=' . $db->Quote('');
     $db->setQuery($query);
     $state = $db->query();
     return $state;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:10,代码来源:MigratePostDocType.php

示例12: main

 public function main()
 {
     $db = EB::db();
     $query = array();
     $query[] = 'UPDATE ' . $db->qn('#__easyblog_post') . ' SET ' . $db->qn('published') . '=' . $db->Quote('0');
     $query[] = ',' . $db->qn('state') . '=' . $db->Quote('1');
     $query[] = 'WHERE ' . $db->qn('published') . '=' . $db->Quote('5');
     $db->setQuery($query);
     $state = $db->query();
     return $state;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:11,代码来源:MigrateTrashedPost.php

示例13: getGroups

 private static function getGroups()
 {
     $db = EB::db();
     $query = 'SELECT a.*, COUNT(DISTINCT(b.`id`)) AS `level` FROM ' . $db->quoteName('#__usergroups') . ' AS a';
     $query .= ' LEFT JOIN ' . $db->quoteName('#__usergroups') . ' AS b';
     $query .= ' ON a.`lft` > b.`lft` AND a.`rgt` < b.`rgt`';
     $query .= ' GROUP BY a.`id`, a.`title`, a.`lft`, a.`rgt`, a.`parent_id`';
     $query .= ' ORDER BY a.`lft` ASC';
     $db->setQuery($query);
     $groups = $db->loadObjectList();
     return $groups;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:12,代码来源:tree.php

示例14: genIsbloggerSQL

 /**
  * generate sql used for blogger retrieval
  *
  * @since	5.0
  * @access	public
  * @param
  * @return string
  */
 public static function genIsbloggerSQL($column = 'a.id')
 {
     $db = EB::db();
     $aclQuery = '1 <= (select count(1) from `#__easyblog_acl_group` as ag';
     $aclQuery .= '			inner join `#__easyblog_acl` as acl on ag.`acl_id` = acl.`id`';
     $aclQuery .= '			inner join `#__user_usergroup_map` as up on ag.`content_id` = up.`group_id`';
     $aclQuery .= '		 	where up.`user_id` = ' . $db->qn($column);
     $aclQuery .= '			and acl.`action` = ' . $db->Quote('add_entry');
     $aclQuery .= '			and ag.`type` = ' . $db->Quote('group');
     $aclQuery .= '			and ag.`status` = 1)';
     return $aclQuery;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:20,代码来源:aclhelper.php

示例15: loadByPostId

 /**
  * Loads a micro posting from twitter given the post id
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function loadByPostId($id)
 {
     $db = EB::db();
     $query = array();
     $query[] = 'SELECT * FROM ' . $db->qn($this->_tbl);
     $query[] = 'WHERE ' . $db->qn('post_id') . '=' . $db->Quote($id);
     $query = implode(' ', $query);
     $db->setQuery($query);
     $result = $db->loadObject();
     $state = parent::bind($result);
     return $state;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:20,代码来源:twittermicroblog.php


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