Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 12-12-2009, 04:38 PM
vaskies vaskies is offline
 
Join Date: Dec 2009
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
strip_quotes();
htmlspecialchars_uni();
fetch_censored_text();
strip_bbcode(); 
Those are all vbulletin functions, yeah? For simple testing, I tried using just the strip_quotes function on its own:
PHP Code:
$lastxdevel1[pagetext] = strip_quotes($lastxdevel1[pagetext]); 
That line of code has no effect on how the javascript mouseover handles $lastxdevel1[pagetext]. As if the function weren't doing anything at all. To test this, I'm using a thread that has all normal characters in the title, but a single quote at the beginning of the post.

Does strip_quotes(); need to be redefined from within the plugin?
Reply With Quote
  #22  
Old 12-12-2009, 05:36 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well to be honest I don't know the details of what any of those functions do, just thought since (I believe) it's doing something like what you're trying, maybe something would be useful.

As it turns out, it looks like "strip_quotes" (which is in functions.php) strips [quote] tags out of the text. So I guess it had nothing to do with your quote problem, sorry about that.

Maybe you can use the php str_replace function to replace ' with \' (put a backslash in front of it)? I'm afraid I'm not much help at this point - maybe worse than none if I lead you astray.
Reply With Quote
  #23  
Old 12-15-2009, 01:01 PM
vaskies vaskies is offline
 
Join Date: Dec 2009
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

-Phew- First of all, thanks for pointing me to functions.php. It's really helping me to begin understanding how vbulletin works.

After a lot of learning (particularly noteworthy is the php str_replace) as well as furthering my understanding of vbulletin's functions, I've managed to create a working concept. Any character I throw at it it replaces with a javascript-friendly version.

I set up a live example here.

You'll see though in the example that the thread on the right doesn't show the tooltip. This is because the post preview (pagetext) has a line break in it. To remedy this problem, I did the following:

PHP Code:
$placeholders = array("'""<br />");
$fixup = array("\'"" ");

$saPreview2 str_replace($placeholders$fixup$lastxdevel2['pagetext']); 
What's odd is, if you view the source you will indeed see that the <br /> has been properly replaced with a space. Yet there is still a line break, and more importantly, the tooltip still does not work.

So my question is, why would a line break in pagetext cause the tooltip to cease functioning? Is there something about how vbulletin handles line breaks in pagetext that I'm unaware of? Or is this a javascript syntax conflict? I know that javascript ignores whitespace so I'm leaning towards the possibility this is more a vbulletin issue than a javascript one...
Reply With Quote
  #24  
Old 12-15-2009, 01:30 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...I think what you have is an actual newline character in the string which I don't think is allowed in a javascript string constant. Maybe try replacing "\n" with "\\n" (which will hopefully put "\n" in the javascript string instead of the actual newline).
Reply With Quote
  #25  
Old 12-15-2009, 01:57 PM
vaskies vaskies is offline
 
Join Date: Dec 2009
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Aweeesome. I was not aware of this newline character. Interesting.

Well, it took over a week but we did it! Thanks so much for your time and help. You have no idea.

Thankfully the rest of the site's development will involve mostly CSS and HTML, which I'm much more adept at. After I get a solid handling of PHP functions and loops though, I plan to learn javascript as well as other programming languages. My feeling is, once I get a firm grasp of one, the rest will be much easier to learn as I've become accustomed to typical programming language syntax.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:36 PM.


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.03814 seconds
  • Memory Usage 2,209KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete