本文整理汇总了PHP中format_filesize函数的典型用法代码示例。如果您正苦于以下问题:PHP format_filesize函数的具体用法?PHP format_filesize怎么用?PHP format_filesize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_filesize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get
public function get($params)
{
$shopId = $this->__checkAuth($params);
$filter['disabled'] = 0;
$filter['target_id'] = $shopId;
$filter['target_type'] = 'shop';
if ($params['img_type'] != 'all') {
$filter['img_type'] = $params['img_type'] != 'other' ? $params['img_type'] : '';
}
if ($params['image_name']) {
$filter['image_name|has'] = $params['image_name'];
}
$total = app::get('image')->model('images')->count($filter);
$result['total'] = $total;
if ($total) {
$page = $this->__page($total, $params['page_no'], $params['page_size']);
$orderBy = $params['orderBy'] ? $params['orderBy'] : 'last_modified desc';
$result['list'] = app::get('image')->model('images')->getList('*', $filter, $page['offset'], $page['limit'], $orderBy);
foreach ($result['list'] as $k => $v) {
$result['list'][$k]['format_size'] = format_filesize($v['size']);
}
} else {
$result['list'] = [];
}
return $result;
}
开发者ID:453111208,项目名称:bbc,代码行数:26,代码来源:list.php
示例2: test_format_filesize
function test_format_filesize()
{
$this->assertEquals(format_filesize(-25), '-25 b');
$this->assertEquals(format_filesize(25), '25 b');
$this->assertEquals(format_filesize(2500), '2 KB');
$this->assertEquals(format_filesize(2500000), '2.4 MB');
$this->assertEquals(format_filesize(25000000), '23.8 MB');
$this->assertEquals(format_filesize(2500000000), '2.3 GB');
}
开发者ID:nathanieltite,项目名称:elefant,代码行数:9,代码来源:FunctionsTest.php
示例3: format_files_column_value
protected function format_files_column_value($col, $object, $template_url) {
$html = "";
switch ($col) {
case 'icon': $html .= "<td class='table_row_value'><img src='".array_var($object, 'icon')."' alt='icon'/></td>"; break;
case 'icon_l': $html .= "<td class='table_row_value'><img src='".array_var($object, 'icon_l')."' alt='icon'/></td>"; break;
case 'name': $html .= "<td class='table_row_value'><a href='$template_url'>".array_var($object, 'name')."</a></td>";break;
case 'size': $html .= "<td class='table_row_value'>".format_filesize(array_var($object, 'size'))."</td>"; break;
default : $html .= "<td class='table_row_value'>".array_var($object, $col, '')."</td>"; break;
}
return $html;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:11,代码来源:FengApiFormat.class.php
示例4: index
public function index()
{
requireadmin();
$query = $this->mdb->dashboard();
$items = array();
if ($query->num_rows()) {
$row = $query->row();
$admins = array();
$adminsQ = $this->mdb->get_admins();
foreach ($adminsQ->result() as $adminRow) {
$admins[] = array('id' => $adminRow->id, 'display_name' => $adminRow->display_name);
}
$items = array('projects' => number_format($row->projects), 'users_active' => number_format($row->active_users), 'users_pending' => number_format($row->pending_users), 'users_banned' => number_format($row->banned_users), 'storage_used' => format_filesize($row->storage_used), 'admins' => $admins);
}
generate_json(array('status' => 1, 'items' => $items));
}
开发者ID:rodino25,项目名称:tsv2,代码行数:16,代码来源:Dashboard.php
示例5: get_ls
/**
* Handle list directory requests (/filemanager/api/ls).
*/
public function get_ls()
{
$file = urldecode(join('/', func_get_args()));
$res = FileManager::dir($file);
if (!$res) {
return $this->error(FileManager::error());
}
foreach ($res['dirs'] as $k => $dir) {
$res['dirs'][$k]['mtime'] = I18n::date_time($dir['mtime']);
}
foreach ($res['files'] as $k => $file) {
$res['files'][$k]['mtime'] = I18n::date_time($file['mtime']);
$res['files'][$k]['fsize'] = format_filesize($file['fsize']);
}
return $res;
}
开发者ID:Selwyn-b,项目名称:elefant,代码行数:19,代码来源:API.php
示例6: get_portable_serverinfo
function get_portable_serverinfo()
{
echo '
<br class="clear" />
<table class="widefat">
<thead>
<tr>
<th>Variable Name</th>
<th>Value</th>
<th>Variable Name</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>OS</td>
<td>' . PHP_OS . '</td>
<td>Database Data Disk Usage</td>
<td>' . format_filesize(get_mysql_data_usage()) . '</td>
</tr>
<tr class="alternate">
<td>Server</td>
<td>' . $_SERVER['SERVER_SOFTWARE'] . '</td>
<td>Database Index Disk Usage</td>
<td>' . format_filesize(get_mysql_index_usage()) . '</td>
</tr>
<tr>
<td>PHP</td>
<td>v' . PHP_VERSION . '</td>
<td>MYSQL Maximum Packet Size</td>
<td>' . format_filesize(get_mysql_max_allowed_packet()) . '</td>
</tr>
<tr class="alternate">
<td>MYSQL</td>
<td>v' . get_mysql_version() . '</td>
<td>MYSQL Maximum Allowed Connections</td>
<td>' . number_format_i18n(get_mysql_max_allowed_connections()) . '</td>
</tr>
</tbody>
</table>
<br class="clear" />';
}
开发者ID:johangas,项目名称:moped,代码行数:42,代码来源:mod_general.php
示例7: get_ls
/**
* Handle list directory requests (/filemanager/api/ls).
*/
public function get_ls()
{
$file = urldecode(join('/', func_get_args()));
if (!self::verify_folder($file, $this->root)) {
return $this->error(i18n_get('Invalid folder name'));
}
$d = dir($this->root . $file);
$out = array('dirs' => array(), 'files' => array());
while (false != ($entry = $d->read())) {
if (preg_match('/^\\./', $entry)) {
continue;
} elseif (@is_dir($this->root . $file . '/' . $entry)) {
$out['dirs'][] = array('name' => $entry, 'path' => ltrim($file . '/' . $entry, '/'), 'mtime' => I18n::date_time(filemtime($this->root . $file . '/' . $entry)));
} else {
$out['files'][] = array('name' => $entry, 'path' => ltrim($file . '/' . $entry, '/'), 'mtime' => I18n::date_time(filemtime($this->root . $file . '/' . $entry)), 'fsize' => format_filesize(filesize($this->root . $file . '/' . $entry)));
}
}
$d->close();
usort($out['dirs'], array('FileManager', 'fsort'));
usort($out['files'], array('FileManager', 'fsort'));
return $out;
}
开发者ID:nathanieltite,项目名称:elefant,代码行数:25,代码来源:FileManager.php
示例8: implode
$sql = "";
$first_row = true;
}
}
}
$processed_objects[] = $cobj->getId();
// check memory to stop script
if (count($processed_objects) >= OBJECT_COUNT || memory_get_usage(true) > SCRIPT_MEMORY_LIMIT) {
$processed_objects_ids = "(" . implode("),(", $processed_objects) . ")";
DB::execute("INSERT INTO " . TABLE_PREFIX . "processed_objects (object_id) VALUES {$processed_objects_ids} ON DUPLICATE KEY UPDATE object_id=object_id");
$rest = Objects::count("id NOT IN(SELECT object_id FROM " . TABLE_PREFIX . "processed_objects)");
$row = DB::executeOne("SELECT COUNT(object_id) AS 'row_count' FROM " . TABLE_PREFIX . "processed_objects");
$proc_count = $row['row_count'];
$status_message = "Memory limit exceeded (" . format_filesize(memory_get_usage(true)) . "). Script terminated. Processed Objects: {$proc_count}. Total: " . ($proc_count + $rest) . ". Please execute 'Fill searchable objects and sharing table' again.";
$_SESSION['hide_back_button'] = 1;
complete_migration_print("\n" . date("H:i:s") . " - Iteration finished or Memory limit exceeded (" . format_filesize(memory_get_usage(true)) . ") script terminated.\nProcessed Objects: " . count($processed_objects) . ".\nTotal processed objects: {$proc_count}.\n{$rest} objects left.\n{$separator}\n");
$processed_objects = array();
break;
}
$cant++;
} else {
$processed_objects[] = $obj;
}
$cobj = null;
}
// add mails to sharing table for account owners
if ($sql != "") {
$sql .= " ON DUPLICATE KEY UPDATE group_id=group_id;";
DB::execute($sql);
$sql = "";
}
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:complete_migration.php
示例9: chdir
<?php
chdir(dirname(__FILE__));
header("Content-type: text/plain");
define("CONSOLE_MODE", true);
include "init.php";
Env::useHelper('format');
define('SCRIPT_MEMORY_LIMIT', 1024 * 1024 * 1024);
// 1 GB
@set_time_limit(0);
ini_set('memory_limit', SCRIPT_MEMORY_LIMIT / (1024 * 1024) + 50 . 'M');
$i = 0;
$objects_ids = Objects::instance()->findAll(array('columns' => array('id'), 'id' => true));
//,'conditions' => 'object_type_id = 6'
echo "\nObjects to process: " . count($objects_ids) . "\n-----------------------------------------------------------------";
foreach ($objects_ids as $object_id) {
$object = Objects::findObject($object_id);
$i++;
if ($object instanceof ContentDataObject) {
$members = $object->getMembers();
DB::execute("DELETE FROM " . TABLE_PREFIX . "object_members WHERE object_id = " . $object->getId() . " AND is_optimization = 1;");
ObjectMembers::addObjectToMembers($object->getId(), $members);
} else {
//
}
if ($i % 100 == 0) {
echo "\n{$i} objects processed. Mem usage: " . format_filesize(memory_get_usage(true));
}
}
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:29,代码来源:rebuild_object_members_optimization.php
示例10: if
if(empty($record['description'])) $record['description'] = JText::_('STATS_LABEL_NODESCRIPTION');
?>
<tr class="row<?php echo $id; ?>">
<td><?php echo $check; ?></td>
<td>
<?php echo $this->escape($record['description']) ?>
</td>
<td>
<?php if( AKEEBA_JVERSION == '16' ): ?>
<?php echo $startTime->format(JText::_('DATE_FORMAT_LC2'), true); ?>
<?php else: ?>
<?php echo $startTime->toFormat(JText::_('DATE_FORMAT_LC2')); ?>
<?php endif; ?>
</td>
<td class="bufa-<?php echo $record['meta']; ?>"><?php echo $status ?></td>
<td><?php echo ($record['meta'] == 'ok') ? format_filesize($record['size']) : ($record['total_size'] > 0 ? "(<i>".format_filesize($record['total_size'])."</i>)" : '—') ?></td>
<td>
<?php echo $filename_col; ?>
<?php if($record['meta'] == 'ok'): ?>
<br/>
<?php
$infoParts = explode("\n", $record['comment']);
$info = json_decode($infoParts[1]);
?>
<?php echo JText::_($info->type) .': '. $info->name ?>
<?php if($info->version): ?>
•
<?php echo JText::_('BUADMIN_LABEL_VERSION')?>: <?php echo $info->version ?>
<?php if($info->date) echo " • "?>
<?php endif?>
<?php if($info->date): ?>
开发者ID:rkern21,项目名称:videoeditor,代码行数:31,代码来源:restorepoint.php
示例11: array
<li>
<?php
$attached_file_options = array();
$attached_file_options[] = '<a href="' . $attached_file->getDetailsUrl() . '">' . lang('file details') . '</a>';
if ($attached_files_object->canDetachFile(logged_user(), $attached_file)) {
$attached_file_options[] = '<a href="' . $attached_files_object->getDetachFileUrl($attached_file) . '" onclick="return confirm(\'' . lang('confirm detach file') . '\')">' . lang('detach file') . '</a>';
}
?>
<a href="<?php
echo $attached_file->getDownloadUrl();
?>
"><span><?php
echo clean($attached_file->getFilename());
?>
</span> (<?php
echo format_filesize($attached_file->getFilesize());
?>
)</a> | <?php
echo implode(' | ', $attached_file_options);
?>
</li>
<?php
}
// foreach
?>
</ul>
<?php
if ($attached_files_object->canAttachFile(logged_user(), $attached_files_object->getProject())) {
?>
<p><a href="<?php
echo $attached_files_object->getAttachFilesUrl();
开发者ID:bklein01,项目名称:Project-Pier,代码行数:31,代码来源:list_attached_files.php
示例12: SaveMail
function SaveMail(&$content, MailAccount $account, $uidl, $state = 0, $imap_folder_name = '')
{
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
self::log_connection_status();
Logger::log("UID: {$uidl}");
}
if (!mysql_ping(DB::connection()->getLink())) {
DB::connection()->reconnect();
Logger::log("*** Connection Lost -> Reconnected ***");
}
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
Logger::log("mem 1) " . format_filesize(memory_get_usage()));
}
if (strpos($content, '+OK ') > 0) {
$content = substr($content, strpos($content, '+OK '));
}
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
Logger::log("mem 2) " . format_filesize(memory_get_usage()));
}
self::parseMail($content, $decoded, $parsedMail, $warnings);
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
Logger::log("mem 3) " . format_filesize(memory_get_usage()));
}
$encoding = array_var($parsedMail, 'Encoding', 'UTF-8');
$enc_conv = EncodingConverter::instance();
$to_addresses = self::getAddresses(array_var($parsedMail, "To"));
$from = self::getAddresses(array_var($parsedMail, "From"));
$message_id = self::getHeaderValueFromContent($content, "Message-ID");
$in_reply_to_id = self::getHeaderValueFromContent($content, "In-Reply-To");
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
Logger::log("mem 4) " . format_filesize(memory_get_usage()));
}
$uid = trim($uidl);
if (str_starts_with($uid, '<') && str_ends_with($uid, '>')) {
$uid = utf8_substr($uid, 1, utf8_strlen($uid, $encoding) - 2, $encoding);
}
if ($uid == '') {
$uid = trim($message_id);
if ($uid == '') {
$uid = array_var($parsedMail, 'Subject', 'MISSING UID');
}
if (str_starts_with($uid, '<') && str_ends_with($uid, '>')) {
$uid = utf8_substr($uid, 1, utf8_strlen($uid, $encoding) - 2, $encoding);
}
if (MailContents::mailRecordExists($account->getId(), $uid, $imap_folder_name == '' ? null : $imap_folder_name)) {
return;
}
}
if (!$from) {
$parsedMail["From"] = self::getFromAddressFromContent($content);
$from = array_var($parsedMail["From"][0], 'address', '');
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
Logger::log("mem 4.1) " . format_filesize(memory_get_usage()));
}
}
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
Logger::log("mem 5) " . format_filesize(memory_get_usage()));
}
if (defined('EMAIL_MESSAGEID_CONTROL') && EMAIL_MESSAGEID_CONTROL) {
if (trim($message_id) != "") {
$id_condition = " AND `message_id`='" . trim($message_id) . "'";
} else {
$id_condition = " AND `subject`='" . trim(array_var($parsedMail, 'Subject')) . "' AND `from`='{$from}'";
if (array_var($parsedMail, 'Date')) {
$sent_date_dt = new DateTimeValue(strtotime(array_var($parsedMail, 'Date')));
$sent_date_str = $sent_date_dt->toMySQL();
$id_condition .= " AND `sent_date`='" . $sent_date_str . "'";
}
}
$same = MailContents::findOne(array('conditions' => "`account_id`=" . $account->getId() . $id_condition, 'include_trashed' => true));
if ($same instanceof MailContent) {
return;
}
}
if ($state == 0) {
if ($from == $account->getEmailAddress()) {
if (strpos($to_addresses, $from) !== FALSE) {
$state = 5;
} else {
$state = 1;
}
//Show only in sent folder
}
}
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
Logger::log("mem 6) " . format_filesize(memory_get_usage()));
self::log_connection_status();
}
$from_spam_junk_folder = strpos(strtolower($imap_folder_name), 'spam') !== FALSE || strpos(strtolower($imap_folder_name), 'junk') !== FALSE || strpos(strtolower($imap_folder_name), 'trash') !== FALSE;
$user_id = logged_user() instanceof User ? logged_user()->getId() : $account->getUserId();
if (defined('DEBUG_EMAIL_RETRIEVAL') && DEBUG_EMAIL_RETRIEVAL) {
self::log_connection_status();
}
$max_spam_level = user_config_option('max_spam_level', null, $user_id);
if ($max_spam_level < 0) {
$max_spam_level = 0;
}
$mail_spam_level = strlen(trim(array_var($decoded[0]['Headers'], 'x-spam-level:', '')));
// if max_spam_level >= 10 then nothing goes to junk folder
$spam_in_subject = false;
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:MailUtilities.class.php
示例13: implode
$sql = "";
$first_row = true;
}
}
}
$processed_objects[] = $cobj->getId();
// check memory to stop script
if (memory_get_usage(true) > SCRIPT_MEMORY_LIMIT) {
$processed_objects_ids = "(" . implode("),(", $processed_objects) . ")";
DB::execute("INSERT INTO " . TABLE_PREFIX . "processed_objects (object_id) VALUES {$processed_objects_ids} ON DUPLICATE KEY UPDATE object_id=object_id");
$rest = Objects::count("id NOT IN(SELECT object_id FROM " . TABLE_PREFIX . "processed_objects)");
$row = DB::executeOne("SELECT COUNT(object_id) AS 'row_count' FROM " . TABLE_PREFIX . "processed_objects");
$proc_count = $row['row_count'];
$status_message = "Memory limit exceeded (" . format_filesize(memory_get_usage(true)) . "). Script terminated. Processed Objects: {$proc_count}. Total: " . ($proc_count + $rest) . ". Please execute 'Fill searchable objects and sharing table' again.";
$_SESSION['hide_back_button'] = 1;
complete_migration_print("\n" . date("H:i:s") . " - Memory limit exceeded (" . format_filesize(memory_get_usage(true)) . ") script terminated. Processed Objects: " . count($processed_objects) . ". Total: {$proc_count}.");
$processed_objects = array();
break;
}
$cant++;
}
$cobj = null;
}
// add mails to sharing table for account owners
if ($sql != "") {
$sql .= " ON DUPLICATE KEY UPDATE group_id=group_id;";
DB::execute($sql);
$sql = "";
}
if (count($processed_objects) > 0) {
$processed_objects_ids = "(" . implode("),(", $processed_objects) . ")";
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:complete_migration.php
示例14: product_signature
/**
* Returns product signature (name and version). If user is not logged in and
* is not member of owner company he will see only product name
*
* @param void
* @return string
*/
function product_signature() {
if (function_exists('logged_user') && (logged_user() instanceof User) && logged_user()->isMemberOfOwnerCompany()) {
$result = lang('footer powered', 'http://www.projectpier.org/', clean(product_name()) . ' ' . product_version());
if (Env::isDebugging()) {
ob_start();
benchmark_timer_display(false);
$result .= '. ' . ob_get_clean();
if (function_exists('memory_get_usage')) {
$result .= '. ' . format_filesize(memory_get_usage());
} // if
} // if
return $result;
} else {
return lang('footer powered', 'http://www.ProjectPier.org/', clean(product_name()));
} // if
} // product_signature
开发者ID:rjv,项目名称:Project-Pier,代码行数:23,代码来源:functions.php
示例15: checkbox_field
<?php
if($file->getType() == ProjectFiles::TYPE_DOCUMENT){
if (!isset($checkin)) {?>
<div class="header">
<?php echo checkbox_field('file[update_file]', array_var($file_data, 'update_file'), array('class' => 'checkbox', 'id' => $genid . 'fileFormUpdateFile', 'tabindex' => '60', 'onclick' => 'App.modules.addFileForm.updateFileClick(\'' . $genid .'\')')) ?>
<?php echo label_tag(lang('update file'), $genid .'fileFormUpdateFile', false, array('class' => 'checkbox'), '') ?>
</div>
<div id="<?php echo $genid ?>updateFileDescription">
<p><?php echo lang('replace file description') ?></p>
</div>
<?php } // if ?>
<div id="<?php echo $genid ?>updateFileForm" style="<?php echo isset($checkin) ? '': 'display:none' ?>">
<p>
<strong><?php echo lang('existing file') ?>:</strong>
<a target="_blank" href="<?php echo $file->getDownloadUrl() ?>" id="extension_old"><?php echo clean($file->getFilename()) ?></a>
| <?php echo format_filesize($file->getFilesize()) ?>
</p>
<p id="warning_extension_file"></p>
<div id="<?php echo $genid ?>selectFileControlDiv">
<?php echo label_tag(lang('new file'), $genid.'fileFormFile', true) ?>
<?php
Hook::fire('render_upload_control', array(
"genid" => $genid,
"attributes" => array(
"id" => $genid . "fileFormFile",
"tabindex" => "65",
"size" => 88,
"style" => 'width:530px',
)
), $ret);
?>
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:add_file.php
示例16:
<a href="<?=site_url('products/web_hosting/reset_ftp_password/'.$psid.'/'.$domain)?>" class="button">
Reset FTP Password
</a>
</div>
<div class="mid header">
<h5>Profile and System Resources</h5>
</div>
<div class="mid body">
<div class="floatr">
<img src="<?=$charts['disk_usage']?>" /> <br/>
<img src="<?=$charts['bandwidth_usage']?>" />
</div>
<p class="clearfix">
<strong>GUID:</strong> <?=$data['gen_info']['guid']?><br/>
<strong>Bandwidth Usage:</strong> <?=format_filesize($data['stat']['traffic'])?> / <?=format_filesize($data['limits']['max_traffic'])?><br/>
<strong>Disk Usage:</strong> <?=format_filesize($data['gen_info']['real_size'])?> / <?=format_filesize($data['limits']['disk_space'])?><br/>
<strong>Database Count:</strong> <?=$data['stat']['db']?> / <?=($data['limits']['max_db'] == -1) ? 'Unlimited' : $data['limits']['max_db']?><br/>
<?php
$hosting = $data['hosting'];
foreach ($hosting as $key=>$property) {
// Ditch The Useless Data
if (
$key == 'ftp_password' OR
substr($key, 0, 2) == "fp"
) {
unset($hosting[$key]);
} else {
// Replacements
$replace['PHP'] = '/php/';
$replace['CGI'] = '/cgi/';
开发者ID:G-LAB,项目名称:glab-cms,代码行数:31,代码来源:domain.php
示例17: lang
</span></a></td>
<td style="text-align:right;">
<?php
if ($linked_object instanceof ProjectFile && $linked_object->getType() == ProjectFiles::TYPE_DOCUMENT) {
$download_url = $linked_object->getDownloadUrl();
include_once ROOT . "/library/browser/Browser.php";
if (Browser::instance()->getBrowser() == Browser::BROWSER_IE) {
$download_url = "javascript:location.href = '{$download_url}';";
}
?>
<a target="_self" href="<?php
echo $download_url;
?>
"><?php
echo lang('download') . ' (' . format_filesize($linked_object->getFilesize()) . ')';
?>
</a> |
<?php
}
if ($linked_object instanceof ProjectWebpage || $linked_object instanceof ProjectFile && $linked_object->getType() == ProjectFiles::TYPE_WEBLINK) {
?>
<a target="_blank" href="<?php
echo $linked_object->getUrl();
?>
"><?php
echo lang('open weblink');
?>
</a> |
<?php
}
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:llo_generic.php
示例18: list_files
//.........这里部分代码省略.........
if ($order == ProjectFiles::ORDER_BY_POSTTIME) {
$order = '`created_on`';
} else {
if ($order == ProjectFiles::ORDER_BY_MODIFYTIME) {
$order = '`updated_on`';
} else {
if ($order == ProjectFiles::ORDER_BY_SIZE) {
$order = '`jt`.`filesize`';
$join_params = array('table' => ProjectFileRevisions::instance()->getTableName(), 'jt_field' => 'file_id', 'e_field' => 'object_id');
$extra_conditions .= " AND `jt`.`object_id` = (SELECT max(`x`.`object_id`) FROM " . TABLE_PREFIX . "project_file_revisions `x` WHERE `x`.`file_id` = `e`.`object_id`)";
} else {
if ($order == 'customProp') {
$order = 'IF(ISNULL(jt.value),1,0),jt.value';
$join_params['join_type'] = "LEFT ";
$join_params['table'] = "" . TABLE_PREFIX . "custom_property_values";
$join_params['jt_field'] = "object_id";
$join_params['e_field'] = "object_id";
$join_params['on_extra'] = "AND custom_property_id = " . $cpId;
$extra_conditions .= " AND ( custom_property_id = " . $cpId . " OR custom_property_id IS NULL)";
$select_columns = array("DISTINCT o.*", "e.*");
} else {
$order = '`name`';
}
}
}
}
// if
$extra_conditions .= $hide_private ? 'AND `is_visible` = 1' : '';
// filter attachments of other people if not filtering
$tmp_mids = array();
foreach (active_context() as $selection) {
if ($selection instanceof Member) {
$d = $selection->getDimension();
if ($d instanceof Dimension && $d->getIsManageable()) {
$tmp_mids[] = $selection->getId();
}
}
}
if (count($tmp_mids) == 0) {
if (Plugins::instance()->isActivePlugin('mail')) {
$extra_conditions .= " AND IF(e.mail_id=0, true, EXISTS (SELECT mac.contact_id FROM " . TABLE_PREFIX . "mail_account_contacts mac \r\n\t\t\t\t\tWHERE mac.contact_id=o.created_by_id AND mac.account_id=(SELECT mc.account_id FROM " . TABLE_PREFIX . "mail_contents mc WHERE mc.object_id=e.mail_id)))";
}
}
Hook::fire("listing_extra_conditions", null, $extra_conditions);
$only_count_result = array_var($_GET, 'only_result', false);
$context = active_context();
$objects = ProjectFiles::instance()->listing(array("order" => $order, "order_dir" => $order_dir, "extra_conditions" => $extra_conditions, "show_only_member_objects" => user_config_option('show_only_member_files'), 'count_results' => false, 'only_count_results' => $only_count_result, "join_params" => $join_params, "start" => $start, "limit" => $limit, "select_columns" => $select_columns));
$custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(ProjectFiles::instance()->getObjectTypeId());
// prepare response object
$listing = array("totalCount" => $objects->total, "start" => $start, "objType" => ProjectFiles::instance()->getObjectTypeId(), "files" => array());
if (is_array($objects->objects)) {
$index = 0;
$ids = array();
foreach ($objects->objects as $o) {
$coName = "";
$coId = $o->getCheckedOutById();
if ($coId != 0) {
if ($coId == logged_user()->getId()) {
$coName = "self";
} else {
$coUser = Contacts::findById($coId);
if ($coUser instanceof Contact) {
$coName = $coUser->getObjectName();
} else {
$coName = "";
}
}
}
if ($o->isMP3()) {
$songname = $o->getProperty("songname");
$artist = $o->getProperty("songartist");
$album = $o->getProperty("songalbum");
$track = $o->getProperty("songtrack");
$year = $o->getProperty("songyear");
$duration = $o->getProperty("songduration");
$songInfo = json_encode(array($songname, $artist, $album, $track, $year, $duration, $o->getDownloadUrl(), $o->getFilename(), $o->getId()));
} else {
$songInfo = array();
}
$ids[] = $o->getId();
$values = array("id" => $o->getId(), "ix" => $index++, "object_id" => $o->getId(), "ot_id" => $o->getObjectTypeId(), "name" => $o->getObjectName(), "type" => $o->getTypeString(), "mimeType" => $o->getTypeString(), "createdBy" => clean($o->getCreatedByDisplayName()), "createdById" => $o->getCreatedById(), "dateCreated" => $o->getCreatedOn() instanceof DateTimeValue ? $o->getCreatedOn()->isToday() ? format_time($o->getCreatedOn()) : format_datetime($o->getCreatedOn()) : '', "dateCreated_today" => $o->getCreatedOn() instanceof DateTimeValue ? $o->getCreatedOn()->isToday() : 0, "updatedBy" => clean($o->getUpdatedByDisplayName()), "updatedById" => $o->getUpdatedById(), "dateUpdated" => $o->getUpdatedOn() instanceof DateTimeValue ? $o->getUpdatedOn()->isToday() ? format_time($o->getUpdatedOn()) : format_datetime($o->getUpdatedOn()) : '', "dateUpdated_today" => $o->getUpdatedOn() instanceof DateTimeValue ? $o->getUpdatedOn()->isToday() : 0, "icon" => $o->getTypeIconUrl(), "size" => format_filesize($o->getFileSize()), "url" => $o->getOpenUrl(), "manager" => get_class($o->manager()), "checkedOutByName" => $coName, "checkedOutById" => $coId, "isModifiable" => $o->isModifiable() && $o->canEdit(logged_user()), "modifyUrl" => $o->getModifyUrl(), "songInfo" => $songInfo, "ftype" => $o->getType(), "url" => $o->getUrl(), "memPath" => json_encode($o->getMembersIdsToDisplayPath()), "genid" => gen_id());
if ($o->isMP3()) {
$values['isMP3'] = true;
}
Hook::fire('add_classification_value', $o, $values);
foreach ($custom_properties as $cp) {
$values['cp_' . $cp->getId()] = get_custom_property_value_for_listing($cp, $o);
}
$listing["files"][] = $values;
}
$read_objects = ReadObjects::getReadByObjectList($ids, logged_user()->getId());
foreach ($listing["files"] as &$data) {
$data['isRead'] = isset($read_objects[$data['object_id']]);
}
ajx_extra_data($listing);
tpl_assign("listing", $listing);
} else {
throw new Error("Not array", $code);
}
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:FilesController.class.php
示例19: count
<?php
if (
is_array($entry['attachments'])
AND count($entry['attachments']) > 0
AND isset($entry['attachments']['recording.mp3']) !== true
):
?>
<h5>Attachments (<?=count($entry['attachments'])?>)</h5>
<p>
<ul>
<?php foreach ($entry['attachments'] as $file) : ?>
<li>
<a href="<?=site_url('communication/attachment/'.$entry['fingerprint'].'/'.basename($file['name']))?>">
<?=basename($file['name'])?>
</a>
<em><?=format_filesize($file['size'])?></em>
</li>
<?php endforeach; ?>
</ul>
</p>
<?php endif; ?>
<div>
<?php $profile = $this->profile->get($entry['source']) ?>
<em>Received from <?php
if ($profile->exists())
{
echo profile_link($entry['source']);
}
elseif (is_tel($entry['source']) === true)
{
echo tel_format($entry['source']);
开发者ID:G-LAB,项目名称:glab-cms,代码行数:31,代码来源:ticket_view.php
示例20: clean
<div class="availableVerion">
<h2><a href="<?php
echo $version->getDetailsUrl();
?>
"><?php
echo clean($version->getSignature());
?>
</a></h2>
<div class="releaseNotes"><?php
echo do_textile($version->getReleaseNotes());
?>
</div>
<?php
$download_links = array();
foreach ($version->getDownloadLinks() as $download_link) {
$download_links[] = '<a href="' . $download_link->getUrl() . '">' . clean($download_link->getFormat()) . ' (' . format_filesize($download_link->getSize()) . ')</a>';
}
// foreach
?>
<div class="downloadLinks"><strong><?php
echo lang('download');
?>
:</strong> <?php
echo implode(' | ', $download_links);
?>
</div>
</div>
<?php
}
// foreach
?>
开发者ID:bklein01,项目名称:Project-Pier,代码行数:31,代码来源:upgrade.php
注:本文中的format_filesize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论