Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#781 2015-01-13 00:51:01

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: [plugin] [ORPHAN] vdh_flickr

Hi Adi, yes its tough to work out! Which code snippet did you use in the end?

Offline

#782 2015-01-13 01:13:54

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: [plugin] [ORPHAN] vdh_flickr

jstubbs wrote #287317:

Hi Adi, yes its tough to work out! Which code snippet did you use in the end?

This is what I’m using:

var $container = $('ul.images');
$container.imagesLoaded(function(){
	$container.masonry({
		itemSelector: 'li'
	});
});

Without it, the inline style added to the ul was always height:600px, which didn’t bear any resemblance to reality.

Offline

#783 2015-04-26 11:40:32

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: [plugin] [ORPHAN] vdh_flickr

Wondering if anyone has fiddled with this plugin to allow the display of a limited number of <txp:vdh_flickr_thumbnails images, for example:

<txp:vdh_flickr_thumbnails nsid="12345" thumbnails_form="flickr_lview" open="lightbox" set="123456789" thumbnail_size='m' img_size='b' limit="4" />

At the moment, there is no limit option with this tag or even generally in the plugin.

Offline

#784 2018-07-17 16:03:50

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,702
Website

Re: [plugin] [ORPHAN] vdh_flickr

Standing on the shoulders of Jonathan’s earlier modifications, I’m trying to make this plugin behave better with PHP 7.0 and txp 4.7.

I’ve uploaded the plugin source to GitHub, added Jonathan’s previous modifications (see commit trail) plus the following:

  • 4.6 Tag Registry (many many tags)
  • PHP 7 class/method clash: Commit here. I’m no expert on this and even less of an expert on public/private/protected function/variable scope but the error message is now silenced and the fatal error that resulted from my first attempt is likewise resolved.

However every single tag call returns a Only variables should be passed by reference error notice in debugging mode with the following tag trace:

tag_error <txp:vdh_flickr_thumbnails nsid="REDACTED" thumbnails_form="flickr_galleri_view" open="lightbox" set="REDACTED" thumbnail_size="m" img_size="b" /> ->  Notice: Only variables should be passed by reference while_parsing_page_form: bilder, Ingen
textpattern/lib/txplib_misc.php(1826) : eval()'d code:403 Thumbnails->getPhotos()
textpattern/lib/txplib_misc.php(1826) : eval()'d code:1111 Thumbnails->__construct()
vdh_flickr_thumbnails()
textpattern/vendors/Textpattern/Tag/Registry.php:116 call_user_func()
textpattern/lib/txplib_publish.php:545 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:469 processTags()
textpattern/publish/taghandlers.php:5025 parse()
if_variable()
textpattern/vendors/Textpattern/Tag/Registry.php:116 call_user_func()
textpattern/lib/txplib_publish.php:545 Textpattern\Tag\Registry->process()

Can any of you code experts:

a) shed light on how to resolve that error, as I really don’t know where to look.
b) advise me whether the class/method construct commit above is sufficient and correct, or whether other functions within the classes / extended classes need to be made public too.

Many thanks!


TXP Builders – finely-crafted code, design and txp

Offline

#785 2018-07-20 09:45:10

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,702
Website

Re: [plugin] [ORPHAN] vdh_flickr

Can any of you code experts shed light on how to resolve that error, as I really don’t know where to look?

Bump! Would really like to resolve this.


TXP Builders – finely-crafted code, design and txp

Offline

#786 2018-07-20 10:24:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,408
Website GitHub

Re: [plugin] [ORPHAN] vdh_flickr

jakob wrote #313044:

every single tag call returns a Only variables should be passed by reference error

This is usually one of these things:

1. Trying to pass another function as a parameter to a function call.

e.g. your_function($var1, some_function($param));

The correct way is:

$var2 = some_function($param);
your_function($var1, $var2);

2. Trying to pass by-reference variables (those preceded by an ampersand) into a function. This can usually be fixed by removing the & in front of the variable.

But I can’t see anywhere in the code where either are done. So, hmmmm.

advise me whether the class/method construct commit above is sufficient and correct

I don’t think so. You shouldn’t need the public declaration for the function with the same name as the class. It is sufficient to have the class name and a single __construct() method so when you issue new YourClass() it calls __construct() automatically.

Also, technically, the scope of all functions inside the classes should be declared. The rule of thumb I stick to is:

a) Use protected for everything because this allows other code to inherit the classes and do stuff with them. Using private makes this harder for anyone making subclasses of the code.
b) Promote any protected methods to public if that function is called directly from outside the class and you want to expose its functionality. Without this, you’ll get warnings/errors.
c) Use public on constructors most of the time, because you usually want to construct objects from outside code. The only time to consider protected constructors is if you want to prevent the class being constructed by others. Not very useful except in edge cases (perhaps when controlling construction of the object from a static method or some factory).

Having said that, the default is public if it’s unspecified, so it doesn’t really matter too much in this case and can be left unspecified.

Not sure if any of that helps in this specific case, sorry.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB