サイトのセキュリティ強化

e在京白堊会のサイトを念願の常時SSLに対応できるように、引っ越しと移植を
実施しました。Topページには、こっそり「47ML」へのリンクも貼っています。
ついでに、テーマのカストマイズで保守性を犠牲にしていた「子テーマ」設置と
MyFunctionとした私的関数の維持管理の知恵をメモしておきます。

1)子テーマの設置
  twentyten-child として次のstyle.css を設置(他のCSS値も置換できる)
/*
Theme Name: Twenty Ten Child
Theme URI: https://wordpress.org/themes/twentyten-child/
Description: The 2010 theme for WordPress is stylish, customizable, simple, and readable -- make it yours with a custom menu, header image, and background. Twenty Ten supports six widgetized areas (two in the sidebar, four in the footer) and featured images (thumbnails for gallery posts and custom header images for posts and pages). It includes stylesheets for print and the admin Visual Editor, special styles for posts in the "Asides" and "Gallery" categories, and has an optional one-column page template that removes the sidebar.
Author: the WordPress team
Author URI: https://wordpress.org/
Template: twentyten
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, two-columns, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu, flexible-header, featured-images, footer-widgets, featured-image-header
Text Domain: twenty-ten-child
*/
2)MyFunctionのinclude方法   childのfunction.php には、次の記述を実施した。
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style'));
}
//ここから自由インクルード
function Include_my_php($params = array()) {
    extract(shortcode_atts(array(
        'file' => 'default'
    ), $params));
    ob_start();
    include(get_stylesheet_directory() ."/$file.php");
    return ob_get_clean();
}
add_shortcode('myphp', 'Include_my_php');
Include_my_php(array('file'=>'myFunction'));
//ここまで
これで、テーマ「twentyten」の更新があっても、全く影響が出ない。
カテゴリー: お知らせ パーマリンク

サイトのセキュリティ強化 への3件のフィードバック

  1. fujii のコメント:

    移植でPHPのVup対応が難しくなったKtai-Entryプラグインについての、旧関数書き換えもメモしておきます。(incフォルダ内のclass-pop3.phpモジュール)

    mb_ereg ("^\.\r\n", 対象文字列)
    ↓
    preg_match("/^\.\r\n/", 対象文字列)
    
  2. fujii のコメント:

    さらに、smoothscrollのプラグインに、非推奨のAPIがあったので、引数の表現を変えた。
    138行
    add_options_page(‘Smooth Scroll Links [SSL]’, ‘Smooth Scroll Links [SSL]’, 9′, basename(__FILE__),’smooth_scroll_options_page’);


    add_options_page(‘Smooth Scroll Links [SSL]’, ‘Smooth Scroll Links [SSL]’, ‘administrator’, basename(__FILE__),’smooth_scroll_options_page’);

  3. fujii のコメント:

    my_is_manager() 関数で使った、
    get_currentuserinfo()
    が非互換になったため、次の関数に取り換えた。
    wp_get_current_user()

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です