What The File - Version 1.0

Version Description

Download this release

Release Info

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

Version 1.0

Files changed (4) hide show
  1. readme.txt +42 -0
  2. screenshot-1.png +0 -0
  3. what-the-file.css +5 -0
  4. what-the-file.php +55 -0
readme.txt ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === What The File ===
2
+ Contributors: barrykooij
3
+ 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
+
11
+ 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.
12
+
13
+ == Description ==
14
+
15
+ 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.
16
+
17
+ == Installation ==
18
+
19
+ 1. Upload `what-the-file` to the `/wp-content/plugins/` directory
20
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
21
+
22
+ == Frequently asked questions ==
23
+
24
+ = Where can I see what template file is used? =
25
+
26
+ In the toolbar you will find the "What The File" option. Hovering this option will display the currently used template file, clicking the template file name will allow you to edit the template file with the WordPress file editor.
27
+
28
+ = I can't find the "What The File" option in the toolbar =
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 ==
screenshot-1.png ADDED
Binary file
what-the-file.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
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 ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
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
+ */
10
+
11
+ class WhatTheFile
12
+ {
13
+ private $template_name = "";
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)
36
+ {
37
+ $this->template_name = basename($template_name);
38
+ return $template_name;
39
+ }
40
+
41
+ public function admin_bar_menu() {
42
+ global $wp_admin_bar;
43
+ $wp_admin_bar->add_menu( array( 'id' => 'wtf-bar', 'parent' => 'top-secondary', 'title' => __('What The File', 'what-the-file'), 'href' => FALSE ) );
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
+ }
54
+ new WhatTheFile();
55
+ ?>