What The File - Version 1.0.1

Version Description

  • Changed the way the plugin initializes.
  • Moved CSS from file to inline CSS.

=

Download this release

Release Info

Developer barrykooij
Plugin Icon 128x128 What The File
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0 to 1.0.1

Files changed (3) hide show
  1. readme.txt +5 -5
  2. what-the-file.css +0 -5
  3. what-the-file.php +12 -14
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: toolbar, development, file, template, template editing
5
  Requires at least: 3.1
6
  Tested up to: 3.4
7
- Stable tag: 1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,14 +29,14 @@ In the toolbar you will find the "What The File" option. Hovering this option wi
29
 
30
  You have to be an Administrator to see the "What The File" option.
31
 
32
-
33
-
34
  == Screenshots ==
35
 
36
- 1. This is the first screen shot.
37
 
38
  == Changelog ==
39
 
40
-
 
 
41
 
42
  == Upgrade notice ==
4
  Tags: toolbar, development, file, template, template editing
5
  Requires at least: 3.1
6
  Tested up to: 3.4
7
+ Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
 
30
  You have to be an Administrator to see the "What The File" option.
31
 
 
 
32
  == Screenshots ==
33
 
34
+ 1. What The File shows you what template file is used.
35
 
36
  == Changelog ==
37
 
38
+ = 1.0.1 =
39
+ * Changed the way the plugin initializes.
40
+ * Moved CSS from file to inline CSS.
41
 
42
  == Upgrade notice ==
what-the-file.css DELETED
@@ -1,5 +0,0 @@
1
- #wp-admin-bar-wtf-bar #wp-admin-bar-wtf-bar-sub .ab-item
2
- {
3
- display: block !important;
4
- text-align: right;
5
- }
 
 
 
 
 
what-the-file.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: What The File
4
  Plugin URI: http://www.cageworks.nl/what-the-file/
5
  Description: Find out what template file (PHP) is used on the current page. What The File will be visible in the Toolbar when viewing your website.
6
- Version: 1.0
7
  Author: Barry Kooij
8
  Author URI: http://www.barrykooij.nl/
9
  */
@@ -14,22 +14,21 @@ class WhatTheFile
14
 
15
  public function __construct()
16
  {
17
- if(!function_exists('wp_get_current_user')){include(ABSPATH . "wp-includes/pluggable.php");}
18
- if(!is_super_admin() || !is_admin_bar_showing()){return false;}
19
- if(is_admin()){return false;}
20
- $this->setup();
21
  }
22
 
23
- private function setup()
24
  {
25
- add_action('wp_enqueue_scripts', array(&$this, 'enqueue_style'));
26
- add_filter('template_include', array(&$this, 'save_current_page'), 1000);
27
- add_action('admin_bar_menu', array( &$this, 'admin_bar_menu' ), 1000);
28
  }
29
 
30
- private function get_current_page()
31
  {
32
- return $this->template_name;
 
 
 
 
33
  }
34
 
35
  public function save_current_page($template_name)
@@ -44,10 +43,9 @@ class WhatTheFile
44
  $wp_admin_bar->add_menu( array( 'id' => 'wtf-bar-sub', 'parent' => 'wtf-bar', 'title' => $this->get_current_page(), 'href' => '/wp-admin/theme-editor.php?file='.$this->get_current_page().'&theme='.strtolower(wp_get_theme()) ) );
45
  }
46
 
47
- public function enqueue_style()
48
  {
49
- wp_register_style('wtf_css', plugins_url('what-the-file.css', __FILE__));
50
- wp_enqueue_style( 'wtf_css');
51
  }
52
 
53
  }
3
  Plugin Name: What The File
4
  Plugin URI: http://www.cageworks.nl/what-the-file/
5
  Description: Find out what template file (PHP) is used on the current page. What The File will be visible in the Toolbar when viewing your website.
6
+ Version: 1.0.1
7
  Author: Barry Kooij
8
  Author URI: http://www.barrykooij.nl/
9
  */
14
 
15
  public function __construct()
16
  {
17
+ add_action('init', array(&$this, 'setup'));
 
 
 
18
  }
19
 
20
+ private function get_current_page()
21
  {
22
+ return $this->template_name;
 
 
23
  }
24
 
25
+ public function setup()
26
  {
27
+ if(!is_super_admin() || !is_admin_bar_showing()){return false;}
28
+ if(is_admin()){return false;}
29
+ add_action('wp_head', array(&$this, 'print_css'));
30
+ add_filter('template_include', array(&$this, 'save_current_page'), 1000);
31
+ add_action('admin_bar_menu', array(&$this, 'admin_bar_menu' ), 1000);
32
  }
33
 
34
  public function save_current_page($template_name)
43
  $wp_admin_bar->add_menu( array( 'id' => 'wtf-bar-sub', 'parent' => 'wtf-bar', 'title' => $this->get_current_page(), 'href' => '/wp-admin/theme-editor.php?file='.$this->get_current_page().'&theme='.strtolower(wp_get_theme()) ) );
44
  }
45
 
46
+ public function print_css()
47
  {
48
+ echo "<style type=\"text/css\" media=\"screen\">#wp-admin-bar-wtf-bar #wp-admin-bar-wtf-bar-sub .ab-item{display: block !important;text-align: right;}</style>\n";
 
49
  }
50
 
51
  }