• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP KConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中KConfig的典型用法代码示例。如果您正苦于以下问题:PHP KConfig类的具体用法?PHP KConfig怎么用?PHP KConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了KConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: 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;
    }
开发者ID:raeldc,项目名称:com_learn,代码行数:31,代码来源:editor.php


示例2: humanize

	public function humanize($config = array())
	{
		$config = new KConfig($config);
		$config->append(array(
			'sizes' => array('Bytes', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb')
		));
		$bytes = $config->size;
		$result = '';
		$format = (($bytes > 1024*1024 && $bytes % 1024 !== 0) ? '%.2f' : '%d').' %s';

		foreach ($config->sizes as $s) {
			$size = $s;
			if ($bytes < 1024) {
				$result = $bytes;
				break;
			}
			$bytes /= 1024;
		}

		if ($result == 1) {
			$size = KInflector::singularize($size);
		}

		return sprintf($format, $result, JText::_($size));
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:25,代码来源:filesize.php


示例3: _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;
 }
开发者ID:LuccaCaldas,项目名称:anahita,代码行数:14,代码来源:html.php


示例4: _initialize

 /**
  * Initializes the default configuration for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  *
  * @return void
  */
 protected function _initialize(KConfig $config)
 {
     $package = KInflector::humanize($this->getIdentifier()->package);
     $name = KInflector::humanize(KInflector::pluralize($this->getName()));
     $config->append(array('title' => $package . ' - ' . $name));
     parent::_initialize($config);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:16,代码来源:default.php


示例5: _initialize

 public function _initialize(KConfig $config)
 {
     $this->mixin($this->getService('com://admin/kutafuta.controller.behavior.indexable'));
     $this->mixin($this->getService('com://admin/moyo.controller.behavior.copyable'));
     $config->append(array('behaviors' => array('com://admin/cck.controller.behavior.autosavable')));
     parent::_initialize($config);
 }
开发者ID:kedweber,项目名称:com_kadi,代码行数:7,代码来源:kadi.php


示例6: input

 /**
  * Renders a password input with the validation.
  *
  * @param bool $required A boolean flag whether the password is
  *                       required or not
  */
 public function input($options = array())
 {
     $options = new KConfig($options);
     $options->append(array('id' => 'person-password', 'name' => 'password', 'class' => 'input-block-level', 'required' => 'required', 'minlength' => ComPeopleFilterPassword::$MIN_LENGTH));
     $html = $this->getService('com:base.template.helper.html');
     return $html->passwordfield($options['name'], $options)->class($options['class'])->id($options['id'])->required($options['required'])->minlength($options['minlength']);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:13,代码来源:password.php


示例7: _afterTableSelect

 /**
  * Decodes json data on each field
  * 
  * @return boolean	true.
  */
 protected function _afterTableSelect(KCommandContext $context)
 {
     //We should only run this on row objects
     if ($context->mode == KDatabase::FETCH_FIELD) {
         return;
     }
     $rows = $context['data'];
     $identifier = clone $rows->getTable();
     $identifier->path = array('model');
     $identifier->name = 'settings';
     $defaults = KFactory::get($identifier)->getParams()->toArray();
     if (is_a($rows, 'KDatabaseRowInterface')) {
         $rows = array($rows);
     }
     foreach ($rows as $row) {
         //if(is_array($row->params)) continue;
         //echo $row->params;
         //if(is_array($row->params)) die('<pre>'.var_export(is_string($row->params) && !is_null($row->params), true).'</pre>');
         //$true = false;
         //if(is_array($row->params)) $true = true;
         $params = is_string($row->params) ? json_decode($row->params, true) : $row->params;
         //if(!is_array($params)) $params = array();
         //if($true) die('<pre>'.__CLASS__.' '.var_export($params, true).'</pre>');
         $params = new KConfig($params);
         //@TODO Make this configurable, instead of hardcoding the defaults to only apply when JSite
         if (KFactory::get('lib.joomla.application')->isSite()) {
             $params->append($defaults);
         }
         $row->params = $params;
     }
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:36,代码来源:configurable.php


示例8: _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);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:14,代码来源:onetomany.php


示例9: 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);
    }
开发者ID:raeldc,项目名称:com_learn,代码行数:40,代码来源:combobox.php


示例10: 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;
 }
开发者ID:janssit,项目名称:www.marlinfishingcanaria.com,代码行数:34,代码来源:behavior.php


示例11: _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);
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:7,代码来源:categories.php


