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


PHP PMA_displayInput函数代码示例

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


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

示例1: foreach

    if ($cf->getServerCount() == 1) {
        $opts['values_disabled'][] = '0';
    }
    $opts['values_disabled'][] = '-';
    foreach ($cf->getServers() as $id => $server) {
        $opts['values'][(string) $id] = $cf->getServerName($id) . " [{$id}]";
    }
} else {
    $opts['values']['1'] = __('- none -');
    $opts['values_escaped'] = true;
}
echo PMA_displayInput('ServerDefault', __('Default server'), 'select', $cf->getValue('ServerDefault'), '', true, $opts);
// Display EOL list
$opts = array('values' => array('unix' => 'UNIX / Linux (\\n)', 'win' => 'Windows (\\r\\n)'), 'values_escaped' => true);
$eol = PMA_ifSetOr($_SESSION['eol'], PMA_IS_WINDOWS ? 'win' : 'unix');
echo PMA_displayInput('eol', __('End of line'), 'select', $eol, '', true, $opts);
echo '<tr>';
echo '<td colspan="2" class="lastrow" style="text-align: left">';
echo '<input type="submit" name="submit_display" value="' . __('Display') . '" />';
echo '<input type="submit" name="submit_download" value="' . __('Download') . '" />';
echo '&nbsp; &nbsp;';
echo '<input type="submit" name="submit_save" value="' . __('Save') . '"';
if (!$config_writable) {
    echo ' disabled="disabled"';
}
echo '/>';
echo '<input type="submit" name="submit_load" value="' . __('Load') . '"';
if (!$config_exists) {
    echo ' disabled="disabled"';
}
echo '/>';
开发者ID:nobodypb,项目名称:phpmyadmin,代码行数:31,代码来源:index.inc.php

示例2: _displayFieldInput


//.........这里部分代码省略.........
  *                                        besides the input field
  * @param bool|null $userprefs_allow      whether user preferences are enabled
  *                                        for this field (null - no support,
  *                                        true/false - enabled/disabled)
  * @param array     &$js_default          array which stores JavaScript code
  *                                        to be displayed
  *
  * @return string HTML for input field
  */
 private function _displayFieldInput(Form $form, $field, $system_path, $work_path, $translated_path, $show_restore_default, $userprefs_allow, array &$js_default)
 {
     $name = PMA_langName($system_path);
     $description = PMA_langName($system_path, 'desc', '');
     $value = $this->_configFile->get($work_path);
     $value_default = $this->_configFile->getDefault($system_path);
     $value_is_default = false;
     if ($value === null || $value === $value_default) {
         $value = $value_default;
         $value_is_default = true;
     }
     $opts = array('doc' => $this->getDocLink($system_path), 'show_restore_default' => $show_restore_default, 'userprefs_allow' => $userprefs_allow, 'userprefs_comment' => PMA_langName($system_path, 'cmt', ''));
     if (isset($form->default[$system_path])) {
         $opts['setvalue'] = $form->default[$system_path];
     }
     if (isset($this->_errors[$work_path])) {
         $opts['errors'] = $this->_errors[$work_path];
     }
     $type = '';
     switch ($form->getOptionType($field)) {
         case 'string':
             $type = 'text';
             break;
         case 'short_string':
             $type = 'short_text';
             break;
         case 'double':
         case 'integer':
             $type = 'number_text';
             break;
         case 'boolean':
             $type = 'checkbox';
             break;
         case 'select':
             $type = 'select';
             $opts['values'] = $form->getOptionValueList($form->fields[$field]);
             break;
         case 'array':
             $type = 'list';
             $value = (array) $value;
             $value_default = (array) $value_default;
             break;
         case 'group':
             // :group:end is changed to :group:end:{unique id} in Form class
             $htmlOutput = '';
             if (mb_substr($field, 7, 4) != 'end:') {
                 $htmlOutput .= PMA_displayGroupHeader(mb_substr($field, 7));
             } else {
                 PMA_displayGroupFooter();
             }
             return $htmlOutput;
         case 'NULL':
             trigger_error("Field {$system_path} has no type", E_USER_WARNING);
             return null;
     }
     // detect password fields
     if ($type === 'text' && mb_substr($translated_path, -9) === '-password') {
         $type = 'password';
     }
     // TrustedProxies requires changes before displaying
     if ($system_path == 'TrustedProxies') {
         foreach ($value as $ip => &$v) {
             if (!preg_match('/^-\\d+$/', $ip)) {
                 $v = $ip . ': ' . $v;
             }
         }
     }
     $this->_setComments($system_path, $opts);
     // send default value to form's JS
     $js_line = '\'' . $translated_path . '\': ';
     switch ($type) {
         case 'text':
         case 'short_text':
         case 'number_text':
         case 'password':
             $js_line .= '\'' . Sanitize::escapeJsString($value_default) . '\'';
             break;
         case 'checkbox':
             $js_line .= $value_default ? 'true' : 'false';
             break;
         case 'select':
             $value_default_js = is_bool($value_default) ? (int) $value_default : $value_default;
             $js_line .= '[\'' . Sanitize::escapeJsString($value_default_js) . '\']';
             break;
         case 'list':
             $js_line .= '\'' . Sanitize::escapeJsString(implode("\n", $value_default)) . '\'';
             break;
     }
     $js_default[] = $js_line;
     return PMA_displayInput($translated_path, $name, $type, $value, $description, $value_is_default, $opts);
 }
