wordpress中的很多样式需要google支持,国内访问又慢,好在360给我们提供了公共资源,直接替换即可:
先查下包含googleapis的代码:(目的是确定能够find出代码)
#find . -name "*.php" -o -name "*.css" -o -name "*.js" -o -name "*.html" -o -name "*.js" -type f |xargs grep googleapis
./wp-content/themes/my-money/style.css:@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400);
./wp-content/themes/my-money/fw/mythemes.class.php: @import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400);
./wp-content/themes/my-money/media/admin/css/admin.css:@import url("http://fonts.googleapis.com/css?family=Oswald&v1");
./wp-content/themes/my-money/media/admin/css/admin.css:@import url("http://fonts.googleapis.com/css?family=PT+Sans+Narrow&v1");
./wp-includes/js/tinymce/plugins/compat3x/css/dialog.css:@import url(//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=latin-ext,latin);
./wp-includes/script-loader.php: $scripts->add( 'prototype', '//ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-root', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-builder', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-dragdrop', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-effects', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-slider', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-sound', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-controls', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php: $open_sans_font_url = "//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";
看来并不多的代码,直接替换吧:
#find . -name "*.php" -o -name "*.css" -o -name "*.js" -o -name "*.html" -o -name "*.js" -type f |xargs sed -i 's/googleapis.com/useso.com/g'
替换完成,进行确认:
find . -name "*.php" -o -name "*.css" -o -name "*.js" -o -name "*.html" -o -name "*.js" -type f |xargs grep useso
./wp-content/themes/my-money/style.css:@import url(http://fonts.useso.com/css?family=Source+Sans+Pro:400);
./wp-content/themes/my-money/fw/mythemes.class.php: @import url(http://fonts.useso.com/css?family=Source+Sans+Pro:200,400);
./wp-content/themes/my-money/media/admin/css/admin.css:@import url("http://fonts.useso.com/css?family=Oswald&v1");
./wp-content/themes/my-money/media/admin/css/admin.css:@import url("http://fonts.useso.com/css?family=PT+Sans+Narrow&v1");
./wp-includes/js/tinymce/plugins/compat3x/css/dialog.css:@import url(//fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=latin-ext,latin);
./wp-includes/script-loader.php: $scripts->add( 'prototype', '//ajax.useso.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-root', '//ajax.useso.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-builder', '//ajax.useso.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-dragdrop', '//ajax.useso.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-effects', '//ajax.useso.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-slider', '//ajax.useso.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-sound', '//ajax.useso.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
./wp-includes/script-loader.php: $scripts->add( 'scriptaculous-controls', '//ajax.useso.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php: $open_sans_font_url = "//fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";
哈哈,完成。