*
* @since 0.71
*
- * @param string $emailaddy Email address.
- * @param int $mailto Optional. Range from 0 to 1. Used for encoding.
+ * @param string $email_address Email address.
+ * @param int $hex_encoding Optional. Set to 1 to enable hex encoding.
* @return string Converted email address.
*/
-function antispambot($emailaddy, $mailto=0) {
- $emailNOSPAMaddy = '';
- srand ((float) microtime() * 1000000);
- for ($i = 0; $i < strlen($emailaddy); $i = $i + 1) {
- $j = floor(rand(0, 1+$mailto));
- if ($j==0) {
- $emailNOSPAMaddy .= '&#'.ord(substr($emailaddy,$i,1)).';';
- } elseif ($j==1) {
- $emailNOSPAMaddy .= substr($emailaddy,$i,1);
- } elseif ($j==2) {
- $emailNOSPAMaddy .= '%'.zeroise(dechex(ord(substr($emailaddy, $i, 1))), 2);
+function antispambot( $email_address, $hex_encoding = 0 ) {
+ $email_no_spam_address = '';
+ for ( $i = 0; $i < strlen( $email_address ); $i++ ) {
+ $j = rand( 0, 1 + $hex_encoding );
+ if ( $j == 0 ) {
+ $email_no_spam_address .= '&#' . ord( $email_address[$i] ) . ';';
+ } elseif ( $j == 1 ) {
+ $email_no_spam_address .= $email_address[$i];
+ } elseif ( $j == 2 ) {
+ $email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[$i] ) ), 2 );
}
}
- $emailNOSPAMaddy = str_replace('@','@',$emailNOSPAMaddy);
- return $emailNOSPAMaddy;
+
+ $email_no_spam_address = str_replace( '@', '@', $email_no_spam_address );
+
+ return $email_no_spam_address;
}
/**
/**
* Convert one smiley code to the icon graphic file equivalent.
*
+ * Callback handler for {@link convert_smilies()}.
* Looks up one smiley code in the $wpsmiliestrans global array and returns an
* <img> string for that smiley.
*
* @global array $wpsmiliestrans
* @since 2.8.0
*
- * @param string $smiley Smiley code to convert to image.
+ * @param array $matches Single match. Smiley code to convert to image.
* @return string Image string for smiley.
*/
-function translate_smiley($smiley) {
+function translate_smiley( $matches ) {
global $wpsmiliestrans;
- if (count($smiley) == 0) {
+ if ( count( $matches ) == 0 )
return '';
- }
- $smiley = trim(reset($smiley));
- $img = $wpsmiliestrans[$smiley];
- $smiley_masked = esc_attr($smiley);
+ $smiley = trim( reset( $matches ) );
+ $img = $wpsmiliestrans[ $smiley ];
+ $smiley_masked = esc_attr( $smiley );
- $srcurl = apply_filters('smilies_src', includes_url("images/smilies/$img"), $img, site_url());
+ $src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
- return " <img src='$srcurl' alt='$smiley_masked' class='wp-smiley' /> ";
+ return " <img src='$src_url' alt='$smiley_masked' class='wp-smiley' /> ";
}
/**
* @since 2.8.1
* @access private
*
- * @param string|array $search
- * @param string $subject
- * @return string The processed string
+ * @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
+ * @param string $subject The string being searched and replaced on, otherwise known as the haystack.
+ * @return string The string with the replaced svalues.
*/
function _deep_replace( $search, $subject ) {
- $found = true;
$subject = (string) $subject;
- while ( $found ) {
- $found = false;
- foreach ( (array) $search as $val ) {
- while ( strpos( $subject, $val ) !== false ) {
- $found = true;
- $subject = str_replace( $val, '', $subject );
- }
- }
+
+ $count = 1;
+ while ( $count ) {
+ $subject = str_replace( $search, '', $subject, $count );
}
return $subject;
* is preparing an array for use in an IN clause.
*
* @since 2.8.0
- * @param string $data Unescaped data
- * @return string Escaped data
+ * @param string|array $data Unescaped data
+ * @return string|array Escaped data
*/
function esc_sql( $data ) {
global $wpdb;
$value = esc_url_raw( $value );
$value = str_replace( 'http://', '', $value );
break;
+
+ case 'default_role' :
+ if ( ! get_role( $value ) && get_role( 'subscriber' ) )
+ $value = 'subscriber';
+ break;
}
$value = apply_filters("sanitize_option_{$option}", $value, $option);