本文整理汇总了PHP中gcms::formatFileSize方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::formatFileSize方法的具体用法?PHP gcms::formatFileSize怎么用?PHP gcms::formatFileSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::formatFileSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($db->customQuery($sql) as $item) {
$id = $item['id'];
$file_exists = file_exists(iconv('UTF-8', 'TIS-620', DATA_PATH . "edocument/{$item['file']}"));
$tr = '<tr id="M_' . $id . '">';
$tr .= '<th headers=c0 id=r' . $id . ' scope=row class=topic><span class=cuttext>' . $item['topic'] . '.' . $item['ext'] . '</span></th>';
$icon = "skin/ext/{$item['ext']}.png";
$icon = WEB_URL . (is_file(ROOT_PATH . $icon) ? "/{$icon}" : "/skin/ext/file.png");
$tr .= '<td headers="r' . $id . ' c0" class=menu>';
$tr .= $file_exists ? '<a href="' . WEB_URL . '/modules/edocument/admin_download.php?id=' . $id . '" target=_blank title="{LNG_CLICK_TO} {LNG_DOWNLOAD}"><img src="' . $icon . '" alt=' . $item['ext'] . '></a>' : '';
$tr .= '</td>';
$tr .= '<td headers="r' . $id . ' c1" class=check-column><a id=check_' . $id . ' class=icon-uncheck href=""></a></td>';
$tr .= '<td headers="r' . $id . ' c2" title="' . $item['detail'] . '" class=tablet>' . $item['detail'] . '</td>';
$sender = trim("{$item['fname']} {$item['lname']}");
$sender = $sender == '' ? $item['email'] : $sender;
$tr .= '<td headers="r' . $id . ' c3" class=mobile><a href="index.php?id=' . $item['sender_id'] . '&module=editprofile&src=edocument-setup" class="cuttext status' . $item['status'] . '">' . $sender . '</a></td>';
$tr .= '<td headers="r' . $id . ' c4" class="' . ($file_exists ? 'size' : 'notfound') . ' tablet center">' . gcms::formatFileSize($item['size']) . '</td>';
$tr .= '<td headers="r' . $id . ' c5" class="date mobile">' . gcms::mktime2date($item['last_update']) . '</td>';
$tr .= '<td headers="r' . $id . ' c6" class="visited mobile"><a class=count href="index.php?id=' . $id . '&module=edocument-report&src=edocument-setup" title="{LNG_EDOCUMENT_DOWNLOAD_DETAILS}">' . $item['downloads'] . '</a></td>';
$tr .= '<td headers="r' . $id . ' c7" class=menu><a href="{URLQUERY?module=edocument-write&id=' . $id . '}" title="{LNG_EDIT}" class=icon-edit></a></td>';
$tr .= '</tr>';
$content[] = $tr;
}
$content[] = '</tbody>';
$content[] = '<tfoot>';
$content[] = '<tr>';
$content[] = '<td headers=c0 colspan=2> </td>';
$content[] = '<td headers=c1 class=check-column><a class="checkall icon-uncheck"></a></td>';
$content[] = '<td headers=c2 colspan=5></td>';
$content[] = '</tr>';
$content[] = '</tfoot>';
$content[] = '</table>';
示例2: foreach
foreach ($db->customQuery($sql) as $item) {
$sel = $item['category_id'] == $index['category_id'] ? ' selected' : '';
$content[] = '<option value=' . $item['category_id'] . $sel . '>' . gcms::ser2Str($item, 'topic') . '</option>';
}
$content[] = '</select></span>';
$content[] = '<div class=comment id=result_download_category>{LNG_CATEGORY_SELECT}</div>';
$content[] = '</div>';
// download_file
$content[] = '<div class=item>';
$content[] = '<label for=download_file>{LNG_DOWNLOAD_FILE}</label>';
$content[] = '<span class="g-input icon-world"><input type=text id=download_file name=download_file title="{LNG_DOWNLOAD_FILE_COMMENT}" value="' . $index['file'] . '"></span>';
$content[] = '<div class=comment id=result_download_file>{LNG_DOWNLOAD_FILE_COMMENT}</div>';
$content[] = '</div>';
// download_upload
$content[] = '<div class=item>';
$t = str_replace(array('{TYPE}', '{SIZE}'), array(str_replace(',', ', ', $config['download_file_typies']), gcms::formatFileSize($config['download_upload_size'])), $lng['LNG_DOWNLOAD_FILE_BROWSER_COMMENT']);
$content[] = '<label for=download_upload>{LNG_BROWSE_FILE}</label>';
$content[] = '<span class="g-input icon-upload"><input type=file class=g-file id=download_upload name=download_upload title="' . $t . '" placeholder="' . $index['file'] . '"></span>';
$content[] = '<div class=comment id=result_download_upload>' . $t . '</div>';
$content[] = '</div>';
$content[] = '</fieldset>';
// submit
$content[] = '<fieldset class=submit>';
$content[] = '<input type=submit class="button large save" value="{LNG_SAVE}">';
$content[] = gcms::get2Input($_GET);
$content[] = '<input type=hidden name=write_id value=' . (int) $index['id'] . '>';
$content[] = '</fieldset>';
$content[] = '</form>';
$content[] = '</section>';
$content[] = '<script>';
$content[] = '$G(window).Ready(function(){';
示例3: array
$list = array();
$patt = array('/(edit\\s{ID})/', '/(report\\s{ID})/', '/(delete\\s{ID})/', '/{ID}/', '/{NAME}/', '/{EXT}/', '/{ICON}/', '/{DETAIL}/', '/{DATE}/', '/{NO}/', '/{SIZE}/', '/{SENDER}/', '/{STATUS}/', '/{UID}/');
$listitem = gcms::loadtemplate($index['module'], 'edocument', 'listitem');
foreach ($datas as $item) {
$replace = array();
$replace[] = $moderator || $login_id == $item['sender_id'] ? '\\1' : 'hidden';
$replace[] = $moderator || $login_id == $item['sender_id'] ? '\\1' : 'hidden';
$replace[] = $moderator || $login_id == $item['sender_id'] ? '\\1' : 'hidden';
$replace[] = $item['id'];
$replace[] = $item['topic'];
$replace[] = $item['ext'];
$replace[] = WEB_URL . '/skin/ext/' . (is_file(ROOT_PATH . "skin/ext/{$item['ext']}.png") ? $item['ext'] : 'file') . '.png';
$replace[] = $item['detail'];
$replace[] = gcms::mktime2date($item['last_update'], 'd M Y');
$replace[] = $item['document_no'];
$replace[] = gcms::formatFileSize($item['size']);
$sender = trim("{$item['fname']} {$item['lname']}");
$replace[] = $sender == '' ? $item['email'] : $sender;
$replace[] = $item['status'];
$replace[] = $item['sender_id'];
$list[] = preg_replace($patt, $replace, $listitem);
}
// แบ่งหน้า
$maxlink = 9;
// query สำหรับ URL
$url = '<a href="' . gcms::getURL($index['module'], '', 0, 0, 'page=%1') . '">%1</a>';
if ($totalpage > $maxlink) {
$start = $page - floor($maxlink / 2);
if ($start < 1) {
$start = 1;
} elseif ($start + $maxlink > $totalpage) {
示例4: rawurlencode
$ret['action'] = 'new';
} else {
// แก้ไข
$db->edit(DB_DOWNLOAD, $id, $save);
$ret['action'] = 'edit';
}
// id
$ret['id'] = $id;
// รายการที่ส่งกลับ
$tr = '<tr id="M_' . $id . '">';
$tr .= '<th headers="c0" id="r' . $id . '" scope="row"><a id="edit-' . $id . '" href="' . WEB_URL . '/admin/index.php?module=download-setup" title="' . $lng['LNG_EDIT'] . '">' . $save['name'] . '.' . $save['ext'] . '</a></th>';
$tr .= '<td headers="r' . $id . ' c0" class="menu"><img src="' . $icon . '" alt="thumbnail" width="16" height="16"></td>';
$tr .= '<td headers="r' . $id . ' c1" class="check-column"><a id="check_' . $id . '" class="uncheck"></a></td>';
$tr .= '<td headers="r' . $id . ' c2" class="no">{WIDGET_DOWNLOAD_' . $id . '}</td>';
$tr .= '<td headers="r' . $id . ' c3">' . gcms::cutstring($save['description'], 50) . '</td>';
$tr .= '<td headers="r' . $id . ' c4" class="size">' . gcms::formatFileSize($save['size']) . '</td>';
$tr .= '<td headers="r' . $id . ' c5" class="date">' . gcms::mktime2date($save['last_update']) . '</td>';
$tr .= '<td headers="r' . $id . ' c6" class="visited">' . $save['count'] . '</td>';
$icon = "modules/download/icons/{$save['ext']}.png";
$icon = WEB_URL . (is_file(ROOT_PATH . $icon) ? "/{$icon}" : "/modules/download/icons/file.png");
$tr .= '<td headers="r' . $id . ' c7" class="menu">';
$tr .= '<a href="' . WEB_URL . '/modules/download/admin_download.php?file=' . $save['file'] . '&size=' . $save['size'] . '" target="_blank" title="' . $lng['LNG_CLICK_TO'] . ' ' . $lng['LNG_DOWNLOAD'] . '"><img src="' . $icon . '" alt="' . $save['ext'] . '" width="16" height="16"></a>';
$tr .= '</td>';
$tr .= '</tr>';
$ret['content'] = rawurlencode($tr);
}
}
}
// คืนค่าเป็น JSON
echo gcms::array2json($ret);
}
示例5: implode
// edocument_file_typies
$content[] = '<div class=item>';
$content[] = '<label for=config_file_typies>{LNG_UPLOAD_FILE_TYPIES} :</label>';
$content[] = '<span class="g-input icon-config"><input type=text id=config_file_typies name=config_file_typies value="' . (is_array($config['edocument_file_typies']) ? implode(',', $config['edocument_file_typies']) : '') . '" title="{LNG_DOWNLOAD_FILE_TYPIES_COMMENT}"></span>';
$content[] = '<div class=comment id=result_config_file_typies>{LNG_DOWNLOAD_FILE_TYPIES_COMMENT}</div>';
$content[] = '</div>';
//config_upload_size
$content[] = '<div class=item>';
$t = str_replace('{SIZE}', ini_get('upload_max_filesize'), $lng['LNG_DOWNLOAD_UPLOAD_SIZE_COMMENT']);
$content[] = '<label for=config_upload_size>{LNG_UPLOAD_FILE_SIZE}</label>';
$content[] = '<span class="g-input icon-config"><select name=config_upload_size id=config_upload_size title="' . $t . '">';
$list = array(2, 4, 6, 8, 16, 32, 64, 128, 256, 512, 1024, 2048);
foreach ($list as $i) {
$a = $i * 1048576;
$sel = $a == $config['edocument_upload_size'] ? ' selected' : '';
$content[] = '<option value=' . $a . $sel . '>' . gcms::formatFileSize($a) . '</option>';
}
$content[] = '</select></span>';
$content[] = '<div class=comment>' . $t . '</div>';
$content[] = '</div>';
$content[] = '</fieldset>';
$content[] = '<fieldset>';
$content[] = '<legend><span>{LNG_DISPLAY}</span></legend>';
// list_per_page
$content[] = '<div class=item>';
$content[] = '<label for=config_listperpage>{LNG_QUANTITY}</label>';
$content[] = '<span class="g-input icon-published1"><select name=config_listperpage id=config_listperpage title="{LNG_LIST_PER_PAGE_COMMENT}">';
foreach (array(10, 20, 30, 40, 50) as $item) {
$sel = $item == $config['edocument_listperpage'] ? ' selected' : '';
$content[] = '<option value=' . $item . $sel . '>' . $item . '</option>';
}
示例6: array
// สถานะ (กลุ่ม) ของสมาชิกทั้งหมด
$status = array();
$sel = in_array(-1, $reciever) ? ' selected' : '';
$status[] = '<option value=-1' . $sel . '>{LNG_GUEST}</option>';
foreach ($config['member_status'] as $i => $item) {
$sel = in_array($i, $reciever) ? ' selected' : '';
$status[] = '<option value=' . $i . $sel . '>' . $item . '</option>';
}
// form
$patt = array('/{BREADCRUMS}/', '/{GROUPS}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{TYPE}/', '/{SIZE}/', '/{ANTISPAM}/', '/{ANTISPAMVAL}/', '/{ID}/', '/{NO}/', '/{TOPIC}/', '/{DETAIL}/', '/{ICON}/', '/{ACTION}/');
$replace = array();
$replace[] = implode("\n", $breadcrumbs);
$replace[] = implode('', $status);
$replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
$replace[] = implode(', ', $config['edocument_file_typies']);
$replace[] = gcms::formatFileSize($config['edocument_upload_size']);
$replace[] = $antispam;
$replace[] = $isAdmin ? $_SESSION[$antispam] : '';
$replace[] = $index['id'];
$replace[] = $index['document_no'];
$replace[] = $index['topic'];
$replace[] = $index['detail'];
$replace[] = is_file(ROOT_PATH . "skin/ext/{$index['ext']}.png") ? $index['ext'] : 'file';
$replace[] = $id > 0 ? $lng['LNG_EDIT'] : $lng['LNG_ADD'];
$content = gcms::pregReplace($patt, $replace, gcms::loadtemplate($index['module'], 'edocument', 'write'));
// title,description, keywords
$title = $index['title'];
$keywords = $index['keywords'];
$description = $index['description'];
} else {
// ไม่พบหรือไม่มีสิทธิ์
示例7: str_replace
$content[] = '<div class=comment id=result_edocument_reciever>{LNG_EDOCUMENT_RECIVE_GROUPS_COMMENT}</div>';
$content[] = '</div>';
// topic
$icon = "skin/ext/{$index['ext']}.png";
$icon = WEB_URL . (is_file(ROOT_PATH . $icon) ? "/{$icon}" : "/skin/ext/file.png");
$content[] = '<div class=item>';
$content[] = '<label for=edocument_topic>{LNG_EDOCUMENT_TOPIC}</label>';
$content[] = '<div class=input-groups-table>';
$content[] = '<span class=width><img src="' . $icon . '" id=imgIcon alt="' . $index['ext'] . '"></span>';
$content[] = '<span class="width g-input icon-edit"><input type=text id=edocument_topic name=edocument_topic maxlength=64 value="' . $index['topic'] . '" title="{LNG_EDOCUMENT_TOPIC_COMMENT}"></span>';
$content[] = '</div>';
$content[] = '<div class=comment id=result_edocument_topic>{LNG_EDOCUMENT_TOPIC_COMMENT}</div>';
$content[] = '</div>';
// file
$content[] = '<div class=item>';
$t = str_replace(array('{TYPE}', '{SIZE}'), array(implode(', ', $config['edocument_file_typies']), gcms::formatFileSize($config['edocument_upload_size'])), $lng['LNG_EDOCUMENT_FILE_BROWSER_COMMENT']);
$content[] = '<label for=edocument_file>{LNG_BROWSE_FILE}</label>';
$content[] = '<span class="g-input icon-upload"><input type=file class=g-file id=edocument_file name=edocument_file title="' . $t . '"></span>';
$content[] = '<div class=comment id=result_edocument_file>' . $t . '</div>';
$content[] = '</div>';
// detail
$content[] = '<div class=item>';
$content[] = '<label for=edocument_detail>{LNG_DESCRIPTION}</label>';
$content[] = '<span class="g-input icon-file"><textarea id=edocument_detail name=edocument_detail rows=5 title="{LNG_EDOCUMENT_DESCRIPTION_COMMENT}">' . gcms::detail2TXT($index, 'detail') . '</textarea></span>';
$content[] = '<div class=comment id=result_edocument_detail>{LNG_EDOCUMENT_DESCRIPTION_COMMENT}</div>';
$content[] = '</div>';
$content[] = '</fieldset>';
// submit
$content[] = '<fieldset class=submit>';
$content[] = '<input type=submit class="button large save" value="{LNG_SAVE}">';
$content[] = ' <label>{LNG_EDOCUMENT_SEND_EMAIL_TO} <input type=checkbox name=send_email value=1></label>';