vernal poolonline staff

Mittineague

WordPress widgets.php Hack

There are 43 plants in blossom on September the 2nd.
Beggar Ticks Bidens frondosa blossoms between Aug 29 and Sep 22
Birdsfoot Trefoil Lotus corniculatus Jun 20 to Sep 05
Bittersweet Nightshade Solanum dulcamara May 30 to Sep 06
Black-eyed Susan Rudbeckia serotina Jun 18 to Sep 06
Black Nightshade Solanum nigrum Jun 29 to Sep 06
Boneset Eupatorium perfoliatum Aug 03 to Sep 06
Bouncing Bet Saponaria officinalis Jun 03 to Aug 31
Butter-and-eggs Linaria vulgaris Jul 10 to Sep 20
Celandine Chelidonium majus May 07 to Sep 11
Chicory Cichorium intybus Jun 28 to Oct 24
Common Dodder Cuscuta gronovii Sep 02 to Oct 02
Common Evening Primrose Oenothera biennis Aug 02 to Sep 20
Common Ragweed Ambrosia artemisiifolia Jul 20 to Sep 20
Common St. Johnswort Hypericum perforatum Jun 08 to Sep 26
Daisy Fleabane Erigeron annuus May 30 to Oct 24
Fall Dandelion Leontodon autumnalis Aug 02 to Sep 30
Field Hawkweed Hieracium pratense May 23 to Sep 07
Galinsoga Galinsoga ciliata Aug 01 to Oct 11
Horseweed Erigeron canadensis Aug 12 to Sep 06
Jimson Weed Datura stramonium Jul 22 to Sep 06
Lady's Thumb Polygonum persicaria Aug 12 to Oct 20
Nodding Smartweed Polygonum lapathifolium Aug 12 to Oct 22
Pale Touch-me-not Impatiens pallida Aug 22 to Sep 06
Pink Knotweed Polygonum pensylvanicum Aug 12 to Sep 11
Purple Coneflower Echinacea purpurea Jul 15 to Sep 06
Queen Anne's Lace Daucus carota Jul 09 to Sep 07
Red Clover Trifolium pratense May 23 to Oct 24
Round-headed Bush Clover Lespedeza capitata Sep 03 to Sep 04
Shrubby Cinquefoil Potentilla fruticosa Jun 03 to Sep 19
Spearmint Mentha spicata Aug 01 to Sep 06
Spotted Knapweed Centaurea maculosa Jul 31 to Sep 20
Spotted Touch-me-not Impatiens capensis Jul 01 to Sep 11
Sweet Everlasting Gnaphalium obtusifolium Aug 28 to Oct 24
Sweet Goldenrod Solidago odora Jul 31 to Sep 20
Tall Rattlesnake Root Prenanthes trifoliata Aug 27 to Sep 06
Tansy Tanacetum vulgare Jul 18 to Sep 11
Three-seeded Mercury Acalypha rhomboidea ....
If you are looking for a way to stop RSS feeds with a character encoding different than your WordPress blog's character encoding from causing validation errors, please see rss.php Hack 1

This hack stops feeds in the WordPress sidebar feed widgets that have different character encodings from causing non-valid mark-up.

I say "hack" because this is NOT a plugin, but involves direct modification of the widgets.php file. If you try this, Please be Sure to Save a Back-up of the original file.

Important* Note* This hack requires the iconv function. From the PHP documentation:

To use functions provided by this module, the PHP binary must be built with the following configure line: --with-iconv[=DIR].

Also, if you are on a Windows or IBM server, or the results are not what you expect, Please read the documentation (actually, it's not a bad idea to read it anyway).

Open the content/plugins/widgets/widgets.php file.

In the widget_rss function find this section of code:

<?php
//php tags needed for highlighter
//.............................
 
      } else {
        $desc = str_replace(array("\n", "\r"), ' ', wp_specialchars(strip_tags(html_entity_decode($item['description'], ENT_QUOTES)), 1));
        $summary = '';
      }
 
//.............................
?>

After the line with the closing curly brace add:

<?php
//php tags needed for highlighter
//.............................
 
      $feed_char_enc = $rss->feed_encoding;
      $board_char_enc = get_bloginfo('charset');
      if($feed_char_enc != $board_char_enc)
      {
        $conv_link = iconv($feed_char_enc, "$board_char_enc//IGNORE", $link);
        $conv_desc = iconv($feed_char_enc, "$board_char_enc//IGNORE", $desc);
        $conv_title = iconv($feed_char_enc, "$board_char_enc//IGNORE", $title);
        $conv_summary = iconv($feed_char_enc, "$board_char_enc//IGNORE", $summary);
        $link = ($conv_link != FALSE) ? $conv_link : $link;
        $desc = ($conv_desc != FALSE) ? $conv_desc : $desc;
        $title = ($conv_title != FALSE) ? $conv_title : $title;
        $summary = ($conv_summary != FALSE) ? $conv_summary : $summary;
      }
 
//.............................
?>

Which will now be before this line:

<?php
//php tags needed for highlighter
//.............................
 
      echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>$summary</li>";
 
//.............................
?>

Notice that for the "out charset" I appended the "//IGNORE" string. This removes any characters that can't be converted. This is not entirely desirable, but using the default will result in the converted strings being terminated at the last valid character. A third option is to append the string "//TRANSLIT" instead. You may want to try it, but I found that the converted strings still caused non-valid mark-up.

About - Blog - Sitemap - Contact - Forums - Home 

PHP icon. PEAR icon. MySQL icon. phpBB icon. Sitepoint icon. Valid XHTML 1.0 icon. Valid CSS! icon. Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0