| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1040 人关注过本帖
标题:failed to open stream: HTTP request failed!网站留言板块出现问题,wordp ...
只看楼主 加入收藏
long890101
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-1-8
收藏
 问题点数:0 回复次数:0 
failed to open stream: HTTP request failed!网站留言板块出现问题,wordpress程序,好心帮忙解决
网站留言代码出现问题,求如何解决?
示例页面:http://www.


燃眉追击高清迅雷下载[1024DVD][经典火爆动作大片]:目前有2 条留言
Warning: file_get_contents(http://www.) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /data/home/bmu040176/htdocs/wp-content/themes/CmsCoo/functions.php on line 206

Warning: file_put_contents(/data/home/bmu040176/htdocs/avatar/d41d8cd98f00b204e9800998ecf8427e.jpg) [function.file-put-contents]: failed to open stream: No such file or directory in /data/home/bmu040176/htdocs/wp-content/themes/CmsCoo/functions.php on line 207

Warning: filesize() [function.filesize]: stat failed for /data/home/bmu040176/htdocs/avatar/d41d8cd98f00b204e9800998ecf8427e.jpg in /data/home/bmu040176/htdocs/wp-content/themes/CmsCoo/functions.php on line 208

Warning: copy(http://www.) [function.copy]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /data/home/bmu040176/htdocs/wp-content/themes/CmsCoo/functions.php on line 208


另外附上functions.php文件全部代码
<?php
include("includes/theme_options.php");
if (function_exists('register_sidebar'))
{
    register_sidebar(array(
        'name'            => 'sidebar Widget1',
        'before_widget'    => '',
        'after_widget'    => '</div>',
        'before_title'    => '<h3>',
        'after_title'    => '</h3><div class="box">',
        'after_widget' => '</div><div class="box-bottom"></div>',
    ));        
}
{
    register_sidebar(array(
        'name'            => 'sidebar Widget2',
        'before_widget'    => '',
        'after_widget'    => '</div>',
        'before_title'    => '<h3>',
        'after_title'    => '</h3><div class="box">',
        'after_widget' => '</div><div class="box-bottom"></div>',
    ));        
}
{
    register_sidebar(array(
        'name'            => 'sidebar Widget3',
        'before_widget'    => '',
        'after_widget'    => '</div>',
        'before_title'    => '<h3>',
        'after_title'    => '</h3><div class="box">',
        'after_widget' => '</div><div class="box-bottom"></div>',
    ));        
}
{
    register_sidebar(array(
        'name'            => 'sidebar Widget4',
        'before_widget'    => '',
        'after_widget'    => '</div>',
        'before_title'    => '<h3>',
        'after_title'    => '</h3><div class="box">',
        'after_widget' => '</div><div class="box-bottom"></div>',
    ));        
}
{
    register_sidebar(array(
        'name'            => 'sidebar Widget5',
        'before_widget'    => '',
        'after_widget'    => '</div>',
        'before_title'    => '<h3>',
        'after_title'    => '</h3><div class="box">',
        'after_widget' => '</div><div class="box-bottom"></div>',
    ));        
}
{
    register_sidebar(array(
        'name'            => 'sidebar Widget6',
        'before_widget'    => '',
        'after_widget'    => '</div>',
        'before_title'    => '<h3>',
        'after_title'    => '</h3><div class="box">',
        'after_widget' => '</div><div class="box-bottom"></div>',
    ));        
}
{
    register_sidebar(array(
        'name'            => 'home bottom',
        'before_widget'    => '',
        'after_widget'    => '</div>',
        'before_title'    => '<div class="widget_box"><h3>',
        'after_title'    => '</h3>',
        'after_widget' => '</div>',
    ));        
}

// 自定义菜单
   register_nav_menus(
      array(
         'header-menu' => __( '导航自定义菜单' ),
         'footer-menu' => __( '页角自定义菜单' )
      )
   );

//标题文字截断
function cut_str($src_str,$cut_length)
{
    $return_str='';
    $i=0;
    $n=0;
    $str_length=strlen($src_str);
    while (($n<$cut_length) && ($i<=$str_length))
    {
        $tmp_str=substr($src_str,$i,1);
        $ascnum=ord($tmp_str);
        if ($ascnum>=224)
        {
            $return_str=$return_str.substr($src_str,$i,3);
            $i=$i+3;
            $n=$n+2;
        }
        elseif ($ascnum>=192)
        {
            $return_str=$return_str.substr($src_str,$i,2);
            $i=$i+2;
            $n=$n+2;
        }
        elseif ($ascnum>=65 && $ascnum<=90)
        {
            $return_str=$return_str.substr($src_str,$i,1);
            $i=$i+1;
            $n=$n+2;
        }
        else
        {
            $return_str=$return_str.substr($src_str,$i,1);
            $i=$i+1;
            $n=$n+1;
        }
    }
    if ($i<$str_length)
    {
        $return_str = $return_str . '';
    }
    if (get_post_status() == 'private')
    {
        $return_str = $return_str . '(private)';
    }
    return $return_str;
}

//分页
function pagination($query_string){
global $posts_per_page, $paged;
$my_query = new WP_Query($query_string ."&posts_per_page=-1");
$total_posts = $my_query->post_count;
if(empty($paged))$paged = 1;
$prev = $paged - 1;                           
$next = $paged + 1;   
$range = 6; // 修改数字,可以显示更多的分页链接
$showitems = ($range * 2)+1;
$pages = ceil($total_posts/$posts_per_page);
if(1 != $pages){
    echo "<div class='pagination'>";
    echo ($paged > 2 && $paged+$range+1 > $pages && $showitems < $pages)? "<a href='".get_pagenum_link(1)."'>最前</a>":"";
    echo ($paged > 1 && $showitems < $pages)? "<a href='".get_pagenum_link($prev)."'>上一页</a>":"";        
    for ($i=1; $i <= $pages; $i++){
    if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )){
    echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>";
    }
    }
    echo ($paged < $pages && $showitems < $pages) ? "<a href='".get_pagenum_link($next)."'>下一页</a>" :"";
    echo ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) ? "<a href='".get_pagenum_link($pages)."'>最后</a>":"";
    echo "</div>\n";
    }
}

