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 القالب ملفات لكي يكتب لها النجاح. 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. اذا لم تكن بي. اتش. بى المطور او لم يكن لديك الوقت لاعادة النظر في قانون البرنامج المساعد وانت تقرر لتفعيل البرنامج المساعد ثم البرنامج المساعد يمكن بسهولة بالغة سبب تحطم الطائرة الى موقعك او الى الاسوأ. 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. هذا يمكن ان تخلق المسألتين الرئيسيتين.
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. وسنتطرق في اثنين من التغييرات الصغيرة يمكنك ان تجعل الى المدونه اعلاه نموذج لرعايه كلا من المشاكل المذكورة أعلاه. 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 وايضا في آية اخرى templating النظام الذي يستخدم بي. اتش. بى المدونه.
Carefully make the changes following the template above to make your site more robust against WordPress plugins. بعناية باجراء التغييرات التالية النموذج اعلاه لجعل موقعك اكثر قوة ضد وردبريس ملحقات.
Filed under المقدم بمقتضى CMS Software برمجيه , ، Headline News أهم الانباء , ، How To كيف , ، PHP بي. اتش. بى , ، Pro Blogging الموالية بلوغغينغ , ، Tech Note ملاحظه تقنيه , ، Web شبكة , ، Web Services خدمات الشبكه العالمية , ، WordPress | |
| |
RSS 2.0 ار اس اس 2،0 | |
Email this Article ارسل هذه المادة
You may also like to read ويمكنك ايضا ان تقرأ |




December 29th, 2005 at 1:37 am كانون الاول / ديسمبر 29th ، 2005 في الساعة 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 كانون الاول / ديسمبر 30th ، 2005 في الساعة 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 كانون الثاني / يناير 3rd ، 2006 في الساعة 1:41
[...] Couple that with php’s “silent treatment” of errors. [...]زوجين مع بي. اتش. بى ان "معاملة صامتة" من الاخطاء. 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 في الساعة 2:54
[...] 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 القالب تعديل بعض النصائح المفيدة لغير المبرمجين -- قوة الافكار البسيطة - -- ويافا وشبكة تكنولوجيا بلوق WordPress المعزقه التهاب الدماغ الياباني في الموقع bestand maken niet tegen crashende من geactiveerde ملحقات. Nu het nog overal inbouwen… (tags: howto PHP wordpress plugins) [...] نو het nog overal inbouwen… (العلامات : howto بي. اتش. بى وردبريس ملحقات) [...]