summaryrefslogtreecommitdiff
path: root/inc/SafeFN.class.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-03-16 12:09:30 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-03-16 12:09:30 +0100
commit63703ba5bd81f50c43bc45f8bf79c514afa3ee49 (patch)
treebbfa7eef5fa5bdd6adc4438d2eb33679145d0c89 /inc/SafeFN.class.php
parentd086370fa9b2f3cfa66d4584ed76314e216df899 (diff)
downloadrpg-63703ba5bd81f50c43bc45f8bf79c514afa3ee49.tar.gz
rpg-63703ba5bd81f50c43bc45f8bf79c514afa3ee49.tar.bz2
coding style updates
Diffstat (limited to 'inc/SafeFN.class.php')
-rw-r--r--inc/SafeFN.class.php23
1 files changed, 12 insertions, 11 deletions
diff --git a/inc/SafeFN.class.php b/inc/SafeFN.class.php
index 43b19e9ab..ab05b9eae 100644
--- a/inc/SafeFN.class.php
+++ b/inc/SafeFN.class.php
@@ -1,17 +1,17 @@
<?php
/**
- * Class to safely store UTF-8 in a Filename
+ * Class to safely store UTF-8 in a Filename
*
- * Encodes a utf8 string using only the following characters 0-9a-z_.-%
- * characters 0-9a-z in the original string are preserved, "plain".
- * all other characters are represented in a substring that starts
- * with '%' are "converted".
- * The transition from converted substrings to plain characters is
- * marked with a '.'
+ * Encodes a utf8 string using only the following characters 0-9a-z_.-%
+ * characters 0-9a-z in the original string are preserved, "plain".
+ * all other characters are represented in a substring that starts
+ * with '%' are "converted".
+ * The transition from converted substrings to plain characters is
+ * marked with a '.'
*
- * @author Christopher Smith
- * @date 2010-04-02
+ * @author Christopher Smith <chris@jalakai.co.uk>
+ * @date 2010-04-02
*/
class SafeFN {
@@ -133,14 +133,15 @@ class SafeFN {
$converted = false;
foreach ($split as $sub) {
+ $len = strlen($sub);
if ($sub[0] != self::$pre_indicator) {
// plain (unconverted) characters, optionally starting with a post_indicator
// set initial value to skip any post_indicator
- for ($i=($converted?1:0); $i < strlen($sub); $i++) {
+ for ($i=($converted?1:0); $i < $len; $i++) {
$unicode[] = ord($sub[$i]);
}
$converted = false;
- } else if (strlen($sub)==1) {
+ } else if ($len==1) {
// a pre_indicator character in the real data
$unicode[] = ord($sub);
$converted = true;