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


PHP Text::bytes方法代码示例

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


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

示例1: get_list

 public function get_list()
 {
     $files = array();
     $handle = opendir(BACKUP_PLUGIN_FOLDER);
     while (false !== ($file = readdir($handle))) {
         if (!preg_match("/(sql|zip)/", $file, $m)) {
             continue;
         }
         $date_create = preg_replace('![^\\d]*!', '', $file);
         $date_create = preg_replace('#^([\\d]{4})([\\d]{2})([\\d]{2})([\\d]{2})([\\d]{2})([\\d]{2})$#', '$3/$2/$1 $4:$5:$6', $date_create);
         $files[$file] = array('size' => Text::bytes(filesize(BACKUP_PLUGIN_FOLDER . $file)), 'path' => BACKUP_PLUGIN_FOLDER . $file, 'date' => $date_create);
     }
     closedir($handle);
     $this->response(View::factory('backup/list', array('files' => $files))->render());
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:15,代码来源:backup.php

示例2: check_files

 /**
  * Проверка файлов на различия, проверяется по размеру файла и наличие файла в ФС
  * @retun array
  */
 public static function check_files()
 {
     $respoonse = self::request('https://api.github.com/repos/:rep/git/trees/:branch?recursive=true');
     $respoonse = json_decode($respoonse, TRUE);
     $files = array('new_files' => array(), 'diff_files' => array(), 'third_party_plugins' => array());
     $cache = Cache::instance();
     $cached_files = $cache->get(self::CACHE_KEY_FILES);
     if ($cached_files !== NULL) {
         return $cached_files;
     }
     if (isset($respoonse['tree'])) {
         $plugins = array();
         foreach ($respoonse['tree'] as $row) {
             $filepath = DOCROOT . $row['path'];
             if (!file_exists($filepath)) {
                 $files['new_files'][] = self::build_remote_url('https://raw.githubusercontent.com/:rep/:branch/' . $row['path']);
                 continue;
             }
             if (is_dir($filepath)) {
                 if (preg_match('/cms\\/plugins\\/([\\w\\_]+)/', $filepath, $matches)) {
                     if (!empty($matches[1])) {
                         $plugins[$matches[1]] = $matches[1];
                     }
                 }
                 continue;
             }
             $filesize = filesize($filepath);
             if ($filesize != $row['size']) {
                 $diff = $filesize - self::_count_file_lines($filepath) - $row['size'];
                 if ($diff > 1 or $diff < -1) {
                     $files['diff_files'][] = array('diff' => Text::bytes($diff), 'url' => self::build_remote_url('https://raw.githubusercontent.com/:rep/:branch/' . $row['path']));
                 }
             }
         }
         if (!empty($plugins)) {
             $local_plugins = array_keys(Plugins::find_all());
             $files['third_party_plugins'] = array_diff($local_plugins, $plugins);
         }
         $cache->set(self::CACHE_KEY_FILES, $files);
     }
     return $files;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:46,代码来源:update.php

示例3: confirm

" data-pk="<?php 
        echo $item['key'];
        ?>
" data-url="<?php 
        echo URL::site('phpredmin/expire/' . $curr_db);
        ?>
" data-title="Key Expiration"><?php 
        echo $item['ttl'];
        ?>
</a></td>
    <td><?php 
        echo $item['encode'];
        ?>
</td>
    <td><?php 
        echo Text::bytes($item['size']);
        ?>
</td>
    <td>
        <a href="<?php 
        echo URL::site('phpredmin/view/' . $curr_db . '?key=' . $item['key']);
        ?>
" class="btn btn-info btn-xs view-detail" data-key="<?php 
        echo $item['key'];
        ?>
">查看</a>&nbsp;&nbsp;&nbsp;
        <a href="<?php 
        echo URL::site('phpredmin/del/' . $curr_db . '?key=' . $item['key']);
        ?>
" class="btn btn-danger btn-xs" onclick="return confirm('确定删除吗?')">删除</a>
    </td>
开发者ID:noikiy,项目名称:kohana,代码行数:31,代码来源:keys.php

示例4: array

        ?>
 <?php 
        echo $snippet->name;
        ?>
					<?php 
    }
    ?>
				</th>
				<td class="modified hidden-xs">
					<?php 
    echo Date::format($snippet->modified());
    ?>
				</td>
				<td class="size">
					<?php 
    echo Text::bytes($snippet->size());
    ?>
				</td>
				<td class="direction hidden-xs">
					<?php 
    echo UI::label($snippet->get_relative_path());
    ?>
				</td>
				<td class="actions text-right">
					<?php 
    if (ACL::check('snippet.delete')) {
        ?>
					<?php 
        echo UI::button(NULL, array('href' => Route::get('backend')->uri(array('controller' => 'snippet', 'action' => 'delete', 'id' => $snippet->name)), 'icon' => UI::icon('times fa-inverse'), 'class' => 'btn-xs btn-danger btn-confirm'));
        ?>
					<?php 
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:31,代码来源:index.php

示例5: getUploadsMaxSizeInBytes

 public function getUploadsMaxSizeInBytes($directoryIndex, $primary)
 {
     $size = 0;
     $data = $this->getEditData($primary);
     if (!empty($data) && !empty($data['uploadsDirs']) && !empty($data['uploadsDirs'][$directoryIndex])) {
         $data = $data['uploadsDirs'][$directoryIndex];
         $modelSize = null;
         if (!empty($data['uploadMaxSize']) && is_numeric($data['uploadMaxSize']) && $data['uploadMaxSize'] > 0) {
             $modelSize = intval($data['uploadMaxSize']);
         }
         $size = Admin::getMaximumFileUploadSize($modelSize);
     }
     return Text::bytes($size);
 }
开发者ID:s4urp8n,项目名称:kohana-admin,代码行数:14,代码来源:Admin.php

示例6: number_format

			<td><?php 
    echo Text::bytes($file['size']);
    ?>
</td>
			<td><?php 
    echo $file['lines'];
    ?>
</td>
		</tr>
		<?php 
    $total_size += $file['size'];
    ?>
		<?php 
    $total_lines += $file['lines'];
    ?>
		<?php 
}
?>
		<tr align="left">
			<th colspan="2">total</th>
			<th><?php 
echo Text::bytes($total_size);
?>
</th>
			<th><?php 
echo number_format($total_lines);
?>
</th>
		</tr>
	</table>
</div>
开发者ID:nexeck,项目名称:kohana-debugger,代码行数:31,代码来源:files.php

示例7: round

			<?php 
        echo Text::auto_p(Text::auto_link($codebench['description']), FALSE);
        ?>
		<?php 
    }
    ?>

		<?php 
    // echo '<h2>Raw output:</h2>', Kohana::debug($codebench)
    ?>

	<?php 
}
?>

	<p id="footer">
		Page executed in <strong><?php 
