Skip to content

Commit

Permalink
Run phpcs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bueltge authored Apr 28, 2021
1 parent baeb55b commit 92c86f8
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 116 deletions.
35 changes: 15 additions & 20 deletions WpAdminStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function __construct() {
* @since 0.0.1
*/
public static function get_instance() {

static $instance;

if ( null === $instance ) {
Expand All @@ -72,7 +71,6 @@ public static function get_instance() {
* @since 05/02/2013
*/
public function plugin_setup() {

$this->load_classes();

if ( ! is_admin() ) {
Expand Down Expand Up @@ -111,7 +109,6 @@ protected function load_classes() {
* @access public
*/
public function add_menu_page() {

$page_hook_suffix = add_menu_page(
esc_html__( 'WordPress Admin Style', 'WpAdminStyle' ),
esc_html__( 'Admin Style', 'WpAdminStyle' ),
Expand Down Expand Up @@ -151,21 +148,26 @@ public function get_style_examples() {
include_once $patterns;
echo '<details class="primer" style="display: inline-block; width: 100%;">';
echo '<summary title="Show markup and usage">&#8226;&#8226;&#8226; '
. esc_attr__( 'Show markup and usage', 'WpAdminStyle' )
. '</summary>';
. esc_attr__( 'Show markup and usage', 'WpAdminStyle' )
. '</summary>';
echo '<section>';
echo '<pre><code class="language-php">';
echo htmlspecialchars( file_get_contents( $patterns,
FILE_USE_INCLUDE_PATH ), ENT_QUOTES );
echo htmlspecialchars(
file_get_contents(
$patterns,
FILE_USE_INCLUDE_PATH
),
ENT_QUOTES
);
echo '</code></pre>';
echo '</section>';
echo '</details><!--/.primer-->';
echo '<p>';
echo '<a class="alignright button" href="javascript:void(0);" onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;">' . esc_attr__(
'scroll to top',
'WpAdminStyle'
)
. '</a><br class="clear" />';
'scroll to top',
'WpAdminStyle'
)
. '</a><br class="clear" />';
echo '</p>';
echo '</section><!--/.pattern-->';
echo '<hr>';
Expand All @@ -187,10 +189,8 @@ public function get_style_examples() {
* @uses get_plugin_data
* @access public
* @since 0.0.1
*
*/
private function get_plugin_data( $value = 'Version' ) {

static $plugin_data = array();

// fetch the data just once.
Expand All @@ -211,7 +211,6 @@ private function get_plugin_data( $value = 'Version' ) {
* Print the mini menu for a short navigation.
*/
public function get_mini_menu() {

$patterns = $this->get_patterns( 'headers' );
?>
<div id="poststuff">
Expand Down Expand Up @@ -345,14 +344,12 @@ public function get_mini_menu() {
*
* @param string $type Type of patters, default '', possible is 'headers'.
*
* @param bool $sort
* @param bool $sort
*
* @return array|mixed
* @since 2015-03-25
*
*/
public function get_patterns( $type = '', $sort = true ) {

$files = array();
$this->patterns_dir = plugin_dir_path( __FILE__ ) . 'patterns';
$handle = opendir( $this->patterns_dir );
Expand All @@ -379,13 +376,12 @@ public function get_patterns( $type = '', $sort = true ) {
/**
* Add donate link to plugin description in /wp-admin/plugins.php
*
* @param array $plugin_meta All met data to a plugin.
* @param array $plugin_meta All met data to a plugin.
* @param string $plugin_file The main file of the plugin with the meta data.
*
* @return array
*/
public function donate_link( $plugin_meta, $plugin_file ) {

if ( plugin_basename( __FILE__ ) === $plugin_file ) {
$plugin_meta[] = sprintf(
'&hearts; <a href="%s">%s</a>',
Expand All @@ -403,7 +399,6 @@ public function donate_link( $plugin_meta, $plugin_file ) {
* @since 2016-05-20
*/
public function enqueue_assets() {

wp_register_style(
'prism',
plugins_url( 'css/prism.css', __FILE__ ),
Expand Down
52 changes: 24 additions & 28 deletions inc/WpAdminDashicons.php
Original file line number Diff line number Diff line change
@@ -1,58 +1,54 @@
<?php
// avoid direct calls to this file, because now WP core and framework has been used.
! defined( 'ABSPATH' ) && exit;
! defined( 'ABSPATH' ) && exit;

add_action(
add_action(
'init',
array( WpAdminDashicons::get_instance(), 'plugin_setup' )
);

class WpAdminDashicons {

/**
* Plugin instance.
*
* @see get_instance()
*/
protected static $instance;

/**
* Access this plugin’s working instance
*
* @wp-hook admin_init
* @since 05/02/2013
*/
public static function get_instance() {

NULL === self::$instance && self::$instance = new self;

null === self::$instance && self::$instance = new self();

return self::$instance;
}

/**
* Used for regular plugin work.
*
*
* @wp-hook admin_init
* @since 05/02/2013
* @return void
*/
public function plugin_setup() {

add_action( 'admin_menu', array( $this, 'register_submenu' ) );

}

/**
* Constructor.
* Intentionally left empty and public.
*
* @see plugin_setup()
* @since 05/02/2013
*/
* Constructor.
* Intentionally left empty and public.
*
* @see plugin_setup()
* @since 05/02/2013
*/
public function __construct() {}

public function register_submenu() {

$hook = add_submenu_page(
'WordPress_Admin_Style',
__( 'Dashicons' ),
Expand All @@ -63,7 +59,7 @@ public function register_submenu() {
);
add_action( 'load-' . $hook, array( $this, 'register_scripts' ) );
}

public function get_dashicon_demo() {
?>
<div class="wrap">
Expand Down Expand Up @@ -144,21 +140,21 @@ function enqueue_font_awesome() {
</div>
<?php
}

public function register_scripts() {

wp_register_style( 'dashicons-demo',
wp_register_style(
'dashicons-demo',
plugin_dir_url( __FILE__ ) . '../css/dashicons-demo.css',
array( 'dashicons' )
);
wp_enqueue_style ( 'dashicons-demo' );
wp_enqueue_style( 'dashicons-demo' );

wp_register_script(
'dashicons-picker',
plugin_dir_url( __FILE__ ) . '../js/dashicons-picker.js',
array( 'jquery' ),
FALSE,
TRUE
false,
true
);
wp_enqueue_script( 'dashicons-picker' );
}
Expand Down
18 changes: 7 additions & 11 deletions inc/WpAdminGenericons.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// avoid direct calls to this file, because now WP core and framework has been used.
! defined( 'ABSPATH' ) && exit;
! defined( 'ABSPATH' ) && exit;

add_action(
'init',
Expand All @@ -23,8 +23,7 @@ class WpAdminGenericons {
* @since 05/02/2013
*/
public static function get_instance() {

NULL === self::$instance && self::$instance = new self;
null === self::$instance && self::$instance = new self();

return self::$instance;
}
Expand All @@ -37,9 +36,7 @@ public static function get_instance() {
* @return void
*/
public function plugin_setup() {

add_action( 'admin_menu', array( $this, 'register_submenu' ) );

}

/**
Expand All @@ -53,7 +50,6 @@ public function __construct() {
}

public function register_submenu() {

$hook = add_submenu_page(
'WordPress_Admin_Style',
esc_html__( 'Genericons' ),
Expand Down Expand Up @@ -113,7 +109,7 @@ public function get_genericon_demo() {
<div title="f204" class="genericon genericon-facebook-alt"><code>.genericon-facebook-alt</code>
<span>facebook</span></div>
<div title="f205" class="genericon genericon-wordpress"><code>.genericon-wordpress</code>
<span>wordpress</span></div>
<span>WordPress</span></div>
<div title="f206" class="genericon genericon-googleplus"><code>.genericon-googleplus</code>
<span>google plus googleplus google+ +</span></div>
<div title="f207" class="genericon genericon-linkedin"><code>.genericon-linkedin</code>
Expand Down Expand Up @@ -382,11 +378,11 @@ public function get_genericon_demo() {
}

public function register_scripts() {

wp_register_style( 'genericons', plugin_dir_url( __FILE__ ) . '../css/genericons.css' );
wp_register_style( 'genericons-demo',
plugin_dir_url( __FILE__ ) . '../css/genericons-demo.css',
'genericons'
wp_register_style(
'genericons-demo',
plugin_dir_url( __FILE__ ) . '../css/genericons-demo.css',
'genericons'
);
wp_enqueue_style( 'genericons' );
wp_enqueue_style( 'genericons-demo' );
Expand Down
Loading

0 comments on commit 92c86f8

Please sign in to comment.