vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Filtering a string (https://vborg.vbsupport.ru/showthread.php?t=203937)

MrEyes 02-02-2009 12:42 PM

Filtering a string
 
Lets say I have the following string:

Quote:

this is some text

[wibble]this is a wibble of random length[/wibble]

this is some more text
I need to filter out everything between, and including, [wibble] and [/wibble]. So I would end up with the following:


Quote:

this is some text

this is some more text
Does anybody know how to do that?

punchbowl 02-02-2009 01:15 PM

Code:

function stripos($haystack, $needle, $offset=0) {
  return strpos(strtoupper($haystack), strtoupper($needle), $offset);
}

That will get the position of a string in another string. After that use substr

MrEyes 02-02-2009 01:49 PM

Quote:

Originally Posted by punchbowl (Post 1731875)
That will get the position of a string in another string. After that use substr

duh!! Wood for the trees and all that :)

Anyway, that works... However

I am currently working on something that will add quote functionality into vBulletin social group discussions (why this wasn't added is a mystery to me). The reason for the question is that I need to strip out quotes within the quoted post. This is something that occurs when a forum post is quoted so I am guessing that this filtering functionality already exists somewhere in the VB framework, but I will be damned if I can find it.

Does anybody know where it might be, as using the substr etc complicates things as the code will have to cater for all imaginable scenarios.

punchbowl 02-02-2009 01:51 PM

look for the functions in postreply.php or whatever it's called? I don't know specifically

Dismounted 02-03-2009 04:32 AM

strip_bbcode()
strip_quotes()

I think you're looking for those.


All times are GMT. The time now is 03:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01001 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete