本文整理汇总了PHP中KConfig::append方法的典型用法代码示例。如果您正苦于以下问题:PHP KConfig::append方法的具体用法?PHP KConfig::append怎么用?PHP KConfig::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfig
的用法示例。
在下文中一共展示了KConfig::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* @return mixed
*/
public function display()
{
$menu = JFactory::getApplication()->getMenu();
$lang = JFactory::getLanguage();
$category = $this->getModel()->getItem();
$category->layout = end(explode(':', $category->layout));
$this->setLayout($category->layout ? $category->layout : 'default');
header('X-Category-ID: ' . $category->id);
$doc =& JFactory::getDocument();
if ($category->title) {
$doc->setTitle($category->title);
}
if ($category->meta_keywords) {
$doc->setMetaData('Keywords', $category->meta_keywords);
}
if ($category->meta_description) {
$doc->setMetaData('Description', $category->meta_description);
}
if ($menu->getActive() == $menu->getDefault($lang->getTag()) || !$menu->getActive()) {
$pathway = JFactory::getApplication()->getPathway();
if (!JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_makundi&view=category&id=' . $category->id, true)) {
foreach ($category->getAncestors(array('level' => 1)) as $ancestor) {
$item = JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_makundi&view=category&id=' . $ancestor->id, true);
if ($item) {
$i = 0;
foreach (explode('/', $item->route) as $part) {
$pathway->addItem(ucfirst($part), 'index.php?Itemid=' . $item->tree[$i]);
$i++;
}
} else {
if (!JSite::getMenu()->getActive()->id) {
$pathway->addItem($ancestor->title, JRoute::_('index.php?option=com_makundi&view=category&parent_slug_path=' . $ancestor->parent_slug_path . '&slug=' . $ancestor->slug));
}
}
}
$pathway->addItem($category->title);
}
}
$descendants = array();
$descendants[] = $category->id;
$config = new KConfig();
if ($params = $menu->getActive()->params) {
$config->append($params->toArray());
}
if ($config->show_subcategories) {
$descendants = array_merge($descendants, $category->getDescendants(array('level' => 1))->getColumn('id'));
}
$config->append(array('show_description' => 1, 'show_articles' => 1));
// TODO: Set the limit default limit inside $category so we can make this more flexable.
$limit = $this->getModel()->getState()->limit;
if (!$limit) {
$this->getModel()->getState()->limit = $config->limit;
} else {
$this->getModel()->getState()->limit = 4;
}
$this->assign('params', $config);
$this->assign('parent', $this->getModel()->getItem()->getParent());
$this->assign('descendants', $descendants);
return parent::display();
}
示例2: image
/**
* Renders the html markup for the user avatar
*
* @author Stian Didriksen <stian@ninjaforge.com>
* @return string
*/
public function image($config = array())
{
$params = KFactory::get('admin::com.ninjaboard.model.settings')->getParams();
$prepend = KFactory::get('lib.joomla.application')->isAdmin() ? KRequest::root() . '/' : '';
$config = new KConfig($config);
$config->append(array('id' => KFactory::get('admin::com.ninjaboard.model.people')->getMe()->id, 'thumbnail' => 'large', 'class' => 'avatar', 'link' => 'person', 'type' => 'css'));
$person = KFactory::tmp('admin::com.ninjaboard.model.people')->id($config->id)->getItem();
$avatar_on = new DateTime($person->avatar_on);
$cache = (int) $avatar_on->format('U');
$config->append(array('avatarurl' => $prepend . JRoute::_('&option=com_ninjaboard&view=avatar&id=' . $config->id . '&thumbnail=' . $config->thumbnail . '&cache=' . $cache), 'profileurl' => $prepend . JRoute::_('&option=com_ninjaboard&view=person&id=' . $config->id)));
$attribs = array('class' => $config->class, 'href' => $config->profileurl);
$height = $params['avatar_settings'][$config->thumbnail . '_thumbnail_height'];
$width = $params['avatar_settings'][$config->thumbnail . '_thumbnail_width'];
///* @TODO Following is the <img /> version, likely going to be deprecated
if ($config->type == 'tag') {
$attribs['src'] = $config->avatarurl;
$attribs['height'] = $height;
$attribs['width'] = $width;
unset($attribs['href']);
$html = '<img ' . KHelperArray::toString($attribs) . ' />';
} else {
$style = 'background-image: url(' . $config->avatarurl . '); ';
$style .= 'height: ' . $height . 'px; ';
$style .= 'width: ' . $width . 'px;';
$attribs['style'] = $style;
$html = '<a ' . KHelperArray::toString($attribs) . '></a>';
}
return $html;
}
示例3: display
public function display()
{
$apps = $this->getService('com://site/actors.domain.entityset.component', array('actor' => $this->_state->getItem(), 'can_enable' => true));
$config = new KConfig();
foreach ($this->_state->getItem()->components as $component) {
$permissions = array();
if (!$component->isAssignable()) {
continue;
}
if (!count($component->getPermissions())) {
continue;
}
foreach ($component->getPermissions() as $identifier => $actions) {
if (strpos($identifier, '.') === false) {
$name = $identifier;
$identifier = clone $component->getIdentifier();
$identifier->path = array('domain', 'entity');
$identifier->name = $name;
}
$identifier = $this->getIdentifier($identifier);
foreach ($actions as $action) {
$key = $identifier->package . ':' . $identifier->name . ':' . $action;
$value = $this->_state->getItem()->getPermission($key);
$permissions[] = array('name' => $key, 'value' => $value);
}
$config->append(array($component->component => array('name' => $component->component, 'enabled' => true, 'permissions' => $permissions)));
}
}
foreach ($apps as $app) {
$config->append(array($app->component => array('name' => $app->component, 'enabled' => $app->enabledForActor($this->_state->getItem()))));
}
$data['followRequests'] = $this->_state->getItem()->requesters->toArray();
$data['apps'] = array_values($config->toArray());
return json_encode($data);
}
示例4: _initialize
/**
* Initializes the options for the object.
*
* Called from {@link __construct()} as a first step of object instantiation.
*
* @param object An optional KConfig object with configuration options.
*/
protected function _initialize(KConfig $config)
{
$config->append(array('template_paths' => array(dirname(__FILE__) . '/html')));
parent::_initialize($config);
$config->append(array('template_paths' => array(JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/com_actors/actor')));
$this->enabled_apps = null;
}
示例5: order
public function order($config = array())
{
$config = new KConfig($config);
$config->append(array(
'name' => 'order',
'state' => null,
'attribs' => array(),
'model' => null,
'package' => $this->getIdentifier()->package,
'selected' => 0
));
//@TODO can be removed when name collisions fixed
$config->name = 'order';
$app = $this->getIdentifier()->application;
$identifier = 'com://'.$app.'/'.$config->package.'.model.'.($config->model ? $config->model : KInflector::pluralize($config->package));
$list = KFactory::get($identifier)->limit(0)->set($config->filter)->getList();
$options = array();
foreach($list as $item) {
$options[] = $this->option(array('text' => $item->ordering, 'value' => $item->ordering - $config->ordering));
}
$list = $this->optionlist(array(
'options' => $options,
'name' => $config->name,
'attribs' => $config->attribs,
'selected' => $config->selected
));
return $list;
}
示例6: _initialize
public function _initialize(KConfig $config)
{
$sluggable = $this->getBehavior('sluggable', array('columns' => array('name')));
$orderable = $this->getBehavior('com://admin/categories.database.behavior.orderable', array('parent_column' => 'catid'));
$config->append(array('identity_column' => 'bid', 'base' => 'banner', 'name' => 'banner', 'behaviors' => array('creatable', 'lockable', $sluggable, $orderable, 'hittable'), 'column_map' => array('enabled' => 'showBanner', 'created_on' => 'date', 'locked_on' => 'checked_out_time', 'locked_by' => 'checked_out', 'slug' => 'alias', 'hits' => 'clicks'), 'filters' => array('custombannercode' => array('html', 'tidy'), 'params' => 'ini')));
parent::_initialize($config);
}
示例7: pagination
/**
* Render item pagination
*
* @param array An optional array with configuration options
* @return string Html
* @see http://developer.yahoo.com/ypatterns/navigation/pagination/
*/
public function pagination($config = array())
{
$config = new KConfig($config);
$config->append(array('total' => 0, 'display' => 4, 'offset' => 0, 'limit' => 0, 'show_limit' => true, 'show_count' => true));
$this->_initialize($config);
$j15 = version_compare(JVERSION, '1.6', '<');
$html = '';
if ($j15) {
$html .= '<div class="container">';
}
$html .= '<div class="pagination">';
if ($config->show_limit) {
$html .= '<div class="limit">' . $this->translate('Display NUM') . ' ' . $this->limit($config) . '</div>';
}
$html .= $this->_pages($this->_items($config));
if ($config->show_count) {
if ($j15) {
$html .= '<div class="limit"> ' . $this->translate('Page') . ' ' . $config->current . ' ' . $this->translate('of') . ' ' . $config->count . '</div>';
} else {
$html .= sprintf($this->translate('JLIB_HTML_PAGE_CURRENT_OF_TOTAL'), $config->current, $config->count);
}
}
$html .= '</div>';
if ($j15) {
$html .= '</div>';
}
return $html;
}
示例8: _initialize
protected function _initialize(KConfig $config)
{
$config->append(array(
'auto_assign' => false
));
parent::_initialize($config);
}
示例9: __construct
/**
* Constructor
*
* @param array Associative array of values
*/
public function __construct(KConfig $options)
{
//Create an object holding our default settings
$defaults = array('path' => false, 'changelog' => false);
//Override default settings
$options->append($defaults);
if (!$options->path) {
$manifests = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR, '.xml$', 0, true);
foreach ($manifests as $manifest) {
$xml = simplexml_load_file($manifest);
if (isset($xml['type'])) {
break;
}
}
$options->path = $manifest;
}
//load the file, and save it to our object
$this->_xml = simplexml_load_file($options->path);
if (!$options->changelog) {
$changelog = false;
$manifests = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR, '.xml$', 0, true);
foreach ($manifests as $manifest) {
$xml = simplexml_load_file($manifest);
if ($xml->getName() == 'changelogs') {
$changelog = $xml;
break;
}
}
if ($changelog) {
$this->_changelog = $changelog;
}
}
}
示例10: groups
public function groups(array $config = array())
{
$config = new KConfig($config);
$config->append(array('name' => 'group', 'core' => null));
$attribs = KHelperArray::toString($config->attribs);
$groups = $this->getService('com://admin/groups.model.groups')->set('core', is_null($config->core) ? null : $config->core)->getList();
if ($config->exclude instanceof KDatabaseRowInterface && $config->exclude->id) {
foreach (clone $groups as $group) {
if ($group->lft >= $config->exclude->lft && $group->rgt <= $config->exclude->rgt) {
$groups->extract($group);
}
}
}
foreach ($groups as $group) {
$checked = $config->selected == $group->id ? ' checked' : '';
if ($group->depth) {
$html[] = '<div style="padding-left: ' . $group->depth * 15 . 'px" class="clearfix">';
$html[] = '<input type="radio" name="' . $config->name . '" id="' . $config->name . $group->id . '" value="' . $group->id . '"' . $checked . ' ' . $attribs . '/>';
$html[] = '<label for="' . $config->name . $group->id . '">' . $group->name . '</label>';
$html[] = '</div>';
} else {
$html[] = '<h4>' . $group->name . '</h4>';
}
}
return implode(PHP_EOL, $html);
}
示例11: positions
/**
* Generates a list over positions
*
* The list is the array over positions coming from the application template merged with the module positions currently in use
* that may not be defined in the xml
*
* @param array An optional array with configuration options
* @return string Html
*/
public function positions($config = array())
{
$config = new KConfig($config);
$config->append(array(
'position' => 'left',
'application' => 'site'
));
$positions = KFactory::get('com://admin/extensions.model.modules')->application($config->application)->getList()->getColumn('position');
$template = KFactory::get('com://admin/extensions.model.templates')
->application($config->application)
->default(1)
->getItem();
$positions = array_unique(array_merge($template->positions, $positions));
sort($positions);
// @TODO combobox behavior should be in the framework
JHTML::_('behavior.combobox');
$html[] = '<input type="text" id="position" class="combobox" name="position" value="'.$config->position.'" />';
$html[] = '<ul id="combobox-position" style="display:none;">';
foreach($positions as $position) {
$html[] = '<li>'.$position.'</li>';
}
$html[] = '</ul>';
return implode(PHP_EOL, $html);
}
示例12: _initialize
/**
* Initializes the options for the object.
*
* Called from {@link __construct()} as a first step of object instantiation.
*
* @param object An optional KConfig object with configuration options.
*/
protected function _initialize(KConfig $config)
{
$child = clone $this->_parent;
$child->name = KInflector::singularize($config->name);
$config->append(array('entityset' => 'anahita:domain.entityset.onetomany', 'cardinality' => 'many', 'child_key' => $this->_parent->name, 'parent_delete' => AnDomain::DELETE_CASCADE, 'child' => $child));
parent::_initialize($config);
}
示例13: _initialize
public function _initialize(KConfig $config)
{
$config->identity_column = 'id';
$orderable = $this->getBehavior('com://admin/categories.database.behavior.orderable', array('parent_column' => 'section_id'));
$config->append(array('name' => 'categories', 'behaviors' => array('lockable', $orderable, 'sluggable', 'cascadable'), 'column_map' => array('enabled' => 'published', 'locked_on' => 'checked_out_time', 'locked_by' => 'checked_out', 'slug' => 'alias', 'section_id' => 'section')));
parent::_initialize($config);
}
示例14: bootstrap
public function bootstrap($config = array())
{
$config = new KConfig($config);
$config->append(array('namespace' => null, 'javascript' => array(), 'package' => null, 'type' => null));
$html = '';
if (count($config->javascript) && !isset(self::$_loaded['jquery'])) {
$html .= $this->jquery();
}
if (empty($config->package)) {
$config->package = $this->getTemplate()->getIdentifier()->package;
}
if (empty($config->type) && $config->type !== false) {
$config->type = $this->getTemplate()->getIdentifier()->application;
}
foreach ($config->javascript as $js) {
if (!isset(self::$_loaded[$config->package . '-bootsrap-' . $js])) {
$html .= '<script src="media://com_' . $config->package . '/bootstrap/js/bootstrap-' . $js . '.js" />';
self::$_loaded['bootsrap-' . $js] = true;
}
}
$filename = 'bootstrap' . ($config->type ? '-' . $config->type : '');
if (!isset(self::$_loaded[$config->package . '-' . $filename])) {
if ($config->type) {
$html .= '<style src="media://com_' . $config->package . '/bootstrap/css/bootstrap.css" />';
}
$html .= '<style src="media://com_' . $config->package . '/bootstrap/css/' . $filename . '.css" />';
self::$_loaded[$config->package . '-' . $filename] = true;
}
$this->getTemplate()->addFilter('bootstrap');
if (!empty($config->namespace) || $config->namespace === false) {
$this->getTemplate()->getFilter('bootstrap')->setNamespace($config->namespace);
}
return $html;
}
示例15: _initialize
/**
* Initializes the options for the object
*
* Called from {@link __construct()} as a first step of object instantiation.
*
* @param object An optional KConfig object with configuration options.
* @return void
*/
protected function _initialize(KConfig $config)
{
$paths[] = dirname($this->getIdentifier()->filepath) . '/html';
$paths[] = implode(DS, array(JPATH_THEMES, JFactory::getApplication()->getTemplate(), 'html', $this->getIdentifier()->type . '_' . $this->getIdentifier()->package, $this->getName()));
$config->append(array('template_paths' => $paths));
parent::_initialize($config);
}