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


PHP filesize_h函数代码示例

本文整理汇总了PHP中filesize_h函数的典型用法代码示例。如果您正苦于以下问题:PHP filesize_h函数的具体用法?PHP filesize_h怎么用?PHP filesize_h使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: handle_output

 function handle_output(&$event, $param)
 {
     if ($event->data['do'] != 'imageshack') {
         return;
     }
     global $lang;
     echo '<h1 id="media__ns">' . $this->getLang('name') . '</h1>';
     echo '<p>' . $this->getLang('intro') . '</p>';
     echo '<form action="' . DOKU_BASE . 'lib/exe/mediamanager.php" method="post" enctype="multipart/form-data">';
     echo '<input type="hidden" name="do" value="imageshack" />';
     echo '<input type="file" name="imageshack_file" />';
     echo '<input type="submit" value="' . $lang['btn_upload'] . '" class="button" />';
     echo '</form>';
     // output the uploads stored in the current session
     if (is_array($_SESSION['imageshack'])) {
         $files = array_reverse($_SESSION['imageshack']);
         $twibble = 1;
         foreach ($files as $item) {
             $twibble *= -1;
             $zebra = $twibble == -1 ? 'odd' : 'even';
             list($ext, $mime, $dl) = mimetype($item['name']);
             $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext);
             $class = 'select mediafile mf_' . $class;
             echo '<div class="' . $zebra . '">' . NL;
             echo '<a name="h_' . $item['link'] . '" class="' . $class . '">' . hsc($item['name']) . '</a> ';
             echo '<span class="info">(' . $item['width'] . '&#215;' . $item['height'] . ' ' . filesize_h($item['size']) . ')</span>' . NL;
             echo ' <a href="' . $item['adlink'] . '" target="_blank"><img src="' . DOKU_BASE . 'lib/images/magnifier.png" ' . 'alt="' . $lang['mediaview'] . '" title="' . $lang['mediaview'] . '" class="btn" /></a>' . NL;
             echo '<div class="example" id="ex_' . str_replace(':', '_', $item['link']) . '">';
             echo $lang['mediausage'] . ' <code>{{' . hsc($item['link']) . '}}</code>';
             echo '</div>';
             if ($item['width'] > 120 || $item['height'] > 100) {
                 $w = 120;
                 $h = 100;
             } else {
                 $w = $item['width'];
                 $h = $item['height'];
             }
             $src = ml($item['link'], array('w' => $w, 'h' => $h));
             $p = array();
             $p['width'] = $w;
             $p['height'] = $h;
             $p['alt'] = $item['name'];
             $p['class'] = 'thumb';
             $att = buildAttributes($p);
             // output
             echo '<div class="detail">';
             echo '<div class="thumb">';
             echo '<a name="d_' . $item['link'] . '" class="select">';
             echo '<img src="' . $src . '" ' . $att . ' />';
             echo '</a>';
             echo '</div>';
             echo '</div>';
             echo '<div class="clearer"></div>' . NL;
             echo '</div>' . NL;
         }
     }
     $event->preventDefault();
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-imageshack,代码行数:58,代码来源:action.php

示例2: _validate

 /**
  * @throws Exception max size, required or upload error
  */
 protected function _validate()
 {
     global $lang;
     parent::_validate();
     $file = $this->getParam('file');
     if ($file['error'] == 1 || $file['error'] == 2) {
         throw new Exception(sprintf($lang['uploadsize'], filesize_h(php_to_byte(ini_get('upload_max_filesize')))));
     } else {
         if ($file['error'] == 4) {
             if (!isset($this->opt['optional'])) {
                 throw new Exception(sprintf($this->getLang('e_required'), hsc($this->opt['label'])));
             }
         } else {
             if ($file['error'] || !is_uploaded_file($file['tmp_name'])) {
                 throw new Exception(hsc($this->opt['label']) . ' ' . $lang['uploadfail'] . ' (' . $file['error'] . ')');
             }
         }
     }
 }
