Renders an INI configuration.

@param array $ini

@return string
510655
public function render(array $ini)
    {
        $output = [];

        foreach ($ini as $sectionName => $section) {
            $sectionOutput = [];

            if (!is_array($section)) {
                throw new RendererException('The section must contain an array of key-value pairs');
            }

            // Values without keys are stored in this temporary array
            $sectionIni = [];

            foreach ($section as $key => $value) {
                if (is_numeric($key)) {
                    if (!is_array($value)) {
                        $value = [$value];
                    }

                    $sectionIni = array_merge($sectionIni, $value);
                    continue;
                }

                $sectionOutput = array_merge($sectionOutput, $this->renderKeyValuePair($key, $value));
            }

            if (count($sectionIni) > 0) {
                $sectionOutput = array_merge($this->renderKeyValuePair($sectionName, $sectionIni), $sectionOutput);
            }

            array_unshift($sectionOutput, sprintf('[%s]', $sectionName));

            // Write a linefeed after sections
            $sectionOutput[] = '';

            $output = array_merge($output, $sectionOutput);
        }

        return implode("\n", $output);
    }
16063
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()
        ));

        // Add editor styles and scripts in JDocument to page when rendering
        $this->getIdentifier('com:koowa.view.page.html')->getConfig()->append(['template_filters' => ['document']]);

        $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;
    }
556574
public function evaluate(array $ini)
	{
		$test = $this->getTest();
		$evalClass = "\\Psecio\\Iniscan\\Operation\\Operation".ucwords(strtolower($test->operation));

		if (!class_exists($evalClass)) {
			throw new \InvalidArgumentException('Invalid operation "'.$test->operation.'"');
		}
		$value = (isset($test->value)) ? $test->value : null;
		$this->setValue($value);

		$evalInstance = new $evalClass($this->getSection());

		if (isset($test->version) && !$this->isVersion($test->version)) {
			$this->na();
		} else {
			($evalInstance->execute($test->key, $value, $ini) === false)
				? $this->fail() : $this->pass();
		}
	}
1115133
public function render(IO $io, $indentation = 0)
    {
        // Is the table empty?
        if (!$this->rows) {
            return;
        }

        $screenWidth = $io->getTerminalDimensions()->getWidth();
        $excessColumnWidth = max(
            StringUtil::getLength(sprintf($this->style->getHeaderCellFormat(), ''), $io),
            StringUtil::getLength(sprintf($this->style->getCellFormat(), ''), $io)
        );

        $wrapper = $this->getCellWrapper($io, $screenWidth, $excessColumnWidth, $indentation);

        $this->renderRows($io, $wrapper->getWrappedRows(), $wrapper->getColumnLengths(), $excessColumnWidth, $indentation);
    }
1348508
public function render($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'toolbar' => null,
            'title'   => null,
        ));

        //Set a custom title
        if($config->title) {
            $config->toolbar->setTitle($config->title);
        }

        $title = $this->getObject('translator')->translate($config->toolbar->getTitle());
        $html  = '';

        if (!empty($title))
        {
            $mobile = ($config->mobile === '' || $config->mobile) ? 'k-title-bar--mobile' : '';

            $html .= '
            <div class="k-title-bar k-js-title-bar '.$mobile.'">
                <div class="k-title-bar__heading">' . $title . '</div>
            </div>';
        }

        return $html;
    }
1018386
public function render(array $options = []): string
    {
        $html = $this->format['menuStart'];
        $html .= !empty($options['title']) ? $options['title'] : '';

        /**
         * @var MenuItemInterface $menuItem
         */
        foreach ($this->menu->getMenuItems() as $menuItem) {
            if ($menuItem->isEnabled()) {
                $html .= $this->renderMenuItem($menuItem);
            }
        }
        $html .= $this->format['menuEnd'];

        return $html;
    }
