Skip to content

Commit

Permalink
adding documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
shapeshed committed Jan 30, 2009
1 parent c974d8f commit bacd570
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 31 deletions.
73 changes: 73 additions & 0 deletions README.markdown
@@ -0,0 +1,73 @@
Human Filesize - Shows the size of a file in human readable format
===========================================================================

**Author**: [George Ornbo][]
**Source Code**: [Github][]

Installation
-----

This file pi.human_filesize.php must be placed in the /system/plugins/ folder in your [ExpressionEngine][] installation.

Name
------------------

Human Filesize

Synopsis
-------

Shows the size of a file in human readable format

Description
-------

This plugin returns the size of a file in human readable format (e.g 101.34 KB, 10.41 GB ) Wrap the absolute path filename in these tags to have it processed

{exp:ss_human_filesize}/uploads/documents/your_document.pdf{/exp:ss_human_filesize}

If you are using Mark Huot's File extension you can just use the EE tag you chose for the file field

{exp:ss_human_file_size}{your_file_field}{/exp:ss_human_file_size}

The function calculates whether to show KB, MB or GB depending on the file size.

Parameters
-------

There are currently no parameters

Single Variables
-------

There are currently no single variables

Examples
-------

{exp:ss_human_filesize}/uploads/documents/your_document.pdf{/exp:ss_human_filesize}

Compatibility
-------

ExpressionEngine Version 1.6.x

See also
-------

http://expressionengine.com/forums/viewthread/92466/

License
-------

Friendly 404 is licensed under a [Open Source Initiative - BSD License][] license.

---

This file is written using the MarkDown syntax. It may or may not have been parsed. If you are having trouble reading it try running the contents through http://daringfireball.net/projects/markdown/dingus.

[George Ornbo]: http://shapeshed.com/
[Github]: http://github.com/shapeshed/human_filesize.ee_addon/
[ExpressionEngine]:http://www.expressionengine.com/index.php?affiliate=shapeshed
[Open Source Initiative - BSD License]: http://opensource.org/licenses/bsd-license.php
63 changes: 32 additions & 31 deletions pi.ss_human_filesize.php
@@ -1,31 +1,37 @@
<?php
/**
* Plugin File for Shape Shed Human Filesize Plugin
*
* Returns the size of a file in human readable format (e.g 101.34 KB )
*
* This file must be placed in the
* /system/plugins/ folder in your ExpressionEngine installation.
*
* @version 1.0.0
* @author George Ornbo <http://shapeshed.com/>
* @license {@link http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-Share Alike 3.0 Unported} All source code commenting and attribution must not be removed. This is a condition of the attribution clause of the license.
*/
/**
* ExpressionEngine
*
* LICENSE
*
* ExpressionEngine by EllisLab is copyrighted software
* The licence agreement is available here http://expressionengine.com/docs/license.html
*
* Human Filesize
*
* @category Plugins
* @package Human Filesize
* @version 1.1.0
* @since 1.0.0
* @author George Ornbo <george@shapeshed.com>
* @see {@link http://github.com/shapeshed/human_filesize.ee_addon/}
* @license {@link http://www.opensource.org/licenses/mit-license.php}
*/

/**
* Plugin information used by ExpressionEngine
* @global array $plugin_info
*/
$plugin_info = array(
'pi_name' => 'SS Human Filesize',
'pi_name' => 'Human Filesize',
'pi_version' => '1.0.0',
'pi_author' => 'George Ornbo, Shape Shed',
'pi_author' => 'George Ornbo',
'pi_author_url' => 'http://shapeshed.com/',
'pi_description' => 'Shows the size of a file in human readable format',
'pi_usage' => Ss_human_filesize::usage()
);

class Ss_human_filesize{
class Human_filesize{

/**
* Returned string
Expand All @@ -38,7 +44,7 @@ class Ss_human_filesize{
* Get the document size
* @access public
*/
function Ss_human_filesize()
function Human_filesize()
{

global $TMPL, $FNS;
Expand Down Expand Up @@ -87,24 +93,19 @@ function Ss_human_filesize()
* @return string Plugin usage instructions
*/

function usage()
{

return "This plugin returns the size of a file in human readable format (e.g 101.34 KB, 10.41 GB )
Wrap the absolute path filename in these tags to have it processed
{exp:doc_size}/uploads/documents/your_document.pdf{/exp:doc_size}
function usage()
{
ob_start();
?>
See http://github.com/shapeshed/human_filesize.ee_addon/

If you are using Mark Huot's File extension you can just use the EE tag you chose for the file field
<?php
$buffer = ob_get_contents();

{exp:ss_human_file_size}{your_file_field}{/exp:ss_human_file_size}
The function calculates whether to show KB, MB or GB depending on the file size.
";
ob_end_clean();

}
return $buffer;
}

}

Expand Down

0 comments on commit bacd570

Please sign in to comment.