wp-load.php

  1. <?php
  2. /**
  3. * Bootstrap file for setting the ABSPATH constant
  4. * and loading the wp-config.php file. The wp-config.php
  5. * file will then load the wp-settings.php file, which
  6. * will then set up the WordPress environment.
  7. *
  8. * If the wp-config.php file is not found then an error
  9. * will be displayed asking the visitor to set up the
  10. * wp-config.php file.
  11. *
  12. * Will also search for wp-config.php in WordPress' parent
  13. * directory to allow the WordPress directory to remain
  14. * untouched.
  15. *
  16. * @internal This file must be parsable by PHP4.
  17. *
  18. * @package WordPress
  19. */
  20.  
  21. /** Define ABSPATH as this file's directory */
  22. define( 'ABSPATH', dirname(__FILE__) . '/' );
  23.  
  24. 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 );
  25.  
  26. /*
  27. * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
  28. * doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
  29. * of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
  30. * and /blog/ is WordPress(b).
  31. *
  32. * If neither set of conditions is true, initiate loading the setup process.
  33. */
  34. if ( file_exists( ABSPATH . 'wp-config.php') ) {//第一次运行之前是没有wp-config.php这个文件的
  35.  
  36. /** The config file resides in ABSPATH */
  37. require_once( ABSPATH . 'wp-config.php' );
  38.  
  39. } elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {//第一次运行之前也没有wp-settings.php这个文件
  40.  
  41. /** The config file resides one level above ABSPATH but is not part of another install */
  42. require_once( dirname( ABSPATH ) . '/wp-config.php' );
  43.  
  44. } else {
  45.  
  46. // A config file doesn't exist
  47. // 所以第一次就是进来这里
  48. define( 'WPINC', 'wp-includes' );
  49. require_once( ABSPATH . WPINC . '/load.php' );// 加载load.php
  50.  
  51. // Standardize $_SERVER variables across setups.
  52. wp_fix_server_vars();// Fix `$_SERVER` variables for various setups.为了处理`$_SERVER`的一些启动变量
  53.  
  54. require_once( ABSPATH . WPINC . '/functions.php' );// Main WordPress API,wordpress 的主要api
  55.  
  56. $path = wp_guess_url() . '/wp-admin/setup-config.php';
  57.  
  58. /*
  59. * We're going to redirect to setup-config.php. While this shouldn't result
  60. * in an infinite loop, that's a silly thing to assume, don't you think? If
  61. * we're traveling in circles, our last-ditch effort is "Need more help?"
  62. */
  63. if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
  64. header( 'Location: ' . $path );// 跳转到setup-config.php 进入用户配置模式,作者说想避免死循环;
  65. exit;
  66. }
  67. // 已经跳走的话,还要做什么?有可能存在一种情况,执行setup-config.php 的时候执行到这里?其实接下来已经是在打印错误信息了
  68. define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
  69. require_once( ABSPATH . WPINC . '/version.php' );// 源码里面都没有这个文件啊
  70.  
  71. wp_check_php_mysql_versions();
  72. wp_load_translations_early();// 大概是和国际化语言有关,具体不知道干嘛,但名字好搞笑,early 你妹啊
  73.  
  74. // Die with an error message
  75. $die = sprintf(
  76. /* translators: %s: wp-config.php */
  77. __( "There doesn't seem to be a %s file. I need this before we can get started." ),
  78. '<code>wp-config.php</code>'
  79. ) . '</p>';
  80. $die .= '<p>' . sprintf(
  81. /* translators: %s: Codex URL */
  82. __( "Need more help? <a href='%s'>We got it</a>." ),
  83. __( 'https://codex.wordpress.org/Editing_wp-config.php' )
  84. ) . '</p>';
  85. $die .= '<p>' . sprintf(
  86. /* translators: %s: wp-config.php */
  87. __( "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." ),
  88. '<code>wp-config.php</code>'
  89. ) . '</p>';
  90. $die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>';
  91.  
  92. wp_die( $die, __( 'WordPress &rsaquo; Error' ) );// 打印错误信息
  93. }

