本文整理汇总了PHP中PMA_Util::getFormattedMaximumUploadSize方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::getFormattedMaximumUploadSize方法的具体用法?PHP PMA_Util::getFormattedMaximumUploadSize怎么用?PHP PMA_Util::getFormattedMaximumUploadSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::getFormattedMaximumUploadSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMaximumUploadSize
/**
* @dataProvider dataProvider
* @return void
*/
function testMaximumUploadSize($size, $unit, $res)
{
$this->assertEquals(
"(" . __('Max: '). $res . $unit .")",
PMA_Util::getFormattedMaximumUploadSize($size)
);
}
示例2: PMA_getHtmlForSqlQueryFormUpload
/**
* return HTML for Sql Query Form Upload
*
* @return string
*
* @usedby PMA_getHtmlForSqlQueryForm()
*/
function PMA_getHtmlForSqlQueryFormUpload()
{
global $timeout_passed, $local_import_file;
$errors = array();
// we allow only SQL here
$matcher = '@\\.sql(\\.(' . PMA_supportedDecompressions() . '))?$@';
if (!empty($GLOBALS['cfg']['UploadDir'])) {
$files = PMA_getFileSelectOptions(PMA_Util::userDir($GLOBALS['cfg']['UploadDir']), $matcher, isset($timeout_passed) && $timeout_passed && isset($local_import_file) ? $local_import_file : '');
} else {
$files = '';
}
// start output
$html = '<fieldset id="">';
$html .= '<legend>';
$html .= __('Browse your computer:') . '</legend>';
$html .= '<div class="formelement">';
$html .= '<input type="file" name="sql_file" class="textfield" /> ';
$html .= PMA_Util::getFormattedMaximumUploadSize($GLOBALS['max_upload_size']);
// some browsers should respect this :)
$html .= PMA_Util::generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n";
$html .= '</div>';
if ($files === false) {
$errors[] = PMA_Message::error(__('The directory you set for upload work cannot be reached.'));
} elseif (!empty($files)) {
$html .= '<div class="formelement">';
$html .= '<strong>' . __('web server upload directory:') . '</strong>';
$html .= '<select size="1" name="sql_localfile">' . "\n";
$html .= '<option value="" selected="selected"></option>' . "\n";
$html .= $files;
$html .= '</select>' . "\n";
$html .= '</div>';
}
$html .= '<div class="clearfloat"></div>' . "\n";
$html .= '</fieldset>';
$html .= '<fieldset id="" class="tblFooters">';
$html .= __('Character set of the file:') . "\n";
$html .= PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', null, 'utf8', false);
$html .= '<input type="submit" name="SQL" value="' . __('Go') . '" />' . "\n";
$html .= '<div class="clearfloat"></div>' . "\n";
$html .= '</fieldset>';
foreach ($errors as $error) {
$html .= $error->getDisplay();
}
return $html;
}
示例3: PMA_getMaxUploadSize
/**
* Retrieve the maximum upload file size
*
* @param array $column description of column in given table
* @param integer $biggest_max_file_size biggest max file size for uploading
*
* @return array an html snippet and $biggest_max_file_size
*/
function PMA_getMaxUploadSize($column, $biggest_max_file_size)
{
// find maximum upload size, based on field type
/**
* @todo with functions this is not so easy, as you can basically
* process any data with function like MD5
*/
global $max_upload_size;
$max_field_sizes = array('tinyblob' => '256', 'blob' => '65536', 'mediumblob' => '16777216', 'longblob' => '4294967296');
$this_field_max_size = $max_upload_size;
// from PHP max
if ($this_field_max_size > $max_field_sizes[$column['pma_type']]) {
$this_field_max_size = $max_field_sizes[$column['pma_type']];
}
$html_output = PMA_Util::getFormattedMaximumUploadSize($this_field_max_size) . "\n";
// do not generate here the MAX_FILE_SIZE, because we should
// put only one in the form to accommodate the biggest field
if ($this_field_max_size > $biggest_max_file_size) {
$biggest_max_file_size = $this_field_max_size;
}
return array($html_output, $biggest_max_file_size);
}
示例4: testPMAGetHtmlForSqlQueryFormUpload
/**
* Test for PMA_getHtmlForSqlQueryFormUpload
*
* @return void
*/
public function testPMAGetHtmlForSqlQueryFormUpload()
{
//Call the test function
$html = PMA_getHtmlForSqlQueryFormUpload();
//validate 1: Browse your computer
$this->assertContains(__('Browse your computer:'), $html);
//validate 2: $GLOBALS['max_upload_size']
$this->assertContains(PMA_Util::getFormattedMaximumUploadSize($GLOBALS['max_upload_size']), $html);
$this->assertContains(PMA_Util::generateHiddenMaxFileSize($GLOBALS['max_upload_size']), $html);
//validate 3: Dropdown Box
$this->assertContains(PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', null, 'utf8', false), $html);
}