当前位置: 首页>>代码示例>>PHP>>正文


PHP mb_conv函数代码示例

本文整理汇总了PHP中mb_conv函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_conv函数的具体用法?PHP mb_conv怎么用?PHP mb_conv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mb_conv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_search_query_terms

 function get_search_query_terms($engine = 'google')
 {
     global $s, $s_array, $blog_charset;
     if (isset($_SERVER['HTTP_REFERER'])) {
         $referer = urldecode($_SERVER['HTTP_REFERER']);
     } else {
         $referer = '';
     }
     $query_array = array();
     switch ($engine) {
         case 'google':
             // Google query parsing code adapted from Dean Allen's
             // Google Hilite 0.3. http://textism.com
             $query_terms = preg_replace('/^.*q=([^&]+)&?.*$/i', '$1', $referer);
             $query_terms = preg_replace('/\'|"/', '', $query_terms);
             $query_terms = mb_conv($query_terms, $blog_charset, "auto");
             $query_array = preg_split("/[\\s,\\+\\.]+/", $query_terms);
             break;
         case 'lycos':
             $query_terms = preg_replace('/^.*query=([^&]+)&?.*$/i', '$1', $referer);
             $query_terms = preg_replace('/\'|"/', '', $query_terms);
             $query_terms = mb_conv($query_terms, $blog_charset, "auto");
             $query_array = preg_split("/[\\s,\\+\\.]+/", $query_terms);
             break;
         case 'yahoo':
             $query_terms = preg_replace('/^.*p=([^&]+)&?.*$/i', '$1', $referer);
             $query_terms = preg_replace('/\'|"/', '', $query_terms);
             $query_terms = mb_conv($query_terms, $blog_charset, "auto");
             $query_array = preg_split("/[\\s,\\+\\.]+/", $query_terms);
             break;
         case 'wordpress':
             // Check the search form vars if the search terms
             // aren't in the referer.
             if (isset($s_array)) {
                 $query_array = $s_array;
                 break;
             } else {
                 if (isset($s)) {
                     $query_array = array($s);
                     break;
                 } else {
                     if (preg_match('/^.*s=/i', $referer)) {
                         $query_terms = preg_replace('/^.*s=([^&]+)&?.*$/i', '$1', $referer);
                         $query_terms = preg_replace('/\'|"/', '', $query_terms);
                         $query_array = preg_split("/[\\s,\\+\\.]+/", $query_terms);
                     }
                 }
             }
             break;
     }
     return $query_array;
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:52,代码来源:google-hilite.php

示例2: add_referer

function add_referer()
{
    global $single, $post_meta_cache, $wp_post_id, $wp_id, $blog_charset, $siteurl;
    if ($single) {
        if (isset($_SERVER["HTTP_REFERER"])) {
            $url = $_SERVER["HTTP_REFERER"];
            if (not_excluded($url)) {
                if ($referer = fopen($url, "rb")) {
                    $page = '';
                    while (!feof($referer)) {
                        $page .= fread($referer, 8192);
                    }
                    fclose($referer);
                    $matched = false;
                    $page = mb_conv($page, $blog_charset, "auto");
                    if (preg_match_all("/<a\\s[^>]*?href=[\"\\']([^\"\\']*?)[\"\\'][^>]*>/", $page, $matches, PREG_PATTERN_ORDER)) {
                        foreach ($matches[1] as $match) {
                            if (strstr($match, $siteurl)) {
                                $matched = true;
                            }
                        }
                    }
                    if (!$matched) {
                        return;
                    }
                    preg_match("/<title>(.+)<\\/title>/is", $page, $title);
                    $title = $title[1];
                }
                if (!$title) {
                    preg_match("/^(http:\\/\\/)?([^\\/]+)/i", $url, $matches);
                    $host = $matches[2];
                    preg_match("/[^\\.\\/]+\\.[^\\.\\/]+\$/", $host, $matches);
                    $title = $matches[0];
                }
                $new_entry = addslashes($title . ":!-!:" . $url);
                add_post_meta($wp_post_id, 'wp-refer', $new_entry);
                $post_meta_cache[$wp_id][$wp_post_id]['wp-refer'][] = $new_entry;
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:41,代码来源:wp-refer.php

示例3: add_referer

function add_referer()
{
    if (!empty($GLOBALS['single'])) {
        if (isset($_SERVER['HTTP_REFERER'])) {
            $url = $_SERVER['HTTP_REFERER'];
            if (not_excluded($url)) {
                require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
                $snoopy = new Snoopy();
                if ($snoopy->fetch($url)) {
                    $page = $snoopy->results;
                    $matched = false;
                    $page = mb_conv($page, $GLOBALS['blog_charset'], 'auto');
                    if (preg_match_all('/<a\\s[^>]*?href=[\\"\']([^\\"\']*?)[\\"\'][^>]*>/', $page, $matches, PREG_PATTERN_ORDER)) {
                        foreach ($matches[1] as $match) {
                            if (strstr($match, wp_siteurl())) {
                                $matched = true;
                            }
                        }
                    }
                    if (!$matched) {
                        return;
                    }
                    preg_match('/<title>(.+)<\\/title>/is', $page, $title);
                    $title = $title[1];
                    if (!$title) {
                        preg_match('/^(http:\\/\\/)?([^\\/]+)/i', $url, $matches);
                        $host = $matches[2];
                        preg_match('/[^\\.\\/]+\\.[^\\.\\/]+$/', $host, $matches);
                        $title = $matches[0];
                    }
                    $new_entry = addslashes($title . ":!-!:" . $url);
                    add_post_meta($GLOBALS['wp_post_id'], 'wp-refer', $new_entry);
                    $GLOBALS['post_meta_cache'][wp_id()][$GLOBALS['wp_post_id']]['wp-refer'][] = $new_entry;
                }
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:38,代码来源:wp-refer.php

示例4: wp_getattach

function wp_getattach($content, $prefix = "", $create_thumbs = 0)
{
    $contents = explode("\r\n\r\n", $content);
    $subtype = preg_match("/Content-Type: [^\\/]*\\/([^\\;]*);/", $contents[0], $matches);
    if ($subtype) {
        $subtype = strtolower($matches[1]);
    }
    $temp_file = "";
    if (in_array($subtype, array("gif", "jpg", "jpeg", "png"))) {
        if (eregi("name=\"?([^\"]+)\"?", $contents[0], $filereg)) {
            $filename = ereg_replace("[\t\r\n]", "", $filereg[1]);
            if (function_exists('mb_convert_encoding')) {
                $temp_file = mb_conv(mb_decode_mimeheader($filename), get_settings('blog_charset'), "auto");
            } else {
                $temp_file = $filename;
            }
        }
        // 添付データをデコードして保存
        if (eregi("Content-Transfer-Encoding:.*base64", $contents[0])) {
            $tmp = base64_decode($contents[1]);
            if (!$temp_file) {
                $temp_file_base = $prefix . "_" . time();
            } else {
                $temp_file_info = pathinfo($temp_file);
                if (in_array($temp_file_info["extension"], array("gif", "jpg", "jpeg", "png"))) {
                    $subtype = $temp_file_info["extension"];
                }
                $temp_file_base = basename($temp_file, "." . $temp_file_info["extension"]);
            }
            $i = 0;
            $temp_file = $temp_file_base . ".{$subtype}";
            while (file_exists(get_settings('fileupload_realpath') . '/' . $temp_file)) {
                $temp_file = $temp_file_base . "-" . $i . ".{$subtype}";
                $i++;
            }
            if (!($temp_fp = fopen(get_settings('fileupload_realpath') . '/' . $temp_file, "wb"))) {
                echo "Error : Could not write attatched file.<br />\n";
                return false;
            }
            fputs($temp_fp, $tmp);
            fclose($temp_fp);
            if ($create_thumbs) {
                wp_create_thumbnail(get_settings('fileupload_realpath') . '/' . $temp_file, 180, "");
            }
        }
        echo "{$temp_file} <br />\n";
        return $temp_file;
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:50,代码来源:wp-mail.php

示例5: wp_convert_rss_charset

 function wp_convert_rss_charset($srcstr)
 {
     return mb_conv($srcstr, wp_get_rss_charset(), $GLOBALS['blog_charset']);
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:4,代码来源:functions.php

示例6: mt_getpost

function mt_getpost($params)
{
    // ($postid, $user, $pass)
    global $xmlrpcerruser;
    $xpostid = $params->getParam(0);
    $xuser = $params->getParam(1);
    $xpass = $params->getParam(2);
    $post_ID = $xpostid->scalarval();
    $username = $xuser->scalarval();
    $password = $xpass->scalarval();
    // Check login
    if (user_pass_ok($username, $password)) {
        $postdata = get_postdata($post_ID);
        if ($postdata["Date"] != "") {
            // why were we converting to GMT here? spec doesn't call for that.
            //$post_date = mysql2date("U", $postdata["Date"]);
            //$post_date = gmdate("Ymd", $post_date)."T".gmdate("H:i:s", $post_date);
            $post_date = strtotime($postdata['Date']);
            $post_date = date("Ymd", $post_date) . "T" . date("H:i:s", $post_date);
            $catids = wp_get_post_cats('1', $post_ID);
            logIO("O", "CateGory No:" . count($catids));
            foreach ($catids as $catid) {
                $catname = get_cat_name($catid);
                logIO("O", "CateGory:" . $catname);
                $catnameenc = new xmlrpcval(mb_conv($catname, "UTF-8", "auto"));
                $catlist[] = $catnameenc;
            }
            $post = get_extended($postdata['Content']);
            $allow_comments = 'open' == $postdata['comment_status'] ? 1 : 0;
            $allow_pings = 'open' == $postdata['ping_status'] ? 1 : 0;
            $resp = array('link' => new xmlrpcval(post_permalink($post_ID)), 'title' => new xmlrpcval(mb_conv($postdata["Title"], "UTF-8", "auto")), 'description' => new xmlrpcval(mb_conv($post['main'], "UTF-8", "auto")), 'dateCreated' => new xmlrpcval($post_date, 'dateTime.iso8601'), 'userid' => new xmlrpcval($postdata["Author_ID"]), 'postid' => new xmlrpcval($postdata["ID"]), 'content' => new xmlrpcval(mb_conv($postdata["Content"], "UTF-8", "auto")), 'permalink' => new xmlrpcval(post_permalink($post_ID)), 'categories' => new xmlrpcval($catlist, 'array'), 'mt_keywords' => new xmlrpcval("{$catids[0]}"), 'mt_excerpt' => new xmlrpcval(mb_conv($postdata['Excerpt'], "UTF-8", "auto")), 'mt_allow_comments' => new xmlrpcval($allow_comments, 'int'), 'mt_allow_pings' => new xmlrpcval($allow_pings, 'int'), 'mt_convert_breaks' => new xmlrpcval('true'), 'mt_text_more' => new xmlrpcval(mb_conv($post['extended'], "UTF-8", "auto")));
            $resp = new xmlrpcval($resp, 'struct');
            return new xmlrpcresp($resp);
        } else {
            return new xmlrpcresp(0, $xmlrpcerruser + 3, "No such post #{$post_ID}");
        }
    } else {
        return new xmlrpcresp(0, $xmlrpcerruser + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:40,代码来源:xmlrpc.php

示例7: bloginfo_rss

?>
</link>
	<description><?php 
bloginfo_rss('description');
?>
</description>
	<dc:language><?php 
echo get_settings('rss_language') ? get_settings('rss_language') : 'en';
?>
</dc:language>
	<dc:date><?php 
echo gmdate('Y-m-d\\TH:i:s');
?>
</dc:date>
	<dc:creator><?php 
echo antispambot(mb_conv(get_settings('admin_email'), $_rss_charset, $GLOBALS['blog_charset']));
?>
</dc:creator>
	<admin:generatorAgent rdf:resource="http://wordpress.xwd.jp/?v=<?php 
echo $GLOBALS['wp_version'];
?>
"/>
	<admin:errorReportsTo rdf:resource="mailto:<?php 
echo antispambot(get_settings('admin_email'));
?>
"/>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
	<items>
		<rdf:Seq>
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-rdf.php

示例8: pingback_ping

function pingback_ping($m)
{
    // original code by Mort
    // (http://mort.mine.nu:8080)
    global $wpdb;
    global $wp_version;
    if (!get_settings('use_pingback')) {
        return new xmlrpcresp(new xmlrpcval('Sorry, this weblog does not allow you to pingback its posts.'));
    }
    $title = '';
    $pagelinkedfrom = $m->getParam(0);
    $pagelinkedfrom = $pagelinkedfrom->scalarval();
    $pagelinkedto = $m->getParam(1);
    $pagelinkedto = $pagelinkedto->scalarval();
    $pagelinkedfrom = addslashes(str_replace('&amp;', '&', $pagelinkedfrom));
    $pagelinkedto = preg_replace('#&([^amp\\;])#is', '&amp;$1', $pagelinkedto);
    $messages = array(htmlentities('Pingback from ' . $pagelinkedfrom . ' to ' . $pagelinkedto . ' registered. Keep the web talking! :-)'), htmlentities("We can't find the URL to the post you are trying to " . "link to in your entry. Please check how you wrote the post's permalink in your entry."), htmlentities("We can't find the post you are trying to link to." . " Please check the post's permalink."));
    $message = $messages[0];
    // Check if the page linked to is in our site
    $pos1 = strpos($pagelinkedto, str_replace('http://', '', str_replace('www.', '', wp_siteurl())));
    if ($pos1) {
        // let's find which post is linked to
        $urltest = parse_url($pagelinkedto);
        if ($post_ID = url_to_postid($pagelinkedto)) {
            $way = 'url_to_postid()';
        } elseif (preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) {
            // the path defines the post_ID (archives/p/XXXX)
            $blah = explode('/', $match[0]);
            $post_ID = $blah[1];
            $way = 'from the path';
        } elseif (preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
            // the querystring defines the post_ID (?p=XXXX)
            $blah = explode('=', $match[0]);
            $post_ID = $blah[1];
            $way = 'from the querystring';
        } elseif (isset($urltest['fragment'])) {
            // an #anchor is there, it's either...
            if (intval($urltest['fragment'])) {
                // ...an integer #XXXX (simpliest case)
                $post_ID = $urltest['fragment'];
                $way = 'from the fragment (numeric)';
            } elseif (preg_match('/post-[0-9]+/', $urltest['fragment'])) {
                // ...a post id in the form 'post-###'
                $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
                $way = 'from the fragment (post-###)';
            } elseif (is_string($urltest['fragment'])) {
                // ...or a string #title, a little more complicated
                $title = preg_replace('/[^a-zA-Z0-9]/', '.', $urltest['fragment']);
                $sql = "SELECT ID FROM " . wp_table('posts') . " WHERE post_title RLIKE '" . addslashes($title) . "'";
                $post_ID = $wpdb->get_var($sql) or die("Query: {$sql}\n\nError: ");
                $way = 'from the fragment (title)';
            }
        } else {
            // TODO: Attempt to extract a post ID from the given URL
            $post_ID = -1;
            $way = 'no match';
        }
        logIO('O', "(PB) URI='{$pagelinkedto}' ID='{$post_ID}' Found='{$way}'");
        $sql = "SELECT post_author FROM " . wp_table('posts') . " WHERE ID = {$post_ID}";
        $result = $wpdb->get_results($sql);
        if ($wpdb->num_rows) {
            // Let's check that the remote site didn't already pingback this entry
            $sql = 'SELECT * FROM ' . wp_table('comments') . ' 
				WHERE comment_post_ID = ' . $post_ID . ' 
					AND comment_author_url = \'' . $pagelinkedfrom . '\' 
					AND comment_content LIKE \'%<pingback />%\'';
            $result = $wpdb->get_results($sql);
            if ($wpdb->num_rows || 1 == 1) {
                // very stupid, but gives time to the 'from' server to publish !
                sleep(1);
                // Let's check the remote site
                require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
                $snoopy = new Snoopy();
                if ($snoopy->fetch($pagelinkedfrom)) {
                    $linea = $snoopy->results;
                } else {
                    $linea = '';
                }
                logIO('O', "(PB) CHARSET='" . $GLOBALS['blog_charset']);
                $linea = mb_conv($linea, $GLOBALS['blog_charset'], 'auto');
                // Work around bug in strip_tags():
                $linea = str_replace('<!DOCTYPE', '<DOCTYPE', $linea);
                $linea = strip_tags($linea, '<title><a>');
                $linea = strip_all_but_one_link($linea, $pagelinkedto);
                // I don't think we need this? -- emc3
                if (empty($matchtitle)) {
                    preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
                }
                $pos2 = strpos($linea, $pagelinkedto);
                $pos3 = strpos($linea, str_replace('http://www.', 'http://', $pagelinkedto));
                logIO('O', "(PB) POS='{$pos2}, {$pos3}'");
                if (is_integer($pos2) || is_integer($pos3)) {
                    //debug_fwrite($log, 'The page really links to us :)'."\n");
                    $pos4 = is_integer($pos2) ? $pos2 : $pos3;
                    $start = $pos4 - 50;
                    if (function_exists('mb_convert_encoding')) {
                        $tmp1 = mb_strcut($linea, 0, $start, $GLOBALS['blog_charset']);
                    } else {
                        $tmp1 = substr($linea, 0, $start);
                    }
//.........这里部分代码省略.........
开发者ID:nobunobuta,项目名称:xoops_mod_WordPress,代码行数:101,代码来源:xmlrpc.php

示例9: wp_notify_postauthor

function wp_notify_postauthor($comment_id, $comment_type = 'comment')
{
    $commentHandler =& wp_handler('Comment');
    if (!($commentObject =& $commentHandler->get($comment_id))) {
        return false;
    }
    $comment =& $commentObject->exportWpObject();
    $postHandler =& wp_handler('Post');
    if (!($postObject =& $postHandler->get($comment->comment_post_ID))) {
        return false;
    }
    $post =& $postObject->exportWpObject();
    $userHandler =& wp_handler('User');
    if (!($userObject =& $userHandler->get($post->post_author))) {
        return false;
    }
    $user = $userObject->exportWpObject;
    if ($user->user_email == '') {
        return false;
    }
    // If there's no email to send the comment to
    $comment_author_domain = gethostbyaddr($comment->comment_author_IP);
    $blogname = get_settings('blogname');
    if ($comment_type == 'comment') {
        $notify_message = _LANG_F_NEW_COMMENT . " #{$comment->comment_post_ID} " . $post->post_title . "\r\n\r\n";
        $notify_message .= "Author : {$comment->comment_author} (IP: {$comment->comment_author_IP} , {$comment_author_domain})\r\n";
        $notify_message .= "E-mail : {$comment->comment_author_email}\r\n";
        $notify_message .= "URI\t   : {$comment->comment_author_url}\r\n";
        $notify_message .= "Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput={$comment->comment_author_IP}\r\n";
        $notify_message .= "Comment:\r\n" . mb_conv($comment->comment_content, $GLOBALS['blog_charset'], 'auto') . "\r\n\r\n";
        $notify_message .= _LANG_F_ALL_COMMENTS . " \r\n";
        $subject = '[' . $blogname . '] Comment: "' . $post->post_title . '"';
    } elseif ($comment_type == 'trackback') {
        $notify_message = _LANG_F_NEW_TRACKBACK . " #{$comment->comment_post_ID} " . $post->post_title . "\r\n\r\n";
        $notify_message .= "Website: " . mb_conv($comment->comment_author, $GLOBALS['blog_charset'], "auto") . " (IP: {$comment->comment_author_IP} , {$comment_author_domain})\r\n";
        $notify_message .= "URI\t   : {$comment->comment_author_url}\r\n";
        $notify_message .= "Comment:\r\n" . mb_conv($comment->comment_content, $GLOBALS['blog_charset'], "auto") . "\r\n\r\n";
        $notify_message .= _LANG_F_ALL_TRACKBACKS . " \r\n";
        $subject = '[' . $blogname . '] Trackback: "' . $post->post_title . '"';
    } elseif ($comment_type == 'pingback') {
        $notify_message = _LANG_F_NEW_PINGBACK . " #{$comment->comment_post_ID} " . $post->post_title . "\r\n\r\n";
        $notify_message .= "Website: {$comment->comment_author}\r\n";
        $notify_message .= "URI\t   : {$comment->comment_author_url}\r\n";
        $notify_message .= "Excerpt: \n[...] " . mb_conv($original_context, $GLOBALS['blog_charset'], "auto") . " [...]\r\n\r\n";
        $notify_message .= _LANG_F_ALL_PINGBACKS . " \r\n";
        $subject = '[' . $blogname . '] Pingback: "' . $post->post_title . '"';
    }
    $notify_message .= get_permalink($comment->comment_post_ID, false) . '#comments';
    if ('' == $comment->comment_author_email || '' == $comment->comment_author) {
        if (function_exists('mb_convert_encoding')) {
            $from = "From: \"" . mb_encode_mimeheader(mb_conv($blogname, "JIS", "auto")) . "\" <wordpress@" . $_SERVER['SERVER_NAME'] . '>';
        } else {
            $from = "From: \"" . $blogname . "\" <wordpress@" . $_SERVER['SERVER_NAME'] . '>';
        }
    } else {
        if (function_exists('mb_convert_encoding')) {
            $from = 'From: "' . mb_encode_mimeheader(mb_conv($comment->comment_author, "JIS", "auto")) . "\" <{$comment->comment_author_email}>";
        } else {
            $from = 'From: "' . $comment->comment_author . "\" <{$comment->comment_author_email}>";
        }
    }
    if (defined('XOOPS_URL')) {
        $xoopsMailer =& getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($user->user_email);
        $xoopsMailer->setFromEmail($comment->comment_author_email);
        $xoopsMailer->setFromName($comment->comment_author);
        $xoopsMailer->setSubject($subject);
        $xoopsMailer->setBody($notify_message);
        $xoopsMailer->send(true);
    } else {
        if (function_exists('mb_send_mail')) {
            mb_send_mail($user->user_email, $subject, $notify_message, $from);
        } else {
            @mail($user->user_email, $subject, $notify_message, $from);
        }
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:79,代码来源:functions.php

示例10: convert_content

function convert_content($content, $charest, $encoding)
{
    if ($charset == "" || trim(strtoupper($charset)) == "ISO-2022-JP") {
        $charset = "JIS";
    }
    if (trim(strtoupper($charset)) == "SHIFT_JIS") {
        $charset = "SJIS";
    }
    if ($encoding == 'quoted-printable') {
        $content = preg_replace('/\\=[\\n\\r]+/', '', $content);
        $content = preg_replace('/\\=([0-9a-fA-F]{2,2})/e', "pack('c',base_convert('\\1',16,10))", $content);
    }
    $content = mb_conv($content, $GLOBALS['blog_charset'], $charset);
    return $content;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:15,代码来源:wp-mail.php

示例11: wp_getattach

function wp_getattach(&$content, $prefix = "", $create_thumbs = 0)
{
    $allowedtypes = explode(' ', trim(get_settings('fileupload_allowedtypes')));
    $allowedimage = array_intersect($allowedtypes, array('gig', 'jpg', 'jpeg', 'png'));
    $subtype = $content['subtype'];
    if (!empty($content['name'])) {
        $origname = $content['name'];
        if (function_exists('mb_convert_encoding')) {
            $origname = mb_conv(mb_decode_mimeheader($origname), $GLOBALS['blog_charset'], "auto");
        }
        $filename_info = pathinfo($origname);
        $subtype = $filename_info["extension"];
        //		$filename_base = basename($filename, "." . $filename_info["extension"]);
    }
    $filename_base = $prefix . "_" . time();
    if (in_array($subtype, $allowedtypes)) {
        if (!empty($content['encodings']) && $content['encodings'] == 'base64') {
            $tmp = base64_decode($content['body']);
            $i = 0;
            $filename = $filename_base . ".{$subtype}";
            while (file_exists(get_settings('fileupload_realpath') . '/' . $filename)) {
                $filename = $filename_base . "-" . $i . ".{$subtype}";
                $i++;
            }
            if (!($fp = fopen(get_settings('fileupload_realpath') . '/' . $filename, "wb"))) {
                echo "Error : Could not write attatched file.<br />\n";
                return false;
            }
            fputs($fp, $tmp);
            fclose($fp);
            if (in_array($subtype, $allowedimage)) {
                if ($create_thumbs) {
                    wp_create_thumbnail(get_settings('fileupload_realpath') . '/' . $filename, 180, "");
                }
            }
        }
        echo "{$filename} <br />\n";
        return array($filename, in_array($subtype, $allowedimage), $origname);
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:41,代码来源:wp-mail.php

示例12: trackback_response

         }
         trackback_response(1, 'Sorry, your contents does not contain any URL of my site.');
     }
 }
 if (function_exists('mb_convert_encoding')) {
     if ($_charset != "" && (mb_http_input("P") == "" || strtolower(ini_get("mbstring.http_input")) == "pass")) {
         $_charset = strtoupper(trim($_charset));
     } else {
         $_charset = "auto";
     }
     if ($_charset == "auto") {
         $_charset = mb_detect_encoding($_title . $_excerpt . $_blog_name, $_charset);
     }
     $_title = mb_conv($_title, $blog_charset, $_charset);
     $_excerpt = mb_conv($_excerpt, $blog_charset, $_charset);
     $_blog_name = mb_conv($_blog_name, $blog_charset, $_charset);
     if ($GLOBALS['wp_debug']) {
         fwrite($_fp, "Title(Conv) ={$_title}\n");
         fwrite($_fp, "Excerpt(Conv) ={$_excerpt}\n");
         fwrite($_fp, "BlogName(Conv) ={$_blog_name}\n");
         fwrite($_fp, "CharSet(Conv) ={$_charset}\n");
         fwrite($_fp, "\n\n");
         fclose($_fp);
     }
 }
 $_title = strip_tags($_title);
 $_title = strlen($_title) > 255 ? substr($_title, 0, 252) . '...' : $_title;
 $_excerpt = strip_tags($_excerpt);
 $_excerpt = strlen($_excerpt) > 255 ? substr($_excerpt, 0, 252) . '...' : $_excerpt;
 $_blog_name = htmlspecialchars($_blog_name);
 $_blog_name = strlen($_blog_name) > 255 ? substr($_blog_name, 0, 252) . '...' : $_blog_name;
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-trackback.php

示例13: array

function &title_sort(&$posts)
{
    $enable_kakasi = $GLOBALS['xoopsModuleConfig']['wp_use_kakasi_for_archive'];
    $kakasi = $GLOBALS['xoopsModuleConfig']['wp_kakasi_path'];
    $kakasi_encode = $GLOBALS['xoopsModuleConfig']['wp_kakasi_charset'];
    $blog_charset = $GLOBALS['blog_charset'];
    if (_LANGCODE == 'ja') {
        if ($enable_kakasi) {
            $descriptorspec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
            // Precheck for kakasi (file_exists cannot be used in safemode);
            $process = proc_open($kakasi . " -?", $descriptorspec, $pipes);
            if (is_resource($process)) {
                if (!preg_match('/^KAKASI /', fgets($pipes[2]))) {
                    $enable_kakasi = false;
                }
                proc_close($process);
            }
            if ($enable_kakasi) {
                $process = proc_open($kakasi . ' -kH -KH -JH', $descriptorspec, $pipes);
                if (is_resource($process)) {
                    for ($i = 0; $i < count($posts); $i++) {
                        fputs($pipes[0], mb_conv($posts[$i]->post_title . "\n", $kakasi_encode, $blog_charset));
                    }
                    fclose($pipes[0]);
                    for ($i = 0; $i < count($posts); $i++) {
                        $posts[$i]->yomi = mb_conv(fgets($pipes[1]), $blog_charset, $kakasi_encode);
                        $posts[$i]->yomi = preg_replace('/[\\r\\n]*$/', '', $posts[$i]->yomi);
                    }
                    fclose($pipes[1]);
                    $return_value = proc_close($process);
                }
            } else {
                if (function_exists('mb_convert_kana')) {
                    for ($i = 0; $i < count($posts); $i++) {
                        $posts[$i]->yomi = mb_convert_kana($posts[$i]->post_title, 'KcV', $blog_charset);
                    }
                } else {
                    for ($i = 0; $i < count($posts); $i++) {
                        $posts[$i]->yomi = $posts[$i]->post_title;
                    }
                }
            }
        } else {
            if (function_exists('mb_convert_kana')) {
                for ($i = 0; $i < count($posts); $i++) {
                    $posts[$i]->yomi = mb_convert_kana($posts[$i]->post_title, 'KcV', $blog_charset);
                }
            } else {
                for ($i = 0; $i < count($posts); $i++) {
                    $posts[$i]->yomi = $posts[$i]->post_title;
                }
            }
        }
    } else {
        for ($i = 0; $i < count($posts); $i++) {
            $posts[$i]->yomi = $posts[$i]->post_title;
        }
    }
    usort($posts, 'title_ja_cmp');
    return $posts;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:61,代码来源:nkarchives.php

示例14: bloginfo_rss

?>
</link>
	<description><?php 
bloginfo_rss('description');
?>
</description>
	<dc:language><?php 
echo get_settings('rss_language') ? get_settings('rss_language') : 'en';
?>
</dc:language>
	<dc:date><?php 
echo gmdate('Y-m-d\\TH:i:s');
?>
</dc:date>
	<dc:creator><?php 
echo antispambot(mb_conv(get_settings('admin_email'), $rss_charset, $blog_charset));
?>
</dc:creator>
	<admin:generatorAgent rdf:resource="http://wordpress.xwd.jp/?v=<?php 
echo $wp_version;
?>
"/>
	<admin:errorReportsTo rdf:resource="mailto:<?php 
echo antispambot(get_settings('admin_email'));
?>
"/>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
	<items>
		<rdf:Seq>
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-rdf.php

示例15: array

    ?>
" />
    </form>
    <?php 
    if ($_GET["orderby"] == 'title') {
        if (_LANGCODE == 'ja') {
            if ($enable_kakasi) {
                $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"));
                $process = proc_open($kakasi . " -kH -KH -JH", $descriptorspec, $pipes);
                if (is_resource($process)) {
                    for ($i = 0; $i < count($posts); $i++) {
                        fputs($pipes[0], mb_conv($posts[$i]->post_title . "\n", $kakasi_encode, $GLOBALS['blog_charset']));
                    }
                    fclose($pipes[0]);
                    for ($i = 0; $i < count($posts); $i++) {
                        $posts[$i]->yomi = mb_conv(fgets($pipes[1]), $GLOBALS['blog_charset'], $kakasi_encode);
                    }
                    fclose($pipes[1]);
                    $return_value = proc_close($process);
                }
            } else {
                for ($i = 0; $i < count($posts); $i++) {
                    $posts[$i]->yomi = mb_convert_kana($posts[$i]->post_title, "KcV", $GLOBALS['blog_charset']);
                }
            }
        } else {
            for ($i = 0; $i < count($posts); $i++) {
                $posts[$i]->yomi = $posts[$i]->post_title;
            }
        }
        usort($posts, "cmp");
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:nkarchives.php


注:本文中的mb_conv函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。