开发者ID:rusidea,项目名称:analitika,代码行数:22,代码来源:fieldfile.php

示例3: internalmedia

 public function internalmedia($src, $title = NULL, $align = NULL, $width = NULL, $height = NULL, $cache = NULL, $linking = NULL, $return = false)
 {
     global $ID;
     list($src, $hash) = explode('#', $src, 2);
     resolve_mediaid(getNS($ID), $src, $exists);
     $noLink = false;
     $render = $linking == 'linkonly' ? false : true;
     $link = $this->_getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render);
     list($ext, $mime, $dl) = mimetype($src, false);
     if (substr($mime, 0, 5) == 'image' && $render) {
         if ($linking == NULL || $linking == '' || $linking == 'details') {
             $linking = 'direct';
         }
         $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache), $linking == 'direct');
     } elseif ($mime == 'application/x-shockwave-flash' && $render) {
         // don't link flash movies
         $noLink = true;
     } else {
         // add file icons
         $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext);
         $link['class'] .= ' mediafile mf_' . $class;
         $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache), true);
         if ($exists) {
             $link['title'] .= ' (' . filesize_h(filesize(mediaFN($src))) . ')';
         }
     }
     if ($hash) {
         $link['url'] .= '#' . $hash;
     }
     //markup non existing files
     if (!$exists) {
         $link['class'] .= ' wikilink2';
     }
     //output formatted
     if ($linking == 'nolink' || $noLink) {
         $this->doc .= $link['name'];
     } else {
         $this->doc .= $this->_formatLink($link);
     }
 }
开发者ID:ssahara,项目名称:dw-plugin-prettyPhoto,代码行数:40,代码来源:renderer.php

