本文整理汇总了PHP中ini_parse函数的典型用法代码示例。如果您正苦于以下问题:PHP ini_parse函数的具体用法?PHP ini_parse怎么用?PHP ini_parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ini_parse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BoxchooserSettingsForm
function BoxchooserSettingsForm()
{
parent::MailForm();
page_title(intl_get('Box Settings'));
//set(array('title'=>'Add a Box'));
global $cgi;
//set
if (!$cgi->box) {
echo 'Missing parameter: box';
exit;
}
ini_add_filter('ini_filter_split_comma_single', array('rule 0', 'rule 1', 'rule 2', 'rule 3', 'rule 4', 'rule 5', 'rule 6', 'rule 7', 'rule 8', 'button 0', 'button 1', 'button 2', 'button 3', 'button 4', 'button 5', 'button 6', 'button 7', 'button 8'));
$this->_box_settings = ini_parse('inc/app/' . $cgi->app . '/boxes/' . $cgi->box . '/settings.php');
ini_clear();
unset($this->_box_settings['Meta']);
if (count($this->_box_settings) === 0) {
$this->onSubmit((array) $cgi);
return;
}
foreach ($this->_box_settings as $k => $v) {
$this->createWidget($k, $v);
}
$this->addWidget('hidden', 'app');
$this->addWidget('hidden', 'box');
$this->addWidget('hidden', 'name');
$w =& $this->addWidget('submit', 'sub');
$w->setValues(intl_get('Done'));
}
示例2: SitetemplateEditsetForm
function SitetemplateEditsetForm()
{
parent::MailForm();
global $cgi;
$set = $cgi->set;
$this->parseSettings('inc/app/sitetemplate/forms/editset/settings.php');
$settings = array();
if (file_exists('inc/html/' . $set . '/config.ini.php')) {
$settings = ini_parse('inc/html/' . $set . '/config.ini.php', false);
}
$name = $settings['set_name'];
if (!$name) {
$name = $set;
}
$settings['set'] = $set;
//put form values into respective forms
foreach ($settings as $k => $v) {
$this->widgets[$k]->setDefault($v);
}
if (@file_exists('inc/html/' . $set . '/modes.php')) {
$this->widgets['modes']->setDefault(@join('', @file('inc/html/' . $set . '/modes.php')));
} else {
$this->widgets['modes']->setDefault($modesd);
}
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="history.go (-1); return false"';
page_title(intl_get('Editing Properties') . ': ' . $name);
}
示例3: onSubmit
function onSubmit($vals)
{
$file = $this->_file;
$info = ini_parse($file);
$code = $vals['code'];
if (!empty($vals['locale'])) {
$code .= '-' . $vals['locale'];
}
$info[$code] = array('name' => $vals['name'], 'code' => $vals['code'], 'locale' => $vals['locale'], 'charset' => $vals['charset'], 'fallback' => $vals['fallback'], 'default' => $vals['default']);
$fp = fopen($file, 'w');
if (!$fp) {
echo 'Error: Failed to open languages.php file!';
return;
}
fwrite($fp, ini_write($info));
fclose($fp);
/*header (
sprintf (
'Location: %s/index/appdoc-translation-strings-action?appname=%s&lang=%s&charset=%s',
site_prefix (),
$vals['appname'],
$code,
$vals['charset']
)
);*/
header('Location: ' . site_prefix() . '/index/multilingual-languages-action');
exit;
}
示例4: sitesearch_filter_ctype
function sitesearch_filter_ctype($ctype)
{
$info = ini_parse('inc/app/cms/conf/collections/' . $ctype . '.php');
if (isset($info['Collection']['display'])) {
return $info['Collection']['display'];
}
return $ctype;
}
示例5: SitewikiSettingsForm
function SitewikiSettingsForm()
{
parent::MailForm(__FILE__);
$settings = ini_parse('inc/app/sitewiki/conf/settings.php', false);
foreach ($settings as $k => $v) {
$this->widgets[$k]->setValue($v);
}
}
示例6: help_get_access
/**
* Looks recursively through the directory structure for an access.php file.
* If found, it will return this file parsed into an array.
*
* @param string
* @param string
* @return array
*
*/
function help_get_access($path, $stop)
{
if (@file_exists($path . '/access.php')) {
return ini_parse($path . '/access.php', false);
}
$info = pathinfo($path);
$newpath = $info['dirname'];
if ($newpath == $stop) {
return array();
}
return help_get_access($newpath, $stop);
}
示例7: Rex
function Rex($collection)
{
// gets collection definition from inc/app/cms/conf/collections
$this->info = ini_parse('inc/app/cms/conf/collections/' . $collection . '.php');
if (!is_array($this->info) || count($this->info) == 0) {
$this->collection = false;
return;
}
$this->collection = $this->info['Collection']['name'];
$this->key = $this->info['Collection']['key_field'];
$this->title = $this->info['Collection']['title_field'];
$this->body = $this->info['Collection']['body_field'];
$this->isVersioned = $this->info['Collection']['is_versioned'];
$this->allowUppercaseKey = $this->info['Collection']['allow_uppercase_key'];
foreach ($this->info as $key => $settings) {
if (strpos($key, 'facet:') === 0) {
$key = substr($key, 6);
$this->addFacet($key, $settings);
/*
$type = $settings['type'];
if (strpos ($type, '.') !== false) {
loader_import ($type);
$type = array_pop (explode ('.', $type));
}
$type = 'r' . ucfirst (strtolower ($type)) . 'Facet';
$this->facets[$key] = new $type ($key, $settings);
$this->facets[$key]->preserve = array ('collection', 'orderBy', 'sort');
if ($settings['fields']) {
$this->facets[$key]->fields = preg_split ('/, ?/', $settings['fields'], -1, PREG_SPLIT_NO_EMPTY);
}*/
}
}
$this->rev = new Rev($this->info['Source']['name'], $this->info['Store']['name']);
$this->rev->isVersioned = $this->isVersioned;
$this->rev->allowUppercaseKey = $this->allowUppercaseKey;
foreach ($this->info['Source'] as $k => $v) {
if ($k == 'name') {
continue;
}
$this->rev->source->{$k} = $v;
}
foreach ($this->info['Store'] as $k => $v) {
if ($k == 'name') {
continue;
}
$this->rev->store->{$k} = $v;
}
}
示例8: UsradmSettingsForm
function UsradmSettingsForm()
{
parent::MailForm(__FILE__);
page_add_style('
td.label {
width: 200px;
}
td.field {
padding-left: 7px;
padding-right: 7px;
}
');
$config = ini_parse('inc/conf/config.ini.php');
foreach ($config as $cname => $conf) {
foreach ($conf as $k => $v) {
if (isset($this->widgets[$cname . '_' . $k])) {
$this->widgets[$cname . '_' . $k]->setValue($v);
}
}
}
}
示例9: onSubmit
function onSubmit($vals)
{
// overwrite file
$cache = array('Cache' => array(), 'Cacheable' => array());
$cacheable = $vals['cacheable'];
unset($vals['cacheable']);
unset($vals['submit_button']);
foreach ($vals as $k => $v) {
$cache['Cache'][$k] = $v;
}
$cacheable = ini_parse($cacheable, false);
foreach ($this->ignore as $i) {
$cacheable[$i] = false;
}
$cache['Cacheable'] = $cacheable;
loader_import('saf.File');
if (!file_overwrite('inc/conf/cache.php', ini_write($cache))) {
die('Error writing to file: inc/conf/cache.php');
}
echo '<p>' . intl_get('Cache settings saved.') . ' <a href="' . site_prefix() . '/index/cms-cpanel-action">' . intl_get('Continue') . '</a></p>';
}
示例10: ini_parse
<?php
// This is where app-level variables can be centrally stored. This file is
// automatically included when the first call to your app is made. Use the
// appconf_set ('name', 'value'); function to add values here.
$conf = ini_parse('inc/app/sitewiki/conf/settings.php', false);
foreach ($conf as $k => $v) {
if ($k == 'template' && $context == 'action') {
page_template($v);
} else {
appconf_set($k, $v);
}
}
appconf_set('default_page', 'HomePage');
appconf_set('date_format', 'F j, Y g:i A');
appconf_set('levels', array('0' => intl_get('Anyone'), '1' => intl_get('Registered Users Only'), '2' => intl_get('Admin-Level Users Only'), '3' => intl_get('Owner Only')));
appconf_set('yesno', array('0' => intl_get('No'), '1' => intl_get('Yes')));
//page_template ('full');
page_add_link('alternate', 'application/rss+xml', site_url() . '/index/sitewiki-feeds-short-action');
page_add_link('alternate', 'application/rss+xml', site_url() . '/index/sitewiki-feeds-full-action');
示例11: getFormSettings
function getFormSettings($name)
{
$app = $this->getApp($name);
$name = $this->removeApp($name, $app);
if (@file_exists($this->prefix . '/' . $app . '/' . $this->formPath . '/' . $name . '/settings.php')) {
return ini_parse($this->prefix . '/' . $app . '/' . $this->formPath . '/' . $name . '/settings.php', true);
}
return array();
}
示例12: array
$rules = array();
foreach ($value as $k => $v) {
if (strpos($k, 'rule ') === 0) {
$rules[] = $v;
}
}
if (count($rules) == 0) {
$rules = false;
}
$data['params'][$key]['rules'] = $rules;
}
ob_start();
highlight_file($path . '/index.php');
$data['source'] = ob_get_contents();
ob_end_clean();
$info = ini_parse(getcwd() . '/inc/app/' . $parameters['appname'] . '/conf/config.ini.php', false);
$fullname = $info['app_name'];
if (!$fullname) {
$fullname = ucfirst($parameters['appname']);
}
$pathinfo = explode('/', $parameters['form']);
foreach ($pathinfo as $key => $value) {
$pathinfo[$key] = ucfirst($value);
}
if (!empty($data['info']['name'])) {
$pathinfo[count($pathinfo) - 1] = $data['info']['name'];
}
$name = join(' / ', $pathinfo);
page_title(intl_get('AppDoc') . ': ' . $fullname . ' / ' . $name);
echo template_simple('<p><a href="{site/prefix}/index/appdoc-appinfo-action?appname={cgi/appname}">{intl Back}</a></p>');
echo template_simple('formviewer.spt', $data);
示例13: parseSettings
/**
* Parses the specified file using the parse_ini_file()
* function. Sections in the file correspond to the names of
* widgets you wish to create, in addition to a [Form] section
* that sets properties for the form itself. The values in
* each section correspond to properties or methods of the
* widgets. This method can be used to simplify the process
* of defining and customizing a form.
*
* @access public
* @param string $file
* @return boolean
*
*/
function parseSettings($file)
{
if (!@file_exists($file)) {
return false;
}
ini_add_filter('ini_filter_split_comma_single', array('rule 0', 'rule 1', 'rule 2', 'rule 3', 'rule 4', 'rule 5', 'rule 6', 'rule 7', 'rule 8', 'button 0', 'button 1', 'button 2', 'button 3', 'button 4', 'button 5', 'button 6', 'button 7', 'button 8', 'submitButtons'));
$conf = ini_parse($file, true);
ini_clear();
if (count($conf) == 0) {
return false;
}
// form properties, optional
if (is_array($conf['Form'])) {
foreach ($conf['Form'] as $key => $value) {
if (($key == 'title' || $key == 'message') && function_exists('intl_get')) {
$value = intl_get($value);
}
$this->{$key} = $value;
}
unset($conf['Form']);
}
foreach ($conf as $name => $data) {
$this->createWidget($name, $data);
}
return true;
}
示例14: active
/**
* Determines whether the specified service is active.
*
* @access public
* @param string
* @param array
* @return boolean
*
*/
function active($service, $actions)
{
foreach ($actions as $action) {
$c = ini_parse('inc/app/cms/conf/services/' . $action . '.php');
if (isset($c['service:' . $service])) {
return true;
}
}
return false;
}
示例15: array
}
if (!isset($cgi->offset)) {
if (isset($cgi->osoffset)) {
$cgi->offset = ($cgi->osoffset - 1) * $cgi->limit;
} else {
$cgi->offset = 0;
}
}
$settings = @parse_ini_file('inc/app/sitesearch/conf/server.ini.php');
$sitesearch_allowed = array();
loader_import('saf.File.Directory');
foreach (Dir::fetch('inc/app/cms/conf/collections') as $file) {
if (strpos($file, '.') === 0 || @is_dir('inc/app/cms/conf/collections/' . $file)) {
continue;
}
$config = ini_parse('inc/app/cms/conf/collections/' . $file);
if (isset($config['Collection']['sitesearch_url'])) {
if (isset($config['Collection']['sitesearch_access']) && session_allowed($config['Collection']['sitesearch_access'], 'r', 'access')) {
$sitesearch_allowed[] = $config['Collection']['name'];
}
}
}
if (!empty($parameters['query'])) {
loader_import('sitesearch.SiteSearch');
$searcher = new SiteSearch();
if (is_array($parameters['ctype'])) {
$collections = $parameters['ctype'];
foreach ($collections as $k => $ctype) {
if (!in_array($ctype, $sitesearch_allowed)) {
unset($collections[$k]);
}