Links to Picasa open in new window

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
windharp
Regular
Posts: 5
Joined: Wed Apr 15, 2009 10:52 am

Links to Picasa open in new window

Post by windharp »

Hi there!

On my shared Serendipity installation, one blog is often posting links to picasa webalbums. They have huuuuge amounts of pictures, so hosting them myself seems not the best option. Additionally - by the original website design, not by my fault - the blog runs in a frame, and by default external links are opened in the same frame.

Recently picasa established a "security policy" that disallows their site from being shown in a frame (currently only working in IE8 and the newest FF). I asked in their forums, and the answers have been "we won't change that, you have to live with it" and "you can use the API for thst".

If I would be the one writing the blog entries, I would be fine with getting the API to work and using that. Sadly, the person who is writing the articles has not the slightest idea about what he is doing, so I definitely don't want to go that route.

Long story, one question: Is there a way to tweak serendipity, so that links to picasa.google.com open in target="_blank", while all other links stay untouched? I am a programmer, so I could modify code if necessary. But I am neither a php specialist nor do I have an idea how and where this could be achieved...
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Links to Picasa open in new window

Post by onli »

Hi
you could use the regexp-plugin to format the links accordingly.

But wouldn't it be easier, in the long run, to get rid of the frame?
sincerely
windharp
Regular
Posts: 5
Joined: Wed Apr 15, 2009 10:52 am

Re: Links to Picasa open in new window

Post by windharp »

onli wrote:you could use the regexp-plugin to format the links accordingly.
I'll have a look into that, thanks.
onli wrote:But wouldn't it be easier, in the long run, to get rid of the frame?
sincerely
Most likely yes. I plan on removing the frames alltogether, but that will need some talk to be done. And I prefer the links not displaying error messages for months...
windharp
Regular
Posts: 5
Joined: Wed Apr 15, 2009 10:52 am

Re: Links to Picasa open in new window

Post by windharp »

Looks like that can do the trick quite easily. If I can get it to work, that is.

Currently the plugin is installed, visible in the interface, configured to run on everything. But the markup() function of the plugin is not called, or the results ignored. I tried to hardcode a $messagetext = preg_replace(/a/, b, $messagetext); into the plugin, but my entries stay as they are. Well, I guess I will have to do some further debugging :-)
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Links to Picasa open in new window

Post by onli »

I didn't test the plugin, but those issues are usually related to the cache. Uninstalling another markup-plugin, which purges the cache, usually helps - or testing in a new article.
windharp
Regular
Posts: 5
Joined: Wed Apr 15, 2009 10:52 am

Re: Links to Picasa open in new window

Post by windharp »

Helped, but in a different way than I thought it would.

I removed and readded another markup plugin as suggested. After that, the regexp plugin was gone from the list, too. Going back with my opera revealed it was in the list before, and I didn't accidently remove it. Readded the regexp plugin, and now it is working.

If someone is interested (even though this regexp is rather trivial)

Code: Select all

$regexpArray = array(
    'SearchArray' =>array('/href="(http\:\/\/picasaweb\.google\.com\/[^"]+)"/i'),
    'ReplaceArray'=>array('href="\1" target="_blank" ')
);
Danke für die Idee und die anschließende Hilfe, onli!
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Links to Picasa open in new window

Post by onli »

Happy it worked :)

Gern geschehen.
Gruß
Post Reply