示例4: html_resulttable

 /**
  * Display a result in a HTML table
  */
 function html_resulttable($result, $header = '', $pager = 0)
 {
     echo '<table class="inline">';
     if (is_array($header)) {
         echo '<tr>';
         foreach ($header as $h) {
             echo '<th>' . hsc($h) . '</th>';
         }
         echo '</tr>';
     }
     $count = 0;
     if (is_array($result)) {
         foreach ($result as $row) {
             echo '<tr>';
             foreach ($row as $k => $v) {
                 if ($k == 'res_x') {
                     continue;
                 }
                 if ($k == 'res_y') {
                     continue;
                 }
                 echo '<td class="plg_stats_X' . $k . '">';
                 if ($k == 'page') {
                     echo '<a href="' . wl($v) . '" class="wikilink1">';
                     echo hsc($v);
                     echo '</a>';
                 } elseif ($k == 'media') {
                     echo '<a href="' . ml($v) . '" class="wikilink1">';
                     echo hsc($v);
                     echo '</a>';
                 } elseif ($k == 'filesize') {
                     echo filesize_h($v);
                 } elseif ($k == 'url') {
                     $url = hsc($v);
                     $url = preg_replace('/^https?:\\/\\/(www\\.)?/', '', $url);
                     if (strlen($url) > 45) {
                         $url = substr($url, 0, 30) . ' &hellip; ' . substr($url, -15);
                     }
                     echo '<a href="' . $v . '" class="urlextern">';
                     echo $url;
                     echo '</a>';
                 } elseif ($k == 'ilookup') {
                     echo '<a href="' . wl('', array('id' => $v, 'do' => 'search')) . '">Search</a>';
                 } elseif ($k == 'lookup') {
                     echo '<a href="http://www.google.com/search?q=' . rawurlencode($v) . '">';
                     echo '<img src="' . DOKU_BASE . 'lib/plugins/statistics/ico/search/google.png" alt="Google" border="0" />';
                     echo '</a> ';
                     echo '<a href="http://search.yahoo.com/search?p=' . rawurlencode($v) . '">';
                     echo '<img src="' . DOKU_BASE . 'lib/plugins/statistics/ico/search/yahoo.png" alt="Yahoo!" border="0" />';
                     echo '</a> ';
                     echo '<a href="http://www.bing.com/search?q=' . rawurlencode($v) . '">';
                     echo '<img src="' . DOKU_BASE . 'lib/plugins/statistics/ico/search/bing.png" alt="Bing" border="0" />';
                     echo '</a> ';
                 } elseif ($k == 'engine') {
                     include_once dirname(__FILE__) . '/inc/searchengines.php';
                     if (isset($SEARCHENGINEINFO[$v])) {
                         echo '<a href="' . $SEARCHENGINEINFO[$v][1] . '">' . $SEARCHENGINEINFO[$v][0] . '</a>';
                     } else {
                         echo hsc(ucwords($v));
                     }
                 } elseif ($k == 'eflag') {
                     $this->html_icon('search', $v);
                 } elseif ($k == 'bflag') {
                     $this->html_icon('browser', $v);
                 } elseif ($k == 'osflag') {
                     $this->html_icon('os', $v);
                 } elseif ($k == 'cflag') {
                     $this->html_icon('flags', $v);
                 } elseif ($k == 'html') {
                     echo $v;
                 } else {
                     echo hsc($v);
                 }
                 echo '</td>';
             }
             echo '</tr>';
             if ($pager && $count == $pager) {
                 break;
             }
             $count++;
         }
     }
     echo '</table>';
     if ($pager) {
         $this->html_pager($pager, count($result) > $pager);
     }
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-statistics,代码行数:90,代码来源:admin.php

示例5: send_media_diff

 /**
  * Send the diff for some media change
  *
  * @fixme this should embed thumbnails of images in HTML version
  * @param string   $subscriber_mail The target mail address
  * @param string   $template        Mail template ('uploadmail', ...)
  * @param string   $id              Media file for which the notification is
  * @param int|bool $rev             Old revision if any
  * @return bool                     true if successfully sent
  */
 public function send_media_diff($subscriber_mail, $template, $id, $rev = false)
 {
     global $conf;
     $file = mediaFN($id);
     list($mime, $ext) = mimetype($id);
     $trep = array('MIME' => $mime, 'MEDIA' => ml($id, '', true, '&', true), 'SIZE' => filesize_h(filesize($file)));
     if ($rev && $conf['mediarevisions']) {
         $trep['OLD'] = ml($id, "rev={$rev}", true, '&', true);
     } else {
         $trep['OLD'] = '---';
     }
     $headers = array('Message-Id' => $this->getMessageID($id, @filemtime($file)));
     if ($rev) {
         $headers['In-Reply-To'] = $this->getMessageID($id, $rev);
     }
     $this->send($subscriber_mail, 'upload', $id, $template, $trep, null, $headers);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:27,代码来源:subscription.php

示例6: _step_download

 /**
  * Download the tarball
  *
  * @return bool
  */
 private function _step_download()
 {
     $this->_say($this->getLang('dl_from'), $this->tgzurl);
     @set_time_limit(120);
     @ignore_user_abort();
     $http = new DokuHTTPClient();
     $http->timeout = 120;
     $data = $http->get($this->tgzurl);
     if (!$data) {
         $this->_warn($http->error);
         $this->_warn($this->getLang('dl_fail'));
         return false;
     }
     if (!io_saveFile($this->tgzfile, $data)) {
         $this->_warn($this->getLang('dl_fail'));
         return false;
     }
     $this->_say($this->getLang('dl_done'), filesize_h(strlen($data)));
     return true;
 }
开发者ID:Verber,项目名称:dokuwiki-plugin-upgrade,代码行数:25,代码来源:admin.php

示例7: strtolower

        $ext = strtolower(substr(strrchr($entry,'.'), 1));
        if (is_file($root.$imglib.$entry) && in_array($ext,$tinyMCE_valid_imgs))
        {
			$arr_tinyMCE_image_files[$i][file_name] = $entry;			
			$i++;
        }
      }
      $d->close();
	  // sort the list of image filenames alphabetically.
	  sort($arr_tinyMCE_image_files);
	  for($k=0; $k<count($arr_tinyMCE_image_files); $k++){ 
      $entry = $arr_tinyMCE_image_files[$k][file_name];
	  $size = getimagesize($tinyMCE_base_url.$imglib.$entry);
	  $fsize = filesize($root.$imglib.$entry);
   ?>
            <option img_width="<?php echo $size[0]; ?>" img_height="<?php echo $size[1]; ?>" f_size="<?php echo filesize_h($fsize,2); ?>" value="<?php echo $entry?>" <?php echo ($entry == $img)?'selected':''?>><?php echo $entry?></option>
            <?php
	  }  
    }
    else
    {
      $errors[] = '{$lang_ibrowser_errornodir}';
    }
  ?>
          </select></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="3"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="40%"><?php if ($tinyMCE_img_delete_allowed) { ?>
开发者ID:rwetzlmayr,项目名称:hak_tinymce,代码行数:31,代码来源:ibrowser.php

示例8: media_upload

if (isset($_FILES['Filedata'])) {
    $_FILES['upload'] =& $_FILES['Filedata'];
    $JUMPTO = media_upload($NS, $AUTH);
    if ($JUMPTO == false) {
        header("HTTP/1.0 400 Bad Request");
        echo 'Upload failed';
    }
    echo 'ok';
    exit;
}
// give info on PHP catched upload errors
if ($_FILES['upload']['error']) {
    switch ($_FILES['upload']['error']) {
        case 1:
        case 2:
            msg(sprintf($lang['uploadsize'], filesize_h(php_to_byte(ini_get('upload_max_filesize')))), -1);
            break;
        default:
            msg($lang['uploadfail'] . ' (' . $_FILES['upload']['error'] . ')', -1);
    }
    unset($_FILES['upload']);
}
// handle upload
if ($_FILES['upload']['tmp_name']) {
    $JUMPTO = media_upload($NS, $AUTH);
    if ($JUMPTO) {
        $NS = getNS($JUMPTO);
    }
}
// handle meta saving
if ($IMG && $_REQUEST['do']['save']) {
开发者ID:Harvie,项目名称:dokuwiki,代码行数:31,代码来源:mediamanager.php

示例9: media_uploadform

/**
 * Print the media upload form if permissions are correct
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Kate Arzamastseva <pshns@ukr.net>
 */
function media_uploadform($ns, $auth, $fullscreen = false)
{
    global $lang;
    global $conf;
    global $INPUT;
    if ($auth < AUTH_UPLOAD) {
        echo '<div class="nothing">' . $lang['media_perm_upload'] . '</div>' . NL;
        return;
    }
    $auth_ow = $conf['mediarevisions'] ? AUTH_UPLOAD : AUTH_DELETE;
    $update = false;
    $id = '';
    if ($auth >= $auth_ow && $fullscreen && $INPUT->str('mediado') == 'update') {
        $update = true;
        $id = cleanID($INPUT->str('image'));
    }
    // The default HTML upload form
    $params = array('id' => 'dw__upload', 'enctype' => 'multipart/form-data');
    if (!$fullscreen) {
        $params['action'] = DOKU_BASE . 'lib/exe/mediamanager.php';
    } else {
        $params['action'] = media_managerURL(array('tab_files' => 'files', 'tab_details' => 'view'), '&');
    }
    $form = new Doku_Form($params);
    if (!$fullscreen) {
        echo '<div class="upload">' . $lang['mediaupload'] . '</div>';
    }
    $form->addElement(formSecurityToken());
    $form->addHidden('ns', hsc($ns));
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeFileField('upload', $lang['txt_upload'], 'upload__file'));
    $form->addElement(form_makeCloseTag('p'));
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeTextField('mediaid', noNS($id), $lang['txt_filename'], 'upload__name'));
    $form->addElement(form_makeButton('submit', '', $lang['btn_upload']));
    $form->addElement(form_makeCloseTag('p'));
    if ($auth >= $auth_ow) {
        $form->addElement(form_makeOpenTag('p'));
        $attrs = array();
        if ($update) {
            $attrs['checked'] = 'checked';
        }
        $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check', $attrs));
        $form->addElement(form_makeCloseTag('p'));
    }
    echo NL . '<div id="mediamanager__uploader">' . NL;
    html_form('upload', $form);
    echo '</div>' . NL;
    echo '<p class="maxsize">';
    printf($lang['maxuploadsize'], filesize_h(media_getuploadsize()));
    echo '</p>' . NL;
}
开发者ID:yjliugit,项目名称:dokuwiki,代码行数:58,代码来源:media.php

