Plugin Icons for Plugins in plugin.local

Post plugins and custom CSS snippets here
mate
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 13 May 2013, 21:12

Plugin Icons for Plugins in plugin.local

Postby mate » 18 Mar 2016, 13:56

Hi!

Maybe I missunderstood something, so im searching for clearness :)

I install all my extra plugins to "plugins.local" directory. Most "Sharing" plugins, for example "Google+" from https://tt-rss.org/gitlab/fox/tt-rss-at ... er/plugins have links to images hardcoded to plugin directory. E.g. from init.php / function hook_article_button($line) :

src=\"plugins/googleplus/googleplus.png\"

should be

src=\"plugins.local/googleplus/googleplus.png\"

but better a variable or function with the plugin directory. Is there such a funtion

Or is it just wrong that I use the plugins.local directory?

Im not such a PHP crack, but here is my suggestions to solve this issue:

Code: Select all

function hook_article_button($line) {
      return "<img src=\"".substr(dirname(__FILE__), strlen($_SERVER['DOCUMENT_ROOT']))."/googleplus.png\"
         class='tagsPic' style=\"cursor : pointer\"
         onclick=\"shareArticleToGooglePlus(".$line["id"].")\"
         title='".__('Share on Google+')."'>";
   }

Maybe ther is a better way to get the relative directory of the running script.

Thanks for discussion
Mate

User avatar
fox
^ me reading your posts ^
Posts: 6267
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Plugin Icons for Plugins in plugin.local

Postby fox » 18 Mar 2016, 14:14

i dunno if relying on document root is a good idea (maybe it is) but overall doing something with __DIR__ here makes sense, maybe in a more elegant way of some kind

attic repo plugins have this hardcoded because they were written before plugins.local was added

e: maybe there should be a method of pluginhost which gives the plugin relative path to itself

User avatar
HeikoAdams
Bear Rating Master
Bear Rating Master
Posts: 101
Joined: 19 Mar 2013, 00:17

Re: Plugin Icons for Plugins in plugin.local

Postby HeikoAdams » 18 Mar 2016, 15:10

In my case

Code: Select all

basename(dirname(dirname(__FILE__)))

did the job

User avatar
fox
^ me reading your posts ^
Posts: 6267
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Plugin Icons for Plugins in plugin.local

Postby fox » 18 Mar 2016, 15:13

you can replace one dirname(__FILE__) with __DIR__

mate
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 13 May 2013, 21:12

Re: Plugin Icons for Plugins in plugin.local

Postby mate » 22 Mar 2016, 12:52

I can confirm that

Code: Select all

basename(dirname(__DIR__))
is working. I tried to fork the project on ttrss gitlab, but have no rights to have projects at all, and also commits are forbidden, so maybe someone with rights can make the changes in ttrss-attic project.

User avatar
fox
^ me reading your posts ^
Posts: 6267
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Plugin Icons for Plugins in plugin.local

Postby fox » 22 Mar 2016, 13:24

post your gitlab username, i'll give you necessary permissions

mate
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 13 May 2013, 21:12

Re: Plugin Icons for Plugins in plugin.local

Postby mate » 24 Mar 2016, 13:09

fox wrote:post your gitlab username, i'll give you necessary permissions

Send you a pm

mate
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 13 May 2013, 21:12

Re: Plugin Icons for Plugins in plugin.local

Postby mate » 24 Mar 2016, 13:55



Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 3 guests