Passing html
Permalink Browser Info Environment
Hi,
I can't seem to pass any html to the posting. It all gets stripped away. I'm using the following code:
Am I implementing this wrong?
Thanks!
I can't seem to pass any html to the posting. It all gets stripped away. I'm using the following code:
$posting_type = array($pkgName, 'test_post', 'Updated Something', 'updated something %1$s', 1, 2); $posting = '<a href="#">Hello World</a>'; ... $wall->postAndPossiblyRegister($uID, $posting, $posting_type);
Am I implementing this wrong?
Thanks!
Type: | Discussion |
---|---|
Status: | New |
Ahh ok. So no way to stick an img tag in there?
Not by calling postAndPossiblyRegister(), which you can think of as a "simple shortcut" method.
AddWithType() does take an option (array('sanitizeData' => false)) that will prevent the stripping of any tags.
If you'd like to use that, you basically have to recreate the postAndPossiblyRegister() functionality, which is only a few lines (see /controller.php):
When you call $post->AddWithType() you would pass the array as the fourth option:
**** Note that if you do this it's very important that you sanitize the data in some other way. *****
AddWithType() does take an option (array('sanitizeData' => false)) that will prevent the stripping of any tags.
If you'd like to use that, you basically have to recreate the postAndPossiblyRegister() functionality, which is only a few lines (see /controller.php):
public function postAndPossiblyRegister($uID, $data, $arrPostingType) { Loader::model('postings', 'lerteco_wall'); $type = new LWPostingType(); call_user_func_array(array($type, 'LoadOrUpdateOrRegister'), $arrPostingType); $post = new LWPosting(); $post->AddWithType($type, $uID, $data); }
When you call $post->AddWithType() you would pass the array as the fourth option:
$post->AddWithType($type, $uID, $data, array('sanitizeData' => false));
**** Note that if you do this it's very important that you sanitize the data in some other way. *****
No. The stripping is intentional for security reasons.