PluginProbe
Theme Check / 20210921
Theme Check v20210921
trunk 20190208.1 20190801.1 20200612.1 20200731.1 20200922.1 20210617 20210921 20211203 20220929 20230412 20230417 20231220 20260821
theme-check / theme-check.php

theme-check.php in Theme Check 20210921, at theme-check.php

75 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Theme Check
4 * Plugin URI: https://github.com/WordPress/theme-check/
5 * Description: A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!
6 * Author: Theme Review Team
7 * Version: 20210921
8 * Text Domain: theme-check
9 * License: GPLv2
10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
11 */
12
13 class ThemeCheckMain {
14 function __construct() {
15 add_action( 'admin_init', array( $this, 'tc_i18n' ) );
16 add_action( 'admin_menu', array( $this, 'themecheck_add_page' ) );
17 }
18
19 function tc_i18n() {
20 load_plugin_textdomain( 'theme-check', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
21 }
22
23 function load_styles() {
24 wp_enqueue_style( 'style', plugins_url( 'assets/style.css', __FILE__ ), array(), '1', 'screen' );
25 }
26
27 function themecheck_add_page() {
28 $page = add_theme_page( 'Theme Check', 'Theme Check', 'manage_options', 'themecheck', array( $this, 'themecheck_do_page' ) );
29 add_action( 'admin_print_styles-' . $page, array( $this, 'load_styles' ) );
30 }
31
32 function tc_add_headers( $extra_headers ) {
33 $extra_headers = array( 'License', 'License URI', 'Template Version' );
34 return $extra_headers;
35 }
36
37 function themecheck_do_page() {
38 if ( ! current_user_can( 'manage_options' ) ) {
39 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'theme-check' ) );
40 }
41
42 add_filter( 'extra_theme_headers', array( $this, 'tc_add_headers' ) );
43
44 include 'checkbase.php';
45 include 'main.php';
46
47 ?>
48 <div id="theme-check" class="wrap">
49 <h1><?php echo esc_html_x( 'Theme Check', 'title of the main page', 'theme-check' ); ?></h1>
50 <div class="theme-check">
51 <?php
52 tc_form();
53 if ( ! isset( $_POST['themename'] ) ) {
54 tc_intro();
55 }
56
57 if ( isset( $_POST['themename'] ) ) {
58 check_admin_referer( 'themecheck-nonce' );
59
60 if ( isset( $_POST['trac'] ) ) {
61 define( 'TC_TRAC', true );
62 }
63
64 wp_raise_memory_limit();
65
66 check_main( wp_unslash( $_POST['themename'] ) );
67 }
68 ?>
69 </div> <!-- .theme-check-->
70 </div>
71 <?php
72 }
73 }
74 new ThemeCheckMain();
75