示例10: sort

	    		<?php 
sort($arr_tinyMCE_image_files);
foreach ($arr_tinyMCE_image_files as $e) {
    $p = $e->gid . $e->file_ext;
    $size = array($e->image_width, $e->image_height);
    $fsize = $e->file_size;
    ?>
			
						<option lang="<?php 
    echo $size[0];
    ?>
" id="<?php 
    echo $size[1];
    ?>
"  label="<?php 
    echo filesize_h($fsize, 2);
    ?>
" value="<?php 
    echo $p;
    ?>
" <?php 
    echo $e->file_name == $img ? 'selected' : '';
    ?>
><?php 
    echo $e->file_name;
    ?>
</option>
			
				<?php 
}
?>
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:31,代码来源:ibrowser.php

示例11: media_printfile_thumbs

/**
 * Formats and prints one file in the list in the thumbnails view
 *
 * @author Kate Arzamastseva <pshns@ukr.net>
 */
function media_printfile_thumbs($item, $auth, $jump = false, $display_namespace = false)
{
    global $lang;
    global $conf;
    // Prepare filename
    $file = utf8_decodeFN($item['file']);
    // output
    echo '<li><dl title="' . hsc($item['id']) . '">' . NL;
    echo '<dt>';
    if ($item['isimg']) {
        media_printimgdetail($item, true);
    } else {
        echo '<a name="d_:' . $item['id'] . '" class="image" title="' . $item['id'] . '" href="' . media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']), 'tab_details' => 'view')) . '">';
        echo media_printicon($item['id']);
        echo '</a>';
    }
    echo '</dt>' . NL;
    if (!$display_namespace) {
        $name = hsc($file);
    } else {
        $name = hsc($item['id']);
    }
    echo '<dd class="name"><a href="' . media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']), 'tab_details' => 'view')) . '" name="h_:' . $item['id'] . '">' . $name . '</a></dd>' . NL;
    if ($item['isimg']) {
        $size = '';
        $size .= (int) $item['meta']->getField('File.Width');
        $size .= '&#215;';
        $size .= (int) $item['meta']->getField('File.Height');
        echo '<dd class="size">' . $size . '</dd>' . NL;
    } else {
        echo '<dd class="size">&nbsp;</dd>' . NL;
    }
    $date = dformat($item['mtime']);
    echo '<dd class="date">' . $date . '</dd>' . NL;
    $filesize = filesize_h($item['size']);
    echo '<dd class="filesize">' . $filesize . '</dd>' . NL;
    echo '</dl></li>' . NL;
}
开发者ID:nblock,项目名称:dokuwiki,代码行数:43,代码来源:media.php

