本文整理汇总了PHP中JObject::setProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP JObject::setProperties方法的具体用法?PHP JObject::setProperties怎么用?PHP JObject::setProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JObject
的用法示例。
在下文中一共展示了JObject::setProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupCanvasProperties
public static function setupCanvasProperties()
{
$jfbcLibrary = JFBCFactory::provider('facebook');
$canvasProperties = new JObject();
$appId = $jfbcLibrary->appId;
if ($appId) {
$params = "?fields=canvas_url,secure_canvas_url,page_tab_default_name,page_tab_url,secure_page_tab_url,namespace,website_url,canvas_fluid_height,canvas_fluid_width";
$appProps = $jfbcLibrary->api($appId . $params, null, FALSE);
$canvasProperties->setProperties($appProps);
}
return $canvasProperties;
}
示例2: getTempUser
public function getTempUser($token)
{
$db =& $this->getDBO();
//the password2 is for JUser binding purpose.
$query = 'SELECT *, ' . $db->nameQuote('password') . ' as ' . $db->nameQuote('password2') . ' FROM ' . $db->nameQuote('#__community_register');
$query .= ' WHERE ' . $db->nameQuote('token') . ' = ' . $db->Quote($token);
$db->setQuery($query);
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
$result = $db->loadObject();
$user = new JObject();
$user->setProperties($result);
return $user;
}
示例3: getTempUser
function getTempUser($token)
{
$db =& $this->getDBO();
//the password2 is for JUser binding purpose.
$query = "SELECT *, `password` as `password2` FROM " . $db->nameQuote('#__community_register');
$query .= " WHERE `token` = " . $db->Quote($token);
$db->setQuery($query);
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
$result = $db->loadObject();
$user = new JObject();
$user->setProperties($result);
return $user;
}
示例4: loadFormData
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.0
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data_array = JFactory::getApplication()->getUserState('com_icagenda.edit.event.data', array());
if (empty($data_array)) {
$data = $this->getItem();
} else {
$data = new JObject();
$data->setProperties($data_array);
}
// If not array, creates array with week days data
if (!is_array($data->weekdays)) {
$data->weekdays = explode(',', $data->weekdays);
}
// Retrieves data, to display selected week days
$arrayWeekDays = $data->weekdays;
foreach ($arrayWeekDays as $allTest) {
if ($allTest == '') {
$data->weekdays = '0,1,2,3,4,5,6';
}
}
return $data;
}
示例5: loadFormData
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
*
* @since 1.0
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$app = JFactory::getApplication();
$data_array = $app->getUserState('com_icagenda.edit.event.data', array());
if (empty($data_array)) {
$data = $this->getItem();
} else {
$data = new JObject();
$data->setProperties($data_array);
}
// If not array, creates array with week days data
if (!is_array($data->weekdays)) {
$data->weekdays = explode(',', $data->weekdays);
}
// Retrieves data, to display selected week days
$arrayWeekDays = $data->weekdays;
foreach ($arrayWeekDays as $allTest) {
if ($allTest == '') {
$data->weekdays = '0,1,2,3,4,5,6';
}
}
// Set displaytime default value
if (!isset($data->displaytime)) {
$data->displaytime = JComponentHelper::getParams('com_icagenda')->get('displaytime', '1');
}
// Set Features
$data->features = $this->getFeatures($data->id);
// Convert features into an array so that the form control can be set
if (!isset($data->features)) {
$data->features = array();
}
if (!is_array($data->features)) {
$data->features = explode(',', $data->features);
}
return $data;
}
示例6: getItem
/**
* Method to get the package.
*
* @return JObject the package
*/
public function getItem()
{
$id = $this->getState('package.id');
$package = new JObject();
$package->checked_out = 0;
$package->standalone = true;
$package->manifest = null;
$package->title = null;
$package->description = null;
if (!empty($id)) {
// If the package exists get it
$table = $this->getTable();
if (is_array($id)) {
$id = $id[0];
}
$table->load($id);
$package->setProperties($table->getProperties());
// Get the manifest
$xml = simplexml_load_file($table->path);
if ($xml) {
$manifest = (string) $xml->manifest;
$client = (string) $xml->manifest->attributes()->client;
LocaliseHelper::loadLanguage($manifest, $client);
// Set up basic information
$name = basename($table->path);
$name = substr($name, 0, strlen($name) - 4);
$package->id = $id;
$package->name = $name;
$package->manifest = $manifest;
$package->client = $client;
$package->standalone = substr($manifest, 0, 4) == 'fil_';
$package->core = (string) $xml->attributes()->core == 'true';
$package->icon = (string) $xml->icon;
$package->title = (string) $xml->title;
$package->description = (string) $xml->description;
$package->license = (string) $xml->license;
$package->copyright = (string) $xml->copyright;
$package->author = (string) $xml->author;
$package->writable = LocaliseHelper::isWritable($package->path);
$user = JFactory::getUser($table->checked_out);
$package->setProperties($table->getProperties());
if ($package->checked_out == JFactory::getUser()->id) {
$package->checked_out = 0;
}
$package->editor = JText::sprintf('COM_LOCALISE_TEXT_PACKAGE_EDITOR', $user->name, $user->username);
// Get the translations
$package->translations = array();
$package->administrator = array();
if ($xml->administrator) {
foreach ($xml->administrator->children() as $file) {
$data = (string) $file;
if ($data) {
$package->translations[] = "administrator_{$data}";
} else {
$package->translations[] = "administrator_joomla";
}
$package->administrator[] = $data;
}
}
$package->site = array();
if ($xml->site) {
foreach ($xml->site->children() as $file) {
$data = (string) $file;
if ($data) {
$package->translations[] = "site_{$data}";
} else {
$package->translations[] = "site_joomla";
}
$package->site[] = $data;
}
}
$package->installation = array();
if ($xml->installation) {
foreach ($xml->installation->children() as $file) {
$data = (string) $file->data();
if ($data) {
$package->translations[] = "installation_{$data}";
} else {
$package->translations[] = "installation_joomla";
}
$package->installation[] = $data;
}
}
} else {
$package = null;
$this->setError(JText::sprintf('COM_LOCALISE_ERROR_PACKAGE_FILEEDIT'), $table->path);
}
}
return $package;
}
示例7: _scanGlobalTranslationsFolders
private function _scanGlobalTranslationsFolders()
{
$filter_storage = $this->getState('filter.storage');
$reftag = $this->getState('translations.reference');
if ($filter_storage != 'local') {
// scan global folder
$filter_client = $this->getState('filter.client');
$filter_tag = $this->getState('filter.tag') ? "^({$reftag}|" . $this->getState('filter.tag') . ")\$" : '.';
$filter_type = $this->getState('filter.type') ? $this->getState('filter.type') : '.';
$filter_search = $this->getState('filter.search') ? $this->getState('filter.search') : '.';
$filter_origin = $this->getState('filter.origin') ? $this->getState('filter.origin') : '.';
if (empty($filter_client)) {
$clients = array('site', 'administrator', 'installation');
} else {
$clients = array($filter_client);
}
foreach ($clients as $client) {
// For all selected clients
$path = constant('LOCALISEPATH_' . strtoupper($client)) . '/language';
if (JFolder::exists($path)) {
$tags = JFolder::folders($path, $filter_tag, false, false, array('overrides', '.svn', 'CVS', '.DS_Store', '__MACOSX'));
foreach ($tags as $tag) {
// For all selected tags
$files = JFolder::files("{$path}/{$tag}", "{$filter_search}.*\\.ini\$");
foreach ($files as $file) {
$filename = substr($file, 1 + strlen($tag));
if ($filename == 'ini') {
$filename = '';
} else {
$filename = substr($filename, 0, strlen($filename) - 4);
}
$origin = LocaliseHelper::getOrigin($filename, $client);
if (preg_match("/{$filter_origin}/", $origin)) {
$prefix = substr($file, 0, 4 + strlen($tag));
$translation = new JObject(array('tag' => $tag, 'client' => $client, 'storage' => 'global', 'refpath' => null, 'path' => "{$path}/{$tag}/{$file}", 'state' => $tag == $reftag ? 'inlanguage' : 'notinreference', 'writable' => LocaliseHelper::isWritable("{$path}/{$tag}/{$file}"), 'origin' => $origin));
if ($file == "{$tag}.ini" && preg_match("/{$filter_type}/", 'joomla')) {
// scan joomla ini file
$translation->setProperties(array('type' => 'joomla', 'filename' => 'joomla', 'name' => JText::_('COM_LOCALISE_TEXT_TRANSLATIONS_JOOMLA')));
$this->translations["{$client}|{$tag}|joomla"] = $translation;
} elseif ($prefix == "{$tag}.com" && preg_match("/{$filter_type}/", 'component')) {
// scan component ini file
$translation->setProperties(array('type' => 'component', 'filename' => $filename, 'name' => $filename));
$this->translations["{$client}|{$tag}|{$filename}"] = $translation;
} elseif ($prefix == "{$tag}.mod" && preg_match("/{$filter_type}/", 'module')) {
// scan module ini file
$translation->setProperties(array('type' => 'module', 'filename' => $filename, 'name' => $filename));
$this->translations["{$client}|{$tag}|{$filename}"] = $translation;
} elseif ($prefix == "{$tag}.tpl" && preg_match("/{$filter_type}/", 'template')) {
// scan template ini file
$translation->setProperties(array('type' => 'template', 'filename' => $filename, 'name' => $filename));
$this->translations["{$client}|{$tag}|{$filename}"] = $translation;
} elseif ($prefix == "{$tag}.plg" && preg_match("/{$filter_type}/", 'plugin')) {
// scan plugin ini file
$translation->setProperties(array('type' => 'plugin', 'filename' => $filename, 'name' => $filename));
$this->translations["{$client}|{$tag}|{$filename}"] = $translation;
} elseif ($prefix == "{$tag}.pkg" && preg_match("/{$filter_type}/", 'package')) {
// scan package ini file
$translation->setProperties(array('type' => 'package', 'filename' => $filename, 'name' => $filename));
$this->translations["{$client}|{$tag}|{$filename}"] = $translation;
} elseif ($prefix == "{$tag}.lib" && preg_match("/{$filter_type}/", 'library')) {
// scan library ini file
$translation->setProperties(array('type' => 'library', 'filename' => $filename, 'name' => $filename));
$this->translations["{$client}|{$tag}|{$filename}"] = $translation;
} elseif ($prefix == "{$tag}.fil" && preg_match("/{$filter_type}/", 'file')) {
// scan files ini file
$translation->setProperties(array('type' => 'file', 'filename' => $filename, 'name' => $filename));
$this->translations["{$client}|{$tag}|{$filename}"] = $translation;
}
}
}
}
}
}
}
}
示例8: loadFormData
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 3.3.3
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data_array = JFactory::getApplication()->getUserState('com_icagenda.edit.registration.data', array());
if (empty($data_array)) {
$data = $this->getItem();
} else {
$data = new JObject();
$data->setProperties($data_array);
}
return $data;
}
示例9: getItem
/**
* Method to get the language.
*/
public function getItem()
{
$id = $this->getState('language.id');
$client = $this->getState('language.client');
$tag = $this->getState('language.tag');
$language = new JObject();
$language->id = $id;
$language->client = $client;
$language->tag = $tag;
$language->checked_out = 0;
if (!empty($id)) {
$table = $this->getTable();
$table->load($id);
$user = JFactory::getUser($table->checked_out);
$language->setProperties($table->getProperties());
if ($language->checked_out == JFactory::getUser()->id) {
$language->checked_out = 0;
}
$language->editor = JText::sprintf('COM_LOCALISE_TEXT_LANGUAGE_EDITOR', $user->name, $user->username);
$language->writable = LocaliseHelper::isWritable($language->path);
if (JFile::exists($language->path)) {
$xml = simplexml_load_file($language->path);
if ($xml) {
foreach ($xml->children() as $node) {
if ($node->name() == 'metadata') {
// metadata nodes
foreach ($node->children() as $subnode) {
$property = $subnode->name();
$language->{$property} = $subnode;
}
} else {
// main nodes
$property = $node->name();
if ($property == 'copyright') {
if (isset($language->joomlacopyright)) {
$language->copyright[] = $node;
} else {
$language->copyright = array();
$language->joomlacopyright = $node;
}
} else {
$language->{$property} = $node;
}
}
}
$language->copyright = implode('<br/>', $language->copyright);
} else {
$this->setError(JText::sprintf('COM_LOCALISE_ERROR_LANGUAGE_FILEEDIT', $language->path));
}
}
}
return $language;
}
示例10: sendResponse
/**
* Method to handle a send a JSON response. The body parameter
* can be a Exception object for when an error has occurred or
* a JObject for a good response.
*
* @param mixed $data JObject on success, Exception on error. [optional]
*
* @since 1.1.0
*/
public static function sendResponse($data = null)
{
$app = JFactory::getApplication();
// Create the response object.
$response = new JObject();
// Send the assigned error code if we are catching an exception.
if ($data instanceof Exception) {
// Log the error
JLog::add($data->getMessage(), JLog::ERROR);
JResponse::setHeader('status', $data->getCode());
JResponse::sendHeaders();
// Prepare the error response.
$response->error = true;
$response->header = JText::_('COM_FILEDSANDFILTERS_FILTERS_ERROR_HEADER');
$response->message = $data->getMessage();
} else {
$document = JFactory::getDocument();
// Prepare the response data.
$response->head = $document->getHeadData();
$response->body = $document->getBuffer('component', 'fieldsandfilters');
JResponse::setBody($response->body);
JPluginHelper::importPlugin('system');
$app->triggerEvent('onAfterRender');
$response->body = JResponse::getBody();
$response->hash = md5(serialize($app->input->get('fieldsandfilters', array(), 'array')));
$response->setProperties($data->getProperties(true));
}
// The old token is invalid so send a new one.
$response->token = JFactory::getSession()->getFormToken();
$response->requestID = $app->input->get('requestID', 0, 'alnum');
// Add the buffer.
// $response->buffer = JDEBUG ? ob_get_contents() : ob_end_clean();
if (self::$app_swap && self::$app_swap instanceof JApplication) {
JFactory::$application = self::$app_swap;
self::$app_swap = null;
}
if (self::$doc_swap && self::$doc_swap instanceof JDocument) {
JFactory::$document = self::$doc_swap;
self::$doc_swap = null;
}
// Send the JSON response.
echo json_encode($response);
// Close the application.
$app->close();
}
示例11: setProperties
public function setProperties($data)
{
parent::setProperties($data);
$this->params = new JRegistry($this->params);
}
示例12: __construct
public function __construct(&$item)
{
$config = JoomDOCConfig::getInstance();
/* @var $config JoomDOCConfig */
$mainframe = JFactory::getApplication();
/* @var $mainframe JApplication */
$user = JFactory::getUser();
$this->isFile = JoomDOCFileSystem::isFile($item);
$this->isFolder = JoomDOCFileSystem::isFolder($item);
$isFileSystemItem = $this->isFile || $this->isFolder;
$this->docid = $isFileSystemItem ? JoomDOCHelper::getDocumentID($item) : $item->id;
if (isset($item->document)) {
$document = new JObject();
$document->setProperties($item->document);
} elseif (!$isFileSystemItem) {
if ($item instanceof JObject) {
$document = $item;
} else {
$document = new JObject($item);
$document->setProperties($item);
}
} else {
$document = new JObject();
}
$this->isTrashed = $isFileSystemItem ? @$item->file_state == JOOMDOC_STATE_TRASHED : $document->get('file_state') == JOOMDOC_STATE_TRASHED;
if ($mainframe->isSite() && $document->get('state') == JOOMDOC_STATE_TRASHED) {
$this->docid = null;
}
$this->relativePath = $isFileSystemItem ? $item->getRelativePath() : $item->path;
$this->absolutePath = $isFileSystemItem ? $item->getAbsolutePath() : JoomDOCFileSystem::getFullPath($this->relativePath);
$this->inRoot = $this->absolutePath == $config->path;
$this->name = $isFileSystemItem ? $item->getFileName() : JFile::getName($this->relativePath);
$this->alias = JoomDOCHelper::getDocumentAlias($item);
$this->isChecked = JoomDOCHelper::isChecked($item);
$this->isLocked = false;
$this->fileType = JoomDOCHelper::getFileType($this->name);
$this->canViewFileInfo = JoomDOCAccessFileSystem::viewFileInfo($this->docid, $this->relativePath);
$this->fileVersion = JoomDOCHelper::getMaxVersion($this->relativePath);
$this->canRename = JoomDOCAccessFileSystem::rename($this->docid, $this->relativePath);
$this->canWebDav = JoomDOCAccessFileSystem::editWebDav($this->docid, $this->relativePath);
$this->canEdit = $this->docid && JoomDOCAccessDocument::canEdit($document);
$this->canCreate = !$this->docid && JoomDOCAccessDocument::create($this->relativePath);
if ($config->documentAccess == 2 && $mainframe->isSite()) {
$this->canDownload = $this->isFile && $document && $user->id == $document->get('access') && $document->get('download');
} else {
$this->canDownload = $this->isFile && JoomDOCAccessFileSystem::download($this->docid, $this->relativePath);
}
$this->canEnterFolder = JoomDOCAccessFileSystem::enterFolder($this->docid, $this->relativePath);
$this->canOpenFolder = $this->isFolder && $this->canEnterFolder;
$this->canOpenFile = $this->isFile;
$this->canEditStates = JoomDOCAccessDocument::editState($this->docid, $document->get('checked_out'));
$this->canEditState = $this->docid && JoomDOCAccessDocument::editState($this->docid, $document->get('checked_out'));
if ($mainframe->isAdmin()) {
$this->canEditState = JoomDOCAccessDocument::editState();
}
$this->canCopyMove = JoomDOCAccessFileSystem::copyMove($this->docid, $this->relativePath);
$this->canDeleteDocs = JoomDOCAccessDocument::delete($this->docid);
$this->canDeleteDoc = $this->docid && JoomDOCAccessDocument::delete($this->docid);
$this->canDeleteFile = JoomDOCAccessFileSystem::deleteFile($this->docid, $this->relativePath);
$this->canUpload = JoomDOCAccessFileSystem::uploadFile($this->docid, $this->relativePath);
$this->canCreateFolder = JoomDOCAccessFileSystem::newFolder($this->docid, $this->relativePath);
$this->canViewVersions = JoomDOCAccessDocument::viewVersions($this->docid);
$this->canShowFileDates = $config->showCreated || $config->showModified;
$this->canShowFileInfo = $config->showFilesize || $config->showHits;
$this->canShowAllDesc = $config->showFolderDesc && $config->showFileDesc;
$this->isFavorite = $document->get('favorite') == 1;
$this->canDisplayFavorite = $this->isFavorite && $config->displayFavorite;
$this->canAnyEditOp = $config->accessHandling && ($this->canEdit || $this->canWebDav || $this->canEditState || $this->canCreate || $this->canDeleteFile || $this->canDeleteDoc);
if (!$this->docid || !$document->get('license_id')) {
$license = JoomDOCHelper::license($this->relativePath);
if ($license) {
$this->licenseID = $license->id;
$this->licenseAlias = $license->alias;
$this->licenseTitle = $license->title;
}
} elseif ($document->get('license_state') == JOOMDOC_STATE_PUBLISHED) {
$this->licenseID = $document->get('license_id');
$this->licenseAlias = $document->get('license_alias');
$this->licenseTitle = $document->get('license_title');
}
$this->canManageVersions = false;
$this->canUntrash = JoomDOCAccessFileSystem::untrash($this->docid, $this->relativePath);
}
示例13: getAppConfigField
public function getAppConfigField($fieldName)
{
$fields = $this->getMergedRecommendations();
if (isset($fields->group)) {
foreach ($fields->group as $group) {
foreach ($group->field as $f) {
if ($f->name == $fieldName) {
$obj = new JObject();
$obj->setProperties($f);
return $obj;
}
}
}
}
return new JObject();
}
示例14: loadFormData
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.0
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_newsletter.edit.nextension.data', array());
if (empty($data)) {
$form = JRequest::getVar('jform');
if (!empty($form)) {
$data = $form;
} else {
$id = $this->getState($this->getName() . '.id');
$native = $this->getState('item.module.native');
$modules = MigurModuleHelper::getSupported(array('extension_id' => $id, 'native' => $native));
$data = new JObject($modules[0]);
if (!empty($data->params)) {
$data->setProperties($data->params);
}
unset($data->params);
}
}
return $data;
}
示例15: loadObjectFromStoredFile
/**
* Load object form stored file
*
* @param string $storedFile
* @param string $currentFolder
* @param string $fileHashes
*
* @return bool|JObject
*
* @since 3.6
*/
public function loadObjectFromStoredFile($storedFile, $currentFolder, $fileHashes)
{
$fileModel = $this->getFileModel();
$fileModel->loadByPath($currentFolder . '/' . $storedFile->filename);
// Skip files already detected
$tmpHash = md5($currentFolder . '/' . $storedFile->filename);
if (in_array($tmpHash, $fileHashes)) {
return false;
}
// Construct the file object for use in the Media Manager
$tmp = new JObject();
$tmp->setProperties($fileModel->getFileProperties());
return $tmp;
}