echo round(microtime(TRUE) - KOHANA_START_TIME, 2);
?>
&nbsp;s</strong>
		using <strong><?php 
echo Text::widont(Text::bytes(memory_get_usage(), 'MB'));
?>
</strong> of memory.<br />
		<a href="http://github.com/kohana/codebench">Codebench</a>, a <a href="http://kohanaframework.org/">Kohana</a> module
		by <a href="http://www.geertdedeckere.be/article/introducing-codebench">Geert De Deckere</a>.
	</p>

</body>
</html>
开发者ID:bosoy83,项目名称:progtest,代码行数:30,代码来源:codebench.php

示例8: round

			<?php 
if (Kohana::$config->load('debugger.panels.benchmarks')) {
    ?>
			<!-- Time -->
			<li id="time" onclick="debugToolbar.show('debug-benchmarks'); return false;">
				<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKrSURBVDjLpdPbT9IBAMXx/qR6qNbWUy89WS5rmVtutbZalwcNgyRLLMyuoomaZpRQCt5yNRELL0TkBSXUTBT5hZSXQPwBAvor/fZGazlb6+G8nIfP0znbgG3/kz+Knsbb+xxNV63DLxVLHzqV0vCrfMluzFmw1OW8ePEwf8+WgM1UXDnapVgLePr5Nj9DJBJGFEN8+TzKqL2RzkenV4yl5ws2BXob1WVeZxXhoB+PP0xzt0Bly0fKTePozV5GphYQPA46as+gU5/K+w2w6Ev2Ol/KpNCigM01R2uPgDcQIRSJEYys4JmNoO/y0tbnY9JlxnA9M15bfHZHCnjzVN4x7TLz6fMSJqsPgLAoMvV1niSQBGIbUP3Ki93t57XhItVXjulTQHf9hfk5/xgGyzQTgQjx7xvE4nG0j3UsiiLR1VVaLN3YpkTuNLgZGzRSq8wQUoD16flkOPSF28/cLCYkwqvrrAGXC1UYWtuRX1PR5RhgTJTI1Q4wKwzwWHk4kQI6a04nQ99mUOlczMYkFhPrBMQoN+7eQ35Nhc01SvA7OEMSFzTv8c/0UXc54xfQcj/bNzNmRmNy0zctMpeEQFSio/cdvqUICz9AiEPb+DLK2gE+2MrR5qXPpoAn6mxdr1GBwz1FiclDcAPCEkTXIboByz8guA75eg8WxxDtFZloZIdNKaDu5rnt9UVHE5POep6Zh7llmsQlLBNLSMTiEm5hGXXDJ6qb3zJiLaIiJy1Zpjy587ch1ahOKJ6XHGGiv5KeQSfFun4ulb/josZOYY0di/0tw9YCquX7KZVnFW46Ze2V4wU1ivRYe1UWI1Y1vgkDvo9PGLIoabp7kIrctJXSS8eKtjyTtuDErrK8jIYHuQf8VbK0RJUsLfEg94BfIztkLMvP3v3XN/5rfgIYvAvmgKE6GAAAAABJRU5ErkJggg==" alt="time">
				<?php 
    echo round(Debugger::get_benchmark_application()->current['time'] * 1000, 2);
    ?>
 ms
			</li>
			<!-- Memory -->
			<li id="memory" onclick="debugToolbar.show('debug-benchmarks'); return false;">
				<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGvSURBVDjLpZO7alZREEbXiSdqJJDKYJNCkPBXYq12prHwBezSCpaidnY+graCYO0DpLRTQcR3EFLl8p+9525xgkRIJJApB2bN+gZmqCouU+NZzVef9isyUYeIRD0RTz482xouBBBNHi5u4JlkgUfx+evhxQ2aJRrJ/oFjUWysXeG45cUBy+aoJ90Sj0LGFY6anw2o1y/mK2ZS5pQ50+2XiBbdCvPk+mpw2OM/Bo92IJMhgiGCox+JeNEksIC11eLwvAhlzuAO37+BG9y9x3FTuiWTzhH61QFvdg5AdAZIB3Mw50AKsaRJYlGsX0tymTzf2y1TR9WwbogYY3ZhxR26gBmocrxMuhZNE435FtmSx1tP8QgiHEvj45d3jNlONouAKrjjzWaDv4CkmmNu/Pz9CzVh++Yd2rIz5tTnwdZmAzNymXT9F5AtMFeaTogJYkJfdsaaGpyO4E62pJ0yUCtKQFxo0hAT1JU2CWNOJ5vvP4AIcKeao17c2ljFE8SKEkVdWWxu42GYK9KE4c3O20pzSpyyoCx4v/6ECkCTCqccKorNxR5uSXgQnmQkw2Xf+Q+0iqQ9Ap64TwAAAABJRU5ErkJggg==" alt="memory">
				<?php 
    echo Text::bytes(Debugger::get_benchmark_application()->current['memory']);
    ?>
			</li>
			<?php 
}
?>

			<!-- Database -->
			<?php 
if (Kohana::$config->load('debugger.panels.database')) {
    ?>
			<li id="toggle-database" onclick="debugToolbar.show('debug-database'); return false;">
				<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAEYSURBVBgZBcHPio5hGAfg6/2+R980k6wmJgsJ5U/ZOAqbSc2GnXOwUg7BESgLUeIQ1GSjLFnMwsKGGg1qxJRmPM97/1zXFAAAAEADdlfZzr26miup2svnelq7d2aYgt3rebl585wN6+K3I1/9fJe7O/uIePP2SypJkiRJ0vMhr55FLCA3zgIAOK9uQ4MS361ZOSX+OrTvkgINSjS/HIvhjxNNFGgQsbSmabohKDNoUGLohsls6BaiQIMSs2FYmnXdUsygQYmumy3Nhi6igwalDEOJEjPKP7CA2aFNK8Bkyy3fdNCg7r9/fW3jgpVJbDmy5+PB2IYp4MXFelQ7izPrhkPHB+P5/PjhD5gCgCenx+VR/dODEwD+A3T7nqbxwf1HAAAAAElFTkSuQmCC" alt="database">
				<?php 
    echo count(Debugger::get_database_queries());
    ?>
开发者ID:nexeck,项目名称:kohana-debugger,代码行数:31,代码来源:toolbar.php

示例9: disk_total_space

<?php 
echo Text::auto_link_emails('My email is someone@somewhere.ca and my web site is www.kohanaphp.com');
?>

<br/>

<?php 
$string = "This is a block of\ntext that has\n\nSome line breaks in it.";
echo Text::auto_p($string);
?>

<br/>

<pre>
<?php 
echo "Simple:<br/>";
echo Text::bytes(5500), "\n";
echo Text::bytes(17139812000), "\n\n";
// Maximum unit
echo "Max units in MB:\n";
echo Text::bytes(81620000000, 'MB'), "\n\n";
// 4 decimal accuracy
echo "4 decimals:\n";
echo Text::bytes(91711816100, null, '%01.4f %s', TRUE), "\n\n";
// 1 decimal accuracy, units in brackets, max unit in MB
echo "1 decimal, units in brackets, max unit of MB:\n";
$size = disk_total_space('/home');
echo Text::bytes($size, 'MB', '%01.1f (%s)', TRUE);
?>
</pre>
开发者ID:ChangLeoplod,项目名称:kohana-demo,代码行数:30,代码来源:text.php

示例10: __

						</div>
					</div>
				</div>
				<p class="help-block">
					<?php 
if (!empty($field->types)) {
    ?>
					<?php 
    echo __('Allowed types: :types', array(':types' => is_array($field->types) ? implode(', ', $field->types) : ''));
    ?>
.
					<?php 
}
?>
					<?php 
echo __('Max file size: :size', array(':size' => Text::bytes($field->max_size)));
?>
				</p>

				<?php 
if (!empty($value)) {
    ?>
				<hr class="no-margin-b"/>
				<?php 
}
?>
			</div>

			<?php 
if (!empty($value)) {
    ?>
开发者ID:ortodesign,项目名称:cms,代码行数:31,代码来源:file_file.php

示例11: testBytes

	public function testBytes()
	{
		$bytes = 60004;
		$size = Text::bytes($bytes);
		$this->assertSame('60.00 kB', $size);
	}
开发者ID:nexeck,项目名称:docs,代码行数:6,代码来源:NumTest.php

示例12: implode

        echo implode(', ', $layout->blocks());
        ?>
</span>
					</span>
					<?php 
    }
    ?>
				</th>
				<td class="modified hidden-xs">
					<?php 
    echo Date::format($layout->modified());
    ?>
				</td>
				<td class="size">
					<?php 
    echo Text::bytes($layout->size());
    ?>
				</td>
				<td class="direction hidden-xs">
					<?php 
    echo UI::label($layout->get_relative_path());
    ?>
				</td>
				<td class="actions text-right">
					<?php 
    if (ACL::check('layout.delete')) {
        ?>
					<?php 
        echo UI::button(NULL, array('icon' => UI::icon('times fa-inverse'), 'href' => Route::get('backend')->uri(array('controller' => 'layout', 'action' => 'delete', 'id' => $layout->name)), 'class' => 'btn-danger btn-xs btn-confirm'));
        ?>
					<?php 
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:31,代码来源:index.php

示例13: exif

 /**
  * Render EXIF info.
  *
  * @return  array
  */
 public function exif()
 {
     // Basic info
     $info = array('<span>&copy;</span> ' . __('Copyright') => $this->image->author_id ? HTML::user($this->image->author_id) : null, '<i class="fa fa-fw fa-upload"></i> ' . __('Added') => HTML::time(Date::format('DMYYYY_HM', $this->image->created), $this->image->created), '<i class="fa fa-fw fa-comment"></i> ' . __('Comments') => (int) $this->image->comment_count, '<i class="fa fa-fw fa-eye"></i> ' . __('Views') => (int) $this->image->view_count);
     // EXIF info
     if ($exif = $this->image->exif()) {
         if ($exif->make || $exif->model) {
             $info['<i class="fa fa-fw fa-camera-retro"></i> ' . __('Camera')] = ($exif->make ? HTML::chars($exif->make) : '') . ($exif->model ? ($exif->make ? '<br />' : '') . HTML::chars($exif->model) : '');
         }
         if ($exif->exposure) {
             $info['<i class="fa fa-fw fa-sun-o"></i> ' . __('Shutter Speed')] = HTML::chars($exif->exposure);
         }
         if ($exif->aperture) {
             $info['<i class="fa fa-fw fa-circle-o"></i> ' . __('Aperture')] = HTML::chars($exif->aperture);
         }
         if ($exif->focal) {
             $info['<i class="fa fa-fw fa-road"></i> ' . __('Focal Length')] = HTML::chars($exif->focal);
         }
         if ($exif->iso) {
             $info['<span class="iso fa fa-fw">iso</span> ' . __('ISO Speed')] = HTML::chars($exif->iso);
         }
         if ($exif->lens) {
             $info['<i class="fa fa-fw fa-cd"></i> ' . __('Lens')] = HTML::chars($exif->lens);
         }
         if ($exif->flash) {
             $info['<i class="fa fa-fw fa-bolt"></i> ' . __('Flash')] = HTML::chars($exif->flash);
         }
         if ($exif->program) {
             $info['<i class="fa fa-fw fa-cloud"></i> ' . __('Program')] = HTML::chars($exif->program);
         }
         if ($exif->metering) {
             $info['<i class="fa fa-fw fa-th"></i> ' . __('Metering')] = HTML::chars($exif->metering);
         }
         if ($exif->latitude) {
             $info['<i class="fa fa-fw fa-arrows-h"></i> ' . __('Latitude')] = HTML::chars($exif->latitude);
         }
         if ($exif->longitude) {
             $info['<i class="fa fa-fw fa-arrows-v"></i> ' . __('Longitude')] = HTML::chars($exif->longitude);
         }
         if ($exif->altitude) {
             $info['<i class="fa fa-fw fa-long-arrow-up"></i> ' . __('Altitude')] = HTML::chars($exif->altitude) . 'm';
         }
         if ($exif->taken) {
             $info['<i class="fa fa-fw fa-calendar"></i> ' . __('Taken')] = Date::format('DMYYYY_HM', $exif->taken);
         }
     }
     // Original image
     $info['<i class="fa fa-fw fa-external-link"></i> ' . __('Original')] = HTML::anchor($this->image->get_url(Model_Image::SIZE_ORIGINAL), sprintf('%d&times;%d <small>(%s)</small>', $this->image->original_width, $this->image->original_height, Text::bytes($this->image->original_size, 'kB')), array('target' => '_blank', 'title' => __('Open in new tab')));
     return $info;
 }
开发者ID:anqh,项目名称:anqh,代码行数:55,代码来源:full.php

示例14: __

		</span>
	</div>
</div>

<hr />
<div class="form-group form-inline">
	<label class="control-label col-md-3"><?php 
echo __('Max file size');
?>
</label>
	<div class="col-md-9">
		<?php 
echo Form::input('max_size', $field->max_size, array('class' => 'form-control', 'id' => 'max_size', 'size' => 10));
?>
&nbsp;&nbsp;&nbsp;(<?php 
echo Text::bytes($field->max_size);
?>
)
		<span class="flags">
			<span class="label" data-value="<?php 
echo NUM::bytes('100K');
?>
">100k</span>
			<span class="label" data-value="<?php 
echo NUM::bytes('1MiB');
?>
">1Mib</span>
			<span class="label" data-value="<?php 
echo NUM::bytes('5MiB');
?>
">5Mib</span>
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:31,代码来源:file_file.php

示例15: byte

 /**
  * 输出字节格式化
  *
  * @param string a definitive unit
  * @param string the return string format
  * @param boolean whether to use SI prefixes or IEC
  * @return string
  */
 public function byte($force_unit = null, $format = null, $si = true)
 {
     return Text::bytes((int) $this->data, $force_unit, $format, $si);
 }
开发者ID:liuyu121,项目名称:myqee,代码行数:12,代码来源:str.class.php


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