开发者ID:rclakmal,项目名称:phpmyadmin,代码行数:101,代码来源:FormDisplay.php

示例3: testDisplayInput

 /**
  * Test for PMA_displayInput()
  *
  * @return void
  */
 public function testDisplayInput()
 {
     if (!PMA_HAS_RUNKIT) {
         $this->markTestSkipped('Cannot modify constant');
     }
     $GLOBALS['_FormDislayGroup'] = 1;
     $opts = array();
     $opts['errors'] = array('e1');
     $opts['userprefs_allow'] = false;
     $opts['setvalue'] = ':group';
     $opts['doc'] = "http://doclink";
     $opts['comment'] = "testComment";
     $opts['comment_warning'] = true;
     $opts['show_restore_default'] = true;
     $result = PMA_displayInput('test/path', 'testName', 'text', 'val', 'desc', false, $opts);
     $this->assertContains('<tr class="group-header-field group-header-1 disabled-field">', $result);
     $this->assertContains('<label for="test/path">', $result);
     $this->assertContains('<a href="http://doclink" target="documentation"', $result);
     $this->assertContains('<img src="themes/dot.gif" title="Documentation" ' . 'alt="Documentation" class="icon ic_b_help" /', $result);
     $this->assertContains('<span class="disabled-notice"', $result);
     $this->assertContains('<small>', $result);
     $this->assertContains('<input type="text" size="40" name="test/path" id="test/path" ' . 'class="custom field-error" value="val" />', $result);
     $this->assertContains('<span class="field-comment-mark field-comment-warning" ' . 'title="testComment">', $result);
     $this->assertContains('<a class="restore-default" href="#test/path"', $result);
     $this->assertContains('<dl class="inline_errors"><dd>e1</dd></dl>', $result);
     // second case
     define('PMA_SETUP', true);
     $GLOBALS['_FormDislayGroup'] = 0;
     $GLOBALS['cfg']['ThemePath'] = 'themePath';
     $opts = array();
     $opts['errors'] = array();
     $opts['setvalue'] = 'setVal';
     $opts['comment'] = "testComment";
     $opts['show_restore_default'] = true;
     $opts['userprefs_comment'] = 'userprefsComment';
     $opts['userprefs_allow'] = true;
     $result = PMA_displayInput('test/path', 'testName', 'checkbox', 'val', '', false, $opts);
     $this->assertContains('<tr class="group-field group-field-1">', $result);
     $this->assertContains('<input type="checkbox" name="test/path" id="test/path" ' . 'checked="checked" />', $result);
     $this->assertContains('<a class="userprefs-comment" title="userprefsComment">', $result);
     $this->assertContains('<td class="userprefs-allow" title="Allow users to customize ' . 'this value">', $result);
     $this->assertContains('<a class="set-value" href="#test/path=setVal" ' . 'title="Set value: setVal" style="display:none">', $result);
     // short_text
     $GLOBALS['_FormDislayGroup'] = 0;
     $GLOBALS['cfg']['ThemePath'] = 'themePath';
     $opts = array();
     $opts['errors'] = array();
     $result = PMA_displayInput('test/path', 'testName', 'short_text', 'val', '', true, $opts);
     $this->assertContains('<input type="text" size="25" name="test/path" id="test/path" ' . 'value="val" />', $result);
     // number_text
     $result = PMA_displayInput('test/path', 'testName', 'number_text', 'val', '', true, $opts);
     $this->assertContains('<input type="number" name="test/path" ' . 'id="test/path" value="val" />', $result);
     // select case 1
     $opts['values_escaped'] = true;
     $opts['values_disabled'] = array(1, 2);
     $opts['values'] = array(1 => 'test', 'key1' => true, 'key2' => false);
     $result = PMA_displayInput('test/path', 'testName', 'select', true, '', true, $opts);
     $this->assertContains('<select name="test/path" id="test/path">', $result);
     $this->assertContains('<option value="1" selected="selected" disabled="disabled">', $result);
     $this->assertContains('<option value="key1">', $result);
     $this->assertContains('<option value="key2">', $result);
     // select case 2
     $opts['values_escaped'] = false;
     $opts['values_disabled'] = array(1, 2);
     $opts['values'] = array('a<b' => 'c&d', 'key1' => true, 'key2' => false);
     $result = PMA_displayInput('test/path', 'testName', 'select', false, '', true, $opts);
     $this->assertContains('<select name="test/path" id="test/path">', $result);
     // assertContains doesn't seem to work with htmlentities
     $this->assertContains('<option value="a&lt;b">c&amp;d</option>', $result);
     // list
     $result = PMA_displayInput('test/path', 'testName', 'list', array('foo', 'bar'), '', true, $opts);
     $this->assertContains('<textarea cols="40" rows="5" name="test/path" id="test/path">', $result);
     runkit_constant_remove('PMA_SETUP');
 }
开发者ID:rclakmal,项目名称:phpmyadmin,代码行数:79,代码来源:PMA_FormDisplay_tpl_test.php


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