458892
public function renderView(array $parameters): string
    {
        if (!$this->permissionAccess('uicron', 'dashboard')) {
            return $this->twig->render('@EdgarEzUICron/dashboard/tab/cron.html.twig', [
                'crons' => [],
            ]);
        }

        $crons = $this->cronService->listCronsStatus();

        $cronRows = [];
        foreach ($crons as $cron) {
            $cronStatus = '';
            $cronReset = false;
            if ($cron instanceof EdgarCron) {
                switch ($cron->getStatus()) {
                    case EdgarCronRepository::STATUS_INIT:
                        $cronStatus = $this->translator->trans('Init', [], 'edgarezcron');
                        $cronReset = true;
                        break;
                    case EdgarCronRepository::STATUS_OK:
                        $cronStatus = $this->translator->trans('OK', [], 'edgarezcron');
                        break;
                    case EdgarCronRepository::STATUS_ERROR:
                        $cronStatus = $this->translator->trans('Error', [], 'edgarezcron');
                        $cronReset = true;
                        break;
                    default:
                        $cronStatus = '';
                        break;
                }
            }

            $cronRows[] = [
                'alias' => $cron->getAlias(),
                'queued' => $cron instanceof EdgarCron
                    ? ($cron->getQueued() ? $cron->getQueued() : false)
                    : false,
                'started' => $cron instanceof EdgarCron ? ($cron->getStarted()
                    ? $cron->getStarted() : false)
                    : false,
                'ended' => $cron instanceof EdgarCron ? ($cron->getEnded()
                    ? $cron->getEnded() : false)
                    : false,
                'status' => $cronStatus,
                'reset' => $cronReset,
            ];
        }

        return $this->twig->render('@EdgarEzUICron/dashboard/tab/cron.html.twig', [
            'crons' => $cronRows,
        ]);
    }
174545
def convert_ini(config_dict):
    
    config_lines = []

    for env, configs in sorted(config_dict.items()):
        for resource, app_properties in sorted(configs.items()):
            try:
                for app_property, value in sorted(app_properties.items()):
                    variable = '{env}_{resource}_{app_property}'.format(
                        env=env, resource=resource, app_property=app_property).upper()

                    if isinstance(value, (dict, DeepChainMap)):
                        safe_value = "'{0}'".format(json.dumps(dict(value)))
                    else:
                        safe_value = json.dumps(value)

                    line = "{variable}={value}".format(variable=variable, value=safe_value)

                    LOG.debug('INI line: %s', line)
                    config_lines.append(line)
            except AttributeError:
                resource = resource.upper()
                app_properties = "'{}'".format(json.dumps(app_properties))
                line = '{0}={1}'.format(resource, app_properties)

                LOG.debug('INI line: %s', line)
                config_lines.append(line)
    return config_lines
1340783
public function renderConfigurationTemplate($type)
    {
        return $this->theliaDispatcher
            ->dispatch(IndexEngineIndexEvents::RENDER_CONFIGURATION_TEMPLATE, new RenderConfigurationEvent($type))
            ->getContent()
        ;
    }
881793
public static function get($initArgs = array())
    {
        if (get_class(Core\Config::getHTMLInstance()) == 'Xiphe\HTML') {
            return Core\Config::getHTMLInstance();
        } elseif (get_class($GLOBALS['HTML']) == 'Xiphe\HTML') {
            return $GLOBALS['HTML'];
        } else {
            return new HTML($initArgs);
        }
    }
518630
public function render(array $parameters = []): string
    {
        return $this->twig->render($this->template, $parameters + $this->parameters);
    }
1099309
def _load_from_ini_py2(ini):
    
    logger.debug('使用PY2不支持自定义default_section，其默认值是:%s' % _DEFAULT_SECTION)
    cf = configparser.ConfigParser()
    cf.read(ini)
    settings = OrderedDict()
    for k, v in cf.defaults().items():
        settings[k.upper()] = convert_value(v)
    cf._defaults = {}
    for section in cf.sections():
        section_dict = OrderedDict()
        for option in cf.items(section):
            section_dict[option[0]] = option[1]
        settings[section] = section_dict
    return settings
