本文整理汇总了PHP中KObject::get方法的典型用法代码示例。如果您正苦于以下问题:PHP KObject::get方法的具体用法?PHP KObject::get怎么用?PHP KObject::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KObject
的用法示例。
在下文中一共展示了KObject::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLink
public function getLink($options = array())
{
$option = $this->_options['option'];
$view = KRequest::get('get.view', 'cmd');
// modify url
$url = clone KRequest::url();
$query = new KObject();
$query->set($url->getquery(1));
//$query['view'] = 'settings';
$query->order = null;
$query->direction = null;
$query->limit = null;
$query->offset = null;
if (isset($query->tmpl)) {
JTML::_('behavior.modal');
}
$this->modal = true;
//$query['layout']= 'default';
$query->set($options);
$url->setQuery($query->get());
return $url;
}
示例2: var_dump
var_dump('Nested folder', $result);
/*
* Root files
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->limit(5)->browse()->toArray();
var_dump('Root files', $result);
/*
* Nested files
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->folder('stories')->limit(5)->browse()->toArray();
var_dump('Nested files', $result);
/*
* Root folders
*/
$result = KObject::get('com:files.controller.folder')->container('files-files')->limit(5)->browse()->toArray();
var_dump('Root folders', $result);
/*
* Nested folders
*/
$result = KObject::get('com:files.controller.folder')->container('files-files')->folder('stories')->limit(5)->browse()->toArray();
var_dump('Nested folders', $result);
/*
* Root nodes
*/
$result = KObject::get('com:files.controller.node')->container('files-files')->limit(5)->browse()->toArray();
var_dump('Root nodes', $result);
/*
* Nested nodes
*/
$result = KObject::get('com:files.controller.node')->container('files-files')->folder('stories')->limit(5)->browse()->toArray();
var_dump('Nested nodes', $result);
示例3: var_dump
var_dump('Root file - move', $result, !file_exists(JPATH_ROOT . '/images/random_test_file.txt') && file_exists(JPATH_ROOT . '/images/moved_test_file.txt'));
/*
* Root file - copy
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->name('moved_test_file.txt')->copy(array('destination_name' => 'copied_test_file.txt'))->toArray();
var_dump('Root file - copy', $result, file_exists(JPATH_ROOT . '/images/moved_test_file.txt') && file_exists(JPATH_ROOT . '/images/copied_test_file.txt'));
/*
* Nested file - move
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->name('moved_test_file.txt')->move(array('destination_folder' => 'random_test_folder'))->toArray();
var_dump('Nested file - move', $result, !file_exists(JPATH_ROOT . '/images/moved_test_file.txt') && file_exists(JPATH_ROOT . '/images/random_test_folder/moved_test_file.txt'));
/*
* Nested file - copy
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->name('copied_test_file.txt')->copy(array('destination_folder' => 'random_test_folder'))->toArray();
var_dump('Nested file - copy', $result, file_exists(JPATH_ROOT . '/images/copied_test_file.txt') && file_exists(JPATH_ROOT . '/images/random_test_folder/copied_test_file.txt'));
/*
* Nested file - copy with a new name
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->name('copied_test_file.txt')->copy(array('destination_folder' => 'random_test_folder', 'destination_name' => 'copied_test_file2.txt'))->toArray();
var_dump('Nested file - copy with a new name', $result, file_exists(JPATH_ROOT . '/images/copied_test_file.txt') && file_exists(JPATH_ROOT . '/images/random_test_folder/copied_test_file2.txt'));
/*
* Nested file - move with a new name
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->name('copied_test_file.txt')->move(array('destination_folder' => 'random_test_folder', 'destination_name' => 'moved_test_file2.txt'))->toArray();
var_dump('Nested file - move with a new name', $result, !file_exists(JPATH_ROOT . '/images/copied_test_file.txt') && file_exists(JPATH_ROOT . '/images/random_test_folder/moved_test_file2.txt'));
/*
* Delete test files
*/
$result = KObject::get('com:files.controller.folder')->container('files-files')->name('random_test_folder')->delete()->toArray();
示例4: var_dump
var_dump('Root file - delete', $result, !file_exists(JPATH_ROOT . '/images/ercan.txt'));
/*
* Nested file - add
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->folder('banners')->name('nested.txt')->add(array('contents' => 'test'))->toArray();
var_dump('Nested file - add', $result, file_exists(JPATH_ROOT . '/images/banners/nested.txt'));
/*
* Nested file - delete
*/
$result = KObject::get('com:files.controller.file')->container('files-files')->folder('banners')->name('nested.txt')->delete()->toArray();
var_dump('Nested file - delete', $result, !file_exists(JPATH_ROOT . '/images/banners/nested.txt'));
/*
* Root folder - add
*/
$result = KObject::get('com:files.controller.folder')->container('files-files')->name('ercan_test')->add()->toArray();
var_dump('Root folder - add', $result, is_dir(JPATH_ROOT . '/images/ercan_test'));
/*
* Root folder - delete
*/
$result = KObject::get('com:files.controller.folder')->container('files-files')->name('ercan_test')->delete()->toArray();
var_dump('Root folder - delete', $result, !file_exists(JPATH_ROOT . '/images/ercan_test'));
/*
* Nested folder - add
*/
$result = KObject::get('com:files.controller.folder')->container('files-files')->folder('banners')->name('ercan_nested')->add()->toArray();
var_dump('Nested folder - add', $result, is_dir(JPATH_ROOT . '/images/banners/ercan_nested'));
/*
* Nested folder - delete
*/
$result = KObject::get('com:files.controller.folder')->container('files-files')->folder('banners')->name('ercan_nested')->delete()->toArray();
var_dump('Nested folder - delete', $result, !file_exists(JPATH_ROOT . '/images/banners/nested.txt'));
示例5: get
/**
* Get the raw value of a property or return the default value passed
*
* @param string $name Then name of the property
* @param mixed $default The default value
*
* @return mixed
*/
public function get($name = null, $default = null)
{
$description = $this->getEntityDescription();
//get the property
$property = $description->getProperty($name);
if (!$property) {
return parent::get($name, $default);
}
//get the property name
$name = $property->getName();
$value = $this->_data->offsetGet($name);
if ($property->isRelationship() && $property->isOneToMany() && is_null($value)) {
//since it's an external relationship
//lets instantitate a dummy relationship
//this should happen for the one-to-one relationships
if ($property->isOneToOne()) {
return null;
}
$value = $this->_data[$name] = $property->getSet($this);
return $value;
}
return is_null($value) ? $default : $value;
}
示例6: render
public function render()
{
return $this->_parent->getTemplate()->loadIdentifier('button_default', array('name' => $this->getName(), 'text' => $this->getText(), 'id' => $this->getId(), 'attribs' => $this->attribs->get()))->render(true);
}
示例7: _createButton
protected function _createButton($url, $name, $button)
{
$html = array();
$var = KInflector::underscore($button);
$href = new KObject();
$href->set(array_merge($url->get(), array('view' => $var)));
$attr = current((array) $button->attributes());
if ($attr['view'] == KRequest::get('get.view', 'cmd', 'dashboard')) {
return false;
}
$img = isset($attr['img']) ? $attr['img'] : null;
$attr['img'] = null;
if (!empty($attr)) {
$href->set($attr);
}
$html[] = '<div><div class="dashboard-button">';
$html[] = '<a href="' . JRoute::_('index.php?' . http_build_query($href->get())) . '"><img src="' . KFactory::get('admin::com.ninja.helper.default')->img('/48/' . JFile::stripExt(basename($img)) . '.png') . '" alt="' . $button . '"/><span>' . JText::_($button) . '</span></a>';
$html[] = '</div></div>';
return implode($html);
}