Skip to content

Commit

Permalink
Cleanup memoory data
Browse files Browse the repository at this point in the history
  • Loading branch information
bueltge committed Jan 22, 2017
1 parent 214368a commit afab204
Show file tree
Hide file tree
Showing 3 changed files with 285 additions and 282 deletions.
169 changes: 85 additions & 84 deletions inc/class-html_inspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,102 +2,103 @@
/**
* Wrapper for HTML Inspector Tool
* HTML Inspector is a code quality tool to help you and your team write better markup.
*
* @see https://github.com/philipwalton/html-inspector
*
*
* @package Debug Objects
* @subpackage HTML Inspector
* @author Frank Bültge
* @since 01/03/2014
* @version 01/03/2014
* @version 2017-01-21
*/

if ( ! function_exists( 'add_filter' ) ) {
echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
exit;
}

if ( ! class_exists( 'Debug_Objects_Html_Inspector' ) ) {
class Debug_Objects_Html_Inspector extends Debug_Objects {

protected static $classobj = NULL;

private static $handle = 'html-inspector';

/**
* Handler for the action 'init'. Instantiates this class.
*
* @access public
* @return \Debug_Objects_Html_Inspector|null $classobj
*/
public static function init() {

NULL === self::$classobj && self::$classobj = new self();

return self::$classobj;
}
class Debug_Objects_Html_Inspector {

/**
* Constructor
*/
public function __construct() {

if ( ! current_user_can( '_debug_objects' ) )
return;

if ( is_admin() )
return;

add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_script' ) );
add_filter( 'debug_objects_tabs', array( $this, 'get_conditional_tab' ) );
}

/**
* Load inspector javascript
*
* @since 01/03/2014
* @return void
*/
public function enqueue_script() {

wp_register_script( self::$handle,
plugins_url( 'html-inspector/', __FILE__ ) . 'html-inspector.js'
);
wp_register_script( 'run-' . self::$handle,
plugins_url( 'html-inspector/', __FILE__ ) . 'run-html-inspector.js',
array( 'jquery', self::$handle )
);
wp_enqueue_script( 'run-' . self::$handle );
}

/**
* Create new tab for information about the plugin in the plugin tab list
*
* @since 01/03/2014
* @param array $tabs
* @return array $tabs
*/
public function get_conditional_tab( $tabs ) {

$tabs[] = array(
'tab' => __( 'HTML Inspector', parent :: get_plugin_data() ),
'function' => array( $this, 'get_html_errors' )
);

return $tabs;
protected static $classobj;

private static $handle = 'html-inspector';

/**
* Handler for the action 'init'. Instantiates this class.
*
* @access public
* @return \Debug_Objects_Html_Inspector|null $classobj
*/
public static function init() {

NULL === self::$classobj && self::$classobj = new self();

return self::$classobj;
}

/**
* Constructor
*/
public function __construct() {

if ( ! current_user_can( '_debug_objects' ) ) {
return;
}

/**
* Greate a output to easier to read without console
*
* @since 01/03/2014
* @return String $output
*/
public function get_html_errors() {

$output = '<h4>HTML Inspector Error Feedback</h4>';

echo $output;

if ( is_admin() ) {
return;
}

} // end class
}

add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_script' ) );
add_filter( 'debug_objects_tabs', array( $this, 'get_conditional_tab' ) );
}

/**
* Load inspector javascript
*
* @since 01/03/2014
* @return void
*/
public function enqueue_script() {

wp_register_script( self::$handle,
plugins_url( 'html-inspector/', __FILE__ ) . 'html-inspector.js'
);
wp_register_script( 'run-' . self::$handle,
plugins_url( 'html-inspector/', __FILE__ ) . 'run-html-inspector.js',
array( 'jquery', self::$handle )
);
wp_enqueue_script( 'run-' . self::$handle );
}

/**
* Create new tab for information about the plugin in the plugin tab list
*
* @since 01/03/2014
*
* @param array $tabs
*
* @return array $tabs
*/
public function get_conditional_tab( $tabs ) {

$tabs[] = array(
'tab' => esc_attr__( 'HTML Inspector', 'debug_objects' ),
'function' => array( $this, 'get_html_errors' )
);

return $tabs;
}

/**
* Create a output to easier to read without console.
*
* @since 01/03/2014
*/
public function get_html_errors() {

$output = '<h4>HTML Inspector Error Feedback</h4>';

echo $output;
}
} // end class
Loading

0 comments on commit afab204

Please sign in to comment.