本文整理汇总了PHP中JObject::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP JObject::getProperties方法的具体用法?PHP JObject::getProperties怎么用?PHP JObject::getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JObject
的用法示例。
在下文中一共展示了JObject::getProperties方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a Error object.
*
* @since 1.6
*/
public function display($tpl = null)
{
try {
$this->item = $this->get('Item');
} catch (Exception $e) {
$app = JFactory::getApplication();
$app->enqueueMessage($e->getMessage(), 'error');
return false;
}
$paramsList = $this->item->getProperties();
unset($paramsList['xml']);
$paramsList = json_encode($paramsList);
return $paramsList;
}
示例2: testGetProperties
/**
* Tests getting the properties of the object.
*
* @group JObject
* @covers JObject::getProperties
* @return void
*/
public function testGetProperties()
{
$this->object = new JObject(
array(
'_privateproperty1' => 'valuep1',
'property1' => 'value1',
'property2' => 5
)
);
$this->assertEquals(
array(
'_errors' => array(),
'_privateproperty1' => 'valuep1',
'property1' => 'value1',
'property2' => 5
),
$this->object->getProperties(false),
'Should get all properties, including private ones'
);
$this->assertEquals(
array(
'property1' => 'value1',
'property2' => 5
),
$this->object->getProperties(),
'Should get all public properties'
);
}
示例3: readXML
public static function readXML($params)
{
$temppath = JPATH_BASE . DS . "cache/mod_bps_kiyoh/";
if (!is_dir($temppath)) {
mkdir($temppath);
}
$xmlUrl = $params->get('xmlUrl', '');
$cacheTime = (int) $params->get('cacheTime', 480) * 60;
$filename = md5($xmlUrl . $params->toString());
$tempfile = $temppath . $filename;
if (file_exists($tempfile)) {
$mtime = filemtime($tempfile);
if (time() - $mtime < $cacheTime) {
$aXmlData = unserialize(file_get_contents($tempfile));
return $aXmlData;
}
}
if (!($oXml = simplexml_load_file($xmlUrl))) {
echo 'Geen xml geladen';
return false;
}
$oXmlInfo = new JObject();
$oXmlInfo->set('naam', (string) $oXml->company->name);
$oXmlInfo->set('kiyohLink', (string) $oXml->company->url);
$oXmlInfo->set('total_score', (double) $oXml->company->total_score);
$oXmlInfo->set('total_reviews', (int) $oXml->company->total_reviews);
$oXmlInfo->set('total_views', (int) $oXml->company->total_views);
$aReviews = array();
$iReviewCount = 0;
foreach ($oXml->review_list->review as $oReview) {
$oReviewInfo = new JObject();
$oReviewInfo->set('naam', (string) $oReview->customer->name);
$oReviewInfo->set('place', (string) $oReview->customer->place);
$oReviewInfo->set('date', JHtml::_('date', (string) $oReview->customer->date, '%d %b'));
$oReviewInfo->set('dateRaw', JHtml::_('date', (string) $oReview->customer->date, '%Y-%m-%d'));
$oReviewInfo->set('total_score', (int) $oReview->total_score);
$oReviewInfo->set('recommendation', (string) $oReview->recommendation);
$oReviewInfo->set('positive', (string) $oReview->positive);
$oReviewInfo->set('negative', (string) $oReview->negative);
$iReviewCount++;
if ($params->get('reviewOnly', false) && ($oReviewInfo->positive == '' && $oReviewInfo->negative == '')) {
continue;
}
$aReviews[] = $oReviewInfo->getProperties();
}
$oXmlInfo->set('reviewCount', $iReviewCount);
$oXmlInfo->set('aReviews', $aReviews);
$aXmlData = $oXmlInfo->getProperties();
//in file zetten
$file = fopen($tempfile, 'w');
fwrite($file, serialize($aXmlData));
fclose($file);
// print_r_pre($aXmlData);
// print_r_pre($oXml->review_list);
return $aXmlData;
}
示例4: sanitizeConstructorData
/**
* Make sure that the data contains CamelCase properties
*
* @param mixed $data Data to sanitize
*
* @return JObject
*/
protected function sanitizeConstructorData($data)
{
$data = new JObject($data);
$properties = $data->getProperties();
$sanitizeData = new JObject();
foreach ($properties as $property => $value) {
$sanitizeData->set(NenoHelper::convertDatabaseColumnNameToPropertyName($property), $value);
}
return $sanitizeData;
}
示例5: JObject
/**
* Gets the appropriate values from the request
*
* @return unknown_type
*/
function _getState()
{
$state = new JObject();
foreach ($state->getProperties() as $key => $value) {
$new_value = JRequest::getVar($key);
$value_exists = array_key_exists($key, JRequest::get('post'));
if ($value_exists && !empty($key)) {
$state->{$key} = $new_value;
}
}
return $state;
}
示例6: JObject
/**
* Gets the appropriate values from the request
*
* @return JObject
*/
function _getState()
{
$state = new JObject();
$state->file = '';
$state->uploaded_file = '';
$state->uploaded_images_zip_file = '';
$state->uploaded_files_zip_file = '';
foreach ($state->getProperties() as $key => $value) {
$new_value = JRequest::getVar($key);
$value_exists = array_key_exists($key, $_POST);
if ($value_exists && !empty($key)) {
$state->{$key} = $new_value;
}
}
return $state;
}
示例7: JObject
/**
* Gets the appropriate values from the request
*
* return JObject
*/
function _getState()
{
$input = JFactory::getApplication()->input;
$state = new JObject();
$state->file = '';
$state->uploaded_file = '';
$state->uploaded_images_zip_file = '';
$state->uploaded_files_zip_file = '';
foreach ($state->getProperties() as $key => $value) {
$new_value = $input->get($key);
$value_exists = array_key_exists($key, $_POST);
if ($value_exists && !empty($key)) {
$state->{$key} = $new_value;
}
}
return $state;
}
示例8: JObject
/**
* Gets the appropriate values from the request
*
* @return unknown_type
*/
function _getState()
{
$state = new JObject();
$state->host = '';
$state->user = '';
$state->password = '';
$state->database = '';
$state->prefix = 'jos_';
$state->vm_prefix = 'vm_';
$state->driver = 'mysql';
$state->port = '3306';
$state->external_site_url = '';
foreach ($state->getProperties() as $key => $value) {
$new_value = JRequest::getVar($key);
$value_exists = array_key_exists($key, $_POST);
if ($value_exists && !empty($key)) {
$state->{$key} = $new_value;
}
}
return $state;
}
示例9: register
public function register(InputInterface $input, OutputInterface $output)
{
$app = Bootstrapper::getApplication($this->target_dir);
ob_start();
// build the record.
$data = new \JObject();
$data->name = $this->extension;
$data->type = $this->type;
$data->element = $this->extension;
$data->client_id = $input->getOption('client_id');
$data->enabled = $input->getOption('enabled');
$data->position = $input->getOption('position');
$element = $input->getOption('element');
if (strlen($element)) {
$data->element = $element;
}
// special case for plugin, naming and folder.
if ($this->type == 'plugin') {
// set the default folder for plugins only.
$data->folder = $input->getOption('folder') ? $input->getOption('folder') : 'system';
// special case for the plugins only.
if (substr($data->element, 0, 4) == 'plg_') {
$data->element = substr($data->element, 4);
}
}
if ($this->type == 'template') {
if (substr($data->name, 0, 4) == 'tpl_') {
$data->name = substr($data->name, 4);
$data->element = substr($data->element, 4);
}
}
//need to be sure that a prefix is provided for components and modules
if (($this->type == "component" || $this->type == "module") && strpos($data->element, '_') === false) {
$prefix = array_search($this->type, $this->typeMap);
$data->element = $prefix . $this->extension;
}
// get the #__extensions model and table
require_once JPATH_ADMINISTRATOR . '/components/com_installer/models/extension.php';
$model = new \InstallerModel();
$table = $model->getTable('extension', 'JTable');
// restrict on same name and type
$unique = array('name' => $data->name, 'type' => $data->type);
// does the extension exist?
if (!$table->load($unique)) {
if ($table->save($data->getProperties())) {
if (array_key_exists($this->type, $this->exceptions)) {
$this->handleExceptions($output, $app, $data, $this->type);
}
$output->writeln("<info>Your extension registered as a '{$this->type}', with extension_id: {$table->extension_id}</info>");
} else {
$output->writeln("<info>" . $table->getError() . "</info>");
}
} else {
$output->writeln("<error>{$this->extension} {$this->type}: That extension already exists.</error>");
}
ob_end_clean();
}
示例10: JObject
/**
* Gets the appropriate values from the request
*
* @return unknown_type
*/
function _getState()
{
$app = JFactory::getApplication();
$state = new JObject();
$state->host = '';
$state->user = '';
$state->password = '';
$state->database = '';
$state->prefix = '';
$state->driver = 'mysql';
$state->port = '3306';
foreach ($state->getProperties() as $key => $value) {
$new_value = $app->input->get($key);
$value_exists = array_key_exists($key, $_POST);
if ($value_exists && !empty($key)) {
$state->{$key} = $new_value;
}
}
return $state;
}
示例11: JObject
/**
* Gets the appropriate values from the request
*
* @return unknown_type
*/
function _getState()
{
$app = JFactory::getApplication();
$state = new JObject();
foreach ($state->getProperties() as $key => $value) {
//$new_value = JRequest::getVar( $key );
$new_value = $app->input->get($key);
$post = $app->input->get($_POST);
$value_exists = array_key_exists($key, $post);
if ($value_exists && !empty($key)) {
$state->{$key} = $new_value;
}
}
return $state;
}