Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Fix sniffer issues in admin files
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Jan 20, 2017
1 parent cf23042 commit d8a8496
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
23 changes: 19 additions & 4 deletions inc/admin.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
<?php
/**
* Admin functions
*
* @package NS_Theme_Check
*/

add_action( 'admin_menu', 'ns_theme_check_admin_menu' );

/**
* Register admin menu.
*
* @since 0.1.0
*/
function ns_theme_check_admin_menu() {

add_theme_page( __( 'NS Theme Check', 'ns-theme-check' ), __( 'NS Theme Check', 'ns-theme-check' ), 'manage_options', 'ns-theme-check', 'ns_theme_check_render_admin_page', 'dashicons-tickets' );
add_theme_page( esc_html__( 'NS Theme Check', 'ns-theme-check' ), esc_html__( 'NS Theme Check', 'ns-theme-check' ), 'manage_options', 'ns-theme-check', 'ns_theme_check_render_admin_page' );

}

add_action( 'admin_menu', 'ns_theme_check_admin_menu' );

/**
* Callback for admin page.
*
* @since 0.1.0
*/
function ns_theme_check_render_admin_page() {
?>
<div class="wrap">
Expand All @@ -16,6 +31,6 @@ function ns_theme_check_render_admin_page() {
<?php ns_theme_check_render_form(); ?>
<hr />
<?php ns_theme_check_render_output(); ?>
</div><!-- .wrap -->
</div>
<?php
}
25 changes: 24 additions & 1 deletion inc/helpers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<?php

/**
* Helper functions
*
* @package NS_Theme_Check
*/

/**
* Render form.
*
* @since 0.1.0
*/
function ns_theme_check_render_form() {
$all_themes = wp_get_themes();
$themes = array();
Expand Down Expand Up @@ -41,6 +51,11 @@ function ns_theme_check_render_form() {
<?php
}

/**
* Render sniff results.
*
* @since 0.1.0
*/
function ns_theme_check_render_output() {

// Bail if empty.
Expand All @@ -66,6 +81,14 @@ function ns_theme_check_render_output() {

}

/**
* Perform sniff check.
*
* @since 0.1.0
*
* @param string $theme Theme slug.
* @param array $args Arguments.
*/
function ns_theme_check_do_sniff( $theme, $args = array() ) {

require_once NS_THEME_CHECK_DIR . '/vendor/autoload.php';
Expand Down
9 changes: 7 additions & 2 deletions ns-theme-check.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php
/**
* Plugin Name: NS Theme Check
* Plugin URI:
* Plugin URI: https://github.com/ernilambar/ns-theme-check
* Description: Theme Check using sniffs.
* Version: 0.1.0
* Version: 0.1.1
* Author: Nilambar Sharma
* Author URI: http://nilambar.net
* Text Domain: ns-theme-check
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*
* @package NS_Theme_Check
*/

// If this file is called directly, abort.
Expand All @@ -20,5 +22,8 @@
define( 'NS_THEME_CHECK_DIR', rtrim( plugin_dir_path( __FILE__ ), '/' ) );
define( 'NS_THEME_CHECK_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );

// Load helpers.
require_once NS_THEME_CHECK_DIR . '/inc/helpers.php';

// Load admin.
require_once NS_THEME_CHECK_DIR . '/inc/admin.php';

0 comments on commit d8a8496

Please sign in to comment.