本文整理匯總了PHP中JCckDatabase::loadObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP JCckDatabase::loadObject方法的具體用法?PHP JCckDatabase::loadObject怎麽用?PHP JCckDatabase::loadObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JCckDatabase
的用法示例。
在下文中一共展示了JCckDatabase::loadObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getRow
public static function getRow($id, $content_type = '')
{
if (!$id) {
return NULL;
}
$index = $id . '_' . $content_type;
if (isset(self::$_items[$index])) {
return self::$_items[$index];
}
$row = JTable::getInstance('content');
$row->load($id);
if (!$content_type) {
$content_type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location = "joomla_article" AND pk = ' . $row->id);
}
if ($content_type) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_form_' . $content_type . ' WHERE id = ' . $row->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$row->{$k} = $v;
}
}
}
self::$_items[$index] = $row;
return $row;
}
示例2: processById
public static function processById($id = 0)
{
$processing = JCckDatabase::loadObject('SELECT type, scriptfile FROM #__cck_more_processings WHERE published = 1 AND id = ' . (int) $id);
if (is_object($processing) && is_file(JPATH_SITE . $processing->scriptfile)) {
include_once JPATH_SITE . $processing->scriptfile;
}
}
示例3: prepareExport
public function prepareExport($id = 0)
{
$config = JFactory::getConfig();
$tmp_path = $config->get('tmp_path');
$tmp_dir = uniqid('cck_');
$path = $tmp_path . '/' . $tmp_dir;
$extension = JCckDatabase::loadObject('SELECT name, type, element, folder FROM #__extensions WHERE extension_id=' . (int) $id);
if (!$extension) {
return;
}
jimport('cck.base.install.export');
$name = $extension->element;
$prefix = CCK_Export::getPrefix($extension->type);
$src = JPATH_SITE . '/plugins/' . $extension->folder . '/' . $extension->element;
$xml = JCckDev::fromXML($src . '/' . $name . '.xml');
$version = isset($xml->version) ? '_' . $xml->version : '';
$filename = $prefix . '_' . $extension->folder . '_' . $name . $version;
$path_zip = $tmp_path . '/' . $filename . '.zip';
if (!$filename) {
return;
}
if ($src && JFolder::exists($src)) {
JFolder::copy($src, $path);
CCK_Export::clean($path);
}
CCK_Export::exportLanguage($src . '/' . $name . '.xml', JPATH_ADMINISTRATOR, $path);
CCK_Export::findFields(array($src . '/tmpl/edit.php', $src . '/tmpl/edit2.php'), $path . '/install');
return CCK_Export::zip($path, $path_zip);
}
示例4: getCall
public static function getCall($name)
{
static $cache = array();
if (!isset($cache[$name])) {
$cache[$name] = JCckDatabase::loadObject('SELECT b.name, b.type, b.options, a.request, a.request_object, a.request_options, a.response' . 'FROM #__cck_more_webservices_calls AS a' . ' LEFT JOIN #__cck_more_webservices AS b ON b.id = a.webservice' . ' WHERE a.name = "' . $name . '"');
}
return $cache[$name];
}
示例5: loadObject
public static function loadObject($query)
{
static $cache = array();
$idx = md5($query);
if (!isset($cache[$idx])) {
$cache[$idx] = parent::loadObject($query);
}
return $cache[$idx];
}
示例6: uniqid
public static function &getUser($userid = 0, $content_type = '', $profile = true)
{
if (!$userid) {
$user = JFactory::getUser();
} else {
$user = JFactory::getUser($userid);
}
// Core
if ($user->id && $user->guest != 1) {
$user->session_id = null;
$user->where_clause = 'user_id=' . $user->id;
} else {
$user->session_id = JFactory::getSession()->getId();
if (empty($user->session_id)) {
$user->session_id = uniqid();
/* Not good, but better than empty */
}
$user->where_clause = 'session_id="' . $user->session_id . '"';
}
// IP
$user->ip = getenv('REMOTE_ADDR');
// $_SERVER["REMOTE_ADDR"];
// More
if ($user->id && $profile) {
if (!$content_type) {
$content_type = '';
// todo: config
if (!$content_type) {
$content_type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location = "joomla_user" AND pk = ' . (int) $user->id);
}
}
$db = JFactory::getDbo();
$prefix = $db->getPrefix();
$tables = $db->getTableList();
$tables = array_flip($tables);
if (isset($tables[$prefix . 'cck_store_item_users'])) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_item_users WHERE id = ' . (int) $user->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$user->{$k} = $v;
}
}
}
if (isset($tables[$prefix . 'cck_store_form_' . $content_type])) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_form_' . $content_type . ' WHERE id = ' . (int) $user->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$user->{$k} = $v;
}
}
}
}
return $user;
}
示例7: delete
public function delete($pk = null)
{
if ($this->id) {
$clients = array('search', 'filter', 'list', 'item');
foreach ($clients as $client) {
$Pf = 'template_' . $client;
$style = JCckDatabase::loadObject('SELECT a.id, a.template FROM #__template_styles AS a' . ' WHERE a.template IN ( SELECT b.template FROM #__template_styles as b WHERE b.id = ' . (int) $this->{$Pf} . ' )' . ' ORDER BY a.id');
if ($style->id != $this->{$Pf}) {
JCckDatabase::execute('DELETE a.* FROM #__template_styles AS a WHERE a.id=' . (int) $this->{$Pf});
}
}
JCckDatabase::execute('DELETE IGNORE a.*, b.*' . ' FROM #__cck_core_search_field AS a' . ' LEFT JOIN #__cck_core_search_position AS b ON b.searchid = a.searchid' . ' WHERE a.searchid=' . (int) $this->id);
}
return parent::delete();
}
示例8: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Prepare
$app = JFactory::getApplication();
if ($app->input->get('option') == 'com_cck' && $app->input->get('view') == 'form') {
$form = '';
$value = '';
} else {
$alter = true;
$alter_type_default = isset($inherit['alter_type_value']) ? $inherit['alter_type_value'] : '';
if (isset($config['item']->id) && $config['item']->id && isset($config['item']->storage_table) && $config['item']->storage_table != '') {
$db = JFactory::getDbo();
$prefix = $db->getPrefix();
$table = str_replace('#__', $prefix, $config['item']->storage_table);
$tables = $db->getTableList();
if (in_array($table, $tables)) {
$column = JCckDatabase::loadObject('SHOW COLUMNS FROM ' . $table . ' WHERE field = "' . $config['item']->storage_field . '"');
$alter_type_value = isset($column->Type) ? strtoupper($column->Type) : $alter_type_default;
} else {
$alter = false;
$alter_type_value = $alter_type_default;
$alter_type_default = '';
}
} else {
$alter_type_value = $alter_type_default;
$alter_type_default = '';
}
ob_start();
include_once dirname(__FILE__) . '/tmpl/form.php';
$form = ob_get_clean();
}
// Set
$field->form = $form;
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
示例9: getStore
public static function getStore($id)
{
static $cache = array();
if (!isset($cache[$id])) {
$cache[$id] = JCckDatabase::loadObject('SELECT id, title, home, parent_id, parent_fee, parent_amount, options' . ' FROM #__cck_more_ecommerce_stores WHERE id = ' . (int) $id);
$cache[$id]->options = new JRegistry($cache[$id]->options);
}
return $cache[$id];
}
示例10: getRouteParams
public static function getRouteParams($name)
{
static $params = array();
if ($name == '') {
return array();
}
if (!isset($params[$name])) {
$object = JCckDatabase::loadObject('SELECT a.storage_location, a.options FROM #__cck_core_searchs AS a WHERE a.name = "' . $name . '"');
$object->options = json_decode($object->options);
$params[$name] = array();
$params[$name]['doSEF'] = isset($object->options->sef) && $object->options->sef != '' ? $object->options->sef : JCck::getConfig_Param('sef', '2');
$params[$name]['join_key'] = 'pk';
$params[$name]['location'] = $object->storage_location ? $object->storage_location : 'joomla_article';
}
return $params[$name];
}
示例11: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
$app = JFactory::getApplication();
$user = JFactory::getUser();
$access = implode(',', $user->getAuthorisedViewLevels());
$text = '';
if ($field->extended && $field->extended != @$config['type']) {
$options2 = JCckDev::fromJSON($field->options2);
$name = $field->storage_field2 ? $field->storage_field2 : $field->storage_field;
$value = array();
if (@$options2['child_language']) {
$language = $options2['child_language'] == '-1' ? JFactory::getLanguage()->getTag() : $options2['child_language'];
$language = ' AND a.language = "' . $language . '"';
} else {
$language = '';
}
$location = @$options2['child_location'] ? $options2['child_location'] : 'joomla_article';
$order = @$options2['child_orderby'] ? ' ORDER BY a.' . $options2['child_orderby'] . ' ' . $options2['child_orderby_direction'] : ' ORDER BY a.title ASC';
$limit = @$options2['child_limit'] ? ' LIMIT ' . $options2['child_limit'] : '';
switch ($field->bool2) {
case 2:
$properties = array('table', 'access', 'custom', 'status');
$properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
$and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : '';
$and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : '';
$items = JCckDatabase::loadObjectList('SELECT a.id as pk, a.' . $properties['custom'] . ' FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b on b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit);
if (count($items)) {
foreach ($items as $item) {
$text .= JHtml::_('content.prepare', $item->{$properties}['custom']);
$value[] = $item->pk;
}
}
break;
case 1:
$properties = array('table', 'access', 'status');
$properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
$and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : '';
$and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : '';
$items = JCckDatabase::loadObjectList('SELECT a.id as pk, a.title FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b ON b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit);
if (count($items)) {
foreach ($items as $item) {
$text .= ', ' . $item->title;
$value[] = $item->pk;
}
}
if ($text) {
$text = substr($text, 2);
}
break;
default:
$options2 = new JRegistry();
$options2->loadString($field->options2);
$options3_json = $options2->get('child_link_options');
$options3 = new JRegistry();
$options3->loadString($options3_json);
// todo >> href
$properties = array('table', 'access', 'status', 'to_route');
$properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
$and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : '';
$and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : '';
$items = JCckDatabase::loadObjectList('SELECT ' . $properties['to_route'] . ' FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b ON b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit);
if (count($items)) {
$sef = JFactory::getConfig()->get('sef') ? $options3->get('sef', 2) : 0;
JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'setRoutes', array(&$items, $sef, $options3->get('itemid', $app->input->getInt('Itemid', 0))));
foreach ($items as $item) {
$text .= ', ' . '<a href="' . $item->link . '">' . $item->title . '</a>';
$value[] = $item->pk;
}
if ($text) {
$text = substr($text, 2);
}
}
break;
}
$field->divider = ',';
$value = implode($field->divider, $value);
} else {
if ($value) {
switch ($field->bool) {
case 2:
$text = JCckDatabase::loadResult('SELECT a.introtext FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')');
$text = JHtml::_('content.prepare', $text);
break;
case 1:
$text = JCckDatabase::loadResult('SELECT a.title FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')');
break;
default:
require_once JPATH_SITE . '/plugins/cck_storage_location/' . self::$type . '/' . self::$type . '.php';
$item = JCckDatabase::loadObject('SELECT a.id, a.title, a.alias, a.catid, a.language FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')');
if (is_object($item)) {
$options2 = new JRegistry();
$options2->loadString($field->options2);
$options3_json = $options2->get('parent_link_options');
$options3 = new JRegistry();
$options3->loadString($options3_json);
$field2 = (object) array('link' => 'content', 'link_options' => $options3_json, 'id' => $field->name, 'name' => $field->name, 'text' => htmlspecialchars($item->title), 'value' => '');
//.........這裏部分代碼省略.........
示例12: getRouteByStorage
public static function getRouteByStorage(&$storage, $sef, $itemId, $config = array())
{
if (isset($storage[self::$table]->_route)) {
return JRoute::_($storage[self::$table]->_route);
}
$bridge = JCckDatabase::loadObject('SELECT a.id, a.title, a.alias, a.catid, b.title AS category_title, b.alias AS category_alias' . ' FROM #__content AS a LEFT JOIN #__categories AS b ON b.id = a.catid' . ' WHERE a.id=' . (int) $config['pkb']);
if (!is_object($bridge)) {
$storage[self::$table]->_route = '';
return $storage[self::$table]->_route;
}
$bridge->slug = $bridge->alias ? $bridge->id . ':' . $bridge->alias : $bridge->id;
if ($sef) {
if ($sef == '0' || $sef == '1') {
$path = '&catid=' . $bridge->catid;
} elseif ($sef[0] == '4') {
$path = '&catid=' . (isset($bridge->category_alias) ? $bridge->category_alias : $bridge->catid);
} elseif ($sef[0] == '3') {
$path = '&typeid=' . $config['type'];
} else {
$path = '';
}
$storage[self::$table]->_route = plgCCK_Storage_LocationJoomla_Article::_getRoute($sef, $itemId, $bridge->slug, $path);
} else {
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
$storage[self::$table]->_route = ContentHelperRoute::getArticleRoute($bridge->slug, $bridge->catid);
}
return JRoute::_($storage[self::$table]->_route);
}
示例13: getType
public static function getType($name, $id, $location = '')
{
// todo: API (move)
$query = 'SELECT a.id, a.title, a.name, a.description, a.location, a.parent, a.storage_location, b.app as folder_app,' . ' a.options_admin, a.options_site, a.options_content, a.options_intro, a.template_admin, a.template_site, a.template_content, a.template_intro, a.stylesheets' . ' FROM #__cck_core_types AS a' . ' LEFT JOIN #__cck_core_folders AS b ON b.id = a.folder' . ' WHERE a.name ="' . (string) $name . '" AND a.published = 1';
return JCckDatabase::loadObject($query);
}
示例14: onCCK_Storage_LocationDelete
public static function onCCK_Storage_LocationDelete($pk, &$config = array())
{
$app = JFactory::getApplication();
$dispatcher = JDispatcher::getInstance();
$item = JCckDatabase::loadObject('SELECT id, cck as type, pk, storage_table FROM #__cck_core WHERE cck = "' . $config['type'] . '" AND pk = ' . (int) $pk);
if (!is_object($item)) {
return false;
}
$table = JCckTable::getInstance($item->storage_table, 'id');
$table->load($pk);
if (!$table) {
return false;
}
// Check
$user = JCck::getUser();
$canDelete = $user->authorise('core.delete', 'com_cck.form.' . $config['type_id']);
$canDeleteOwn = $user->authorise('core.delete.own', 'com_cck.form.' . $config['type_id']);
if (!$canDelete && !$canDeleteOwn || !$canDelete && $canDeleteOwn && $config['author'] != $user->get('id') || $canDelete && !$canDeleteOwn && $config['author'] == $user->get('id')) {
$app->enqueueMessage(JText::_('COM_CCK_ERROR_DELETE_NOT_PERMITTED'), 'error');
return;
}
// Process
// -- onContentBeforeDelete?
if (!$table->delete($pk)) {
return false;
}
// Delete Core
if ($item->id) {
$table = JCckTable::getInstance('#__cck_core', 'id', $item->id);
$table->delete();
}
// Delete More
$base = str_replace('#__', '', $item->storage_table);
$tables = JCckDatabase::loadColumn('SHOW TABLES');
$prefix = JFactory::getConfig()->get('dbprefix');
if (in_array($prefix . 'cck_store_item_' . $base, $tables)) {
$table = JCckTable::getInstance('#__cck_store_item_' . $base, 'id', $pk);
if ($table->id) {
$table->delete();
}
}
if (in_array($prefix . 'cck_store_form_' . $item->type, $tables)) {
$table = JCckTable::getInstance('#__cck_store_form_' . $item->type, 'id', $pk);
if ($table->id) {
$table->delete();
}
}
// -- onContentAfterDelete?
return true;
}
示例15: _setTemplateStyle
protected function _setTemplateStyle($style)
{
$style = JCckDatabase::loadObject('SELECT template, params FROM #__template_styles WHERE id = ' . (int) $style);
if (is_object($style)) {
JFactory::getApplication()->setTemplate($style->template, $style->params);
}
}