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


PHP RMUtilities::formatBytesSize方法代码示例

本文整理汇总了PHP中RMUtilities::formatBytesSize方法的典型用法代码示例。如果您正苦于以下问题:PHP RMUtilities::formatBytesSize方法的具体用法?PHP RMUtilities::formatBytesSize怎么用?PHP RMUtilities::formatBytesSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RMUtilities的用法示例。


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

示例1: showForm

function showForm()
{
    global $db, $xoopsOption, $xoopsUser, $mc, $tpl, $xoopsConfig, $xoopsModuleConfig, $user, $xoopsSecurity;
    $xoopsOption['template_main'] = "gs_submit.html";
    $xoopsOption['module_subpage'] = 'submit';
    include 'header.php';
    GSFunctions::makeHeader();
    $mc =& $xoopsModuleConfig;
    $tpl->assign('lang_uploadyour', __('Upload your Pictures', 'galleries'));
    $tpl->assign('lang_step1', __('Step 1:', 'galleries'));
    $tpl->assign('lang_step2', __('Step 2:', 'galleries'));
    $tpl->assign('lang_step3', __('Step 3:', 'galleries'));
    $tpl->assign('lang_step4', __('Step 4:', 'galleries'));
    $tpl->assign('lang_choose', __('Select Files', 'galleries'));
    $tpl->assign('lang_privacy', __('Set Privacy', 'galleries'));
    $tpl->assign('lang_privateme', __('Private (<em>Only you will seee these pictures</em>)', 'galleries'));
    $tpl->assign('lang_privatef', __('For Friends (<em>Only you and your friends will see these pictures</em>)', 'galleries'));
    $tpl->assign('lang_public', __('Public (<em>Pictures will visible for all</em>)'));
    $tpl->assign('lang_upload', __('Upload Files', 'galleries'));
    $tpl->assign('lang_clicktou', __('Click to Upload', 'galleries'));
    $tpl->assign('lang_tagsesp', __('Specify tags to use', 'galleries'));
    $tpl->assign('lang_tagsdesc', __('Separate each tag with a comma (,).', 'galleries'));
    $tpl->assign('lang_maxsize', sprintf(__('The maximum file size allowed is <strong>%s</strong>.', 'galleries'), RMUtilities::formatBytesSize($mc['size_image'] * 1024)));
    $tpl->assign('used_graph', GSFunctions::makeQuota($user, false));
    $tpl->assign('form_action', GSFunctions::get_url() . ($mc['urlmode'] ? 'submit/' : '?submit=submit'));
    $tpl->assign('token', $xoopsSecurity->getTokenHTML());
    $used = round($user->usedQuota() / $user->quota() * 100) . '%';
    $tpl->assign('lang_used', sprintf(__('You have used <strong>%s</strong> of <strong>%s</strong> available. You left <strong>%s</strong>', 'galleries'), $used, RMUtilities::formatBytesSize($user->quota()), RMUtilities::formatBytesSize($user->usedQuota() >= $user->quota() ? 0 : $user->quota() - $user->usedQuota())));
    RMTemplate::get()->add_xoops_style('submit.css', 'galleries');
    include 'footer.php';
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:31,代码来源:submit.php

示例2: makeQuota

 public function makeQuota(GSUser $user, $showpercent = false)
 {
     $rtn = '<div style="font-weight: bold; color: #999; font-family: Verdana, arial, helvetica, sans-serif; font-size: 10px; width: 102px; text-align: center:"><div style="text-align: left;width: 102px; height: 15px; border: 1px solid #ccc; background: url(' . XOOPS_URL . '/modules/galleries/images/quotagray.png) no-repeat;">';
     $quota = $user->quota();
     $used = $user->usedQuota();
     $percent = $quota / 102;
     $rtn .= '<div style="text-align: center; width: ' . ($used > 0 ? $used / $percent > 102 ? 102 : round($used / $percent) : 0) . 'px; background: url(' . XOOPS_URL . '/modules/galleries/images/quotabar.png) no-repeat;">&nbsp;</div>';
     $rtn .= '</div>';
     if ($showpercent) {
         $rtn .= round($user->usedQuota() * (100 / $quota)) . '%';
     } else {
         $rtn .= RMUtilities::formatBytesSize($user->usedQuota());
     }
     $rtn .= "</div>";
     return $rtn;
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:16,代码来源:gsfunctions.class.php

示例3: show_dashboard

function show_dashboard()
{
    global $xoopsModuleConfig;
    $db = Database::getInstance();
    // Sets count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_sets");
    list($set_count) = $db->fetchRow($db->query($sql));
    // Pictures count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_images");
    list($pic_count) = $db->fetchRow($db->query($sql));
    // Users count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_users");
    list($user_count) = $db->fetchRow($db->query($sql));
    // Tags count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_tags");
    list($tag_count) = $db->fetchRow($db->query($sql));
    // E-Cards count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_postcards");
    list($post_count) = $db->fetchRow($db->query($sql));
    // Used space
    $space = RMUtilities::formatBytesSize(GSFunctions::folderSize($xoopsModuleConfig['storedir']));
    // Number of files
    $file_count = count_files(rtrim($xoopsModuleConfig['storedir'], '/'));
    // First picture
    $sql = "SELECT * FROM " . $db->prefix("gs_images") . " ORDER BY `created` ASC LIMIT 0,1";
    $result = $db->query($sql);
    if ($db->getRowsNum($result) > 0) {
        $img = new GSImage();
        $img->assignVars($db->fetchArray($result));
        $user = new GSUser($img->owner(), 1);
        $tf = new RMTimeFormatter(0, '%M% %d%, %Y%');
        $first_pic['date'] = $tf->format($img->created());
        $first_pic['link'] = $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'img/' . $img->id() . '/set/' : '&amp;img=' . $img->id());
    }
    xoops_cp_header();
    GSFunctions::toolbar();
    RMTemplate::get()->add_style('dashboard.css', 'galleries');
    RMTemplate::get()->add_style('admin.css', 'galleries');
    RMTemplate::get()->add_head('<script type="text/javascript">var xurl = "' . XOOPS_URL . '";</script>');
    RMTemplate::get()->add_local_script('dashboard.js', 'galleries');
    include RMTemplate::get()->get_template('admin/gs_dashboard.php', 'module', 'galleries');
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:43,代码来源:index.php

示例4: showUsers

/**
* @desc Visualiza todos los usuarios existentes
**/
function showUsers()
{
    global $xoopsModule, $db, $tpl, $xoopsSecurity;
    $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
    $limit = 15;
    $search = rmc_server_var($_REQUEST, 'search', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users');
    $sql1 = '';
    $search = trim($search);
    if ($search && strlen($search) > 2) {
        $sql1 .= $sql1 == '' ? " WHERE (uname LIKE '%{$search}%')" : " OR (uname LIKE '%{$search}%')";
    }
    list($num) = $db->fetchRow($db->query($sql . $sql1));
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $tpages = ceil($num / $limit);
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url("users.php?page={PAGE_NUM}&amp;search={$search}");
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_users');
    $sql2 = " LIMIT {$start},{$limit}";
    $result = $db->query($sql . $sql1 . $sql2);
    while ($rows = $db->fetchArray($result)) {
        $uname = eregi_replace("({$search})", "<span class='searchResalte'>\\1</span>", $rows['uname']);
        $user = new GSUser();
        $user->assignVars($rows);
        $users[] = array('id' => $user->id(), 'uid' => $user->uid(), 'uname' => $uname, 'quota' => RMUtilities::formatBytesSize($user->quota()), 'blocked' => $user->blocked(), 'used' => GSFunctions::makeQuota($user), 'pics' => $user->pics(), 'sets' => $user->sets(), 'date' => formatTimeStamp($user->date(), 'custom'), 'url' => $user->userUrl());
    }
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Users management', 'galleries'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Users management', 'galleries'));
    RMTemplate::get()->add_script('../include/js/gsscripts.php?file=sets&form=frm-users');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected users?', 'galleries') . "';\n</script>");
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/gs_users.php", 'module', 'galleries');
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:44,代码来源:users.php

示例5: array

 } else {
     $userData = array();
     $userData['id'] = 0;
     $userData['uname'] = $xoopsModuleConfig['anonymous_prefix'] . $post->uname();
     //$userData['rank'] = $xoopsConfig['anonymous'];
     //$userData['rank_image'] = '';
     $userData['registered'] = '';
     $userData['avatar'] = RMEvents::get()->run_event("rmcommon.get.avatar", '', 0);
     $userData['posts'] = sprintf(__('Posts: %u', 'bxpress'), 0);
     $userData['online'] = false;
     $userData['type'] = 'anon';
 }
 // Adjuntos
 $attachs = array();
 foreach ($post->attachments() as $k) {
     $attachs[] = array('title' => $k->name(), 'downs' => $k->downloads(), 'id' => $k->id(), 'ext' => $k->extension(), 'size' => RMUtilities::formatBytesSize($k->size()), 'icon' => $k->getIcon());
 }
 $tf = new RMTimeFormatter(0, __('%T% %d%, %Y%', 'bxpress'));
 // Likes parsing
 if (!is_null($row['liked'])) {
     $likes_ids = explode(",", $row['liked'], 3);
 } else {
     $likes_ids = array();
 }
 $likes = array();
 foreach ($likes_ids as $like) {
     if (!isset($users[$like])) {
         $users[$like] = new XoopsUser($like);
     }
     $like_user = $users[$like];
     $likes[] = array('uid' => $like, 'uname' => $like_user->getVar('uname'), 'name' => $like_user->getVar('name') != '' ? $like_user->getVar('name') : $like_user->getVar('uname'), 'avatar' => RMEvents::get()->run_event("rmcommon.get.avatar", $like_user->getVar('email'), 40));
开发者ID:petitours,项目名称:bxpress,代码行数:31,代码来源:topic.php

示例6: RMForm

 $form->addElement($ele);
 // Adjuntar Archivos
 if ($forum->attachments() && $forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'attach')) {
     $forma = new RMForm('<a name="attachments"></a>' . __('Attached Files', 'bxpress'), 'frmAttach', 'edit.php');
     $forma->addElement(new RMFormSubTitle(sprintf(__('You can upload new files to this post. You have a limit of <strong>%s</strong> attachment per post.', 'bxpress'), $xoopsModuleConfig['attachlimit']), 1, 'even'));
     if ($post->totalAttachments() < $xoopsModuleConfig['attachlimit']) {
         $ele = new RMFormFile(__('Attach File:', 'bxpress'), 'attach', 45, $xoopsModuleConfig['maxfilesize'] * 1024);
         $ele->setDescription(sprintf(__('Allowed File Types: %s', 'bxpress'), implode(',', $forum->extensions())));
         $forma->addElement($ele, true);
         $forma->setExtra('enctype="multipart/form-data"');
     }
     // Lista de Archivos Adjuntos
     $list = new RMFormCheck(__('Cuerrent Attachments', 'bxpress'));
     $list->asTable(1);
     foreach ($post->attachments() as $file) {
         $list->addOption("<img src='" . $file->getIcon() . "' align='absmiddle' /> " . $file->name() . " (" . RMUtilities::formatBytesSize($file->size()) . ")", 'files[]', $file->id());
     }
     $forma->addElement($list);
     $ele = new RMFormButtonGroup();
     if ($post->totalAttachments() < $xoopsModuleConfig['attachlimit']) {
         $ele->addButton('upload', __('Upload File', 'bxpress'), 'submit');
     }
     $ele->addButton('delete', __('Delete File(s)', 'bxpress'), 'button', 'onclick="document.forms[\'frmAttach\'].op.value=\'delete\'; submit();"');
     $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location = \'topic.php?pid=' . $post->id() . '#p' . $post->id() . '\'";');
     $forma->addElement($ele);
     $forma->addElement(new RMFormHidden('op', 'upload'));
     $forma->addElement(new RMFormHidden('id', $id));
 }
 $tpl->assign('topic_form', $form->render() . "<br />" . $forma->render());
 $tpl->assign('lang_topicreview', __('Topic Review (Newest First)', 'bxpress'));
 include 'footer.php';
开发者ID:laiello,项目名称:bitcero-modules,代码行数:31,代码来源:edit.php

示例7: str_replace

    echo str_replace('http://', '', $file['url']);
    ?>
</a></td>
    <td align="center"><?php 
    echo $file['lang'];
    ?>
</td>
	<td align="center"<?php 
    echo time() - $file['time'] >= $plugin->get_config('time') ? ' class="warn"' : '';
    ?>
><?php 
    echo sprintf(__('%s secs.', 'booster'), time() - $file['time']);
    ?>
</td>
	<td align="center"><?php 
    echo RMUtilities::formatBytesSize($file['size']);
    ?>
</td>
	<td align="center">
		<input id="<?php 
    echo $file['id'];
    ?>
" class="del_file" type="button" value="<?php 
    _e('Delete', 'booster');
    ?>
" />
	</td>
</tr>
<?php 
}
?>
开发者ID:laiello,项目名称:bitcero-modules,代码行数:31,代码来源:cache_files.php


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