学php之翻译wordpress(2)
wp-load.php
- <?php
- /**
- * Bootstrap file for setting the ABSPATH constant
- * and loading the wp-config.php file. The wp-config.php
- * file will then load the wp-settings.php file, which
- * will then set up the WordPress environment.
- *
- * If the wp-config.php file is not found then an error
- * will be displayed asking the visitor to set up the
- * wp-config.php file.
- *
- * Will also search for wp-config.php in WordPress' parent
- * directory to allow the WordPress directory to remain
- * untouched.
- *
- * @internal This file must be parsable by PHP4.
- *
- * @package WordPress
- */
- /** Define ABSPATH as this file's directory */
- define( 'ABSPATH', dirname(__FILE__) . '/' );
- error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
- /*
- * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
- * doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
- * of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
- * and /blog/ is WordPress(b).
- *
- * If neither set of conditions is true, initiate loading the setup process.
- */
- if ( file_exists( ABSPATH . 'wp-config.php') ) {//第一次运行之前是没有wp-config.php这个文件的
- /** The config file resides in ABSPATH */
- require_once( ABSPATH . 'wp-config.php' );
- } elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {//第一次运行之前也没有wp-settings.php这个文件
- /** The config file resides one level above ABSPATH but is not part of another install */
- require_once( dirname( ABSPATH ) . '/wp-config.php' );
- } else {
- // A config file doesn't exist
- // 所以第一次就是进来这里
- define( 'WPINC', 'wp-includes' );
- require_once( ABSPATH . WPINC . '/load.php' );// 加载load.php
- // Standardize $_SERVER variables across setups.
- wp_fix_server_vars();// Fix `$_SERVER` variables for various setups.为了处理`$_SERVER`的一些启动变量
- require_once( ABSPATH . WPINC . '/functions.php' );// Main WordPress API,wordpress 的主要api
- $path = wp_guess_url() . '/wp-admin/setup-config.php';
- /*
- * We're going to redirect to setup-config.php. While this shouldn't result
- * in an infinite loop, that's a silly thing to assume, don't you think? If
- * we're traveling in circles, our last-ditch effort is "Need more help?"
- */
- if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
- header( 'Location: ' . $path );// 跳转到setup-config.php 进入用户配置模式,作者说想避免死循环;
- exit;
- }
- // 已经跳走的话,还要做什么?有可能存在一种情况,执行setup-config.php 的时候执行到这里?其实接下来已经是在打印错误信息了
- define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
- require_once( ABSPATH . WPINC . '/version.php' );// 源码里面都没有这个文件啊
- wp_check_php_mysql_versions();
- wp_load_translations_early();// 大概是和国际化语言有关,具体不知道干嘛,但名字好搞笑,early 你妹啊
- // Die with an error message
- $die = sprintf(
- /* translators: %s: wp-config.php */
- __( "There doesn't seem to be a %s file. I need this before we can get started." ),
- '<code>wp-config.php</code>'
- ) . '</p>';
- $die .= '<p>' . sprintf(
- /* translators: %s: Codex URL */
- __( "Need more help? <a href='%s'>We got it</a>." ),
- __( 'https://codex.wordpress.org/Editing_wp-config.php' )
- ) . '</p>';
- $die .= '<p>' . sprintf(
- /* translators: %s: wp-config.php */
- __( "You can create a %s file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ),
- '<code>wp-config.php</code>'
- ) . '</p>';
- $die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>';
- wp_die( $die, __( 'WordPress › Error' ) );// 打印错误信息
- }
学php之翻译wordpress(2)的更多相关文章
- 学php之翻译wordpress(1)
单看文件结构,wordpress分了3个文件夹 wp-admin,wp-content,wp-includes 和零散的一堆php,暂时不清楚各自的分工 入口文件是index.php <?php ...
- wordpress 插件 汉化
http://blog.wpjam.com/article/localizing-a-wordpress-plugin-using-poedit/ 翻译或者说本地化 WordPress 插件和主题可以 ...
- php里ezpdo orm框架初探
http://jackyrong.iteye.com/blog/238930 http://www.oschina.net/project/tag/126/orm?sort=view&lang ...
- 架构设计:系统间通信(34)——被神化的ESB(上)
1.概述 从本篇文章开始,我们将花一到两篇的篇幅介绍ESB(企业服务总线)技术的基本概念,为读者们理清多个和ESB技术有关名词.我们还将在其中为读者阐述什么情况下应该使用ESB技术.接下来,为了加深读 ...
- 黄聪:《跟黄聪学WordPress插件开发》
续<跟黄聪学WordPress主题开发>之后,又一个作品完成!<跟黄聪学Wordpress插件开发>,国内最好的Wordpress插件开发视频教程!! 目录预览: WordPr ...
- WordPress翻译中 __()、_e()、_x、_ex 和 _n 的用法及区别
编译函数 WordPress使用了下面几个函数来方便语言本地化. __() _e() _x() _ex() _n() 以上所列的函数是用来包含所需翻译的字符串的,根据字符串的不同参数和输出类型,需要使 ...
- 黄聪:《跟黄聪学WordPress主题开发》
又一个作品完成!<跟黄聪学Wordpress主题开发>,国内最好的Wordpress主题模版开发视频教程!! 目录预览: WordPress官方源文件层式结构讲解 WordPress数据库 ...
- 黄聪:让WordPress主题支持语言本地化(使用poedit软件实现中文翻译功能)
如果你的WordPress主题要提交到WordPress官方主题库,使用者来自世界各地的多种语言,那么,你就要让你的WordPress主题支持语言本地化,方便使用者进行语言翻译和制作语言包. 让Wor ...
- 翻译学python---《Learn Python the hard Way》---第一章 绪论
打算学习python,但是又不想单纯地看书或是写个小项目,干脆引入很流行的翻译学习法来学习吧- 在论坛上看到了国外的一本<Learn Python the hard Way> ...
随机推荐
- (原)编译caffe时提示未定义的引用(undefined reference to)
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5864715.html 参考网址: https://github.com/BVLC/caffe/issu ...
- (原)使用opencv的warpAffine函数对图像进行旋转
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5070576.html 参考网址: http://stackoverflow.com/questions ...
- css使用技巧
1) 网站上经常会出现用户输入一大段字符和字母以至于文字无法正常折行,把版式破坏,这样我们就要参考以下样式:word-wrap:break-word; overflow:hidden; 当然必须得有宽 ...
- 裸kmp算法
Number Sequence Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and ...
- linux 安装mysqlServer
先下载mysql安装包 打开 http://dev.mysql.com/downloads/mysql/ 选择 linux - Generic 再选择*.tar.gz(最后那两个) 下载完毕后,得到 ...
- Gson的简单使用
package test; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.uti ...
- error: ‘shared_ptr’ in namespace ‘std’ does not name a type
用G++编译项目的时候发生标题上的错误,原因是,这是c++ 11标准的.在给g++传递命令行的时候加上-std=c++0x就行了. 还需要在源码中#include<memory> 我的cm ...
- log4cplus配置文件使用
简介 log4cplus是log4j的c++移植版,是c++中一个很好的打印日志的库.它与另外一个c++的log库log4cxx相比较,好处是不依赖于libapr和libaprutil,可以静态链接到 ...
- cf471B MUH and Important Things
B. MUH and Important Things time limit per test 1 second memory limit per test 256 megabytes input s ...
- 过程化开发2048智力游戏WebApp
时间荏苒,唯编程与青春不可辜负,感觉自己一直没有专心去提升编程的技能,甚是惭愧!!! 周五,无意间看到一个开发2048的视频,有点兴趣就动起手来了,虽然不擅长前端开发,在此献丑,分享一下自己使用过程化 ...