<?php /*********** ** ** @晨星博客开发主题扩展代码放置区 ** @添加方法: ** @1、 从下一行开始,放置您复制的代码; ** @2、 注意代码中符号的格式,php代码全部用半角符号,全角会报错; ** @3、 禁止使用windows记事本编辑改php文件; ** **********************************************/ /////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // 以下是主题的一些默认参数,如果默认值不能满足您的需求可以通过修改来实现部分效果 // // // /////////////////////////////////////////////////////////////////////////////////////////////////////////// if ( !defined( 'CX_USERS_SYSTEM' ) ) define('CX_USERS_SYSTEM', 'on');//是否启用会员系统 if ( !defined( 'CX_AUTO_POST' ) ) define('CX_AUTO_POST', 5);//图片超过5个自动分页 if ( !defined( 'CX_AUTO_LUNBO' ) ) define('CX_AUTO_LUNBO', 3);//幻灯片轮播图数量 if ( !defined( 'CX_PAGE_NUM' ) ) define('CX_PAGE_NUM', 3);//定义分页当前页码前后显示数量 if ( !defined( 'CX_DT_NUM' ) ) define('CX_DT_NUM', 5);//单图模式下文章分页数量 if ( !defined( 'CX_AJAX_NUM' ) ) define('CX_AJAX_NUM', 5);//单图模式ajax自动加载分页数量 if ( !defined( 'CX_IMAGES_NUM' ) ) define('CX_IMAGES_NUM', 3);//图片预加载多少张 if ( !defined( 'CX_BQTJ' ) ) define('CX_BQTJ',0); if ( !defined( 'CX_DT_NUMTOW' ) ) define('CX_DT_NUMTOW',10); /////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // 以下功能不常用,非特色需求请勿开启! // // // /////////////////////////////////////////////////////////////////////////////////////////////////////////// //add_filter('the_content', 'page_glmt_cx');//过滤分页符 //add_filter( 'site_url', 'cx_remove_root' );//站内后台相关链接使用相对路径 /////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // 以下修改可能导致主题运行不正常或后台设置项失效 ,该区域不建议大家做任何修改 // // // /////////////////////////////////////////////////////////////////////////////////////////////////////////// add_filter( 'max_srcset_image_width', 'cx_srcset_image_width' );//禁用自适应图像 add_filter('pre_option_link_manager_enabled','__return_true'); //添加链接功能 add_action('admin_print_scripts', 'my_quicktags');//添加短代码按钮 add_action('widgets_init','unregister_rss_widget');//禁用默认小工具 update_option('image_default_link_type', 'none');//图片默认无连接 add_filter('show_admin_bar', '__return_false');//禁用工具栏 add_action('delete_post', 'delete_chenxing_meta_fields');//删除文章时删除自定义字段 function cx_srcset_image_width($width){ return 1; } /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /* 发布文章自动设置字段 /* -------------------------------- */ add_action('publish_post', 'add_custom_field_automatically', 10, 2 ); add_action( 'publish_picture', 'add_custom_field_automatically', 10, 2 ); function add_custom_field_automatically($post_ID) { global $wpdb; if(!wp_is_post_revision($post_ID)) { $random = 0; $random2 = 0; if(option_off('cx_fujia_views')) $random = mt_rand(500, 2000); if(option_off('cx_fujia__ding')) $random2 = mt_rand(5, 20); add_post_meta($post_ID, 'views', $random, true); add_post_meta($post_ID, 'bigfa_ding', $random2, true); add_post_meta($post_ID, 'chenxing_post_collects', 0, true); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // 以下是主题伪静态规则,适用于/%category%/%post_id%.html样式,如果使用其他样式需要修改以下规则 // // // /////////////////////////////////////////////////////////////////////////////////////////////////////////// add_filter('http_request_args','http_request_args_rest',10,1); function http_request_args_rest($r){ $r['sslverify'] = false; $r['timeout'] = 120; return $r; } //扩展代码放到上面一行 .end // 拦截流氓机器人恶意搜索刷数据库日志 function filter_search_keywords($query) { if ($query->is_search && !is_admin()) { $search_query = get_search_query(); $black_list = array('发票', '开票', '溦', '葳', '微信', '加微'); foreach ($black_list as $bad_word) { if (strpos($search_query, $bad_word) !== false) { wp_die('请文明搜索!', '拒绝恶意注入', array('response' => 403)); } } } return $query; } add_action('pre_get_posts', 'filter_search_keywords'); 45美图片 – 第 711 页
最近一周新增 11944 篇文章
加载中...
正在为您加载新内容
<!--footer--> <?php if(option_off('_cx_tongji')){?> <div class="foot" id="footer"> <div class="foot_list"> <?php $tongji_arr = option_data('_cx_tongji_type',['postnum','plnum','ztnum','daynum']); $for_number = 0; foreach ($tongji_arr as $tj_value) { $for_number++; if( $for_number > 4) break; echo '<div class="foot_num">'; switch ($tj_value) { case 'postnum': ?> <div>文章总数</div> <div style="position: relative;"><?php $count_posts = wp_count_posts(); $pub_posts = intval($count_posts->publish); if($pub_posts>10000){ echo number_format($pub_posts/10000, 2).'<span style="font-size: 32px;position: absolute;">万</span>'; }else{ echo $pub_posts.'+'; } ?></div> <?php break;case 'plnum': ?> <div>评论总数</div> <div><?php echo $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments");?>+</div> <?php break;case 'ztnum': ?> <div>专题栏目</div> <div><?php $zt = wp_count_posts('zhuanti_type'); echo $zt->publish;?>+</div> <?php break;case 'usernum': ?> <div>注册用户</div> <div><?php echo (int)$wpdb->get_var("select count(id) from $wpdb->users");?>+</div> <?php break;case 'daynum': ?> <div>运营天数</div> <div> <?php $user_admin_info = get_userdata(1); $admin_time = ($user_admin_info)?$user_admin_info->user_registered:'2016-11-22'; echo floor((time()-strtotime($admin_time))/86400); ?>+</div> <?php break; } echo '</div>'; } ?> </div> </div> <?php } ?> <footer class="w100 cl" id="footer-boot"> <?php echo cx_foot(); ?> </footer> <div class="popsearch-js popsearch-box"> <div class="bg cxposi0"></div> <div class="popse-main"> <div class="search-content"> <div class="search-input-box"> <form role="search" method="get" action="<?php echo home_url();?>"> <button type="submit"><i class="iconfont">&#xe659;</i></button> <input type="hidden" name="post_type" value="post"> <input placeholder="请输入搜索词..." name="s" type="text" autocomplete="off" required="required"> </form> </div> <div class="search-history search-hot"> <strong>热门搜索</strong> <ul> <?php // cx_get_searchlist();?> </ul> </div> </div> <div class="popadbox"> <?php cx_ad_zhenghe(10); ?> </div> </div> <div class="closebox close"> <i class="iconfont popsearch-close-js" style="margin-right: 0">&#xe93e;</i> </div> </div> <style> </style> <?php wp_footer();?> <!--移动侧边导航--> </body> </html>