// // 定义小工具的类 WordPressRunningInfoStat class WordPressRunningInfoStat extends WP_Widget{ function WordPressRunningInfoStat(){ // 定义小工具的构造函数 $widget_ops = array('classname' => 'widget_blogstat', 'description' => '显示博客的统计信息'); $this->WP_Widget(false, '博客统计', $widget_ops); } function form($instance){ // 表单函数,控制后台显示 // $instance 为之前保存过的数据 // 如果之前没有数据的话,设置默认量 $instance = wp_parse_args( (array)$instance, array( 'title' => '博客统计', 'establish_time' => '2016-09-28' ) ); $title = htmlspecialchars($instance['title']); $establish_time = htmlspecialchars($instance['establish_time']); // establish_time => 建站日期 // 表格布局输出表单 $output = ''; $output .= '
标题'; $output .= ''; $output .= '
建站日期:'; $output .= ''; $output .= '
'; echo $output; } function update($new_instance, $old_instance){ // 更新数据的函数 $instance = $old_instance; // 数据处理 $instance['title'] = strip_tags(stripslashes($new_instance['title'])); $instance['establish_time'] = strip_tags(stripslashes($new_instance['establish_time'])); return $instance; } function widget($args, $instance){ extract($args); //展开数组 $title = apply_filters('widget_title',empty($instance['title']) ? ' ' : $instance['title']); $establish_time = empty($instance['establish_time']) ? '2013-01-27' : $instance['establish_time']; echo $before_widget; echo $before_title . $title . $after_title; echo '
'; echo $after_widget; } function efan_get_blogstat($establish_time /*, $instance */){ // 相关数据的获取 global $wpdb; $count_posts = wp_count_posts(); $published_posts = $count_posts->publish; $draft_posts = $count_posts->draft; $comments_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments"); $time = floor((time()-strtotime($establish_time))/86400); $count_tags = wp_count_terms('post_tag'); $count_pages = wp_count_posts('page'); $page_posts = $count_pages->publish; $count_categories = wp_count_terms('category'); $link = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'"); $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); $last = $wpdb->get_results("SELECT MAX(post_modified) AS MAX_m FROM $wpdb->posts WHERE (post_type = 'post' OR post_type = 'page') AND (post_status = 'publish' OR post_status = 'private')"); $last = date('Y-m-d', strtotime($last[0]->MAX_m)); $total_views = $wpdb->get_var("SELECT SUM(meta_value+0) FROM $wpdb->postmeta WHERE meta_key = 'views'"); $uptime = trim(file_get_contents('/proc/uptime')); $uptime = explode(' ', $uptime); $uptime = $uptime[0]; $uptime = round($uptime / 86400, 2); $this->statItem('fa fa-file', '文章数量', $published_posts); $this->statItem('fa fa-comments', '评论数量', $comments_count); $this->statItem('fa fa-tags', '标签数量', $count_tags); $this->statItem('fa fa-clock-o', '建站日期', $establish_time); $this->statItem('fa fa-battery-full', '累计安全运行', $time . ' 天'); $this->statItem('fa fa-power-off', '自上次服务重启后持续运行', $uptime . ' 天'); $this->statItem('fa fa-clock-o', '最后更新', $last); } function statItem($fa, $desc, $data) { echo '
  • '; echo ''; echo '' . $data . ''; echo ' ' . $desc. ' '; echo '
  • '; } } function WordPressRunningInfoStat(){ // 注册小工具 register_widget('WordpressRunningInfoStat'); } add_action('widgets_init','WordpressRunningInfoStat'); ?>
    ( ! ) Warning: session_start(): Cannot start session when headers already sent in D:\wamp64\www\wp-content\themes\ripro\inc\theme-functions.php on line 2638
    Call Stack
    #TimeMemoryFunctionLocation
    10.0001405848{main}( )...\index.php:0
    20.0001406120require( 'D:\wamp64\www\wp-blog-header.php' )...\index.php:17
    30.0001406472require_once( 'D:\wamp64\www\wp-load.php' )...\wp-blog-header.php:13
    40.0002407152require_once( 'D:\wamp64\www\wp-config.php' )...\wp-load.php:37
    50.0002408400require_once( 'D:\wamp64\www\wp-settings.php' )...\wp-config.php:90
    68.92676746000do_action( )...\wp-settings.php:540
    78.92676746376WP_Hook->do_action( )...\plugin.php:478
    88.92676746376WP_Hook->apply_filters( )...\class-wp-hook.php:311
    98.97547495352wp_widgets_init( )...\class-wp-hook.php:287
    108.98097525048do_action( )...\widgets.php:1765
    118.98097525424WP_Hook->do_action( )...\plugin.php:478
    128.98097525424WP_Hook->apply_filters( )...\class-wp-hook.php:311
    138.98097526552caozhuti_widgets_init( )...\class-wp-hook.php:287
    148.98097526552is_cao_site_list_blog( )...\functions.php:153
    158.98107526552session_start ( )...\theme-functions.php:2638

    ( ! ) Warning: session_start(): Cannot start session when headers already sent in D:\wamp64\www\wp-content\themes\ripro\inc\theme-functions.php on line 1869
    Call Stack
    #TimeMemoryFunctionLocation
    10.0001405848{main}( )...\index.php:0
    20.0001406120require( 'D:\wamp64\www\wp-blog-header.php' )...\index.php:17
    310.412015008104require_once( 'D:\wamp64\www\wp-includes\template-loader.php' )...\wp-blog-header.php:19
    410.412015008104do_action( )...\template-loader.php:13
    510.412015008480WP_Hook->do_action( )...\plugin.php:478
    610.412015008480WP_Hook->apply_filters( )...\class-wp-hook.php:311
    710.413415072672cao_retrieve_referral_keyword( )...\class-wp-hook.php:287
    810.413415072672session_start ( )...\theme-functions.php:1869
    未找到页面-大连莱立佰信息技术有限公司
    ( ! ) Warning: session_start(): Cannot start session when headers already sent in D:\wamp64\www\wp-content\themes\ripro\inc\theme-functions.php on line 18
    Call Stack
    #TimeMemoryFunctionLocation
    10.0001405848{main}( )...\index.php:0
    20.0001406120require( 'D:\wamp64\www\wp-blog-header.php' )...\index.php:17
    310.412015008104require_once( 'D:\wamp64\www\wp-includes\template-loader.php' )...\wp-blog-header.php:19
    410.425715078784include( 'D:\wamp64\www\wp-content\themes\ripro\404.php' )...\template-loader.php:106
    510.425715078784get_header( )...\404.php:2
    610.425715079160locate_template( )...\general-template.php:41
    710.425715079240load_template( )...\template.php:672
    810.425815079576require_once( 'D:\wamp64\www\wp-content\themes\ripro-child\header.php' )...\template.php:723
    910.489016401104body_class( )...\header.php:40
    1010.489016401104get_body_class( )...\post-template.php:593
    1110.489516401480apply_filters( )...\post-template.php:834
    1210.489516401880WP_Hook->apply_filters( )...\plugin.php:206
    1310.489516403384cao_body_classes( )...\class-wp-hook.php:289
    1410.489516403384session_start ( )...\theme-functions.php:18
    class="error404 hfeed navbar-sticky sidebar-none pagination-infinite_button no-off-canvas elementor-default">

    暂无内容

    抱歉,没有找到您需要的文章,可以搜索看看

    辽公安备21029602000420