【至急・重要】ウィルスチェックのお願い

Change Style


WP Plugin[up]: 管理パネルから日本語ドキュメントを参照・検索 – ps more help 0.1 a2

先日試作品を公開した more help プラグインに、「ドキュメント横断検索」ボックスを付けました。

ps more help 0.1a2 動作見本ps more help 0.1a2 検索結果表示

バージョン番号のつけ方も分かってないのですけど、適当に 0.1 alpha2 あたりです。
みなさまよかったらお試し&アドバイスをお願いいたしまする~。

コーディングの面では、switch じゃなくて URL を配列に入れたほうがいいんじゃろか。。と思い、試しに書き方を変更。ちょうど源広将殿もアドバイスしてくださろうとしていたとのことで、一安心するとともに、

源広将: なぜぼのをは、ぼくがきのういおうとおもったことを
      すでにじっせんしているのですか。。 えすぱーか。。(笑
「ぼのをエスパー説」が濃厚に。

また、クラス化してまともなコードになれました。うれしーい ヽ(*´ ∇`)ノ
ひろ☆まさをてんてい、本当にありがとう~~。解説もしてもらってすごーく勉強になりました。 :-)

ps more help 0.1 a2

では恒例のコードペーストでひとつ。
テキストエディタにコピペして UTF-8 BOM なしで保存して wp-content/plugins/ps_more_help/ ディレクトリあたりにアップロードで有効化、です。

(注意) Search Docs プラグインとかぶるので、どちらかをオフにしてくださいまし。

<?php
/*
Plugin Name: ps more help
Plugin URI: http://bono.s206.xrea.com/
Description: 管理パネルの「ヘルプ」に日本語ドキュメントへのリンクと横断検索窓を追加します。
Author: bono
Version: 0.1 alpha2
Author URI: http://bono.s206.xrea.com/
SVN Version: $id$
*/

/*  Copyright 2009 bono (email : xxx)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/******************************************************************************
 * psMoreHelp - WordPress Interface Define
 *****************************************************************************/

if( !(defined('ABSPATH') && defined('WPINC')) ) return;
if( !is_admin() ) return;

/******************************************************************************
 * psMoreHelp
 *
 * @author      bono
 * @version     0.1 alpha2
 *
 *****************************************************************************/
class psMoreHelp {
    
    var $help;
    
    /**
     * init
     */
    function init() {
        
        $this->help = array(
            __('Dashboard')         => "http://wpdocs.sourceforge.jp/%E7%AE%A1%E7%90%86%E3%83%91%E3%83%8D%E3%83%AB/%E3%83%80%E3%83%83%E3%82%B7%E3%83%A5%E3%83%9C%E3%83%BC%E3%83%89",
            __('Edit Posts')        => "http://wpdocs.sourceforge.jp/Posts_Edit_SubPanel",
            __('Add New Post')      => "http://wpdocs.sourceforge.jp/Posts_Add_New_SubPanel",
            __('Tags')              => "http://wpdocs.sourceforge.jp/Posts_Tags_SubPanel",
            __('Categories')        => "http://wpdocs.sourceforge.jp/Posts_Categories_SubPanel",
            __('Media Library')     => "http://wpdocs.sourceforge.jp/Media_Library_SubPanel",
            __('Upload New Media')  => "http://wpdocs.sourceforge.jp/Media_Add_New_SubPanel",
            __('Edit Links')        => "http://wpdocs.sourceforge.jp/Links_Edit_SubPanel",
            __('Add New Link')      => "http://wpdocs.sourceforge.jp/Links_Add_New_SubPanel",
            __('Link Categories')   => "http://wpdocs.sourceforge.jp/Links_Link_Categories_SubPanel",
            __('Edit Pages')        => "http://wpdocs.sourceforge.jp/Pages_Edit_SubPanel",
            __('Add New Page')      => "http://wpdocs.sourceforge.jp/Pages_Add_New_SubPanel",
            __('Edit Comments')     => "http://wpdocs.sourceforge.jp/Comments_Comments_SubPanel",
            __('Manage Themes')     => "http://wpdocs.sourceforge.jp/Appearance_Themes_SubPanel",
            __('Widgets')           => "http://wpdocs.sourceforge.jp/Appearance_Widgets_SubPanel",
            __('Edit Themes')       => "http://wpdocs.sourceforge.jp/Appearance_Editor_SubPanel",
            __('Customize Header')  => "http://wpdocs.sourceforge.jp/Appearance_Header_Image_and_Color_SubPanel",
            __('Manage Plugins')    => "http://wpdocs.sourceforge.jp/Plugins_Installed_SubPanel",
            __('Install Plugins')   => "http://wpdocs.sourceforge.jp/Plugins_Add_New_SubPanel",
            __('Edit Plugins')      => "http://wpdocs.sourceforge.jp/Plugins_Editor_SubPanel",
            __('Users')             => "http://wpdocs.sourceforge.jp/Users_Authors_and_Users_SubPanel",
            __('Add New User')      => "http://wpdocs.sourceforge.jp/Users_Add_New_SubPanel",
            __('Profile')           => "http://wpdocs.sourceforge.jp/Users_Your_Profile_SubPanel",
            __('Tools')             => "http://wpdocs.sourceforge.jp/Tools_Tools_SubPanel",
            __('Import')            => "http://wpdocs.sourceforge.jp/Tools_Import_SubPanel",
            __('Export')            => "http://wpdocs.sourceforge.jp/Tools_Export_SubPanel",
            __('Upgrade WordPress') => "http://wpdocs.sourceforge.jp/Tools_Upgrade_SubPanel",
            __('General Settings')  => "http://wpdocs.sourceforge.jp/Settings_General_SubPanel",
            __('Writing Settings')  => "http://wpdocs.sourceforge.jp/Settings_Writing_SubPanel",
            __('Reading Settings')  => "http://wpdocs.sourceforge.jp/Settings_Reading_SubPanel",
            __('Discussion Settings')       => "http://wpdocs.sourceforge.jp/Settings_Discussion_SubPanel",
            __('Media Settings')    => "http://wpdocs.sourceforge.jp/Settings_Media_SubPanel",
            __('Privacy Settings')  => "http://wpdocs.sourceforge.jp/Settings_Privacy_SubPanel",
            __('Permalink Settings')        => "http://wpdocs.sourceforge.jp/Settings_Permalinks_SubPanel",
            __('Miscellaneous Settings')    => "http://wpdocs.sourceforge.jp/Settings_Miscellaneous_SubPanel"
        );
    }
    
    /**
     * add_help
     *
     * @param   string  $contextual_help
     * @return  string
     */
    function add_help($contextual_help) {
        
        $title = get_admin_page_title();
        $new_contextual_help = $contextual_help;
        $new_contextual_help .= '<p><a href="' . $this->help[$title] . '" target="_blank">「' . $title . '」画面の説明</a></p>';

        // 検索ボックス
        $new_contextual_help .= '
<div id="search-docs" class="search-box">
    <form action="" id="searchbox_004119287544314637300:40aiiok0jrs" onsubmit="return false;">
      <div>
        <input type="text" name="q" size="30" class="search-input" />
        <input type="submit" value="ドキュメント横断検索" class="button" />
      </div>
    </form>
    <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_004119287544314637300%3A40aiiok0jrs&lang=ja"></script>

    <div id="results_004119287544314637300:40aiiok0jrs" style="display:none">
      <div class="cse-closeResults"> 
        <a>&times; 閉じる</a>
      </div>
      <div class="cse-resultsContainer"></div>
    </div>

    <style type="text/css">
    @import url(http://www.google.com/cse/api/overlay.css);
    </style>

    <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABQIAAAAiTJ1cthSLaa1vviyY90C0BQaFrDtWtqc3RRrwhV_7LFEzFCvdxT78cniW_7V6rheRCwRAq49a6o8Cw&hl=ja" type="text/javascript"></script>
    <script src="http://www.google.com/cse/api/overlay.js" type="text/javascript"></script>
    <script type="text/javascript">
    function OnLoad() {
      new CSEOverlay("004119287544314637300:40aiiok0jrs",
                     document.getElementById("searchbox_004119287544314637300:40aiiok0jrs"),
                     document.getElementById("results_004119287544314637300:40aiiok0jrs"));
    }
    GSearch.setOnLoadCallback(OnLoad);
    </script>
</div>';
            
        return $new_contextual_help;
        
    }
    
    /**
     * more_help_css
     *
     */
    function more_help_css() {
        echo '
<style type="text/css">
#search-docs {
    position: absolute; top: 4px; right: 2em;
    margin: 0; 
    padding: 0;
    color: #666;
}
</style>';
    }
    
}

/******************************************************************************
 * psMoreHelp - WordPress Interface Define
 *****************************************************************************/

$psMoreHelp = new psMoreHelp();

add_action('init', array(&$psMoreHelp, 'init'));
add_action('contextual_help', array(&$psMoreHelp, 'add_help'));
add_action('admin_head', array(&$psMoreHelp, 'more_help_css'));
?>

YOU、これも読んじゃないなYO!

コメントをどうぞ