Đã hoàn thành

134136 function sendValidText

I need to have the following function implemented TODAY. You will likely need to use regular expressions.

It will take some text (usually with html tags) and return the text trimmed & cleaned as necessary given the parameters.

function sendValidText($txt, $max_length, $length_criteria, $max_links) {

// $txt = the original article text for the particular article field

// $max_length = the maxumum length the particular article directory allows for this field

// $length_criteria = "word" or "char" depending on whether the length is a word or character limit

// $max_links = the maxumum amount of hyperlinks allowed in the txt

// given the above parameters, return the $txt trimmed as necessary

// count any html tags along with text when determining word or character count

// if a trim is needed, trim at *sentence boundaries*...

// So if you are 30 characters into a new sentence and it then exceeds the limit, remove the entire sentence.

// but if removing the entire sentence would result in there being no text left in $txt,

// then instead trim at a word boundary, and put "..." after it

// (making sure the "..." doesn't exceed limit)

// if the max_links are exceeded, remove random links to pull it back to the maxumum.

// but make sure a trim doesn't take place in the middle of the following html tags: "a, b, strong, em, i".


Kĩ năng: Bất kì công việc gì, PHP

Xem nhiều hơn: use regular expressions, text em, regular expressions in c, regular expressions c, c regular expressions, Trim, function, word count character count, php count txt, remove html tags text, php count word txt, php article directory, word count php, php word count, php remove word characters, php random links, php char, count characters text, count characters txt, random word php, php directory hyperlinks, html random links, php hyperlinks, sentence random, Regular Expressions

Về Bên Thuê:
( 29 nhận xét ) Raleigh, United States

ID dự án: #1880308

Được trao cho:


Hello! We can efficiently develop this for you. Quick, professional and bug free script guaranteed. Thank you for considering our bid! Best regards, skiv

$100 USD trong 1 ngày
(514 Đánh Giá)