[Xerte-dev] Re: Using Wordpress code in XOT

Pat @ Pgogy xerte at pgogywebstuff.com
Fri Feb 22 09:35:24 GMT 2013


Let me talk to some people....

Pgogy Webstuff - http://www.pgogywebstuff.com
Makers of web things of a fair to middling quality

On 22 Feb 2013, at 00:46, "Smith, John" <J.J.Smith at gcu.ac.uk> wrote:

> Cetis is sold out :-( registered for the waiting list
> 
> happy to Skype though and/or get together at the same time on Titanpad or Google Docs to flesh out a plan of attack...
> 
> I'll have the plugins code done soon and i'll patch a few files to demo and circulate a couple of my plugins to try out. Might not get much done this weekend though - need to build a papier mache pterodactyl for a School project.
> 
> Regards,
> 
> John Smith | Learning Technologist
> Room A251, Govan Mbeki Building | School of Health & Life Sciences | Glasgow Caledonian University
> Cowcaddens Road | Glasgow | G4 0BA
> ________________________________________
> From: xerte-dev-bounces at lists.nottingham.ac.uk [xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Pat @ Pgogy [xerte at pgogywebstuff.com]
> Sent: 21 February 2013 10:07
> To: For Xerte technical developers
> Subject: [Xerte-dev] Re: Using Wordpress code in XOT
> 
> I think some sort of list works first - then some basic tasks to make some work easier.
> 
> For example, we should really neaten up the root folder, and completely abstract the database for example. I'd be tempted to send all Ajax through one file and turn all the responses into Json as well.
> 
> You really should come to the cetis conference? Maybe we could sort out a Skype or something and get a few people involved?
> 
> Pgogy Webstuff - http://www.pgogywebstuff.com
> Makers of web things of a fair to middling quality
> 
> On 21 Feb 2013, at 00:12, "Smith, John" <J.J.Smith at gcu.ac.uk> wrote:
> 
>> I Agree,
>> 
>> Architecture planning would be good... how do you suggest we do it?
>> 
>> As for having a single file for things, it is neater but can hinder maintainability - I think it will work either way - it has in my tests, adding the hooks into the ajaxed php file fires the action callbacks and the plugin can react... I like the way some of the Wordpress files work though, plugins in particular - they global the variable in the function and then if it's not set they set it to an empty array etc so everything is contained in the one file and variables are declared the first time the function is used rather than outside the function when the file is included...
>> 
>> The Wordpress file is intact, renamed to wp-plugins, but intact, which is the way i'd like it, so that we don't have to maintain it!!
>> 
>> So onto tonight, I've basically created a plugins.php file in the root and a plugins folder, containing my sample plugins (these can now be a single .php file or a folder containing a .php file and other fies in a structure not dissimilar to Wordpress)...
>> 
>> When you include plugins.php in a php script near the start then it looks like you can now add do_action() or apply_filters() anywhere in the file and any plugins you have are hooked up. I've just hooked up a few more php files (just playing just now - i won't commit my changes) and the hooks seem to be working flawlessly... and i've created another plugin which is now doing as I described earlier, only it was easier. When the editor publishes the data i have added both "editor_save_data" and "editor_save_preview" hooks in the engine/save.php file. In my plugin I have an editor_save_data callback and it is adding a new first node as a kind of standard opening page and returning the xml for saving...
>> 
>> You are right though that the filters are of limited use just now since most content is echoed out. I think we need to really decide what we want to allow people to hook into and change and we can have a very limited subset of hooks initially...
>> 
>> Last thing - do you prefer Rest or Soap (for the api, not for your bath!!). Do you prefer one over the other or will I just cobble something together to get a flavour for how it will work but with the aim to possibly change it later?
>> 
>> Regards,
>> 
>> John Smith | Learning Technologist
>> Room A251, Govan Mbeki Building | School of Health & Life Sciences | Glasgow Caledonian University
>> Cowcaddens Road | Glasgow | G4 0BA
>> ________________________________________
>> From: xerte-dev-bounces at lists.nottingham.ac.uk [xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Pat @ Pgogy [xerte at pgogywebstuff.com]
>> Sent: 20 February 2013 23:38
>> To: For Xerte technical developers
>> Subject: [Xerte-dev] Re: Using Wordpress code in XOT
>> 
>> Hello,
>> 
>> I think the Wordpress hooks work better as all Wordpress code goes through one file, whereas XOT code is more fragmented (I blame the developer)
>> 
>> For example all Ajax could go through one file - and then it feels a bit neater?
>> 
>> I'd also need to look at modules as well.
>> 
>> Filters work ok as long as code is returned, but most XOT is echoed.
>> 
>> I think if you include the licence for the file intact it is fine.
>> 
>> Would still like to think a bit architecturally though
>> 
>> Pgogy Webstuff - http://www.pgogywebstuff.com
>> Makers of web things of a fair to middling quality
>> 
>> On 20 Feb 2013, at 19:16, "Smith, John" <J.J.Smith at gcu.ac.uk> wrote:
>> 
>>> Hi
>>> 
>>> I was concerned about the ajax stuff too but thinking about it, all you do is stick a do_action('TAG_TO_DESCRIBE_AJAX_CALL') in the php code that the ajax calls. This  could then be hooked...
>>> 
>>> And with the filters you would just do apply_filters('FILTER_TAG', _translate('English to translate')); - i'm sure this isn't the function name and agree that it might be of little use anyway...
>>> 
>>> Mostly the filters can be used to do various things like wrap code in extra markup or something like you've done with properties; you pass in an associative array of tabs, if the filter is hooked then you could augment it based on any condition...
>>> 
>>> I've thought if another great use that i'd love to use and should now be relatively easy to do. We hook the save xml and load xml from the editor. On save we run it through a filter - the plungin adds in a new title page with the university/organisation logo and passes it back to be written to a file (possibly here we also do some stats for the api. Then we hook the load xml and pass through the read xml and remove the page with the logo so that it doesn't appear in the editor... Would be simple to implement now..
>>> 
>>> Can we use the wordpress files like that under their license? They're very mature - would take us a while to write alternative similar functionality.
>>> 
>>> Regards
>>> 
>>> John Smith
>>> Learning Technologist
>>> School of Health and Life Sciences
>>> 
>>> Sent from Samsung Galaxy SII
>>> 
>>> 
>>> 
>>> "Pat @ Pgogy" <xerte at pgogywebstuff.com> wrote:
>>> 
>>> 
>>> Hi John
>>> 
>>> Think it's great for index - just wondering what we do with the Ajax requests and the other stuff?
>>> 
>>> The Wordpress action model is ok, but I am not sure if the filters translate as well.
>>> 
>>> I think you could make every part of the site an api request?
>>> 
>>> I think it'd make sense to think of architectures around this?
>>> 
>>> 
>>> Pgogy Webstuff - http://www.pgogywebstuff.com<http://www.pgogywebstuff.com/>
>>> Makers of web things of a fair to middling quality
>>> 
>>> On 20 Feb 2013, at 15:24, "Smith, John" <J.J.Smith at gcu.ac.uk<mailto:J.J.Smith at gcu.ac.uk>> wrote:
>>> 
>>> Hi Pat,
>>> 
>>> Well I’ve started writing some code for the api, mainly helper functions to process the request formats and return formats as I’ve not fully though through what methods I’d want or yours… but then I was thinking about whether we could (and how we could) absorb the data within XOT too…
>>> 
>>> Then I remembered a discussion I had with you (I think) about hooks and started writing some helpers (add_action/do_action etc) but obviously Wordpress already has that functionality. So I’ve instead included their whole plugins.php file…some plugin discovery and management code of my own and voila I have action and filter hooks all working in test and about 30 odd hook events wired up in my index.php file. Now I’m able to insert css/js into the head, change image urls, text (such as My Projects changed to Johnny’s Projects) within the page… but all from the plugin.
>>> 
>>> Obviously we could write our own library but the Wordpress plugin.php is so polished that it works flawlessly with a minimum of new xerte code… Obviously it needs more work but it will allow us to add widgets (I’m currently playing with the Wordpress widgets.php file too) which could show api data. Obviously if we go forward with this (that’s my question really) then I’d be looking at the best fit with your recent code but I think if we can use the Wordpress files “as is” then it saves a lot of work ironing out issues…
>>> 
>>> What do you think? Wasting my time or worth a go?
>>> 
>>> Regards,
>>> 
>>> John Smith
>>> Learning Technologist
>>> School of Health & Life Sciences
>>> Glasgow Caledonian University
>>> 
>>> From: xerte-dev-bounces at lists.nottingham.ac.uk<mailto:xerte-dev-bounces at lists.nottingham.ac.uk> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Pat @ Pgogy
>>> Sent: Wednesday, February 20, 2013 2:17 PM
>>> To: For Xerte technical developers
>>> Subject: [Xerte-dev] Re: Using Wordpress code in XOT
>>> 
>>> What kind of Wordpress file?
>>> 
>>> Pgogy Webstuff - http://www.pgogywebstuff.com<http://www.pgogywebstuff.com/>
>>> Makers of web things of a fair to middling quality
>>> 
>>> On 20 Feb 2013, at 12:31, "Smith, John" <J.J.Smith at gcu.ac.uk<mailto:J.J.Smith at gcu.ac.uk>> wrote:
>>> Please ignore last diagram sent… too many things going on in my head..
>>> 
>>> My question, for Pat or Julian probably… if I wanted to use a Wordpress file (php) in XOT, would there be any license issues etc? can the file go in the SVN etc and be distributed with XOT or should there just be advice on where to get it from on Wordpress site?
>>> 
>>> John
>>> 
>>> 
>>> 
>>> Glasgow Caledonian University is a registered Scottish charity, number SC021474
>>> 
>>> Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009.
>>> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
>>> 
>>> Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners.
>>> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
>>> 
>>> 
>>> _______________________________________________
>>> Xerte-dev mailing list
>>> Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk>
>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>>> 
>>> 
>>> 
>>> Glasgow Caledonian University is a registered Scottish charity, number SC021474
>>> 
>>> Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009.
>>> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
>>> 
>>> Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners.
>>> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
>>> _______________________________________________
>>> Xerte-dev mailing list
>>> Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk>
>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>>> 
>>> 
>>> 
>>> 
>>> Glasgow Caledonian University is a registered Scottish charity, number SC021474
>>> 
>>> Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009.
>>> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
>>> 
>>> Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners.
>>> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
>>> _______________________________________________
>>> Xerte-dev mailing list
>>> Xerte-dev at lists.nottingham.ac.uk
>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>> 
>> _______________________________________________
>> Xerte-dev mailing list
>> Xerte-dev at lists.nottingham.ac.uk
>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>> 
>> Glasgow Caledonian University is a registered Scottish charity, number SC021474
>> 
>> Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009.
>> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
>> 
>> Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners.
>> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
>> 
>> _______________________________________________
>> Xerte-dev mailing list
>> Xerte-dev at lists.nottingham.ac.uk
>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
>> 
>> This message has been checked for viruses but the contents of an attachment
>> may still contain software viruses which could damage your computer system:
>> you are advised to perform your own checks. Email communications with the
>> University of Nottingham may be monitored as permitted by UK legislation.
> 
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
> 
> Glasgow Caledonian University is a registered Scottish charity, number SC021474
> 
> Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009.
> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
> 
> Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners.
> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
> 
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
> 
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.



More information about the Xerte-dev mailing list