/** * Reset the cached container object if container changes * * @param KModelContextInterface $context */ protected function _afterReset(KModelContextInterface $context) { $modified = (array) KObjectConfig::unbox($context->modified); if (in_array('container', $modified)) { unset($this->_container); } }
/** * Constructor * * @param KObjectConfig $config An optional ObjectConfig object with configuration options */ public function __construct(KObjectConfig $config) { parent::__construct($config); //Session write and close handlers are called after destructing objects since PHP 5.0.5. if (version_compare(phpversion(), '5.4.0', '>=')) { session_register_shutdown(); } else { register_shutdown_function('session_write_close'); } //Only configure the session if it's not active yet if (!$this->isActive()) { //Set the session options $this->setOptions($config->options); //Set the session name if (!empty($config->name)) { $this->setName($config->name); } //Set the session identifier if (!empty($config->id)) { $this->setId($config->id); } //Set the session handler $this->setHandler($config->handler, KObjectConfig::unbox($config)); } //Set the session namespace $this->setNamespace($config->namespace); //Set lifetime time $this->getContainer('metadata')->setLifetime($config->lifetime); }
/** * Constructor. * * @param KObjectConfig $config Configuration options. */ public function __construct(KObjectConfig $config) { parent::__construct($config); $this->_title_column = KObjectConfig::unbox($config->title_column); $this->_controller = $config->controller; $this->setActions(KObjectConfig::unbox($config->actions)); }
public function __construct(KObjectConfig $config) { parent::__construct($config); $this->setThumbnailSize(KObjectConfig::unbox($config->thumbnail_size)); $this->_container = $config->container; $this->_folder = $config->folder; }
/** * Reset the cached container object if container changes * * @param KModelContextInterface $context */ protected function _afterReset(KModelContextInterface $context) { $modified = (array) KObjectConfig::unbox($context->modified); if (in_array('container', $modified)) { self::$_container = null; } }
protected function _saveGroups(KDatabaseRowInterface $entity) { $table = $this->getObject('com://admin/docman.database.table.levels'); $row = $table->select(array('entity' => $entity->uuid), KDatabase::FETCH_ROW); $groups = KObjectConfig::unbox($entity->groups); $access = null; if (is_array($groups) && count($groups)) { sort($groups); $row->groups = implode(',', array_map('intval', $groups)); $row->entity = $entity->uuid; if ($row->save()) { $access = -1 * $row->id; } } elseif ($entity->inherit || $groups) { if (!$row->isNew()) { $row->delete(); } $access = $groups ?: self::INHERIT; } if ($access !== null) { if ($entity->getIdentifier()->name === 'document') { $entity->access = $access; } else { $entity->access_raw = $access; } } }
public function __construct(KObjectConfig $config) { parent::__construct($config); $this->_redirect_schemes = KObjectConfig::unbox($config->redirect_schemes); $this->_redirect_unknown = $config->redirect_unknown; }
public function __construct(KObjectConfig $config) { parent::__construct($config); if (isset($config->adapters)) { $this->_adapters = KObjectConfig::unbox($config->adapters); } }
public function __construct(KObjectConfig $config) { parent::__construct($config); if ($config->fields) { $this->_fields = KObjectConfig::unbox($config->fields); } }
/** * Object constructor * * @param KObjectConfig $config Configuration options * @throws InvalidArgumentException */ public function __construct(KObjectConfig $config) { parent::__construct($config); if (is_null($config->command_chain)) { throw new InvalidArgumentException('command_chain [KCommandChainInterface] config option is required'); } //Create a command chain object $this->__command_chain = $config->command_chain; //Add the event subscribers $handlers = (array) KObjectConfig::unbox($config->command_handlers); foreach ($handlers as $key => $value) { if (is_numeric($key)) { $this->addCommandHandler($value); } else { $this->addCommandHandler($key, $value); } } //Add the command callbacks foreach ($this->getMixer()->getMethods() as $method) { $match = array(); if (preg_match('/_(after|before)([A-Z]\\S*)/', $method, $match)) { $this->addCommandCallback($match[1] . '.' . strtolower($match[2]), $method); } } }
/** * Constructor. * * @param KObjectConfig $config An optional ObjectConfig object with configuration options. */ public function __construct(KObjectConfig $config) { parent::__construct($config); //Set the supported methods $this->_methods = KObjectConfig::unbox($config->methods); //Load the dispatcher translations $this->addCommandCallback('before.dispatch', '_loadTranslations'); }
/** * Constructor * * @param KObjectConfig $config An optional KObjectConfig object with configuration options */ public function __construct(KObjectConfig $config) { parent::__construct($config); $headers = KObjectConfig::unbox($config->headers); foreach ($headers as $key => $values) { $this->set($key, $values); } }
protected function _initialize(KObjectConfig $config) { $size = KObjectConfig::unbox($config->size); if (empty($size)) { $config->size = array('x' => 200, 'y' => 150); } parent::_initialize($config); }
/** * Constructor. * * @param KObjectConfig $config Configuration options */ public function __construct(KObjectConfig $config = null) { parent::__construct($config); $this->_title = $config->title; $this->_class = $config->class; $this->_styles = KObjectConfig::unbox($config->styles); $this->_attribs = KObjectConfig::unbox($config->attribs); }
/** * Creates a tab panel with title and starts that panel * * @param array|KObjectConfig $config An optional array with configuration options * @return string Html */ public function startPanel($config = array()) { $translator = $this->getObject('translator'); $config = new KObjectConfigJson($config); $config->append(array('title' => $translator->translate('Slide'), 'id' => '', 'translate' => true)); $title = $config->translate ? $translator->translate($config->title) : $config->title; return JHtml::_('sliders.panel', $title, KObjectConfig::unbox($config->attribs)); }
public function validate($entity) { $allowed = KObjectConfig::unbox($entity->getContainer()->getParameters()->allowed_extensions); $value = $entity->extension; if (is_array($allowed) && (empty($value) || !in_array(strtolower($value), $allowed))) { return $this->_error($this->getObject('translator')->translate('Invalid file extension')); } }
/** * Constructor. * * @param KObjectConfig $config Configuration options */ public function __construct(KObjectConfig $config = null) { parent::__construct($config); $this->_columns = (array) KObjectConfig::unbox($config->columns); $this->_separator = $config->separator; $this->_updatable = $config->updatable; $this->_length = $config->length; $this->_unique = $config->unique; }
/** * Returns the groups the user is part of * * @return array An array of group id's */ public function getGroups() { $data = $this->getData(); $groups = KObjectConfig::unbox($data->groups); if (empty($groups)) { $this->getSession()->set('user.groups', JAccess::getGroupsByUser($this->getId())); } return parent::getGroups(); }
/** * Recalculate offset * * @param KModelContextInterface $context A model context object * @return void */ protected function _afterReset(KModelContextInterface $context) { $modified = (array) KObjectConfig::unbox($context->modified); if (in_array('limit', $modified)) { $limit = $context->state->limit; if ($limit) { $context->state->offset = floor($context->state->offset / $limit) * $limit; } } }
/** * Sets the folder name as created by the OS (encoding) in the filesystem * * @param KDatabaseContextInterface $context */ protected function _afterSave(KDatabaseContextInterface $context) { if ($context->siblings && count($context->siblings)) { $siblings = KObjectConfig::unbox($context->siblings); $name = array_diff(scandir(dirname($context->getSubject()->fullpath)), array_pop($siblings)); if (count($name) == 1) { $this->name = current($name); } $context->siblings = $siblings; } }
/** * Creates a tab panel with title and starts that panel * * @param array $config An optional array with configuration options * @return string Html */ public function startPanel($config = array()) { $config = new KObjectConfigJson($config); $config->append(array('title' => '', 'class' => '', 'translate' => true)); $title = $config->translate ? $this->getObject('translator')->translate($config->title) : $config->title; $class = KObjectConfig::unbox($config->class); if (is_array($class)) { $class = implode(' ', $class); } return JHtml::_('tabs.panel', $title, $class); }
/** * Generates an HTML editor * * @param array $config An optional array with configuration options * @return string Html */ public function display($config = array()) { $config = new KObjectConfigJson($config); $config->append(array('editor' => null, 'name' => 'description', 'value' => '', 'width' => '100%', 'height' => '500', 'cols' => '75', 'rows' => '20', 'buttons' => true, 'options' => array())); $editor = JFactory::getEditor($config->editor); $options = KObjectConfig::unbox($config->options); $result = $editor->display($config->name, $config->value, $config->width, $config->height, $config->cols, $config->rows, KObjectConfig::unbox($config->buttons), $config->name, null, null, $options); // Some editors like CKEditor return inline JS. $result = str_replace('<script', '<script data-inline', $result); return $result; }
protected function _getPageConditions($pages) { $pages = (array) KObjectConfig::unbox($pages); $document_pages = array_intersect($pages, array_keys($this->_getDocumentPages()->toArray())); // Return an empty list of categories if the model is filtered against single document pages only. if (count($document_pages) === count($pages)) { $conditions = array(array('categories', array(-1))); } else { $conditions = parent::_getPageConditions($pages); } return $conditions; }
/** * Constructor * * @param object &$subject The object to observe * @param array $config An array that holds the plugin configuration */ public function __construct(&$subject, $config) { if ($this->bootFramework()) { $configuration = new KObjectConfig(); $this->_initialize($configuration); foreach ($configuration as $key => $value) { $this->{$key} = KObjectConfig::unbox($value); } } parent::__construct($subject, $config); $this->loadLanguage(); }
/** * Constructor * * @param KObjectConfig $config Configuration options */ public function __construct(KObjectConfig $config) { parent::__construct($config); $this->_version = $config->version; $this->_text_fields = KObjectConfig::unbox($config->text_fields); $this->_fields = KObjectConfig::unbox($config->fields); $query = $this->getUrl()->getQuery(true); if (!empty($query['fields'])) { $fields = explode(',', rawurldecode($query['fields'])); $this->_fields = array_merge($this->_fields, $fields); } }
/** * Constructor * * @param KObjectConfig $config An optional ObjectConfig object with configuration options. */ public function __construct(KObjectConfig $config) { parent::__construct($config); //Add the behaviors in FIFO order $behaviors = (array) KObjectConfig::unbox($config->behaviors); foreach ($behaviors as $key => $value) { if (is_numeric($key)) { $this->addBehavior($value); } else { $this->addBehavior($key, $value); } } }
/** * Constructor * * @param KObjectConfig $config An optional ObjectConfig object with configuration options. */ public function __construct(KObjectConfig $config) { parent::__construct($config); //Add the toolbars $toolbars = (array) KObjectConfig::unbox($config->toolbars); foreach ($toolbars as $key => $value) { if (is_numeric($key)) { $this->addToolbar($value); } else { $this->addToolbar($key, $value); } } }
/** * Constructor. * * @param KObjectConfig $config Configuration options */ public function __construct(KObjectConfig $config) { parent::__construct($config); //Register the engines $engines = KObjectConfig::unbox($config->engines); foreach ($engines as $key => $value) { if (is_numeric($key)) { $this->registerEngine($value); } else { $this->registerEngine($key, $value); } } }
/** * Constructor * * Prevent creating instances of this class by making the constructor private * * @param KObjectConfig $config An optional ObjectConfig object with configuration options */ public function __construct(KObjectConfig $config) { parent::__construct($config); //Reset the data $this->_data = array(); //Reset the content $this->_source = null; //Register the functions $functions = (array) KObjectConfig::unbox($config->functions); foreach ($functions as $name => $callback) { $this->registerFunction($name, $callback); } }
/** * Constructor. * * @param KObjectConfig $config Configuration options */ public function __construct(KObjectConfig $config) { parent::__construct($config); //Register the locators $locators = KObjectConfig::unbox($config->locators); foreach ($locators as $key => $value) { if (is_numeric($key)) { $this->registerLocator($value); } else { $this->registerLocator($key, $value); } } }