代码之家  ›  专栏  ›  技术社区  ›  two7s_clash

为什么我的wordpress php头模板会生成奇怪的编码路径,并在输出的html中转换一些css和js文件?

  •  0
  • two7s_clash  · 技术社区  · 14 年前

    我认为这是一个编码问题(?)但不太确定。

    当我查看生成的源代码(在FF和IE中)时,我会看到来自JS和CSS文件的奇怪路径,如: <script type="text/javascript" src="http://www.domain.com/wp-content/themes/dudical/js/ce.f4195499d3cfc40ae09588aae02ff2dc.jquery,oeasing,omin,l.js"></script>

    此外,有几个JS/CSS文件实际上正在被隐藏,也就是说,我看不到对外部文件的引用,而是这些文件的内容显示在 <script> <style> 分别标记。我以前从未见过这种行为,我对此感到非常困惑。

    下面是header.php文件的开头:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
        <head profile="http://gmpg.org/xfn/11">
        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
        <title><?php if (is_front_page() ) {
            bloginfo('name');
            } elseif ( is_category() ) {
                single_cat_title(); echo ' - ' ; bloginfo('name');
            } elseif (is_single() ) {
                single_post_title();
            } elseif (is_page() ) {
                single_post_title(); echo ' - '; bloginfo('name');
            } else {
                wp_title('',true);
            } ?>
        </title>
        <?php if(get_option('favicon')) { ?>
        <link rel="shortcut icon" href="<?php echo get_option('favicon'); ?>" type="image/x-icon" /> 
        <?php }else{?><link rel="shortcut icon" href="<?php echo system32_url; ?>/favicon.ico" type="image/x-icon" /> <?php } ?>
        <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
        <?php wp_head(); ?>
        <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_url'); ?>/css/reset.css" />
        <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/style.css" />
        <!-- Jquery and Easing-->
        <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.4.min.js"></script>
        <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.easing.min.js"></script>
        <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.capSlide.js"></script>
    

    以下是我看到的输出:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang=en lang=en>
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"/>
    <title>Surf Hatteras</title>
    <link rel="shortcut icon" href="http://www.surfhatteras.com/wp-content/uploads/2010/10/surf-icon.gif" type="image/x-icon"/>
    <style>body                             { outline:none;}
    .postoptions                    { padding:0px; padding-top:0;  }
    .postoptions select,
    
    ...
    
    </style>
    <style>/* CSS for WP-Testimonials */
    #sfstest-form label {
    float: left;
    width: 200px;
    font-weight: bold;
    }
    
    ...
    
    </style>
    <script type='text/javascript' src='http://www.surfhatteras.com/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
    <link rel=EditURI type="application/rsd+xml" title=RSD href="http://www.surfhatteras.com/xmlrpc.php?rsd"/>
    <link rel=wlwmanifest type="application/wlwmanifest+xml" href="http://www.surfhatteras.com/wp-includes/wlwmanifest.xml"/>
    <link rel=index title='Surf Hatteras' href='http://www.surfhatteras.com/'/>
    <meta name=generator content="WordPress 3.0.1"/>
    <style>/* http://meyerweb.com/eric/tools/css/reset/ */
    /* v1.0 | 20080212 */
    
    html, body, div, span, applet, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, font, img, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    b, u, i, center,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td {
        margin: 0;
        padding: 0;
        border: 0;
        outline: 0;
        font-size: 100%;
        vertical-align: baseline;
        background: transparent;
    }
    
    ...
    
    </style>
    <link rel=stylesheet type="text/css" href="http://www.surfhatteras.com/wp-content/themes/dudical/ce.51cd742ab6418eec6131ff2cf43b61c4.style,s.css"/>
    <!-- Jquery and Easing-->
    <script type="text/javascript" src="http://www.surfhatteras.com/wp-content/themes/dudical/js/ce.9e936b27d8d0e4e07ebef242d7c6e2cc.jquery-1,o4,omin,l.js"></script>
    
    <script type="text/javascript">(function($) {
        $.fn.capslide = function(options) {
            var opts = $.extend({}, $.fn.capslide.defaults, options);
            return this.each(function() {
                $this = $(this);
                var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
    
    ...         
    
    })(jQuery);</script>
    <link rel=stylesheet type="text/css" href="http://www.surfhatteras.com/wp-content/themes/dudical/colors/ce.d47db6d7bbcb1f0192576f60ffa27ec9.white,s.css" media=screen />
    <!-- Slider CSS-->
    <style>/*
        Coin Slider jQuery plugin CSS styles
        http://workshop.rs/projects/coin-slider
    */
    
    #coin-slider    { margin-left:20px;}
    
    ...
    
    
    </style>
    <link rel=stylesheet type="text/css" media=screen href="http://www.surfhatteras.com/wp-content/themes/dudical/css/cc.224c1b363a793961fc7bc2e428d6ce58.nivo-slider,s+superfish,s.css">
    

    不知道我的路径发生了什么,也不知道为什么一些外部文件会被这样对待…

    编辑

    我使用的插件列表:

    • 分类文章小部件
    • 联系方式7
    • 联系表7至DB分机
    • 获取post图像
    • 获取图像
    • 上传时调整大小
    • 重新加载小工具
    • WordPress哈希卡什
    • wp数据库管理器
    • wp邮件smtp
    • wp显示ID
    • wp地下
    • (我使用的缓存插件是快速缓存)

    Contents of my functions.php file

    1 回复  |  直到 14 年前
        1
  •  1
  •   wanjie    14 年前

    没什么大不了的。 只是因为你使用了goolge页面速度扩展模块。