示例12: media_printfile

/**
 * Formats and prints one file in the list
 */
function media_printfile($item, $auth, $jump, $display_namespace = false)
{
    global $lang;
    global $conf;
    // Prepare zebra coloring
    // I always wanted to use this variable name :-D
    static $twibble = 1;
    $twibble *= -1;
    $zebra = $twibble == -1 ? 'odd' : 'even';
    // Automatically jump to recent action
    if ($jump == $item['id']) {
        $jump = ' id="scroll__here" ';
    } else {
        $jump = '';
    }
    // Prepare fileicons
    list($ext, $mime, $dl) = mimetype($item['file'], false);
    $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext);
    $class = 'select mediafile mf_' . $class;
    // Prepare filename
    $file = utf8_decodeFN($item['file']);
    // Prepare info
    $info = '';
    if ($item['isimg']) {
        $info .= (int) $item['meta']->getField('File.Width');
        $info .= '&#215;';
        $info .= (int) $item['meta']->getField('File.Height');
        $info .= ' ';
    }
    $info .= '<i>' . dformat($item['mtime']) . '</i>';
    $info .= ' ';
    $info .= filesize_h($item['size']);
    // output
    echo '<div class="' . $zebra . '"' . $jump . '>' . NL;
    if (!$display_namespace) {
        echo '<a name="h_:' . $item['id'] . '" class="' . $class . '">' . hsc($file) . '</a> ';
    } else {
        echo '<a name="h_:' . $item['id'] . '" class="' . $class . '">' . hsc($item['id']) . '</a><br/>';
    }
    echo '<span class="info">(' . $info . ')</span>' . NL;
    media_fileactions($item, $auth);
    echo '<div class="example" id="ex_' . str_replace(':', '_', $item['id']) . '">';
    echo $lang['mediausage'] . ' <code>{{:' . $item['id'] . '}}</code>';
    echo '</div>';
    if ($item['isimg']) {
        media_printimgdetail($item);
    }
    echo '<div class="clearer"></div>' . NL;
    echo '</div>' . NL;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:53,代码来源:media.php

