• You are doing a great job with this plugin, and I’ d like to congratulate you on your achievement.

    In case no-one else has reported it to you, there are some errors that are generated in the logs related to your plugin. I don’t think it affects the functionality at all but, I am sure you would agree, it would be nice if it didn’t generate them at all.

    Please see them below:

    [11-Jan-2010 23:52:31] PHP Notice:  Undefined index:  noodp in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 362
    [11-Jan-2010 23:52:31] PHP Notice:  Undefined index:  noydir in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 368
    [11-Jan-2010 23:52:31] PHP Notice:  Undefined index:  noarchive in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 374
    [11-Jan-2010 23:52:25] PHP Notice:  Undefined index:  allfeeds in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 531
    [11-Jan-2010 23:52:25] PHP Notice:  Undefined index:  commentfeeds in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 531
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  trailingslash in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 534
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  redirectattachment in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 537
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  allfeeds in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 541
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  login in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 548
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  admin in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 551
    [11-Jan-2010 23:52:25] PHP Notice:  Undefined index:  disabledate in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 554
    [11-Jan-2010 23:52:25] PHP Notice:  Undefined index:  disableauthor in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 554
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  redirectsearch in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 557
    [11-Jan-2010 23:52:25] PHP Notice:  Undefined index:  nofollowcatsingle in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 560
    [11-Jan-2010 23:52:25] PHP Notice:  Undefined index:  nofollowcatpage in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 560
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  nofollowmeta in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 563
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  nofollowcommentlinks in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 567
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  nofollowtaglinks in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 570
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  googleverify in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 573
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  yahooverify in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 576
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  msverify in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 579
    [11-Jan-2010 23:52:33] PHP Notice:  Undefined index:  nofollowindexlinks in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 582
    [11-Jan-2010 23:52:25] PHP Notice:  Undefined index:  replacemetawidget in /home/myhome/public_html/content/wp-content/plugins/robots-meta/robots-meta.php on line 585

    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) 😉

    Best wishes
    Hal

The topic ‘[Plugin: Robots Meta] Minor Errors in Log files’ is closed to new replies.