Recent Topics

1 Sep 12, 2008 14:49    

That's what I would like to do: put a help icon linked to the readme.html file for a plugin on the toolbar it creates. This way anyone who can access the toolbar could also access the help file. Workaround would be to create a tools subtab and duplicate the readme content there, but to me a "question mark in a circle" icon on the toolbar would be a lot more user friendly.

2 Sep 12, 2008 16:59

You should be able to play with this ;)

inc/plugins/plugin.class.php ( approx 2698 )

	/**
	 * Get a link to a help page (with icon).
	 *
	 * @param string Target; one of the following:
	 *         - anchor to {@link $help_url} ("#anchor")
	 *         - absolute link to some URL, e.g. "http://example.com/example.php"
	 *         - '$help_url' or empty for {@link $help_url}, then also the "www" icon gets used
	 *         - '$readme' to link to the plugin's README.html file (if available)
	 * @return string The html A tag, linking to the help (or empty in case of $readme, if there is none).
	 */
	function get_help_link( $target = '' )
	{

¥

3 Sep 12, 2008 17:55

Cool. I looked there but got scared off by something.

My stupid plugin decided that every now and then an embedded object would have a height of zero. Sometimes I can make it happen, but then a few efforts later the problem won't duplicate so I think I fixed it only to find it shows up again. Repeat :(

I hate to overly complicate things (even by my standards) but it is kinda hard to watch a video when the object height is zero eh? So now a simple bit of code that clearly is capable of finding a numeric value and doing simple math with it will have to turn into a bunch of hoops. Did you find the value? Is it numeric? Can you do math without resulting in 0? If not ... fake it?

4 Sep 12, 2008 18:04

Okay the help link was easy - thanks!
I replaced the toolbar-ending </div> with this this:

echo '&nbsp;'.$this->get_help_link('$readme').'</div>'; ?>

I should put some more effort into debugging the mysterious intermittent lack of height, but yesterday's dental work is a dim memory so methinks it be time to have a buxom gal feed me breakfast :)

5 Sep 12, 2008 19:44

EdB wrote:

If not ... fake it

You sure yer not a woman? :|

¥

6 Sep 13, 2008 18:19

Wow you're a damned genius! See this is why I say you gotta stick to short answers. So here's how I think it'll work: if not try again. Never mind that it should have worked. Never mind that repeating the same thing expecting a different outcome is the definition of insanity. Just do it. Again.

if( ! $width ) { // true only if $width is 0
do the damned math again because duh it's gotta work
}

[video:source:something]

By the way the real problem can be seen thusly. When the videoplug plugin does the actual rendering it looks for '' and uses preg_replace to use 'something' to create the object tag. What I'm doing is including another preg_replace to turn '[dims:NNN]' into width and height attributes where NNN is the height if the width was 425 and the actual width is a setting the admin decided on. Default is 425 but your skin might work better with 400 or 480 for all I know.

/* shine on you crazy diamond */
function buildwidthandheight( $content, $width ) {
	$height = round( ( $width * substr($content,strpos($content,'[')+6,3) ) / 425 );
	$content = preg_replace( '¤\[dims:(.+?)]¤', 'width="'.$width.'" height="'.$height.'"', $content );
	}


The problem was that AFTER multiple videos from multiple sources in a single post, every now and then the second preg_replace would calculate a height of 0 pixels. Clearly the "view source" showed that the '[dims:NNN]' portion was gone so it must have found it. But somehow ($width * NNN)/425 was returning 0. But not if the poorly rendered video was moved up above the video above it in the same post. And not in a clearly repeatable way. For example metacafe could follow askaninja, but not vimeo. But askaninja could not follow metacafe even though vimeo or youtube could follow any of 'em.

So yeah: just do it. again. I think.

7 Sep 13, 2008 19:28

Cool cool cool. Just had a moment of poopypants though: DailyMotion doesn't always give the same dimensions. I'm pretty sure other sources will do the same eh? Like, youtube I'm pretty sure always is the same X and Y values so I can easily figure on NNN being the height if 425 were the width. That is what I based everything on, and just now I went to re-test each and every source for multiple videos ... just to make sure the javascript portion was properly pulling the required code.

EPIC FAIL!

So now I am stealing a page from John's "embed local SWF" hack to include the original width and height from the "embed me" code. The problem is I've never preg_replaced anything all by myself before. Like, "regular expressions" simply are NOT regular. They're weird and scary and not my cup of tea.

Anyway my brain hurts. It's a lot of fun to try this but damn it is turning into a major piece of "how'd that happen?"

8 Sep 13, 2008 19:28

/* the lunatics are on the grass */
$content = preg_replace( '~\[dims:([0-9])+?\]~', 'width="'.( $width ? $width : 425 ) .'" height="'.( ( ( $width ? $width : 425 )  * '$1' )/425 ).'"', $content );

Completely untested, so it may be a moment of madness .... it's a fine line I walk :D

¥

*edit*
Don't listen to that John geezer ... barring the fact that he's a convict hand me down, he's just a copy paste merchant at heart ... mind you, he is an expert at the 4 key process "ctrl+c ctrl+v" :|


Form is loading...