diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-05-05 18:39:18 +0200 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-05-05 18:39:18 +0200 |
commit | 7327499064ae165468c7440f8571c3e570b58a0b (patch) | |
tree | 4f0d0053e7d25f7064c63070edcbc3af114abed9 /user_guide | |
parent | 7539f67a23c8536f892263d8d7ab9448655d8e22 (diff) |
Added get_dir_file_info(), get_file_info(), and get_mime_by_extension() to the File Helper.
Changed ( ! condition) into (! condition) within the code
Diffstat (limited to 'user_guide')
-rw-r--r-- | user_guide/changelog.html | 7 | ||||
-rw-r--r-- | user_guide/helpers/file_helper.html | 19 | ||||
-rw-r--r-- | user_guide/libraries/email.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/encryption.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/file_uploading.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/image_lib.html | 6 | ||||
-rw-r--r-- | user_guide/libraries/input.html | 4 | ||||
-rw-r--r-- | user_guide/libraries/trackback.html | 4 | ||||
-rw-r--r-- | user_guide/libraries/xmlrpc.html | 4 |
9 files changed, 30 insertions, 20 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index f52aa7732..9817d162a 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -94,6 +94,7 @@ SVN Commit: not currently released</p> <li>Modified <kbd>anchor()</kbd> in the <a href="helpers/url_helper.html">URL helper</a> to convert entities in the title attribute (#4209).</li>
<li>The <a href="helpers/download_helper.html">Download helper</a> now exits within <kbd>force_download()</kbd>.</li>
<li>The <a href="helpers/download_helper.html">Zip class</a> now exits within <kbd>download()</kbd>.</li>
+ <li>Added <kbd>get_dir_file_info()</kbd>, <kbd>get_file_info()</kbd>, and <kbd>get_mime_by_extension()</kbd> to the <a href="helpers/file_helper.html">File Helper</a>.</li>
</ul>
</li>
<li>Plugins
@@ -101,11 +102,11 @@ SVN Commit: not currently released</p> <li>Modified captcha generation to first look for the function imagecreatetruecolor, and fallback to imagecreate if it isn't available (#4226).</li>
</ul>
</li>
-</ul>
+ </ul>
<h3>Bugfixes for 1.6.2</h3>
<ul>
- <li>Fixed assorted user guide typos (#3453, #4364, #4379, #4399, #4408, #4412, #4448).</li>
+ <li>Fixed assorted user guide typos (#3453, #4364, #4379, #4399, #4408, #4412, #4448, #4488).</li>
<li>Fixed an AR_caching error where it wasn't tracking table aliases (#3463).</li>
<li>Fixed an AR bug when joining with a table alias and table prefix (#4400).</li>
<li>Fixed a bug in the DB class testing the $params argument.</li>
@@ -145,7 +146,7 @@ SVN Commit: not currently released</p> <li>Helpers
<ul>
<li>Modified <kbd>get_filenames()</kbd> in the File Helper to return FALSE if the $source_dir is not readable.</li>
- </ul>
+ </ul>
</li>
</ul>
diff --git a/user_guide/helpers/file_helper.html b/user_guide/helpers/file_helper.html index 80063a619..af724a9d4 100644 --- a/user_guide/helpers/file_helper.html +++ b/user_guide/helpers/file_helper.html @@ -18,7 +18,6 @@ <meta name='robots' content='all' />
<meta name='author' content='ExpressionEngine Dev Team' />
<meta name='description' content='CodeIgniter User Guide' />
-
</head>
<body>
@@ -89,7 +88,7 @@ might not work if you are trying to access a file above the calling script.</p> <code>
$data = 'Some file data';<br />
<br />
-if ( ! write_file('./path/to/file.php', $data))<br />
+if (! write_file('./path/to/file.php', $data))<br />
{<br />
echo 'Unable to write the file';<br />
}<br />
@@ -110,8 +109,6 @@ If the file does not already exist, the directory containing it must be writable <p class="important"><strong>Note:</strong> The path is relative to your main site index.php file, NOT your controller or view files.
CodeIgniter uses a front controller so paths are always relative to the main site index.</p>
-
-
<h2>delete_files('<var>path</var>')</h2>
<p>Deletes ALL files contained in the supplied path. Example:</p>
@@ -123,13 +120,25 @@ CodeIgniter uses a front controller so paths are always relative to the main sit <p class="important"><strong>Note:</strong> The files must be writable or owned by the system in order to be deleted.</p>
-
<h2>get_filenames('<var>path/to/directory/</var>')</h2>
<p>Takes a server path as input and returns an array containing the names of all files contained within it. The file path
can optionally be added to the file names by setting the second parameter to TRUE.</p>
+<h2>get_dir_file_info('<var>path/to/directory/</var>')</h2>
+
+<p>Reads the specified directory and builds an array containing the filenames, filesize, dates, and permissions. Any sub-folders contained within the specified path are read as well.</p>
+
+<h2>get_file_info('<var>path/to/file</var>', <kbd>$file_information</kbd>)</h2>
+
+<p>Given a file and path, returns the name, path, size, date modified. Second parameter allows you to explicitly declare what information you want returned; options are: name, server_path, size, date, readable, writable, executable, fileperms. Returns FALSE if the file cannot be found.</p>
+
+<p class="important"><strong>Note:</strong> The "writable" uses the PHP function is_writable() which is known to have issues on the IIS webserver. Consider using fileperms instead, which returns information from PHP's fileperms() function.</p>
+<h2>get_mime_by_extension('<var>path/to/file/</var>')</h2>
+
+<p>Translates a file extension into a mime type based on config/mimes.php. Returns FALSE if it can't determine the type, or open the mime config file.</p>
+<p class="important"><strong>Note:</strong> This is not an accurate way of determining file mime types, and is here strictly as a convenience. It should not be used for security.</p>
</div>
<!-- END CONTENT -->
diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html index a93614238..fb784a7d9 100644 --- a/user_guide/libraries/email.html +++ b/user_guide/libraries/email.html @@ -250,7 +250,7 @@ in a loop, permitting the data to be reset between cycles.</p> <p>The Email sending function. Returns boolean TRUE or FALSE based on success or failure, enabling it to be used
conditionally:</p>
-<code>if ( ! $this->email->send())<br />
+<code>if (! $this->email->send())<br />
{<br />
// Generate error<br />
}</code>
diff --git a/user_guide/libraries/encryption.html b/user_guide/libraries/encryption.html index 8c1766ac9..913b7b14f 100644 --- a/user_guide/libraries/encryption.html +++ b/user_guide/libraries/encryption.html @@ -140,7 +140,7 @@ $plaintext_string = $this->encrypt->decode($encrypted_string);</code> <p>Please visit php.net for a list of <a href="http://php.net/mcrypt">available ciphers</a>.</p>
<p>If you'd like to manually test whether your server supports Mcrypt you can use:</p>
-<code>echo ( ! function_exists('mcrypt_encrypt')) ? 'Nope' : 'Yup';</code>
+<code>echo (! function_exists('mcrypt_encrypt')) ? 'Nope' : 'Yup';</code>
<h2>$this->encrypt->set_mode();</h2>
diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html index a26a7e38f..9aa4f7157 100644 --- a/user_guide/libraries/file_uploading.html +++ b/user_guide/libraries/file_uploading.html @@ -167,7 +167,7 @@ class Upload extends Controller { $this->load->library('upload', $config);
- if ( ! $this->upload->do_upload())
+ if (! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html index 1c7380429..028414bdb 100644 --- a/user_guide/libraries/image_lib.html +++ b/user_guide/libraries/image_lib.html @@ -132,7 +132,7 @@ error message using this function:</p> <p>A good practice is use the processing function conditionally, showing an error upon failure, like this:</p>
-<code>if ( ! $this->image_lib->resize())<br />
+<code>if (! $this->image_lib->resize())<br />
{<br />
echo $this->image_lib->display_errors();<br />
}</code>
@@ -370,7 +370,7 @@ $config['y_axis'] = '60';<br /> $this->image_lib->initialize($config);
<br />
<br />
-if ( ! $this->image_lib->crop())<br />
+if (! $this->image_lib->crop())<br />
{<br />
echo $this->image_lib->display_errors();<br />
}</code>
@@ -407,7 +407,7 @@ $config['rotation_angle'] = 'hor';<br /> $this->image_lib->initialize($config);
<br />
<br />
-if ( ! $this->image_lib->rotate())<br />
+if (! $this->image_lib->rotate())<br />
{<br />
echo $this->image_lib->display_errors();<br />
}</code>
diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html index feabc4879..0b583a04e 100644 --- a/user_guide/libraries/input.html +++ b/user_guide/libraries/input.html @@ -120,7 +120,7 @@ return false (boolean) if not. This lets you conveniently use data without havi In other words, normally you might do something like this:</p>
<code>
-if ( ! isset($_POST['something']))<br />
+if (! isset($_POST['something']))<br />
{<br />
$something = FALSE;<br />
}<br />
@@ -178,7 +178,7 @@ else<br /> <p>Takes an IP address as input and returns TRUE or FALSE (boolean) if it is valid or not. Note: The $this->input->ip_address() function above
validates the IP automatically.</p>
-<code>if ( ! valid_ip($ip))<br />
+<code>if (! valid_ip($ip))<br />
{<br />
echo 'Not Valid';<br />
}<br />
diff --git a/user_guide/libraries/trackback.html b/user_guide/libraries/trackback.html index 513cbf2c9..6ca1fec49 100644 --- a/user_guide/libraries/trackback.html +++ b/user_guide/libraries/trackback.html @@ -86,7 +86,7 @@ $tb_data = array(<br /> 'charset' => 'utf-8'<br />
);<br />
<br />
-if ( ! $this->trackback->send($tb_data))<br />
+if (! $this->trackback->send($tb_data))<br />
{<br />
echo $this->trackback->display_errors();<br />
}<br />
@@ -173,7 +173,7 @@ if ($this->uri->segment(3) == FALSE)<br /> $this->trackback->send_error("Unable to determine the entry ID");<br />
}<br />
<br />
-if ( ! $this->trackback->receive())<br />
+if (! $this->trackback->receive())<br />
{<br />
$this->trackback->send_error("The Trackback did not contain valid data");<br />
}<br />
diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html index 8bec465ba..2f366bea0 100644 --- a/user_guide/libraries/xmlrpc.html +++ b/user_guide/libraries/xmlrpc.html @@ -120,7 +120,7 @@ $this->xmlrpc->method('weblogUpdates.ping');<br /> $request = array('My Photoblog', 'http://www.my-site.com/photoblog/');<br />
$this->xmlrpc->request($request);<br />
<br />
-if ( ! $this->xmlrpc->send_request())<br />
+if (! $this->xmlrpc->send_request())<br />
{<br />
echo $this->xmlrpc->display_error();<br />
}</code>
@@ -333,7 +333,7 @@ class Xmlrpc_client extends Controller { $request = array('How is it going?');
$this->xmlrpc->request($request);
- if ( ! $this->xmlrpc->send_request())
+ if (! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
}
|