當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMA_Util::getFormattedMaximumUploadSize方法代碼示例

本文整理匯總了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)
        );

    }
開發者ID:nhodges,項目名稱:phpmyadmin,代碼行數:12,代碼來源:PMA_getFormattedMaximumUploadSize_test.php

示例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;
}
開發者ID:ecssjapan,項目名稱:guiding-you-afteropen,代碼行數:52,代碼來源:sql_query_form.lib.php

示例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);
}
開發者ID:hewenhao2008,項目名稱:phpmyadmin,代碼行數:30,代碼來源:insert_edit.lib.php

示例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);
 }
開發者ID:xtreme-jamil-shamy,項目名稱:phpmyadmin-cf,代碼行數:17,代碼來源:PMA_sql_query_form_test.php


注:本文中的PMA_Util::getFormattedMaximumUploadSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。