Leave a comment

Comments 32

sssexygirl December 28 2004, 16:13:06 UTC
what does all of this do?

Reply

kunzite1 December 29 2004, 11:28:21 UTC
adds functions to the string class of s2.

you can only define new functions in layout layers.

these are all global functions.

if you wanted to add them to the string class you would have to declare them like:
function string alter_entry(string original) : string {
}or
function string alter_entry() : string {
var string original = $this;
}depending on which version of the function you use you would call them as:
$e.text-or
$e.text->alter_entry();

Reply


absolut December 29 2004, 09:52:21 UTC
I tried using the altered_entry function, but the code you have there didn't work, I had to change it to this:

function alter_entry(string original) : string {
var string find = "";
var string replace = "";
var string altered = "";

$find = "http://stat.livejournal.com/img/userinfo.gif";
$replace = "http://pics.livejournal.com/img/fb-userinfo.gif";
$altered = replace_text($original, $find, $replace);

return $altered;
}

Reply


luinied January 11 2005, 04:16:19 UTC
Not sure if you'll see this, but is there an official story as to why the builtin striphtml is broken?

Reply

kunzite1 January 11 2005, 05:09:05 UTC
official? somewhere. here.
unofficial? never implemented.

same with alternate(string a, string b) that i could have used today.

Reply


camomiletea February 27 2005, 06:20:23 UTC
This is in the description of one of the functions:

rehtml(string text) : string "Unescape html in \$text by replacing > with > and < with <."

Should probably be: < with > and > with >. It's repeated twice there.

Reply

kunzite1 February 27 2005, 17:17:07 UTC
yeah... i noticed that too and forgot to do something about it. :D

Reply


Sorry to bother you, but... xtomxfallsx May 6 2005, 08:10:05 UTC
Is there a simple function for just checking whether a string contains a certain substring?

For example, say i want to check entries for img tags ("

Reply

Re: Sorry to bother you, but... kunzite1 May 6 2005, 13:37:02 UTC
<3 php.net
if($string->contains("
... )

Reply

Re: Sorry to bother you, but... xtomxfallsx May 7 2005, 22:27:12 UTC
Oh, it's not likely that I'll come up with any nice functions on my own. This S2 stuff is out of my league.

I used what you listed to check for img tags and it works great. I've even got it checking for any instance of [info] with the img tags so that it will ignore lj-user tags.

Unfortunately, using foreach to go through and check the image dimensions is beyond me, so I'll just stick with my half-assed job.

Thanks for your help, though. It allowed me to do basically what I was trying to do.

Reply

Re: Sorry to bother you, but... kunzite1 May 7 2005, 22:30:47 UTC
could you show me how you use the code that i gave you?
i might be able to rig something to search for height and width and extract it.
then it would hopefully be able to be used for anything.

yay for getting it worked out. :)

Reply


Leave a comment

Up