WordPress Template Modification Tips for Non-Programmers - Robustness WordPressのテンプレートの変更のヒントを非プログラマー-ロバスト
Several WordPress plugins ask you to add certain code to the WordPress theme template files to make them work.いくつかのWordPressのプラグインを追加するようお願いする特定のコードをWordPressのテーマのテンプレートファイルを組み合わせて動作します。 If you are not a PHP developer or you don’t have time to code review the plugin and you decide to activate the plugin then the plugin can very easily cause your site to crash or worse. PHPの開発者ではない場合は、時間をコードする必要はありませんを決定した日の差込式と入力し、差込式のプラグインを有効にするには、お客様のサイトを非常に簡単に原因がクラッシュしたり、悪化している。 Often the errors are hard to detect (sporadic, happening only in certain conditions) and even harder to debug as you are not familiar with the code.多くの場合、エラーを検出するのは難しい(散発的、起きて、一定の条件下でのみ)や困難をデバッグするとしてもあなたが精通していないコードです。 Today we will talk about a simple step you can take to make your site robust against untested and buggy plugins.今日我々は、単純なステップについて話すすることができます。強固な反対に、お客様のサイトを作るとバギーの差込真価が問われています。
Normally most of the time you are asked to include a code block similar to this:通常、ほとんどの場合、あなたが求められるには、コードブロックに似て、この:
The func_name obviously represents a function which the plugin author wants you to include; the arguments are as required for that function. func_name明らかにする関数を表すのは、差込式著者は、お客様が含まれて;の引数には、その機能を必要とします。
This can create two major issues.これは2つの主要な問題を作成します。
Firstly if at any time you decide to disable the plugin then you will have to first remove the code from all your template files before you can safely de-activate / remove the plugin.第一の場合、いつでも無効にするにプラグインすることに決めたのを最初に入力し、必要がありますからコードを削除する前に、すべてのテンプレートファイルを安全にすることができますデ-アクティブ/削除して差込式です。 Otherwise the pages in the site will fail to load properly.サイト内の他のページの読み込みに失敗する適切です。
Secondly the plugin itself may fail in certain conditions or always.第二に、プラグイン自体が失敗する場合が特定の条件や、常にです。 In the worst case you will find certain pages on your site fails to load sometimes.で、最悪の場合には、お客様のサイトの特定のページの読み込みに失敗することもあります。 It could be long before you are aware of the problem.それが長いする前には、問題を認識しています。
We will look at two small changes you can make to the code template above to take care of both of the problems described above.我々は2つの小さな変化を見てmakeを実行することができます。上記のコードテンプレートの世話をし、上記の両方の問題が発生します。 First the modified code:最初に改変されたコード:
if(function_exists(’ func_name ‘) @ func_name( arg1,arg2 …); ?> もし( function_exists ( ' func_name ' ) @ func_name (値arg1 、値arg2 … ) ;ですか? >
Remember to replace func_name with the actual name of the function. func_nameに置き換えるのを忘れないでの実際の名前の関数です。
Testing the existence of the function ensures that the code isn’t executed when the plugin is inactive / disabled.この関数が存在するテストにより、コードが実行されるプラグインが非アクティブにする/無効になっています。 This prevents the first problem.これにより、最初の問題です。
Appending an @ before the function name ensures that errors, if any, while executing the function are ignored and do not cause further problems down the road and do not prevent the overall page from displaying.関数名に@付け加えることにより、エラーが発生する前に、もしあれば、実行中の機能は無視され、より詳細な問題が発生する原因はありません道路ではないからページを防ぐための全体を表示します。
This fix works against all versions of WordPress and also in any other templating system which uses php code.この修正プログラムのすべてのバージョンのWordPressの作品に対しても、他のテンプレートシステムを使用してPHPコードです。
Carefully make the changes following the template above to make your site more robust against WordPress plugins.慎重に次のように変更してサイトのテンプレートを作る上の他のロバスト反対WordPressの差込です。
Filed under提出されて CMS Software CMSソフトウェア , 、 Headline Newsニュースの見出し , 、 How Toどのように , 、 PHP PHPの , 、 Pro BloggingプロBlogging , 、 Tech Note技術のノート , 、 Webウェブ , 、 Web Services Webサービス , 、 WordPress WordPressの | |
| |
RSS 2.0 RSS 2.0を | |
Email this Article電子メールこの記事
You may also like to readを読むようにすることも可能 |




December 29th, 2005 at 1:37 am 2005年12月29日は1:37アム
[...] Thanks to Simple Thoughts for this simple way to keep things from breaking if and when I have to turn off a plugin in the future. [...]のおかげで簡単な思考を簡単にささいなことから、この場合と破壊を無効にするときに私は、将来のプラグインです。 [...]
December 30th, 2005 at 12:40 pm 2005年12月30日at 12:40午後
[...] Despite all the warnings above if you still want to upgrade then please please please (repeatation intentional) backup the database and harden your templates against plugins before you upgrade. [...]のすべての警告にもかかわらず、まだ上にアップグレードしたい場合に入力し、プリーズプリーズプリーズ( repeatation意図的)のバックアップ、データベースとの差込ハーデンしてテンプレートをアップグレードする前に反対します。 [...]
January 3rd, 2006 at 1:41 pm 2006年1月3日は1:41 pmの
[...] Couple that with php’s “silent treatment” of errors. [...]カップルが、 PHPの"サイレント治療"のエラーが発生します。 In other words you and your viewers are greeted with a nice looking, white in color web page, whenever any (plugin) error occurs.言い換えればあなたとあなたの視聴者は、容姿が良い迎え、白い色のウェブページ、いついかなる(プラグイン)エラーが発生します。 Plugin errors could be as simple as having blank spaces at the end of plugin files after ?> to more complex ones like invalid argument to methods.差込式のエラーが空白と同じくらい簡単に差込式の最後にファイルをした後ですか? >をさらに複雑なもののようなメソッドの引数を無効です。 Update: Please check tips on making your plugins robust.更新日:プラグインをご確認のヒントについてはロバストです。 [...]
September 5th, 2006 at 2:54 pm 2006年9月5日は2:54 pmの
[...] WordPress Template Modification Tips for Non-Programmers - Robustness -Simple Thoughts - Java and Web Technology Blog Hoe je wordpress-site bestand maken tegen crashende of niet geactiveerde plugins. [...] WordPressのテンプレートの変更のヒントを非プログラマー-ロバスト性-簡単な思考-鍬は、 J a vaとウェブ技術のブログサイトのW o rdPress-c r ashendeのb e standni ette genma kenge activeerdeプラグインです。 Nu het nog overal inbouwen… (tags: howto PHP wordpress plugins) [...]全般的ヌナヴットhet nog inbouwen … (タグ:手引きPHPのWordPressの差込) [...]