//自定义头像
add_filter( 'avatar_defaults', 'fb_addgravatar' );
function fb_addgravatar( $avatar_defaults ) {
$myavatar = get_bloginfo('template_directory') . '/images/gravatar.png';
  $avatar_defaults[$myavatar] = '自定义头像';
  return $avatar_defaults;
}

//彩色标签云
function colorCloud($text) {
$text = preg_replace_callback('|<a (.+?)>|i', 'colorCloudCallback', $text);
return $text;
}
function colorCloudCallback($matches) {
$text = $matches[1];
$color = dechex(rand(0,16777215));
$pattern = '/style=(\'|\")(.*)(\'|\")/i';
$text = preg_replace($pattern, "style=\"color:#{$color};$2;\"", $text);
return "<a $text>";
}
add_filter('wp_tag_cloud', 'colorCloud', 1);

//自动截图设置
function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];
  return $first_img;
}
// 评论回复/头像缓存
function robin_comment($comment, $args, $depth) {
   $GLOBALS['comment'] = $comment; ?>
   <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
   <div id="div-comment-<?php comment_ID() ?>">
      <?php $add_below = 'div-comment'; ?>
        <div class="comment-author vcard">
            <?php
                $p = 'avatar/';
                $f = md5(strtolower($comment->comment_author_email));
                $a = $p . $f .'.jpg';
                $e = ABSPATH . $a;
                if (!is_file($e)){ //当头像不存在就更新
                $d = get_bloginfo('wpurl'). '/avatar/default.jpg';
                $s = '48'; //头像大小 自行根据自己模板设置
                $r = get_option('avatar_rating');
                $g = 'http://www.'.$f.'.jpg?s='.$s.'&d='.$d.'&r='.$r;
                $avatarContent = file_get_contents($g);
                file_put_contents($e, $avatarContent);
                if ( filesize($e) == 0 ){ copy($d, $e); }
                };
            ?>
            <img src='<?php bloginfo('wpurl'); ?>/<?php echo $a ?>' alt='' class='avatar' />
            <strong><?php comment_author_link() ?></strong> :
            <span class="datetime"><?php comment_date('Y年m月d日') ?> <?php comment_time() ?> <?php edit_comment_link('编辑','&nbsp;&nbsp;',''); ?></span>
            <span class="reply"><?php comment_reply_link(array_merge( $args, array('reply_text' => '回复', 'add_below' =>$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?></span>
        </div>
        <?php comment_text() ?>
        <div class="clear"></div>
  </div>
<?php
}
function robin_end_comment() {
        echo '</li>';
}
// 评论回应邮件通知
function comment_mail_notify($comment_id) {
  $admin_notify = '1'; // admin 要不要收回复通知 ( '1'=要 ; '0'=不要 )
  $admin_email = get_bloginfo ('admin_email'); // $admin_email 可改为你指定的 e-mail.
  $comment = get_comment($comment_id);
  $comment_author_email = trim($comment->comment_author_email);
  $parent_id = $comment->comment_parent ? $comment->comment_parent : '';
  global $wpdb;
  if ($wpdb->query("Describe {$wpdb->comments} comment_mail_notify") == '')
    $wpdb->query("ALTER TABLE {$wpdb->comments} ADD COLUMN comment_mail_notify TINYINT NOT NULL DEFAULT 0;");
  if (($comment_author_email != $admin_email && isset($_POST['comment_mail_notify'])) || ($comment_author_email == $admin_email && $admin_notify == '1'))
    $wpdb->query("UPDATE {$wpdb->comments} SET comment_mail_notify='1' WHERE comment_ID='$comment_id'");
  $notify = $parent_id ? get_comment($parent_id)->comment_mail_notify : '0';
  $spam_confirmed = $comment->comment_approved;
  if ($parent_id != '' && $spam_confirmed != 'spam' && $notify == '1') {
    $wp_email = 'no-reply@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); // e-mail 发出点, no-reply 可改为可用的 e-mail.
    $to = trim(get_comment($parent_id)->comment_author_email);
    $subject = '您在 [' . get_option("blogname") . '] 的留言有了回应';
    $message = '
    <div style="background-color:#eef2fa; border:1px solid #d8e3e8; color:#111; padding:0 15px; -moz-border-radius:5px; -webkit-border-radius:5px; -khtml-border-radius:5px;">
      <p>' . trim(get_comment($parent_id)->comment_author) . ', 您好!</p>
      <p>您曾在《' . get_the_title($comment->comment_post_ID) . '》的留言:<br />'
       . trim(get_comment($parent_id)->comment_content) . '</p>
      <p>' . trim($comment->comment_author) . ' 给您的回应:<br />'
       . trim($comment->comment_content) . '<br /></p>
      <p>您可以点击 <a href="' . htmlspecialchars(get_comment_link($parent_id)) . '">查看回应完整內容</a></p>
      <p>欢迎您再度光临 <a href="' . get_option('home') . '">' . get_option('blogname') . '</a></p>
      <p>(此邮件由系统自动发出,请勿回复.)</p>
    </div>';
    $from = "From: \"" . get_option('blogname') . "\" <$wp_email>";
    $headers = "$from\nContent-Type: text/html; charset=" . get_option('blog_charset') . "\n";
    wp_mail( $to, $subject, $message, $headers );
    //echo 'mail to ', $to, '<br/> ' , $subject, $message; // for testing
  }
}
add_action('comment_post', 'comment_mail_notify');
// 自动勾选
function add_checkbox() {
  echo '<input type="checkbox" name="comment_mail_notify" id="comment_mail_notify" value="comment_mail_notify" checked="checked" style="margin-left:0px;" /><label for="comment_mail_notify">有人回复时邮件通知我</label>';
}
add_action('comment_form', 'add_checkbox');
//自动生成版权时间
function comicpress_copyright() {
    global $wpdb;
    $copyright_dates = $wpdb->get_results("
    SELECT
    YEAR(min(post_date_gmt)) AS firstdate,
    YEAR(max(post_date_gmt)) AS lastdate
    FROM
    $wpdb->posts
    WHERE
    post_status = 'publish'
    ");
    $output = '';
    if($copyright_dates) {
    $copyright = "&copy; " . $copyright_dates[0]->firstdate;
    if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
    $copyright .= '-' . $copyright_dates[0]->lastdate;
    }
    $output = $copyright;
    }
    return $output;
    }
//密码保护提示
function password_hint( $c ){
global $post, $user_ID, $user_identity;
if ( empty($post->post_password) )
return $c;
if ( isset($_COOKIE['wp-postpass_'.COOKIEHASH]) && stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) == $post->post_password )
return $c;
if($hint = get_post_meta($post->ID, 'password_hint', true)){
$url = get_option('siteurl').'/wp-pass.php';
if($hint)
$hint = '密码提示:'.$hint;
else
$hint = "请输入您的密码";
if($user_ID)
$hint .= sprintf('欢迎进入,您的密码是:', $user_identity, $post->post_password);
$out = <<<END
<form method="post" action="$url">
<p>这篇文章是受保护的文章,请输入密码继续阅读:</p>
<div>
<label>$hint<br/>
<input type="password" name="post_password"/></label>
<input type="submit" value="Submit" name="Submit"/>
</div>
</form>
END;
return $out;
}else{
return $c;
}
}
add_filter('the_content', 'password_hint');
//全部设置结束
?>

搜索更多相关主题的帖子: 网站 wordpress 迅雷下载 request 留言代码 
2012-01-08 00:10
快速回复:failed to open stream: HTTP request failed!网站留言板块出现问题, ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.055362 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved