May 4, 2011

PHP strip_tags() not working. | CyberSEO Pro | Support Forum

Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_TopicIcon
PHP strip_tags() not working.
Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 (0 votes) 
June 25, 2012
10:02 pm
Avatar
drew@sharklasers.com
Guest
Guests

I am trying to use the PHP feature to stirp out all <IMG> and <A> tags like so:

Login to see the code

But it ignores the code and just inserts the complete content with all tags intact. Is strip_tags not allowed for some reason?

UPDATE:

The more I play around with it, the more broken this seems. Even doing something basic like this doesn't do anything (the post content remains unchanged):

Login to see the code

Perhaps my feed is screwed up somehow? This is it:Login to see this link

Also note, that these don't do anything either, so it's impossible to set a blank excerpt.

Login to see the code

June 26, 2012
2:57 am
Avatar
drew@sharklasers.com
Guest
Guests

So I figured it out!

Seems that $post['post_content'] wasn't even set yet. It was empty this whole time.

So I just did this:

Login to see the code

It's pretty confusing what the plugin is assigning to which variable. I guessed that $post['post_content'] was being set with the contents of the <item> (or section tag), but in fact $post['post_excerpt'] was getting given that.

Word of advice to anyone using this PHP formatter: start with those first 5 lines of code I have above!

June 26, 2012
10:43 am
Avatar
CyberSEO
Admin
Forum Posts: 3910
Member Since:
July 2, 2009
sp_UserOfflineSmall Offline

The "<content>" element ($post['post_content']) is not required by Login to see this link, so many feeds have only "<description>" ($post['post_excerpt']).

Thus your code must check both variables and if $post['post_content'] is empty, the $post['post_excerpt'] variable must be used instead.

Your code above does it right excepting this line:

Login to see the code

If you want make the excerpt empty, you should do it this way:

Login to see the code

Otherwise just leave it as is.

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 541

Currently Online:
50 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

ninja321: 84

s.baryshev.aoasp: 68

Freedom: 61

Pandermos: 54

MediFormatica: 49

B8europe: 48

Member Stats:

Guest Posters: 337

Members: 2817

Moderators: 0

Admins: 1

Forum Stats:

Groups: 1

Forums: 5

Topics: 1626

Posts: 8274

Newest Members:

igor.buzaev, jeremyboucher, lthompson2709, MAC, duty3canada, backlinkmorocco

Administrators: CyberSEO: 3910