示例13: processFieldsBuildTable

 /**
  * Create html and plain table of the field
  * and collect values for subject and replyto
  *
  * @param helper_plugin_bureaucracy_field[] $fields
  * @param Mailer $mail
  * @return array of html and text table
  */
 protected function processFieldsBuildTable($fields, $mail)
 {
     global $ID;
     $table_html = '<table>';
     $table_text = '';
     foreach ($fields as $field) {
         $html = $text = '';
         $value = $field->getParam('value');
         $label = $field->getParam('label');
         switch ($field->getFieldType()) {
             case 'fieldset':
                 if (!empty($field->depends_on)) {
                     //print fieldset only if depend condition is true
                     foreach ($fields as $field_tmp) {
                         if ($field_tmp->getParam('label') === $field->depends_on[0] && $field_tmp->getParam('value') === $field->depends_on[1]) {
                             list($html, $text) = $this->mail_buildRow($label);
                         }
                     }
                 } else {
                     list($html, $text) = $this->mail_buildRow($label);
                 }
                 break;
             case 'file':
                 if ($value === null || $label === null) {
                     break;
                 }
                 //print attachment only if field was visible
                 $file = $field->getParam('file');
                 if (!$file['size']) {
                     $message = $this->getLang('attachmentMailEmpty');
                 } else {
                     if ($file['size'] > $this->getConf('maxEmailAttachmentSize')) {
                         $message = $file['name'] . ' ' . $this->getLang('attachmentMailToLarge');
                         msg(sprintf($this->getLang('attachmentMailToLarge_userinfo'), hsc($file['name']), filesize_h($this->getConf('maxEmailAttachmentSize'))), 2);
                     } else {
                         $message = $file['name'];
                         $mail->attachFile($file['tmp_name'], $file['type'], $file['name']);
                     }
                 }
                 list($html, $text) = $this->mail_buildRow($label, $message);
                 break;
             case 'subject':
                 $this->subject = $label;
                 break;
             case 'usemailtemplate':
                 if (!is_null($field->getParam('template'))) {
                     $this->mailtemplate = $this->replace($field->getParam('template'));
                     resolve_pageid(getNS($ID), $this->mailtemplate, $ignored);
                 }
                 break;
             default:
                 if ($value === null || $label === null) {
                     break;
                 }
                 list($html, $text) = $this->mail_buildRow($label, $value);
                 if (!is_null($field->getParam('replyto'))) {
                     $this->replyto[] = $value;
                 }
         }
         $table_html .= $html;
         $table_text .= $text;
     }
     $table_html .= '</table>';
     return array($table_html, $table_text);
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-bureaucracy,代码行数:73,代码来源:actionmail.php

示例14: listtable

 /**
  * Print a simple listing table
  *
  * @param array  $data
  * @param float  $max
  * @param string $title
  * @param bool   $istraffic
  * @return void
  */
 private function listtable(&$data, $max, $title, $istraffic = false)
 {
     if (!$data) {
         $data = array();
     }
     arsort($data);
     $row = 1;
     $this->R->table_open();
     $this->R->tablerow_open();
     $this->head($title, 4);
     $this->R->tablerow_close();
     $this->R->tablerow_open();
     $this->head('#');
     $this->head($this->getLang('name'));
     if ($istraffic) {
         $this->head($this->getLang('traffic'), 2);
     } else {
         $this->head($this->getLang('hits'), 2);
     }
     $this->R->tablerow_close();
     foreach ($data as $key => $count) {
         if ($istraffic) {
             $val = filesize_h($count);
         } else {
             $val = $count;
         }
         $this->R->tablerow_open();
         $this->cell($row);
         $this->hcell($key);
         $this->cell($val);
         $this->cell($this->pct($count, $max));
         $this->R->tablerow_close();
         $row++;
         if ($row > $this->log->top_limit) {
             break;
         }
     }
     $this->R->table_close();
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:48,代码来源:table.php

示例15: _mod_media_printfile_thumbs

 /**
  * Formats and prints one file in the list in the thumbnails view
  *
  * @see media_printfile_thumbs()
  */
 function _mod_media_printfile_thumbs($item, $auth, $jump = false, $display_namespace = false)
 {
     global $lang;
     global $conf;
     // Prepare filename
     $file = $this->_getOriginalFileName($item['id']);
     if ($file === false) {
         $file = utf8_decodeFN($item['file']);
     }
     // build fake media id
     $ns = getNS($item['id']);
     $fakeId = $ns === false ? $file : "{$ns}:{$file}";
     $fakeId_escaped = hsc($fakeId);
     // output
     echo '<li><dl title="' . $fakeId_escaped . '">' . NL;
     echo '<dt>';
     if ($item['isimg']) {
         media_printimgdetail($item, true);
     } else {
         echo '<a name="d_:' . $item['id'] . '" class="image" title="' . $fakeId_escaped . '" href="' . media_managerURL(array('image' => $fakeId, 'ns' => $ns, 'tab_details' => 'view')) . '">';
         echo media_printicon($fakeId_escaped);
         echo '</a>';
     }
     echo '</dt>' . NL;
     if (!$display_namespace) {
         $name = hsc($file);
     } else {
         $name = $fakeId_escaped;
     }
     echo '<dd class="name"><a href="' . media_managerURL(array('image' => $fakeId, 'ns' => $ns, 'tab_details' => 'view')) . '" name="h_:' . $item['id'] . '">' . $name . '</a></dd>' . NL;
     if ($item['isimg']) {
         $size = '';
         $size .= (int) $item['meta']->getField('File.Width');
         $size .= '&#215;';
         $size .= (int) $item['meta']->getField('File.Height');
         echo '<dd class="size">' . $size . '</dd>' . NL;
     } else {
         echo '<dd class="size">&#160;</dd>' . NL;
     }
     $date = dformat($item['mtime']);
     echo '<dd class="date">' . $date . '</dd>' . NL;
     $filesize = filesize_h($item['size']);
     echo '<dd class="filesize">' . $filesize . '</dd>' . NL;
     echo '</dl></li>' . NL;
 }
开发者ID:kazmiya,项目名称:dokuwiki-plugin-preservefilenames,代码行数:50,代码来源:action_angua.php


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