Quantcast
Channel: WPMU DEV Community » Topic: forward slash in front of links for a RSS feed reader that I wrote.
Viewing all articles
Browse latest Browse all 4

Mauri on "forward slash in front of links for a RSS feed reader that I wrote."

$
0
0

Calling out Jack who was helping me via chat.

Background: I wrote out a simple function to spit out title and permalinks of an rss feed using the simplepie function fetch_feed.

Problem: Fetch Feed was calling hyperlinks and images with a \ in front of it of the link. When looking at my debugger, I found that my browser was looking for

http://www.acqops.com/%20www.someurl/somepic.png

This resulted in bringing my site down to a crawl as it looked through each bad link, checked a few times and timed out.

I did a little research and found that there is a function called called magic_quotes that adds the slash. Magic quotes helps out by telling PHP to mind the link. SO... I found this thread: http://wordpress.org/support/topic/wp-adding-forward-slash-to-all-links

The solution was to add some code to wp-settings.php directly below

// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
wp_magic_quotes();

Add:

if ( get_magic_quotes_gpc() ) {
    $_POST      = array_map( 'stripslashes_deep', $_POST );
    $_GET       = array_map( 'stripslashes_deep', $_GET );
    $_COOKIE    = array_map( 'stripslashes_deep', $_COOKIE );
    $_REQUEST   = array_map( 'stripslashes_deep', $_REQUEST );
}

QUESTION: What the heck is the code above doing to my code? I dont like to set something with haste to only suffer late.

PS: Thanks for all the help, Jack.


Viewing all articles
Browse latest Browse all 4

Trending Articles