From ec0a2dabd0ccfb4a6ea0bf8b044378e7b4dcbf56 Mon Sep 17 00:00:00 2001 From: messju Date: Thu, 11 Dec 2003 09:25:23 +0000 Subject: [PATCH] fixed indentiation --- libs/plugins/function.mailto.php | 150 +++++++++++++++---------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/libs/plugins/function.mailto.php b/libs/plugins/function.mailto.php index f6e3de0c..2c1b978b 100644 --- a/libs/plugins/function.mailto.php +++ b/libs/plugins/function.mailto.php @@ -27,7 +27,7 @@ * - newsgroups = (optional) newsgroup(s) to post to * - followupto = (optional) address(es) to follow up to * - extra = (optional) extra tags for the href link - * + * * Examples: *
  * {mailto address="me@domain.com"}
@@ -40,11 +40,11 @@
  * @link http://smarty.php.net/manual/en/language.function.mailto.php {mailto}
  *          (Smarty online manual)
  * @version  1.2
- * @author	 Monte Ohrt 
- * @author credits to Jason Sweat (added cc, bcc and subject functionality)
- * @param array
- * @param Smarty
- * @return string
+ * @author   Monte Ohrt 
+ * @author   credits to Jason Sweat (added cc, bcc and subject functionality)
+ * @param    array
+ * @param    Smarty
+ * @return   string
  */
 function smarty_function_mailto($params, &$smarty)
 {
@@ -55,84 +55,84 @@ function smarty_function_mailto($params, &$smarty)
         $smarty->trigger_error("mailto: missing 'address' parameter");
         return;
     }
-	
+
     if (empty($text)) {
-		$text = $address;
+        $text = $address;
     }
-	
-	// netscape and mozilla do not decode %40 (@) in BCC field (bug?)
-	// so, don't encode it.
-	
-	$mail_parms = array();
-	if (!empty($cc)) {
-		$mail_parms[] = 'cc='.str_replace('%40','@',rawurlencode($cc));
-	}
-	
-	if (!empty($bcc)) {
-		$mail_parms[] = 'bcc='.str_replace('%40','@',rawurlencode($bcc));
-	}
-	
-	if (!empty($subject)) {
-		$mail_parms[] = 'subject='.rawurlencode($subject);
-	}
 
-	if (!empty($newsgroups)) {
-		$mail_parms[] = 'newsgroups='.rawurlencode($newsgroups);
-	}
+    // netscape and mozilla do not decode %40 (@) in BCC field (bug?)
+    // so, don't encode it.
+
+    $mail_parms = array();
+    if (!empty($cc)) {
+        $mail_parms[] = 'cc='.str_replace('%40','@',rawurlencode($cc));
+    }
+
+    if (!empty($bcc)) {
+        $mail_parms[] = 'bcc='.str_replace('%40','@',rawurlencode($bcc));
+    }
+
+    if (!empty($subject)) {
+        $mail_parms[] = 'subject='.rawurlencode($subject);
+    }
+
+    if (!empty($newsgroups)) {
+        $mail_parms[] = 'newsgroups='.rawurlencode($newsgroups);
+    }
+
+    if (!empty($followupto)) {
+        $mail_parms[] = 'followupto='.str_replace('%40','@',rawurlencode($followupto));
+    }
 
-	if (!empty($followupto)) {
-		$mail_parms[] = 'followupto='.str_replace('%40','@',rawurlencode($followupto));
-	}
-	
     $mail_parm_vals = '';
-	for ($i=0; $itrigger_error("mailto: 'encode' parameter must be none, javascript or hex");
-        return;		
-	}
-	
-	if ($encode == 'javascript' ) {
-		$string = 'document.write(\''.$text.'\');';
-		
-		for ($x=0; $x < strlen($string); $x++) {
-			$js_encode .= '%' . bin2hex($string[$x]);
-		}
-	
-		return '';
-		
-	} elseif ($encode == 'hex') {
+        return;
+    }
 
-		preg_match('!^(.*)(\?.*)$!',$address,$match);
-		if(!empty($match[2])) {
-        	$smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.");
-        	return;						
-		}  
-		for ($x=0; $x < strlen($address); $x++) {
-			if(preg_match('!\w!',$address[$x])) {
-				$address_encode .= '%' . bin2hex($address[$x]);
-			} else {
-				$address_encode .= $address[$x];				
-			}
-		}
-		for ($x=0; $x < strlen($text); $x++) {
-			$text_encode .= '&#x' . bin2hex($text[$x]).';';
-		}
-		
-		return ''.$text_encode.'';
-		
-	} else {
-		// no encoding		
-		return ''.$text.'';
+    if ($encode == 'javascript' ) {
+        $string = 'document.write(\''.$text.'\');';
+
+        for ($x=0; $x < strlen($string); $x++) {
+            $js_encode .= '%' . bin2hex($string[$x]);
+        }
+
+        return '';
+
+    } elseif ($encode == 'hex') {
+
+        preg_match('!^(.*)(\?.*)$!',$address,$match);
+        if(!empty($match[2])) {
+            $smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.");
+            return;
+        }
+        for ($x=0; $x < strlen($address); $x++) {
+            if(preg_match('!\w!',$address[$x])) {
+                $address_encode .= '%' . bin2hex($address[$x]);
+            } else {
+                $address_encode .= $address[$x];
+            }
+        }
+        for ($x=0; $x < strlen($text); $x++) {
+            $text_encode .= '&#x' . bin2hex($text[$x]).';';
+        }
+
+        return ''.$text_encode.'';
+
+    } else {
+        // no encoding
+        return ''.$text.'';
+
+    }
 
-	}
-	
 }
 
 /* vim: set expandtab: */