当前位置: 首页>>代码示例>>PHP>>正文


PHP KConfig::toArray方法代码示例

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


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

示例1: __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

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

示例3: message

 public function message($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('message' => 'com://admin/logman.activity.message.default', 'formatted' => true, 'escape_html' => false));
     $message = $this->getService($config->message, array_merge($config->toArray(), array('activity' => $config->row)));
     return (string) $message;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:7,代码来源:activity.php

示例4: createStory

 /**
  * Creates a story.
  *
  * @param array|KCommandContext $config Config. Can be a story data or KCommandContext if the method
  *                                      is used as a callback
  *
  * @return ComStoriesDomainEntityStory
  */
 public function createStory($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('subject' => get_viewer(), 'owner' => get_viewer(), 'component' => 'com_' . $this->_mixer->getIdentifier()->package));
     $story = $this->getService('repos://site/stories')->create($config->toArray());
     //$story = $this->getService('com://site/stories.controller.story')->add($config->toArray());
     $story->save();
     return $story;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:17,代码来源:publisher.php

示例5: modal

   	/**
	 * Render a modal box
	 *
	 * @return string	The html output
	 */
	public function modal($config = array())
	{
		$config = new KConfig($config);
		$config->append(array(
			'selector' => 'a.modal',
			'options'  => array('disableFx' => true)
 		));

		return JHTML::_('behavior.modal', $config->selector, $config->toArray());
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:15,代码来源:behavior.php

示例6: __construct

 /** 
  * Constructor.
  *
  * @param array $config An optional KConfig object with configuration options.
  */
 public function __construct($config = array())
 {
     $config = new KConfig($config);
     $this->_message = $config->message;
     $this->_code = $config->code;
     $this->_key = $config->key;
     unset($config['message']);
     unset($config['code']);
     unset($config['key']);
     $this->_data = $config->toArray();
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:16,代码来源:error.php

示例7: instantiate

	/**
	 * Create an instance of a class based on a class identifier
	 *
	 * @param 	mixed  		 Identifier or Identifier object - joomla.[.path].name
	 * @param 	object 		 An optional KConfig object with configuration options
	 * @return object|false  Return object on success, returns FALSE on failure
	 */
	public function instantiate($identifier, KConfig $config)
	{
        $name = ucfirst($identifier->package);
			
		//Check to see of the type is an alias
		if(array_key_exists($name, $this->_alias_map)) {
			$name = $this->_alias_map[$name];
		}

		$instance = call_user_func_array(array('JFactory', 'get'.$name), $config->toArray());
		return $instance;
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:19,代码来源:joomla.php

示例8: 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('limit' => 0));
     $html = '<div class="container" id="files-paginator-container">';
     $html .= '<div class="pagination" id="files-paginator">';
     $html .= '<div class="limit">' . $this->limit($config->toArray()) . '</div>';
     $html .= $this->_pages();
     $html .= '<div class="limit"> ' . JText::_('Page') . ' <span class="page-current">1</span>';
     $html .= ' ' . JText::_('of') . ' <span class="page-total">1</span></div>';
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:21,代码来源:paginator.php

示例9: 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, 'attribs' => array('attribs' => array('onchange' => 'this.form.submit();'))));
     // Paginator object
     $paginator = KFactory::tmp('lib.koowa.model.paginator')->setData(array('total' => $config->total, 'offset' => $config->offset, 'limit' => $config->limit, 'display' => $config->display));
     // Get the paginator data
     $list = $paginator->getList();
     $html = '<del class="container">';
     $html = '<div class="pagination">';
     $html .= '<div class="limit">' . JText::_('Display NUM') . ' ' . $this->limit($config->toArray()) . '</div>';
     $html .= $this->_pages($list);
     $html .= '<div class="limit"> ' . JText::_('Page') . ' ' . $paginator->current . ' ' . JText::_('of') . ' ' . $paginator->count . '</div>';
     $html .= '</div>';
     $html .= '</del>';
     return $html;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:24,代码来源:paginator.php

示例10: _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)
 {
     $config->append(array('parser' => 'com://site/notifications.template.helper.parser', 'behaviors' => array('com://site/mailer.controller.behavior.mailer' => $config->toArray())));
     parent::_initialize($config);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:14,代码来源:processor.php

示例11: thumbnail

    public function thumbnail($config = array())
    {
        $config = new KConfig($config);
        $config->append(array('images_root' => KRequest::root() . '/joomlatools-files/docman-images/', 'enable_automatic_thumbnail' => true, 'automatic_thumbnail' => false, 'automatic_thumbnail_text' => $this->translate('Automatically generate')));
        //Don't cache automatic thumbnails
        if (!$config->automatic_thumbnail) {
            $config->automatic_thumbnail_image = false;
        }
        $value = $config->value;
        if (!$value) {
            $value = 'default.png';
        }
        if (substr($value, 0, 6) === 'image:') {
            $value = substr($value, 6);
        }
        if ($config->enable_automatic_thumbnail) {
            $html = '<div class="image-picker thumbnail-picker" style="margin-top: 5px">
                        <img
                                id="image-preview"
                                data-src="' . $value . '"
                                src="' . $config->images_root . $value . '"
                                onerror="this.src=\'media://com_docman/images/nothumbnail.png\';"
                                style="max-height:128px;max-width:128px;background:#EEE;margin:0"
                                    />
                        <div id="choose-thumbnail" class="dropdown btn-group" style="float:left;margin-left:5px">
                            <button class="btn choose-photo-button dropdown-toggle" id="profile_header_upload" type="button" data-toggle="dropdown"
                                    style="float:none">
                                    ' . $this->translate('Change thumbnail') . '
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                                <li id="automatic_thumbnail" class="dropdown-link">
                                    <a href="#" class="dropdown-link" id="automatic_thumbnail">
                                        <input style="display:none" type="checkbox" name="automatic_thumbnail" value="1"
                                        ' . ($config->automatic_thumbnail ? 'checked="checked"' : '') . '
                                            />
                                        ' . $this->translate('Automatically generate') . '
                                    </a>
                                </li>
                                <li id="thumbnail-choose-existing" class="dropdown-link">
                                    <div id="image-selector" class="image-selector">
                                        ' . $this->getTemplate()->renderHelper('modal.image', $config->toArray()) . '
                                    </div>
                                </li>
                                <li class="divider"></li>
                                <li id="thumbnail-delete-image" class="pretty-link dropdown-link ">
                                    <a href="#" class="dropdown-link btn" id="image-selector-clear">' . $this->translate('Clear') . '</a>
                                </li>
                            </ul>
                            <p class="help-inline automatic-enabled">' . $this->translate('Thumbnail is automatically generated.') . '</p>
                            <p class="help-inline automatic-unsupported-format">' . $this->translate('Automatically generated thumbnails are only supported on image files.') . '</p>
                            <p class="help-inline automatic-unsupported-location">' . $this->translate('Automatically generated thumbnails are only supported on local files') . '</p>
                        </div>

                    </div>';
        } else {
            $html = '<div class="image-picker thumbnail-picker" style="margin-top: 5px">
                        <img
                                id="image-preview"
                                data-src="' . $value . '"
                                src="' . $config->images_root . $value . '"
                                onerror="this.src=\'media://com_docman/images/nothumbnail.png\';"
                                style="max-height:128px;max-width:128px;background:#EEE;margin:0"
                                    />
                        <div id="choose-thumbnail" class="dropdown btn-group" style="float:left;margin-left:5px">
                            <button class="btn choose-photo-button dropdown-toggle" id="profile_header_upload" type="button" data-toggle="dropdown"
                                    style="float:none">
                                    ' . $this->translate('Change thumbnail') . '
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                                <li id="thumbnail-choose-existing" class="dropdown-link">
                                    <div id="image-selector" class="image-selector">
                                        ' . $this->getTemplate()->renderHelper('modal.image', $config->toArray()) . '
                                    </div>
                                </li>
                                <li class="divider"></li>
                                <li id="thumbnail-delete-image" class="pretty-link dropdown-link ">
                                    <a href="#" class="dropdown-link btn" id="image-selector-clear">' . $this->translate('Clear') . '</a>
                                </li>
                            </ul>
                        </div>

                    </div>';
        }
        return $html;
    }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:87,代码来源:behavior.php

示例12: create

 /**
  * Create a module object
  *
  * @param $config
  * @return stdClass
  */
 public function create($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('id' => 0, 'title' => false, 'module' => 'mod_custom', 'position' => 'left', 'content' => false, 'showtitle' => 1, 'control' => '', 'params' => '', 'user' => 0, 'name' => 'custom', 'style' => ''));
     return (object) $config->toArray();
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:12,代码来源:module.php

示例13: tfoot

 public function tfoot($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('total' => 0, 'colspan' => 10));
     if (!$config->total) {
         return '<tbody>' . '<tr class="' . KFactory::get('admin::com.ninja.helper.grid')->zebra() . '">' . '<td colspan="' . $config->colspan . '" align="center">' . '<h2 class="ninja-empty-list">' . sprintf(JText::_('No %s found'), JText::_($this->name)) . '</h2>' . '</td>' . '</tr>' . '</tbody>';
     }
     $html[] = '<tfoot><tr><td class="pagination-footer" colspan="' . $config->colspan . '">';
     $html[] = self::pagination($config->toArray());
     $html[] = '</td></tr></tfoot>';
     return implode(PHP_EOL, $html);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:12,代码来源:paginator.php

示例14: build

 /**
  * @param $siteRouter
  * @param $uri
  * @return mixed
  */
 public function build(&$siteRouter, &$uri)
 {
     $query = $uri->getQuery(true);
     $query2 = array();
     if (isset($query['option'])) {
         $query2['option'] = $query['option'];
     }
     if (isset($query['view'])) {
         $query2['view'] = $query['view'];
     }
     if (isset($query['id'])) {
         $query2['id'] = $query['id'];
     }
     /**
      * Check if the uri is a menu item.
      */
     $items = JSite::getMenu()->getItems('link', 'index.php?' . urldecode(http_build_query($query2)), true);
     if (is_object($items) && $items->id) {
         $merged = array_diff_key($query, $items->query);
         unset($merged['Itemid']);
         if (is_object($this->_routes->get($query['view']))) {
             preg_match_all('/\\{(.*?)\\}/ ', $this->_routes->get($query['view'])->getPattern(), $matches);
             $merged = array_diff_key($merged, array_flip($matches[1]));
         }
         $merged['format'] = isset($query['format']) ? $query['format'] : 'html';
         $langTag = isset($query['_locale']) ? $query['_locale'] : substr($items->language, 0, 2);
         $uri->setQuery($merged);
         $uri->setPath($langTag . '/' . $items->route);
         return $uri;
     }
     $generator = $this->_router->getGenerator();
     if (isset($query['view']) && array_key_exists($query['view'], $this->_routes->all())) {
         if (isset($query['_locale']) && $query['_locale'] != $this->_lang) {
             try {
                 $originalApplicationLanguage = JFactory::getLanguage()->getTag();
                 $row = KService::get('com://site/' . str_replace('com_', null, $query['option']) . '.model.' . KInflector::pluralize($query['view']))->slug($query['slug'])->getItem();
                 //TODO: Get default languages and select the default one.
                 switch ($query['_locale']) {
                     case 'en':
                         $iso_code = 'en-GB';
                         break;
                     case 'fr':
                         $iso_code = 'fr-FR';
                         break;
                     case 'nl':
                         $iso_code = 'nl-NL';
                         break;
                     default:
                         $iso_code = 'en-GB';
                 }
                 JFactory::getLanguage()->setLanguage($iso_code);
                 $row = KService::get('com://site/' . str_replace('com_', null, $query['option']) . '.model.' . KInflector::pluralize($query['view']))->id($row->id)->getItem();
                 if ($row->id) {
                     $query['slug'] = $row->slug;
                 }
                 JFactory::getLanguage()->setLanguage($originalApplicationLanguage);
             } catch (Exception $e) {
             }
         }
         $format = isset($query['format']) ? $query['format'] : 'html';
         $requirements = $this->_routes->get($query['view'])->getRequirements();
         $config = new KConfig(array_merge($requirements, $query));
         $config->append(array('_locale' => $this->_lang, 'format' => $format));
         try {
             if ($query['option'] != 'com_search') {
                 $component_router = $siteRouter->getComponentRouter($query['option']);
                 $vars = $component_router->build($query);
             }
             if ($vars) {
                 foreach ($vars as $key => $var) {
                     $config->{$key} = $var;
                 }
             }
             $url = $generator->generate($query['view'], $config->toArray());
             // Remove format since the joomla router handles this.
             $url = str_replace('.' . $format, null, $url);
             $url = parse_url($url);
             $path = $url['path'];
             parse_str(isset($url['query']) ? $url['query'] : '', $query);
             if (isset($query['Itemid'])) {
                 $uri->setVar('Itemid', $query['Itemid']);
             }
             unset($query['Itemid']);
             unset($query['id']);
             $uri->setQuery(array_merge(array('format' => $format), $query));
             $uri->setPath($path);
         } catch (Exception $e) {
         }
     }
     $query = array_filter(array_merge($uri->getQuery(true), $query));
     unset($query['_route']);
     unset($query['_locale']);
     $uri->setQuery($query);
     return $uri;
 }
开发者ID:kedweber,项目名称:pkg_router,代码行数:100,代码来源:router.php


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