I am trying to integrate my peace of code with OJS3 as a plugin.
As can be seen you use import statement to include a Class to your code (like in Java), but I haven’t found any information about this for PHP. Can I use simple require or include statement in my plugin to include my PHP code in …Plugin.inc.php?
It can be seen, that when pointing URL you use 'DIRECTORY_SEPARATOR constant (as path to javascript for example). Is this necessary? Or simple pointing / can make problems on the windows machines?
Thanks for the answer. I have rewrited my code to fit OJS style. Now I have a problem to get XML from article galley. Plugin is uploaded to the github. The problem occurs here: https://github.com/Vitaliy-1/JATSParserPlugin/blob/master/JatsParserPlugin.inc.php#L136
I have no idea in OJS classes methods. This code was copied from @ajnyga’s embedGalley.
PHP logs tell me Call to undefined method Article::getGalleys(). So, can you give me a hint how to deliver JATS XML to my parser? Also there is a lot of deprecation about Non-static method Request through ::
Maybe it should be not: $article = $smarty->get_template_vars('article'); but $article = $smarty->get_template_vars('publishedArticle');?
Hmm, after fix it works only for one language and only for last issue. In other case it throws: Uncaught Error: Call to a member function getGalleys() on null (couldn’t find galley I suppose).
I think that the biggest problem with embedGalley is statistics. I do not know how they should be considered because galley files are not getting opened and OJS is counting galley downloads.
Stats are proper. If you embed the xml fikes into abstract page. The stats will count abstract views only. If some one opens xml or pdf, then that will add upto the downloads stats.
However, if you want to create a new static page and embed xml into it, then you can do that as well. You can create a new html galley and link it to an external page.
If this was the problem you meant. Then its completely fine. Also, when you embed the xml files onto abstract page, google scholar counts as html and not abstract. Win win for us.
I am actually thinking a situation where you compare statistics for journals using the plugin and for journals not using the plugin. Our site theme has a “top articles of the week” stat in the site front page. At the moment it is counting the downloads, but that is of course not fair for journals with embedded HTML. I will have to find out what COUNTER says about this.
Do you know if there are some meta tags etc. for Google scholar to tell that the full text is on that page? I was looking that it would be maybe possible to add a feature to embedGalley that adds the XML references and list them for google scholar: Improve Google Scholar exposure with reference metatags!
For start I wished to test plugin statically. It works only with several articles and with $smarty->get_template_vars('publishedArticle'). So the object PublishedArticle in most cases returns null. As for Article object there is a weird things to. For example, in 2 articles it returns articles with other id (and all the data). In several cases it not returns galleys.
this is weird, because I have not encountered a similar problem with embedGalley. I mean the article object should be there always, because it is the article page. Do you have similar problems with embedGalley if you test it with the same articles?
Ok. I will test with embedGalley plugin. As far as I can see the problem is related to the hook, that is used. With Template::Article::Main hook all seems to be OK, but not with Footer hook.
Before doing more work, I want also to ask you the best way to expose article with PHP. My idea, after taking a look at the OJS code more precisely, is parse XML into POPO objects, assign data to the variables like here: https://github.com/Vitaliy-1/JATSParserPlugin/blob/master/JatsParserPlugin.inc.php#L156 and expose them through tpl file. In this case front-end will be generated according to smarty native way. What do you think about this approach?
And one more question is about order inside the hooks. Did you figure out how to change it, because in my case article statistics goes before the article main text?
Have tested embedGalley plugin. The problem occurs with several articles. From error log: PHP Fatal error: Uncaught Error: Call to undefined method Article::getGalleys() in plugins\generic\embedGalley\EmbedGalleyPlugin.inc.php:147
Also Recommend Articles by Author plugin not always working. They both use Footer hook. I think the reason is in loading order. Maybe this plugins are loaded actually before the Article object is created? Is it possible?
Edit: seems to be a conflict between this plugins. After disabling the latter embedGalleys works fine.
I want completely change the front-end look of articles. Do it more PLOS- or elifesciences-like Don’t know if it is better to do it with javascipt or change theme files. Also I am not aware how will work assigning ArrayObjects to smarty templates.
Article (abstract, main metadata, maybe full text)
How to cite (this takes a lot of room at the moment)
Authors (if author biographies available)
Statistics (if enabled, the problem is that at the moment the stats plugin is just hooked to a multipurpose hook. You would have to add a new hook and fork the stats plugin to hook it in the right place)
References (if available)
A have a work on progress theme that uses Jquery UI tabs (Tabs | jQuery UI).
Another way of making room to the abstract page would be using these Accordion | jQuery UI in the abstract page side bar.
I have a feeling that return false will prevent other plugins from using the same hook? @asmecher?
edit: note to self, I have that in embedGalley as well… But I recall reading (can not remember where) that return false would prevent other plugins from using the hook. I could be wrong here. I can not test that right now so if you can let me know, thanks!
Nope. Not helping. There is a need to note that, for example, with the last article embedGalley works on primary locale and not working with second locale. The same case if for recommend by author. But I don’t understand why is so, because for the 80% of articles all works fine.