Plugin Directory

Changeset 647427


Ignore:
Timestamp:
01/03/2013 01:08:17 PM (13 years ago)
Author:
Aurelien
Message:

Display the template name in the admin bar when it's used.

Location:
display-template-name/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • display-template-name/trunk/display-template-name.php

    r641847 r647427  
    33Plugin Name: Display Template Name
    44Description: Displays the name of the template used by the currently displayed page. Plugins very useful for developing your blog.
    5 Version: 1.3.1
     5Version: 1.4
    66Author: Aurélien Chappard
    77Author URI: http://www.deefuse.fr/
     
    115115                    </div>
    116116                    <div class="clearBoth"></div>
     117                    <p><em>
     118                            <?php _e("If the toolbar is displayed when you visit the site, the template name will be displayed in it and the above parameter will not be considered.", "display-template-name") ?>
     119                        </em></p>
    117120                    <div class="submit">
    118121                        <input type="submit" class="button-primary" name="update_displayTemplateNamePluginSettings" value="<?php _e('Update Settings', 'display-template-name') ?>" />
     
    137140               
    138141                // Css position according to the showing admin bar
    139                 $top = ( is_admin_bar_showing() ? "29px" : "0px" );
    140                 switch ($devOptions['position'])
     142                if(!is_admin_bar_showing())
    141143                {
    142                    
    143                     case 'BL' :
    144                         $stringCss = 'bottom:0px; left:0px;';
    145                         break;
    146                     case 'BR' :
    147                         $stringCss = 'bottom:0px; right:0px;';
    148                         break;
    149                     case 'TR' :
    150                         $stringCss = 'top:' . $top . '; right:0px;';
    151                         break;
    152                     case 'TL' :
    153                     default :
    154                         $stringCss = 'top:' . $top . '; left:0px;';
    155                         break;
    156                 }
    157                
     144                    $top = "0px";
     145                    switch ($devOptions['position'])
     146                    {
     147
     148                        case 'BL' :
     149                            $stringCss = 'bottom:0px; left:0px;';
     150                            break;
     151                        case 'BR' :
     152                            $stringCss = 'bottom:0px; right:0px;';
     153                            break;
     154                        case 'TR' :
     155                            $stringCss = 'top:' . $top . '; right:0px;';
     156                            break;
     157                        case 'TL' :
     158                        default :
     159                            $stringCss = 'top:' . $top . '; left:0px;';
     160                            break;
     161                    }   
    158162                ?>
    159163                    <style type="text/css">
    160                         #debug-display-template-name{font-size: 14px; position: fixed; <?php echo $stringCss;?> background: #000; color: #FFF; padding: 5px 7px; border: 1px solid #FFF;z-index: 99999}
     164                        #debug-display-template-name{font-size: 14px;cursor: default; position: fixed; <?php echo $stringCss;?> background: #000; color: #FFF; padding: 5px 7px; border: 1px solid #FFF;z-index: 99999}
    161165                        #debug-display-template-name a, #debug-display-template-name a:visited{
    162166                            color: #FFF;
    163167                            cursor: default;
    164                            
    165                         }
     168                        }
     169                        #debug-display-template-name p{margin-bottom:10px;}
     170                        #debug-display-template-name ul{
     171                            list-style-type:disc;
     172                            padding-left:10px;
     173                            line-height:17px;
     174                            list-style-position:inside;
     175                        }
     176                        #debug-display-template-name ul li{
     177                            margin-bottom:10px;
     178                        }
     179                        #debug-display-template-name ul li  ul{
     180                            list-style-type:square;
     181                            padding-left:15px;
     182                        }
     183                        #debug-display-template-name ul li  ul li{margin-bottom:inherit;}
    166184                    </style>
    167185                    <?php
    168186                        $templateInfos = $this->get_current_template();
    169187                    ?>
    170                      <div id="debug-display-template-name"><?php _e('Current template:','display-template-name'); ?> <a href="#" title="<?php echo $templateInfos; ?>" target="_blank"><?php echo basename($templateInfos); ?></a></div>
     188                    <div id="debug-display-template-name">
     189                        <p><?php _e('Current template:','display-template-name'); ?></p>
     190                        <ul>
     191                            <li>
     192                                <a href="#" title="<?php echo $templateInfos; ?>" target="_blank"><?php echo basename($templateInfos); ?></a>
     193                            </li>
     194                        </ul>
     195                    </div>
    171196                <?php
     197                }
    172198            }
    173199        }
     
    182208         //   $GLOBALS['current_theme_template'] = basename($t);
    183209            $GLOBALS['current_theme_template'] = $t;
     210           
    184211            return $t;
    185212        }
     
    198225        }
    199226       
     227       
     228       
     229        function get_header_Action($args){
     230            print_r($args);
     231        }
    200232        function dispayTplName_settings_link($links)
    201233        {
     
    204236            return $links;
    205237        }
    206 
     238       
     239        function displayTplNameAdminBar()
     240        {
     241            if(!is_admin() && is_admin_bar_showing()){
     242                global $wp_admin_bar;
     243                $templateInfos = $this->get_current_template();
     244                $wp_admin_bar->add_menu( array(
     245                    'parent' => false, // use 'false' for a root menu, or pass the ID of the parent menu
     246                    'id' => 'displayTemplateName', // link ID, defaults to a sanitized title value
     247                    'title' => __('Current template:','display-template-name') .' <b>'. basename($templateInfos) .'</b>', // link title
     248                    'meta' => array('title' => $templateInfos) // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
     249                ));
     250            }
     251           
     252        }
    207253    }
    208254}
     
    223269    add_action('admin_menu', 'DisplaYTemplateName_ap');
    224270    add_action( 'admin_init', array(&$display_template_name_plugin, 'displayTplNameenqueue_my_styles') );
     271    add_action( 'wp_before_admin_bar_render', array(&$display_template_name_plugin, 'displayTplNameAdminBar') );
    225272    // Filter
    226273    add_filter( 'template_include', array(&$display_template_name_plugin,'var_template_include'), 1000 );
     
    228275    $plugin = plugin_basename(__FILE__);
    229276    add_filter("plugin_action_links_$plugin", array(&$display_template_name_plugin,'dispayTplName_settings_link') );
     277   
     278   
    230279}
    231280
  • display-template-name/trunk/lang/display-template-name-en_EN.po

    r551725 r647427  
    33"Project-Id-Version: display-template-name\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2012-06-01 10:02+0100\n"
    6 "PO-Revision-Date: 2012-06-01 10:02+0100\n"
     5"POT-Creation-Date: 2013-01-03 14:05+0100\n"
     6"PO-Revision-Date: 2013-01-03 14:05+0100\n"
    77"Last-Translator: Chap <nanao@yopmail.com>\n"
    88"Language-Team: Aurelien Chappard <aucha@deefuse.fr>\n"
     
    1515"X-Poedit-Country: FRANCE\n"
    1616"X-Poedit-SourceCharset: utf-8\n"
    17 "X-Poedit-SearchPath-0: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name\n"
     17"X-Poedit-SearchPath-0: /Users/aurelienchappard/Documents/Laboratoires/wordpress plugins/display-template-name/trunk\n"
    1818
    19 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:51
     19#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     20#: plugins/display-template-name/trunk/display-template-name.php:58
    2021msgid "The position have been saved."
    2122msgstr "The position have been saved."
    2223
    23 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:57
     24#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     25#: plugins/display-template-name/trunk/display-template-name.php:77
    2426msgid "Select the position of the debug box."
    2527msgstr "Select the position of the debug box in your website :"
    2628
    27 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:61
     29#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     30#: plugins/display-template-name/trunk/display-template-name.php:86
    2831msgid "Top left"
    2932msgstr "Top left"
    3033
    31 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:66
     34#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     35#: plugins/display-template-name/trunk/display-template-name.php:95
    3236msgid "Top right"
    3337msgstr "Top right"
    3438
    35 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:71
     39#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     40#: plugins/display-template-name/trunk/display-template-name.php:104
    3641msgid "Bottom left"
    3742msgstr "Bottom left"
    3843
    39 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:76
     44#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     45#: plugins/display-template-name/trunk/display-template-name.php:113
    4046msgid "Bottom right"
    4147msgstr "Bottom right"
    4248
    43 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:80
     49#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     50#: plugins/display-template-name/trunk/display-template-name.php:118
     51msgid "If the toolbar is displayed when you visit the site, the template name will be displayed in it and the above parameter will not be considered."
     52msgstr "If the toolbar is displayed when you visit the site, the template name will be displayed in it and the above parameter will not be considered."
     53
     54#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     55#: plugins/display-template-name/trunk/display-template-name.php:121
    4456msgid "Update Settings"
    4557msgstr "Update Settings"
    4658
    47 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:124
     59#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     60#: plugins/display-template-name/trunk/display-template-name.php:189
     61#: plugins/display-template-name/trunk/display-template-name.php:247
    4862msgid "Current template:"
    4963msgstr "Current template:"
    5064
    51 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:159
     65#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     66#: plugins/display-template-name/trunk/display-template-name.php:234
    5267msgid "Settings"
    5368msgstr "Settings"
  • display-template-name/trunk/lang/display-template-name-fr_FR.po

    r551725 r647427  
    33"Project-Id-Version: display-template-name\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2012-06-01 10:01+0100\n"
    6 "PO-Revision-Date: 2012-06-01 10:02+0100\n"
     5"POT-Creation-Date: 2013-01-03 14:03+0100\n"
     6"PO-Revision-Date: 2013-01-03 14:04+0100\n"
    77"Last-Translator: Chap <nanao@yopmail.com>\n"
    88"Language-Team: Aurelien Chappard <aucha@deefuse.fr>\n"
     
    1515"X-Poedit-Country: FRANCE\n"
    1616"X-Poedit-SourceCharset: utf-8\n"
    17 "X-Poedit-SearchPath-0: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name\n"
     17"X-Poedit-SearchPath-0: /Users/aurelienchappard/Documents/Laboratoires/wordpress plugins/display-template-name/trunk\n"
    1818
    19 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:51
     19#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     20#: plugins/display-template-name/trunk/display-template-name.php:58
    2021msgid "The position have been saved."
    2122msgstr "La position d'affichage a été enregistrée."
    2223
    23 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:57
     24#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     25#: plugins/display-template-name/trunk/display-template-name.php:77
    2426msgid "Select the position of the debug box."
    2527msgstr "Sélectionnez la position de la zone de debug sur les pages de votre site :"
    2628
    27 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:61
     29#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     30#: plugins/display-template-name/trunk/display-template-name.php:86
    2831msgid "Top left"
    2932msgstr "En haut à gauche"
    3033
    31 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:66
     34#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     35#: plugins/display-template-name/trunk/display-template-name.php:95
    3236msgid "Top right"
    3337msgstr "En haut à droite"
    3438
    35 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:71
     39#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     40#: plugins/display-template-name/trunk/display-template-name.php:104
    3641msgid "Bottom left"
    3742msgstr "En bas à gauche"
    3843
    39 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:76
     44#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     45#: plugins/display-template-name/trunk/display-template-name.php:113
    4046msgid "Bottom right"
    4147msgstr "En bas à droite"
    4248
    43 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:80
     49#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     50#: plugins/display-template-name/trunk/display-template-name.php:118
     51msgid "If the toolbar is displayed when you visit the site, the template name will be displayed in it and the above parameter will not be considered."
     52msgstr "Si la barre d'outils est affichée lorsque vous visitez le site, le nom du template sera affiché dans celle-ci et le paramètre ci-dessus ne sera pas pris en compte"
     53
     54#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     55#: plugins/display-template-name/trunk/display-template-name.php:121
    4456msgid "Update Settings"
    4557msgstr "Mettre à jour"
    4658
    47 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:124
     59#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     60#: plugins/display-template-name/trunk/display-template-name.php:189
     61#: plugins/display-template-name/trunk/display-template-name.php:247
    4862msgid "Current template:"
    4963msgstr "Template en cours :"
    5064
    51 #: /Users/aurelienchappard/Documents/Laboratoires/CMS/wordpress-3.3.1/wp-content/plugins/display-template-name/display-template-name.php:159
     65#: /Users/aurelienchappard/Documents/Laboratoires/wordpress
     66#: plugins/display-template-name/trunk/display-template-name.php:234
    5267msgid "Settings"
    5368msgstr "Configuration"
  • display-template-name/trunk/readme.txt

    r641847 r647427  
    33Requires at least: 3.0.0
    44Tested up to: 3.5
    5 Stable tag: 1.3.1
     5Stable tag: 1.4
    66
    77
     
    2424
    2525== Changelog ==
     26
     27= 1.4 =
     28* Display the template name in the admin bar when it's used.
    2629
    2730= 1.3.1 =
Note: See TracChangeset for help on using the changeset viewer.