1144992
public function evaluate(array $ini)
	{
		$openBasedir = $this->getCast()->castValue($this->findValue('open_basedir', $ini));

		// This only matters if an open_basedir is set
		if ($openBasedir === 0) {
			return true;
		} else {
			$openBasedir = realpath($openBasedir);
		}

		$uploadTmpDir = $this->getCast()->castValue($this->findValue('upload_tmp_dir', $ini));

		// If we have no upload_tmp_dir, get the system default
		if ($uploadTmpDir === 0) {
			$uploadTmpDir = realpath(sys_get_temp_dir());
		} else {
			$uploadTmpDir = realpath($uploadTmpDir);
		}

		// Make sure the folders are still valid
		if ($openBasedir === false) {
			$this->setDescription('The open_basedir did not resolve to a valid directory');
			$this->fail();
			return false;
		}
		if ($uploadTmpDir === false) {
			$this->setDescription('The upload_tmp_dir did not resolve to a valid directory');
			$this->fail();
			return false;
		}

		// Ensure that the upload_tmp_dir is inside the base directory
		if (strpos($uploadTmpDir, $openBasedir) !== 0) {
			$this->setDescription('upload_tmp_dir is not inside of open_basedir which will prevent files from being uploaded');
			$this->fail();
			return false;
		}

		return true;
	}
230436
protected function render()
	{
		if (empty($this->getContent())) {
			$parsed = parse_ini_string($this->file->getContent(), true);
			$this->setContent(is_array($parsed) ? $parsed : []);
		}
	}
844843
public function render(array $options = array())
    {
        $url = $this->service->generateEmbedUrl($this);
        $options = array_replace(array(
            'width' => 560,
            'height' => 315,
            'frameborder' => 0,
            'allowfullscreen' => ''
        ), $options);

        $html = <<<HTML
<iframe src="$url" width="{$options['width']}" height="{$options['height']}" frameborder="{$options['frameborder']}" {$options['allowfullscreen']}></iframe>
HTML;
        return $html;
    }
399784
protected function _appendIniData(&$ini, $key, $iniRow)
    {
        if ($this->_processIniSection && is_array($iniRow)) {
            $ini .= '[' . $key . ']' . "\n";
            foreach ($iniRow as $rowKey => $rowData) {
                $ini .= $rowKey . ' = ' . $rowData . "\n";
            }
        } else {
            $ini .= $key . ' = ' . $iniRow . "\n";
        }
    }
1211509
public function getConfig($type = null)
    {
        $types = ['php' => true, 'ini' => true];
        $type  = isset($types[$type]) ? $type : 'ini';

        foreach (['app/config/', 'config/', 'apps/config/', 'apps/frontend/config/'] as $configPath) {
            if ('ini' == $type && file_exists($this->rootPath . $configPath . 'config.ini')) {
                return new ConfigIni($this->rootPath . $configPath . 'config.ini');
            } else {
                if (file_exists($this->rootPath . $configPath. 'config.php')) {
                    $config = include($this->rootPath . $configPath . 'config.php');
                    if (is_array($config)) {
                        $config = new Config($config);
                    }

                    return $config;
                }
            }
        }

        $directory = new RecursiveDirectoryIterator('.');
        $iterator = new RecursiveIteratorIterator($directory);
        foreach ($iterator as $f) {
            if (preg_match('/config\.php$/i', $f->getPathName())) {
                $config = include $f->getPathName();
                if (is_array($config)) {
                    $config = new Config($config);
                }

                return $config;
            } else {
                if (preg_match('/config\.ini$/i', $f->getPathName())) {
                    return new ConfigIni($f->getPathName());
                }
            }
        }

        throw new BuilderException("Builder can't locate the configuration file");
    }