The following warnings occurred: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
|
Multi-file plugins - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Feature Requests (http://get-simple.info/forums/forumdisplay.php?fid=7) +--- Thread: Multi-file plugins (/showthread.php?tid=994) |
Multi-file plugins - tankmiche - 2010-09-24 Hello. I'm writing a plugin myself, and as it would also include a bit of AJAX I'm trying to fit all the functions and checks in one single file. Which is bad, in my opinion, it's starting to get messy. My question is: should I provide myplugin.php with a "myplugin" folder, the first then requiring the proper scripts in "myplugin"? I ask because I thought of a much cleaner solution, but it needs a modification of "admin/inc/plugin_functions.php":
Multi-file plugins - ZegnÃ¥t - 2010-09-25 tankmiche Wrote:Should I provide myplugin.php with a “myplugin†folder, the first then requiring the proper scripts in “mypluginâ€�Many plugins already come together with a folder to hold other files. So yes, that’s the best way to go. You are right, it might be cleaner to check for folders within the plugins folder. Good idea that will be taken in consideration for the next update of the plugin system. Multi-file plugins - JWH_Matthew - 2010-09-25 Automatically including Files within a plugins folder could cause some issues, not all plugins are including files in the plugin itself but in the templates and other administration pages or nowhere at all. How would it be determined witch files to include? Does this make sense? Multi-file plugins - ZegnÃ¥t - 2010-09-25 What I (like to) think tankmiche meant is something like this:
This way, if I have a plugin that needs several files all of my files can go within the folder instead of having one file outside of the folder. It makes the plugins folder much easier to oversee. 1 file plugins can exist of only their 1 PHP file in the plugin folder. Other plugins exist of only a folder in the plugin folder. Instead of the way they do now: 1 PHP file and 1 folder. Multi-file plugins - tankmiche - 2010-09-25 Exactly, sorry for the poor phrasing, when saying "include" I actually meant the require() function as is already used now in plugins_function(). OWS_Matthew, plugins are "included" this way in every page, even though most of them won't use their functions. Here's the example form plugin_functions.php:23 Code: foreach ($pluginfiles as $fi) Here's the modified code: Code: foreach ($pluginfiles as $fi) I added is_file to the first check to avoid requiring directories, and then to check for the existance of a "plugin.php" file. Note that the slash '/' is supposed to be fine for Win* platforms, and the "." and ".." directories are excluded from the list. Multi-file plugins - ccagle8 - 2010-09-25 thanks tankmiche - so this works fine in your setup? does your setup have a combination of plugins that are built the old way and also some with the /folder/plugin.php file? Multi-file plugins - tankmiche - 2010-09-25 ccagle8 Wrote:thanks tankmiche - so this works fine in your setup? does your setup have a combination of plugins that are built the old way and also some with the /folder/plugin.php file?I'm actually in the middle of the upgrade to the latest version - my ftp service is very slow - as soon as I get a working copy I'll check for problems with older plugins. Edit: I've checked the code with other plugins. An error occours if these coditions are all met:
To avoid this risk we could include all files first, then directories with require_once() to prevent errors. Dunno. |