学php之翻译wordpress(2)的更多相关文章

  1. 学php之翻译wordpress(1)

    单看文件结构,wordpress分了3个文件夹 wp-admin,wp-content,wp-includes 和零散的一堆php,暂时不清楚各自的分工 入口文件是index.php <?php ...

  2. wordpress 插件 汉化

    http://blog.wpjam.com/article/localizing-a-wordpress-plugin-using-poedit/ 翻译或者说本地化 WordPress 插件和主题可以 ...

  3. php里ezpdo orm框架初探

    http://jackyrong.iteye.com/blog/238930 http://www.oschina.net/project/tag/126/orm?sort=view&lang ...

  4. 架构设计:系统间通信(34)——被神化的ESB(上)

    1.概述 从本篇文章开始,我们将花一到两篇的篇幅介绍ESB(企业服务总线)技术的基本概念,为读者们理清多个和ESB技术有关名词.我们还将在其中为读者阐述什么情况下应该使用ESB技术.接下来,为了加深读 ...

  5. 黄聪:《跟黄聪学WordPress插件开发》

    续<跟黄聪学WordPress主题开发>之后,又一个作品完成!<跟黄聪学Wordpress插件开发>,国内最好的Wordpress插件开发视频教程!! 目录预览: WordPr ...

  6. WordPress翻译中 __()、_e()、_x、_ex 和 _n 的用法及区别

    编译函数 WordPress使用了下面几个函数来方便语言本地化. __() _e() _x() _ex() _n() 以上所列的函数是用来包含所需翻译的字符串的,根据字符串的不同参数和输出类型,需要使 ...

  7. 黄聪:《跟黄聪学WordPress主题开发》

    又一个作品完成!<跟黄聪学Wordpress主题开发>,国内最好的Wordpress主题模版开发视频教程!! 目录预览: WordPress官方源文件层式结构讲解 WordPress数据库 ...

  8. 黄聪:让WordPress主题支持语言本地化(使用poedit软件实现中文翻译功能)

    如果你的WordPress主题要提交到WordPress官方主题库,使用者来自世界各地的多种语言,那么,你就要让你的WordPress主题支持语言本地化,方便使用者进行语言翻译和制作语言包. 让Wor ...

  9. 翻译学python---《Learn Python the hard Way》---第一章 绪论

    打算学习python,但是又不想单纯地看书或是写个小项目,干脆引入很流行的翻译学习法来学习吧-         在论坛上看到了国外的一本<Learn Python the hard Way> ...

随机推荐

  1. (原)编译caffe时提示未定义的引用(undefined reference to)

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5864715.html 参考网址: https://github.com/BVLC/caffe/issu ...

  2. (原)使用opencv的warpAffine函数对图像进行旋转

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5070576.html 参考网址: http://stackoverflow.com/questions ...

  3. css使用技巧

    1) 网站上经常会出现用户输入一大段字符和字母以至于文字无法正常折行,把版式破坏,这样我们就要参考以下样式:word-wrap:break-word; overflow:hidden; 当然必须得有宽 ...

  4. 裸kmp算法

    Number Sequence Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and ...

  5. linux 安装mysqlServer

    先下载mysql安装包 打开 http://dev.mysql.com/downloads/mysql/  选择 linux - Generic 再选择*.tar.gz(最后那两个) 下载完毕后,得到 ...

  6. Gson的简单使用

    package test; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.uti ...

  7. error: ‘shared_ptr’ in namespace ‘std’ does not name a type

    用G++编译项目的时候发生标题上的错误,原因是,这是c++ 11标准的.在给g++传递命令行的时候加上-std=c++0x就行了. 还需要在源码中#include<memory> 我的cm ...

  8. log4cplus配置文件使用

    简介 log4cplus是log4j的c++移植版,是c++中一个很好的打印日志的库.它与另外一个c++的log库log4cxx相比较,好处是不依赖于libapr和libaprutil,可以静态链接到 ...

  9. cf471B MUH and Important Things

    B. MUH and Important Things time limit per test 1 second memory limit per test 256 megabytes input s ...

  10. 过程化开发2048智力游戏WebApp

    时间荏苒,唯编程与青春不可辜负,感觉自己一直没有专心去提升编程的技能,甚是惭愧!!! 周五,无意间看到一个开发2048的视频,有点兴趣就动起手来了,虽然不擅长前端开发,在此献丑,分享一下自己使用过程化 ...