Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
0 + 6 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Deprecated method replacements?
by Catzwolf on 2010/8/4 17:44:49

Quote:

Peekay wrote:
That's great catzwolf, many thanks indeed

Quote:
use PHP native htmlspecialchars() rather than the one provided in $myts.

Do you recommend this for all instances where htmlspecialchars is the replacement? Is there a problem with the sanitiser version?


Yes I do, I don't see the need of loading a entire class just to use one function, especially when the php equivalent has the exact same functionality.

I would have said the same about stripslashes and addslashes as well, but due to the different server set-ups, the actual $myts version is more appropriate. I cannot wait to see the back of these two functions, they have caused developers more headaches than they are worth.
Re: Deprecated method replacements?
by Peekay on 2010/8/4 16:43:42

That's great catzwolf, many thanks indeed

Quote:
use PHP native htmlspecialchars() rather than the one provided in $myts.

Do you recommend this for all instances where htmlspecialchars is the replacement? Is there a problem with the sanitiser version?
Re: Deprecated method replacements?
by Catzwolf on 2010/8/4 16:39:17

Quote:
MyTextSanitizer::codeSanitizer()


There is no alternative to this.

Quote:
MyTextSanitizer::sanitizeForDisplay()


use MyTextSanitizer::displayTarea()

Quote:
MyTextSanitizer::sanitizeForPreview()


use MyTextSanitizer::previewTarea()

Quote:
MyTextSanitizer::oopsStripSlashesGPC()


stripslashes is regarded as deprecated as of php 5.3, but until the time useMyTextSanitizer::stripSlashesGPC()

Quote:
MyTextSanitizer::oopsStripSlashesRT()


same as above

Quote:
MyTextSanitizer::oopsAddSlashes()


MyTextSanitizer::addSlashes();

Quote:
MyTextSanitizer::oopsNl2Br()


MyTextSanitizer::nl2br();

use PHP native htmlspecialchars() rather than the one provided in $myts.

if you are not going to use XoopsObect class for dealing with saving to database, do not use addslashes use mysql_real_escape_string
Re: Deprecated method replacements?
by Peekay on 2010/8/4 16:02:49

OK, so based on the WIKI article, this is current:

Xoops 2.4.5

These methods are valid:

smiley()
makeClickable()
xoopsCodeDecode()
nl2Br()
addSlashes()
htmlSpecialChars()
undoHtmlSpecialChars()
displayTarea()
previewTarea()

These methods are deprecated. The replacement is shown:

makeTboxData4Save()
makeTareaData4Save()

Use instead: addSlashes()

makeTboxData4Show()
makeTboxData4Edit()
makeTareaData4InsideQuotes()
makeTareaData4Edit()

Use instead: htmlSpecialChars();

makeTareaData4Show()

Use instead: displayTarea();

makeTareaData4Preview()

Use instead: previewTarea();

makeTboxData4Preview()
makeTboxData4PreviewInForm()
makeTareaData4PreviewInForm()

use instead: htmlSpecialChars() combined with stripSlashesGPC()

Example usage:

le="color: #000000"><?php $ts->htmlSpecialChars($ts->stripSlashesGPC($text));


That just leaves:

* MyTextSanitizer::codeSanitizer()

* MyTextSanitizer::sanitizeForDisplay()

* MyTextSanitizer::sanitizeForPreview()

* MyTextSanitizer::oopsStripSlashesGPC()

* MyTextSanitizer::oopsStripSlashesRT()

* MyTextSanitizer::oopsAddSlashes()

* MyTextSanitizer::oopsNl2Br()

If someone can provide replacements for those, then it's QED!
Re: Deprecated method replacements?
by ghia on 2010/8/4 12:48:57

Quote:
This makes me wonder why they became depreciated in the first place?
Sometimes the function names does not fit no longer or the developer decided for new ones.

Who's Online

189 user(s) are online (147 user(s) are browsing Support Forums)


Members: 0


Guests: 189


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits