本文整理汇总了PHP中KConfig::unbox方法的典型用法代码示例。如果您正苦于以下问题:PHP KConfig::unbox方法的具体用法?PHP KConfig::unbox怎么用?PHP KConfig::unbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfig
的用法示例。
在下文中一共展示了KConfig::unbox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(KConfig $config)
{
parent::__construct($config);
if ($config->fields) {
$this->setFields(KConfig::unbox($config->fields));
}
}
示例2: __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);
// Set the table indentifier
if (isset($config->identity_column)) {
$this->_identity_column = $config->identity_column;
}
// Reset the row
$this->reset();
// Set the new state of the row
$this->_new = $config->new;
// Set the row data
if (isset($config->data)) {
$this->setData((array) KConfig::unbox($config->data), $this->_new);
}
//Set the status
if (isset($config->status)) {
$this->setStatus($config->status);
}
//Set the status message
if (!empty($config->status_message)) {
$this->setStatusMessage($config->status_message);
}
}
示例3: updateMentionsFromBody
/**
* Extracts mention usernames from the entity body and updates the entity.
*
* @param KCommandContext $context
*
* @return bool
*/
public function updateMentionsFromBody(KCommandContext $context)
{
$entity = $this->getItem();
$body_mentions = $this->extractMentions($entity->body);
$body_mentions = array_map('strtolower', $body_mentions);
$entity_mentions = KConfig::unbox($entity->mentions->username);
if (is_array($entity_mentions)) {
$entity_mentions = array_map('strtolower', $entity_mentions);
}
//update removed mentions
if (is_array($body_mentions)) {
foreach ($entity_mentions as $mention) {
if (!in_array($mention, $body_mentions)) {
$entity->removeMention($mention);
}
}
}
//remove the body mentions that already exists in the entity mentions
if (is_array($entity_mentions)) {
foreach ($body_mentions as $index => $mention) {
if (in_array($mention, $entity_mentions)) {
unset($body_mentions[$index]);
}
}
}
//what's left are new mentions. Add them to the entity.
foreach ($body_mentions as $mention) {
$entity->addMention(trim($mention));
}
//keep the list of new mentions so you can notify them later.
$this->_newly_mentioned = $body_mentions;
}
示例4: javascript
public function javascript($config = array())
{
$config = new KConfig($config);
$config->append(array('keys' => array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'An error occurred during request', 'You selected following folders and files to be deleted. Are you sure?', 'All Files', 'An error occurred with status code: ', 'An error occurred: ', 'Unknown error', 'Uploaded successfully!', 'Select files from your computer', 'Choose File')));
$keys = KConfig::unbox($config->keys);
$map = array();
foreach ($keys as $key) {
$map[$key] = $this->translate($key);
}
ob_start();
?>
<script>
if (typeof Files === 'undefined') {
Files = {};
}
(function() {
var keys = <?php
echo json_encode($map);
?>
;
Files._ = function(key) {
if (typeof keys[key] !== 'undefined') {
return keys[key];
}
return key;
};
})();
</script>
<?php
$html = ob_get_clean();
return $html;
}
示例5: __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::unbox($config->render);
}
示例6: __construct
public function __construct(KConfig $config = null)
{
parent::__construct($config);
if (isset($config->adapters)) {
$this->_adapters = KConfig::unbox($config->adapters);
}
}
示例7: _actionBrowse
/**
* Browse Action.
*
* @param KCommandContext $context Context parameter
*
* @return AnDomainEntitysetDefault
*/
protected function _actionBrowse(KCommandContext $context)
{
$context->append(array('query' => $this->getRepository()->getQuery()));
$query = $context->query;
if ($this->q) {
$query->keyword($this->getService('anahita:filter.term')->sanitize($this->q));
}
if ($this->ids) {
$ids = KConfig::unbox($this->ids);
$query->id($ids);
} else {
$query->limit($this->limit, $this->start);
}
$entities = $query->toEntitySet();
if ($this->isOwnable() && $this->actor) {
$this->_state->append(array('filter' => 'following'));
if ($this->filter == 'administering' && $this->getRepository()->hasBehavior('administrable')) {
$entities->where('administrators.id', 'IN', array($this->actor->id));
} elseif ($this->actor->isFollowable()) {
$entities->where('followers.id', 'IN', array($this->actor->id));
}
}
$entities->order('created_on', 'desc');
return $this->setList($entities)->getList();
}
示例8: _actionBrowse
/**
* Browse Action.
*
* @param KCommandContext $context Context parameter
*
* @return ComPeopleDomainEntityPerson
*/
protected function _actionBrowse(KCommandContext $context)
{
if (!$context->query) {
$context->query = $this->getRepository()->getQuery();
}
$query = $context->query;
if ($this->filter) {
if ($this->filter['usertype'] && in_array($this->filter['usertype'], $this->_allowed_user_types)) {
$query->filterUsertype($this->getService('koowa:filter.cmd')->sanitize($this->filter['usertype']));
}
if ($this->filter['disabled']) {
$query->filterDisabledAccounts(true);
}
}
if ($this->getService('koowa:filter.email')->validate($this->q)) {
$query->filterEmail($this->q);
}
if ($this->getService('com://site/people.filter.username')->validate($this->q)) {
$query->filterUsername($this->q);
}
if ($this->q) {
$query->keyword = $this->getService('anahita:filter.term')->sanitize($this->q);
}
if ($this->ids) {
$ids = KConfig::unbox($this->ids);
$query->id($ids);
} else {
$query->limit($this->limit, $this->start);
}
$entities = $this->getState()->setList($query->toEntityset())->getList();
//print str_replace('#_', 'jos', $entities->getQuery());
return $entities;
}
示例9: create
/**
* Creates a new story.
*
* @param array $data The story data
*
* @return ComStoriesDomainEntityStory
*/
public function create($data)
{
$data = new KConfig($data);
$data->append(array('owner' => $data->target ? $data->target : $data->subject));
$data = KConfig::unbox($data);
return $this->getEntity(array('data' => $data));
}
示例10: _actionAssign
/**
* Sets the assignment
*/
protected function _actionAssign(KCommandContext $context)
{
if ($item = $this->getService('com://admin/components.domain.set.assignablecomponent')->find(array('id' => $this->id))) {
$item->setAssignmentForIdentifier(KConfig::unbox($context->data->identifiers));
$item->save();
}
}
示例11: __construct
/**
* Object constructor
*
* @param object An optional KConfig object with configuration options
*/
public function __construct(KConfig $config)
{
parent::__construct($config);
if (is_null($config->event_dispatcher)) {
throw new KMixinException('event_dispatcher [KEventDispatcher] option is required');
}
//Set the event dispatcher
$this->_event_dispatcher = $config->event_dispatcher;
//Add the event listeners
if (!empty($config->event_listeners)) {
foreach ($config->event_listeners as $event => $listener) {
$this->addEventListener($event, $listener);
}
}
//Add the event handlers
if (!empty($config->event_subscribers)) {
$subscribers = (array) KConfig::unbox($config->event_subscribers);
foreach ($subscribers as $key => $value) {
if (is_numeric($key)) {
$this->addEventSubscriber($value);
} else {
$this->addEventSubscriber($key, $value);
}
}
}
}
示例12: __construct
/**
* Constructor.
*
* @param KConfig $config An optional KConfig object with configuration options.
*
* @return void
*/
public function __construct(KConfig $config)
{
parent::__construct($config);
$paths = array_reverse(KConfig::unbox($config->asset_paths));
foreach ($paths as $path) {
$this->addPath($path);
}
}
示例13: persistState
/**
* Restores a state for an action
*
* @param string $action
* @return void
*/
public function persistState($action)
{
$state = $this->getRequest();
// Built the session identifier based on the action
$identifier = $this->_mixer->getIdentifier() . '.' . $action;
//Set the state in the session
KRequest::set('session.' . $identifier, KConfig::unbox($state));
}
示例14: __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::unbox($config->styles);
$this->_attribs = KConfig::unbox($config->attribs);
}
示例15: _actionSetprivacy
/**
* Set a privacy for a privatable entity
*
* @param KCommandContext $context Context parameter
*
* @return void
*/
protected function _actionSetprivacy($context)
{
$data = $context->data;
$names = KConfig::unbox($data->privacy_name);
settype($names, 'array');
foreach ($names as $name) {
$this->getItem()->setPermission($name, $data->{$name});
}
}