本文整理汇总了PHP中KConfig::toData方法的典型用法代码示例。如果您正苦于以下问题:PHP KConfig::toData方法的具体用法?PHP KConfig::toData怎么用?PHP KConfig::toData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfig
的用法示例。
在下文中一共展示了KConfig::toData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param object An optional KConfig object with configuration options.
*/
public function __construct(KConfig $config)
{
parent::__construct($config);
// Set the view identifier
$this->_modules = KConfig::toData($config->modules);
}
示例2: display
/**
* Generates an HTML editor
*
* @param array An optional array with configuration options
* @return string Html
*/
public function display($config = array())
{
$config = new KConfig($config);
$config->append(array(
'editor' => null,
'name' => 'description',
'width' => '100%',
'height' => '500',
'cols' => '75',
'rows' => '20',
'buttons' => true,
'options' => array()
));
$editor = KFactory::get('joomla:editor', array($config->editor));
$options = KConfig::toData($config->options);
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$result = $editor->display($config->name, $config->{$config->name}, $config->width, $config->height, $config->cols, $config->rows, KConfig::toData($config->buttons), $config->name, null, null, $options);
} else {
$result = $editor->display($config->name, $config->{$config->name}, $config->width, $config->height, $config->cols, $config->rows, KConfig::toData($config->buttons), $options);
}
return $result;
}
示例3: addElement
/**
* Add an element
*
* @param NinjaFormElementInterface $elem
* @return this
*/
public function addElement(comNinjaFormElementInterface $elem)
{
$data = $this->_data;
$data[] = $elem;
$this->_data = KConfig::toData($data);
return $this;
}
示例4: __construct
/**
* Constructor
*
* @param object An optional KConfig object with configuration options
*/
public function __construct(KConfig $config)
{
parent::__construct($config);
// set the auto assign state
$this->_auto_assign = $config->auto_assign;
//set the data
$this->_data = KConfig::toData($config->data);
// user-defined escaping callback
$this->setEscape($config->escape);
// set the template object
$this->_template = $config->template;
//Set the template filters
if(!empty($config->template_filters)) {
$this->getTemplate()->addFilter($config->template_filters);
}
// Set base and media urls for use by the view
$this->assign('baseurl' , $config->base_url)
->assign('mediaurl', $config->media_url);
//Add alias filter for media:// namespace
$this->getTemplate()->getFilter('alias')->append(
array('media://' => $config->media_url.'/'), KTemplateFilter::MODE_READ | KTemplateFilter::MODE_WRITE
);
//Add alias filter for base:// namespace
$this->getTemplate()->getFilter('alias')->append(
array('base://' => $config->base_url.'/'), KTemplateFilter::MODE_READ | KTemplateFilter::MODE_WRITE
);
}
示例5: __construct
/**
* Constructor
*
* @param object An optional KConfig object with configuration options
*/
public function __construct(KConfig $config)
{
parent::__construct($config);
$this->_encdoing = $config->encoding;
$this->_config = KConfig::toData($config->config);
}
示例6: display
/**
* Generates an HTML editor
*
* @param array An optional array with configuration options
* @return string Html
*/
public function display($config = array())
{
$config = new KConfig($config);
$config->append(array('editor' => null, 'name' => 'description', 'width' => '100%', 'height' => '500', 'cols' => '75', 'rows' => '20', 'buttons' => true, 'options' => array()));
$editor = KFactory::get('lib.joomla.editor', array($config->editor));
$options = KConfig::toData($config->options);
return $editor->display($config->name, $config->{$config->name}, $config->width, $config->height, $config->cols, $config->rows, $config->buttons, $options);
}
示例7: __construct
/**
* Constructor
*
* @param object An optional KConfig object with configuration options.
*/
public function __construct(KConfig $config)
{
parent::__construct($config);
// Set the view identifier
$this->_menubar = $config->menubar;
$this->_render = KConfig::toData($config->render);
}
示例8: __construct
/**
* Constructor.
*
* @param object An optional KConfig object with configuration options
*/
public function __construct( KConfig $config = null)
{
parent::__construct($config);
$this->_title = $config->title;
$this->_class = $config->class;
$this->_styles = KConfig::toData($config->styles);
$this->_attribs = KConfig::toData($config->attribs);
}
示例9: __construct
/**
* Constructor.
*
* @param object An optional KConfig object with configuration options
*/
public function __construct(KConfig $config = null)
{
//If no config is passed create it
if (!isset($config)) {
$config = new KConfig();
}
parent::__construct($config);
$this->_data = KConfig::toData($config->data);
}
示例10: __construct
/**
* Constructor
*
* Prevent creating instances of this class by making the contructor private
*
* @param object An optional KConfig object with configuration options
*/
public function __construct(KConfig $config)
{
parent::__construct($config);
// Set the table indentifier
if (isset($config->view)) {
$this->setView($config->view);
}
//Register the template stream wrapper
KTemplateStream::register();
//Set the template search paths
$this->_paths = KConfig::toData($config->paths);
// Mixin a command chain
$this->mixin(new KMixinCommandchain($config->append(array('mixer' => $this))));
}
示例11: startPane
/**
* Creates a pane and creates the javascript object for it
*
* @param array An optional array with configuration options
* @return string Html
*/
public function startPane($config = array())
{
$config = new KConfig($config);
$config->append(array('id' => 'pane', 'attribs' => array(), 'options' => array()));
$html = '';
// Load the necessary files if they haven't yet been loaded
if (!isset($this->_loaded['tabs'])) {
$this->_loaded['tabs'] = true;
}
$id = strtolower($config->id);
$attribs = KHelperArray::toString($config->attribs);
$html .= "\n\t\t\t<script>\n\t\t\t\twindow.addEvent('domready', function(){ new KTabs('tabs-" . $id . "', " . json_encode($config->toData($config->options)) . "); });\n\t\t\t</script>";
$html .= '<dl class="tabs" id="tabs-' . $id . '" ' . $attribs . '>';
return $html;
}
示例12: _sanitize
/**
* Sanitize a value
*
* If the value passed for sanitisation is a json encoding string it will be decoded,
* otherwise the value will be encoded.
*
* @param scalar Value to be sanitized
* @return string
*/
protected function _sanitize($value)
{
$result = null;
//Try to decode the string
if(is_string($value)) {
$result = json_decode($value);
}
//Encode the data if it could not be decode
if(is_null($result))
{
if($value instanceof KConfig) {
$value = KConfig::toData($value);
}
$result = json_encode($value);
}
return $result;
}
示例13: __construct
public function __construct(KConfig $config)
{
parent::__construct($config);
$this->_database = $config->database;
$this->_name = $config->name;
// Set the identity column
$this->_identity_column = $config->identity_column;
//Set the default column mappings
$this->_column_map = $config->column_map ? $config->column_map->toArray() : array();
if (!isset($this->_column_map['id']) && isset($this->_identity_column)) {
$this->_column_map['id'] = $this->_identity_column;
}
// TODO: Set the column filters
if (!empty($config->filters) && false) {
foreach ($config->filters as $column => $filter) {
$this->getColumn($column, true)->filter = KConfig::toData($filter);
}
}
// Mixin a command chain
$this->mixin(new KMixinCommand($config->append(array('mixer' => $this))));
// Mixin the behavior interface
$this->mixin(new KMixinBehavior($config));
}
示例14: _actionDispatch
/**
* Dispatch the controller
*
* @param object A command context object
* @return mixed
*/
protected function _actionDispatch(KCommandContext $context)
{
//Set the default controller
if ($context->data) {
$this->_controller_default = KConfig::toData($context->data);
}
//Set the date in the context
$context->data = $this->getData();
//Execute the controller
$result = $this->getController()->execute($this->getAction(), $context);
//Set the response header
if ($context->status) {
header(KHttpResponse::getHeader($context->status));
}
return $result;
}
示例15: _actionDelete
/**
* Generic delete function
*
* @param KCommandContext A command context object
* @return KDatabaseRowset A rowset object containing the deleted rows
*/
protected function _actionDelete(KCommandContext $context)
{
$data = $this->getModel()->getData();
if(count($data))
{
$data->setData(KConfig::toData($context->data));
//Only throw an error if the action explicitly failed.
if($data->delete() === false)
{
$error = $data->getStatusMessage();
$context->setError(new KControllerException(
$error ? $error : 'Delete Action Failed', KHttpResponse::INTERNAL_SERVER_ERROR
));
}
else $context->status = KHttpResponse::NO_CONTENT;
}
else $context->setError(new KControllerException('Resource Not Found', KHttpResponse::NOT_FOUND));
return $data;
}