7:24 am
Hello Admin,
I'm finding that adding an "array check" function for bad words is creating alot of "overhead" and creating some error or causing PHP scripts to 'time out'.
For instance the following script "times out" and never inserts a post (CyberSEO complains that there was an 'error' and not post was added, but I have no way of knowing what the error is):
Login to see the code
If I change the Array to just 3 words it does complete:
$arrayBadWords = array('copyright','bad1','bad2',);
Any suggestion as to how this sort of functionality could be improved other than creating fa slow PHP 'looping' array?
Regards,
Cyber1
First of all, your code is not well optimized because it continues to check for all "bad" keywords even if one of them was found (lines 4-8). This is just a wasting of your server resources which is the reason of those "overheads".
The second thing is that this code runs for every post in the feed, including those that there syndicated already. You can skip these posts using special API function cseo_post_exists() which returns true if post already exists in the database (it uses the selected duplicated check method).
So here is a slightly optimized version of your code which also uses the cseo_post_exists() function to skip all the existing posts (note lines #1, #5 and #6):
Login to see the code
Most Users Ever Online: 541
Currently Online: harboot
3 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: 2813
Moderators: 0
Admins: 1
Forum Stats:
Groups: 1
Forums: 5
Topics: 1620
Posts: 8251
Newest Members:
duty3canada, backlinkmorocco, dmitrypehovskiwork, lmsdesigns4, diegomanzetti, moondream53Administrators: CyberSEO: 3901