Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin System Needed #13

Closed
GoogleCodeExporter opened this issue Aug 8, 2015 · 12 comments
Closed

Plugin System Needed #13

GoogleCodeExporter opened this issue Aug 8, 2015 · 12 comments

Comments

@GoogleCodeExporter
Copy link

Plugin systems are vital to to the development process of a CMS. 



Original issue reported on code.google.com by ccagle8 on 4 Jan 2010 at 1:51

@GoogleCodeExporter
Copy link
Author

Ok guys, I've started working on this. Have the base system up and running as 
per the 
WP plugin system you sent Chris. Works a treat.. Really impressed, would never 
have 
though of doing it like this... 

Converting my Themetags to a plugin at the moment. 

I'll work on an offline copy for the next day or so and send ye guys the 
updates to 
try. 

Mike. 


Original comment by MichaelS...@gmail.com on 4 Jan 2010 at 11:05

@GoogleCodeExporter
Copy link
Author

Including files from the plugins directory like so at the end of index.php: 

// include any plugins 
$pluginfiles = getFiles('admin/plugins/');
 foreach ($pluginfiles as $fi) {
 $path_parts = pathinfo($fi);
 if ($path_parts['extension']=="php"){
  include('admin/plugins/'.$fi);
 }
}


You have any other way of doing this? 


Original comment by MichaelS...@gmail.com on 4 Jan 2010 at 1:07

@GoogleCodeExporter
Copy link
Author

This looks like it should work. We should also do this inside of
/admin/inc/functions.php - Hopefully we won't have any file-path issues.

We also need to start thinking about a "hook" naming convention.

Original comment by ccagle8 on 4 Jan 2010 at 1:55

@GoogleCodeExporter
Copy link
Author

what about "filename-function" for the hook names. 

For my Tags plugin I need 3 . 

o - 1 in index.php called "index.shutdown"   (WP uses shutdown for the end of 
files) 
this calls a function to make the new tags available to the theme. 
o - on the backend I need 2 on the edit Page. "edit-save" & "edit-extras" 
one to save the new options and one to print them out, 


Updated the plugin so it's all contained in one file now, no more tags.xml , 
all 
options help in php array. This also means tags are available to all installed 
themes. If you changed themes on the old system you lost the tags. 




Original comment by MichaelS...@gmail.com on 4 Jan 2010 at 3:37

@GoogleCodeExporter
Copy link
Author

In order to get the Plugin system working I've had to move chagedata.php down a 
level 
to the admin folder. The relative paths are causing the problem. 

You guys have a problem with this ? 



Original comment by MichaelS...@gmail.com on 4 Jan 2010 at 8:06

@GoogleCodeExporter
Copy link
Author

does everything still work fine when you do that? are the backups still 
created? 

I tried to set a define('DOCROOT') variable to get rid of the relative paths, 
but had
trouble because the architecture of the site didn't really work well with 
setting a
defined variable right off the bat. I think I'll have another go at it later on.

For now, if everything still works - move the file - its an even bigger problem 
if we
continue to not have a plugin system.

Original comment by ccagle8 on 4 Jan 2010 at 8:37

@GoogleCodeExporter
Copy link
Author

Ok Guys,  Have the plugin system ready to go. 

what needs to be done. 

o - changedata.php needs to move up a level to /admin
o - new file plugins.php
o - This file need to be included in any file that requires plugin hooks or we 
merge the functions with into 
another file, but I can't see 1 file used by all.
o - Once included we need to setup all the hooks we think we'll require. 
we need to insert the following line wherever we want hooks to be enabled. 

exec_hook('filename-hookname');

Plugins/templates can then setup a hook using: 

add_action('filename-hookname', 'user_function',array());   // array of args... 

I've added 2 functions that allow the creation of Tabs and Menu items. 

So for e.g. if you want your plugin to display an extra menu option say on the 
theme Sidebar 
we would have hook in there called 

exec_hook('sidebar-theme-menu');

sample plugin which just adds new item to menubar could be ;

admin/plugins/myplugin.php
---------------------------

// createSideMenu($url,$text) 
add_action('sidebar-theme-menu','createSideMenu',array('mypage.php','Myplugin'))
; 


I've attached the plugins.php
and my first plugin themetags.php which allows the extra options to be 
automatically added to pages. 

It requires 3 hooks; 

index-shutdown   -   at the end of the main index.php on root which makes all 
extra options available to themes 
in the format $tags[name]['value']

edit-extras      - in edit.php just below the end of the table. This read in 
the new options and creates the new 
form items. 

changedata-save  - in changedata.php just before the XML file is saved. This 
saves the page with the new 
options. 

Options are now setup using the $tags Array. At the moment it supports text 
input and a dropdown box.
This could be expanded for other options if required. 


So what do I do next, should I branch off the main build and upload my updates 
to there and we can merge later?
And you guys could check out the system. 

Mike. 







Original comment by MichaelS...@gmail.com on 5 Jan 2010 at 1:59

Attachments:

@GoogleCodeExporter
Copy link
Author

I'm not sure how we merge... do you? 

I like the name plugin_functions.php to keep it similar with other files. 

Since 2.0 is still in it's early stages, it might be best to just change the 
main SVN
repository. I think having a working plugin system is vital for 2.0 and since 
we plan
on putting a security release out soon, 2.0 can take it's good old time to make 
sure
the plugin system is working correctly. 

Great job on this Mike - I am really excited about it all.

Original comment by ccagle8 on 5 Jan 2010 at 2:45

@GoogleCodeExporter
Copy link
Author

Your asking an svn newbie here .. 8) 
Found some good docs here: http://svnbook.red-bean.com/en/1.0/ 

Will change the name of the plugins file. 

Will update my local copy this evening and I'll update the SVN later. 




Original comment by MichaelS...@gmail.com on 5 Jan 2010 at 3:23

@GoogleCodeExporter
Copy link
Author

Switched the issue status around a little.

Looking good Mike, I just spotted the files having been updated on the SVN. 
I’ll see
whether I can get the security patches to work on this latest version.

Original comment by martijn.personal@gmail.com on 6 Jan 2010 at 10:16

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

Currently writing documentation on the Plugin system

Original comment by MichaelS...@gmail.com on 7 Jan 2010 at 1:19

@GoogleCodeExporter
Copy link
Author

I think this is implemented enough that we can start adding specific problems 
with the 
plugin system to the issue tracker. Great job Mike

Original comment by ccagle8 on 17 Jan 2010 at 11:21

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant