http://hi.baidu.com/wordpressing/blog/item/64b8f538163069f53a87cec7.html
/**
* timer_start() - PHP 4 standard microtime start capture
*
* @access private
* @since 0.71
* @global int $timestart Seconds and Microseconds added together from when function is called
* @return bool Always returns true
*/
function timer_start() {
global $timestart;
$mtime = explode(' ', microtime() );
$mtime = $mtime[1] + $mtime[0];
$timestart = $mtime;
return true;
}
microtime -- 返回当前 Unix 时间戳和微秒数。
如果调用时不带可选参数,本函数以 "msec sec" 的格式返回一个字符串,其中 sec 是自 Unix 纪元(0:00:00 January 1, 1970 GMT)起到现在的秒数,msec 是微秒部分。字符串的两部分都是以秒为单位返回的。
/**
* timer_stop() - Return and/or display the time from the page start to when function is called.
*
* You can get the results and print them by doing:
* <code>
* $nTimePageTookToExecute = timer_stop();
* echo $nTimePageTookToExecute;
* </code>
*
* Or instead, you can do:
* <code>
* timer_stop(1);
* </code>
* which will do what the above does. If you need the result, you can assign it to a variable, but
* most cases, you only need to echo it.
*
* @since 0.71
* @global int $timestart Seconds and Microseconds added together from when timer_start() is called
* @global int $timeend Seconds and Microseconds added together from when function is called
*
* @param int $display Use '0' or null to not echo anything and 1 to echo the total time
* @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
* @return float The "second.microsecond" finished time calculation
*/
function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
global $timestart, $timeend;
$mtime = microtime();
$mtime = explode(' ',$mtime);
$mtime = $mtime[1] + $mtime[0];
$timeend = $mtime;
$timetotal = $timeend-$timestart;
$r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
if ( $display )
echo $r;
return $r;
}
timer_start();
时间函数,开始记录时间,结束时间是timer_stop
// Add define('WP_DEBUG',true); to wp-config.php to enable display of notices during development.
/*在 WordPress 2.3.1 版本中,又增加了新的参数,调试参数(WP_DEBUG)。这是一个逻辑参数,也就是只有是(true)和否(false)两个选项。如果设置为是,则 WordPress 发生错误是,会将错误报告给用户。如果你没有在 wp-config.php 中设置此参数,默认参数为否,即不发送错误报告。*/
if (defined('WP_DEBUG') and WP_DEBUG == true) {
error_reporting(E_ALL);
} else {
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
}
// For an advanced caching plugin to use, static because you would only want one
if ( defined('WP_CACHE') )
@include ABSPATH . 'wp-content/advanced-cache.php';
/**
* Stores the location of the WordPress directory of functions, classes, and core content.
*
* @since 1.0.0
*/
define('WPINC', 'wp-includes');
if ( !defined('LANGDIR') ) {
/**
* Stores the location of the language directory. First looks for language folder in wp-content
* and uses that folder if it exists. Or it uses the "languages" folder in WPINC.
*
* @since 2.1.0
*/
if ( file_exists(ABSPATH . 'wp-content/languages') && @is_dir(ABSPATH . 'wp-content/languages') )
define('LANGDIR', 'wp-content/languages'); // no leading slash, no trailing slash
else
define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash
}
关于语言的操作。如果存在wp-content/languages文件夹,就定义常量LANGDIR为wp-content/languages
否则就是wp-includes/languages
/**
* Allows for the plugins directory to be moved from the default location.
*
* This isn't used everywhere. Constant is not used in plugin_basename()
* which might cause conflicts with changing this.
*
* @since 2.1
*/
if ( !defined('PLUGINDIR') )
define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash
require (ABSPATH . WPINC . '/compat.php');
require (ABSPATH . WPINC . '/functions.php');
require (ABSPATH . WPINC . '/classes.php');
require_wp_db();
if ( !empty($wpdb->error) )
dead_db();
$prefix = $wpdb->set_prefix($table_prefix);
if ( is_wp_error($prefix) )
wp_die('<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.');
if ( file_exists(ABSPATH . 'wp-content/object-cache.php') )
require_once (ABSPATH . 'wp-content/object-cache.php');
else
require_once (ABSPATH . WPINC . '/cache.php');
wp_cache_init();
require (ABSPATH . WPINC . '/plugin.php');
require (ABSPATH . WPINC . '/default-filters.php');
include_once(ABSPATH . WPINC . '/streams.php');
include_once(ABSPATH . WPINC . '/gettext.php');
require_once (ABSPATH . WPINC . '/l10n.php');
if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
if ( defined('WP_SITEURL') )
$link = WP_SITEURL . '/wp-admin/install.php';
elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false)
$link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
else
$link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
require_once(ABSPATH . WPINC . '/kses.php');
require_once(ABSPATH . WPINC . '/pluggable.php');
wp_redirect($link);
die(); // have to die here ~ Mark
}
require (ABSPATH . WPINC . '/formatting.php');
require (ABSPATH . WPINC . '/capabilities.php');
require (ABSPATH . WPINC . '/query.php');
require (ABSPATH . WPINC . '/theme.php');
require (ABSPATH . WPINC . '/user.php');
require (ABSPATH . WPINC . '/general-template.php');
require (ABSPATH . WPINC . '/link-template.php');
require (ABSPATH . WPINC . '/author-template.php');
require (ABSPATH . WPINC . '/post.php');
require (ABSPATH . WPINC . '/post-template.php');
require (ABSPATH . WPINC . '/category.php');
require (ABSPATH . WPINC . '/category-template.php');
require (ABSPATH . WPINC . '/comment.php');
require (ABSPATH . WPINC . '/comment-template.php');
require (ABSPATH . WPINC . '/rewrite.php');
require (ABSPATH . WPINC . '/feed.php');
require (ABSPATH . WPINC . '/bookmark.php');
require (ABSPATH . WPINC . '/bookmark-template.php');
require (ABSPATH . WPINC . '/kses.php');
require (ABSPATH . WPINC . '/cron.php');
require (ABSPATH . WPINC . '/version.php');
require (ABSPATH . WPINC . '/deprecated.php');
require (ABSPATH . WPINC . '/script-loader.php');
require (ABSPATH . WPINC . '/taxonomy.php');
require (ABSPATH . WPINC . '/update.php');
require (ABSPATH . WPINC . '/canonical.php');
require (ABSPATH . WPINC . '/shortcodes.php');
require (ABSPATH . WPINC . '/media.php');
if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) {
// Used to guarantee unique hash cookies
$cookiehash = md5(get_option('siteurl'));
/**
* Used to guarantee unique hash cookies
* @since 1.5
*/
define('COOKIEHASH', $cookiehash);
}
分享到:
相关推荐
Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码——iPhone版Wordpress源代码Iphone开发系列源码...
基于PHP的扎鸟搜索引擎蜘蛛爬行查询(wordpress专用)php版源码.zip 基于PHP的扎鸟搜索引擎蜘蛛爬行查询(wordpress专用)php版源码.zip 基于PHP的扎鸟搜索引擎蜘蛛爬行查询(wordpress专用)php版源码.zip 基于PHP...
WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PHP和MySQL数据库的服务器上架设属于自己的网站。
wordpress之wp-settings.php
Rockable.Press.Building.WordPress.Themes.From.Scratch.May.2012.rar
基于PHP的WordPress爱导航网址大全源码.zip
PHP实例开发源码—wordpress人文古风主题 php版.zip PHP实例开发源码—wordpress人文古风主题 php版.zip PHP实例开发源码—wordpress人文古风主题 php版.zip
PHP实例开发源码—wordpress团购淘客主题 php版.zip PHP实例开发源码—wordpress团购淘客主题 php版.zip PHP实例开发源码—wordpress团购淘客主题 php版.zip
PHP实例开发源码—Wordpress 商业模板源码 php版.zip PHP实例开发源码—Wordpress 商业模板源码 php版.zip PHP实例开发源码—Wordpress 商业模板源码 php版.zip
PHP实例开发源码—WordPress MU php 多用户博客.zip PHP实例开发源码—WordPress MU php 多用户博客.zip PHP实例开发源码—WordPress MU php 多用户博客.zip
wordpress-5.3(1).tar.gz,最新的wordpress版本,适合centos7等linux系统。
源代码,构建自己最出色的WordPress主题,本书是英文版,英文好的大侠可以深入研究,。里面有图,一步步指引,挺简单。喜欢的朋友可以下。
3 Content management with WordPress: Beyond the blog 89 4 Users, categories, and tags: Keeping things organized 131 5 Video and plug-ins: Getting things moving 167 6 Podcasting and ...
PHP实例开发源码—雪箭Wordpress淘宝客主题Jumei php版.zip PHP实例开发源码—雪箭Wordpress淘宝客主题Jumei php版.zip PHP实例开发源码—雪箭Wordpress淘宝客主题Jumei php版.zip
wordpress 代码分析整理
对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步...
对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步...