示例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.
  * @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);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:15,代码来源:html.php


示例13: _initialize

    public function  _initialize(KConfig $config)
    {
        $config->identity_column = 'id';
        
        $config->append(array(
            'name' => 'content',
            'behaviors' => array(
            	'creatable', 'modifiable', 'lockable', 'orderable', 'sluggable', 'revisable'  
            ),
            'column_map' => array(
                'locked_on'        => 'checked_out_time',
                'locked_by'        => 'checked_out',
                'slug'       	   => 'alias',
                'section_id'       => 'sectionid',
                'category_id'	   => 'catid',
                'created_on' 	   => 'created',
                'modified_on'      => 'modified',
                'description'      => 'metadesc',
                'params'		   => 'attribs'
            ),
            'filters' => array(
                'introtext'   => array('html', 'tidy'),
                'fulltext'    => array('html', 'tidy'),
                'attribs'	  => 'ini'
		    )
        ));

        parent::_initialize($config);
    }
开发者ID:raeldc,项目名称:com_learn,代码行数:29,代码来源:articles.php


示例14: __construct

 /**
  * Constructor.
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     $this->_root = $config->root;
     $this->_property = $config->property;
     $config->object = $config->service_container->get($config->repository->getEntityset(), $config->toArray());
     parent::__construct($config);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:12,代码来源:onetomany.php


示例15: translations

 public function translations($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('row' => null, 'table' => ''));
     // First for our knowledge we get the original language (if exists.)
     $original = $this->_getOriginalLanguage($config->row, $config->table);
     $html = '<style src="media://com_translations/css/translations.css" />';
     $view = KInflector::singularize(KRequest::get('get.view', 'string'));
     foreach ($this->_getLanguages() as $language) {
         $relation = $this->_getLanguage($config, $language->lang_code);
         if ($language->lang_code == $original->iso_code) {
             $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-info">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
         } else {
             if ($relation->translated) {
                 $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-success">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
             } else {
                 if (strtotime('+ 2 weeks', strtotime($original->created_on)) > strtotime(date('d-m-Y H:i:s'))) {
                     $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-warning">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
                 } else {
                     if (strtotime('+ 2 weeks', strtotime($original->created_on)) < strtotime(date('d-m-Y H:i:s'))) {
                         $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-important">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
                     }
                 }
             }
         }
     }
     return $html;
 }
开发者ID:kedweber,项目名称:com_translations,代码行数:28,代码来源:language.php


示例16: 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);
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:26,代码来源:select.php


示例17: select

	public function select($config = array()) 
	{
		$config = new KConfig($config);
		$config->append(array(
			'name' => '',
			'visible' => true,
			'link' => '',
			'link_text' => JText::_('Select')
		))->append(array(
			'value' => $config->name
		));
		
		$input = '<input name="%1$s" id="%1$s" value="%2$s" %3$s size="40" />';
		
		$link = '<a class="modal-button"
					rel="{\'ajaxOptions\': {\'method\': \'get\'}, \'handler\': \'iframe\', \'size\': {\'x\': 700}}"
					href="%s">'
				.$config->link_text
				.'</a>';
				
		$html = sprintf($input, $config->name, $config->value, $config->visible ? 'type="text" readonly' : 'type="hidden"');
		$html .= sprintf($link, $config->link);
		
		return $html;
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:25,代码来源:modal.php


示例18: __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;
         }
     }
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:38,代码来源:manifest.php


示例19: _initialize

	protected function _initialize(KConfig $config)
	{
		$config->append(array(
			'auto_assign' => false
		));
		parent::_initialize($config);
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:7,代码来源:html.php


示例20: users

    public function users($config = array())
    {
        $config = new KConfig($config);
		$config->append(array(
		    'deselect'  => true,
		    'prompt'	=> '- Select -'
		));

		$list = KFactory::get('com://admin/users.model.users')
		    ->set('sort', 'name')
		    ->set('limit', 0)
		    ->getList();

 		if($config->deselect) {
         	$options[] = $this->option(array('text' => $config->prompt, 'value' => -1));
        }

        foreach($list as $item) {
			$options[] = $this->option(array('text' => $item->name, 'value' => $item->id));
		}

		$config->options = $options;

		return $this->optionlist($config);
    }
开发者ID:raeldc,项目名称:com_learn,代码行数:25,代码来源:listbox.php



注:本文中的KConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP KDatabaseTableDefault类代码示例发布时间:2022-05-23
下一篇:
PHP KAutoloader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap