Thread Starter
halwp
(@halwp)
That’s great, alex, well done!
Do you think you can resolve the warning too (PHP Notice: Undefined index)? I know how to resolve these warnings but, funnily enough, I can’t actually find galAjaxNav in nggallery.php on line 316, which is strange.
I will check up this tomorrow
Thread Starter
halwp
(@halwp)
Thanks for that, alex!
The solution to the warning notice is simply to test that a variable exists before using it. For example,
if ($options['allfeeds'] || $options['commentfeeds'])
would be changed to:
if (array_key_exists('allfeeds', $options) && $options['allfeeds'] || array_key_exists('commentfeeds', $options) && $options['commentfeeds'])
While some may argue that isset is better for testing arrays, because it performs slightly better, you need to bear in mind that if the array key does indeed exist but it has been set to null, isset will return false, whereas array_key_exists returns the result that you would expect.
With scalars, you would simply use isset.
Hope this is all useful to you (although I imagine that you know all this already) 😉
Cheers
Hal
Thread Starter
halwp
(@halwp)
Alex
I just wanted to caution you about substituting the function “__ngettext” with “_n” – are you aware that this may make NextGen incompatible with some earlier versions of WordPress. I am afraid I cannot tell you which versions it will affect.
In contrast, the other changes that I suggested, which fix the PHP “Undefined index” notices, are good practice for all versions, and so I would still encourage you implement them.
Thank you again
Hal
I know and it’s no problem (for me)…. after each new WP version I will increase the needed version. I cannot (and will not) maintain backward compat.
I will check how I can circle around the notice bug, as I want to keep my code readable… tooo many “array_key_exists” will destroy the code, although it’s the correct way 🙂
Hi, thanks for the great plug-in!
From the posts here it appears that these problems have been fixed; however I still get the following error for every page in the browser:
Notice: Undefined index: galAjaxNav in /home/nealio/web/wordpress/drumlab/wp-content/plugins/nextgen-gallery/nggallery.php on line 337
I’m using:
WordPress 2.9.2
NextGEN Gallery 1.5.0
If it helps, here are my server settings (my development machine):
* Operating System : Linux (32 Bit)
* Server : Apache/2.2.12 (Ubuntu)
* Memory usage : 13.85 MByte
* MYSQL Version : 5.1.37-1ubuntu5.1
* SQL Mode : Not set
* PHP Version : 5.2.10-2ubuntu6.4
* PHP Safe Mode : Off
* PHP Allow URL fopen : On
* PHP Memory Limit : 32M
* PHP Max Upload Size : 2M
* PHP Max Post Size : 8M
* PCRE Backtracking Limit : 100000
* PHP Max Script Execute Time : 30s
* PHP Exif support : Yes ( V1.4 )
* PHP IPTC support : Yes
* PHP XML support : Yes