• Welcome to Simple Machines Community Forum. Please login or sign up.

Quote Source Mod

Started by Garou, March 11, 2009, 04:31:28 AM

Previous topic - Next topic

Garou

March 11, 2009, 04:31:28 AM Last Edit: February 08, 2010, 02:46:26 PM by Garou
This Mod is no longer supported.
You can accomplish the same thing with [quote="[url=http://somesite.com]Name[/url]"]Quoted Text[/quote]
If someone wants to borrow code from this mod for theirs feel free.
~Garou

Quote Source Mod v1.4





Introduction:
This Mod adds a new quote attribute, useful when quoting sources from outside your forum.

Features:
When using the quote function you now have the option of the source= attribute similar to quote author= attribute. However this will add a clickable link to a URL of your choosing to the Quote From:Name.

For example previously you could type...
[quote author=Authors Name]Quoted text[/quote]
to get
Quote from: Authors NameQuoted text
or
[quote author=http://somesiteurl.com]Quoted text[/quote]
to get
Quote from: http://somesiteurl.comQuoted text

This mod now gives the option to use
[quote source=Authors Name link=Link to URL]Quoted text[/quote]
to get
Quote from: Authors Name
Quoted text

In a quote box, feature not available till mod is installed.

Installation:
To install, simply upload the entire zip file to the package manager (Admin -> Package Manager -> Download New Packages).
This mod should install under all versions of SMF and under all themes as it only changes source code in the ./Sources/Subs.php

Compatibility:
Tested under SMF Versions 1.1.7 - 1.1.10 and 2.0 RC1 - 2.0 RC2

Credits:
Original idea inspired by yutt's World of Warcraft Blizzard Quote BBC

Change log:
Version: 1.4
* Updated to provide better server compatibility, suggested by TAI06GR
+ Updated to install properly on SMF 2.0 RC2

Version: 1.3 August 27, 2009
! Plugged Security loophole allowing scripts in the link. Thanks to the SMF Customization Team for spotting and submitting the fix.
* Changed the Quote from: to the standard variable in SMF rather then it being hard coded in the mod. This allows the mod to support multiple languages.

Version: 1.2 February 10, 2009
* Mod renamed to "Quote Source"
* Usage changed to...
[quote source=Authors Name link=Link to URL]Quoted text[/quote]
+ Updated to work with 1.1.8 and 2.0 RC1
+ Packaged as an installable mod

Version: 1.1 March 09, 2007
+ Adds clickable link to quote box via Alternate Quote "a-quote" bbc
+ Usage...
[a-quote author=Authors Name link=http://Link to URL]Quoted text[/quote]

Legend:
! bug fix
+ added feature
* changed
> Comment

babjusi

Nice mod. Well done Garou :)

Garou


TAI06GR

Du solltest die Sourcezeile abändern, um eine Systemunabhängigkeit sicherzustellen, hatte auf meinen Linux-Server Probleme
nachdem ich die source zeile wie folgt geändert habe gings:

'source' => array('match' => '(.{1,192}?)', 'validate' => 'parse_bbc'),

Garou

Übersetzung durch Google

Sie können versuchen, aber es wird sehr wahrscheinlich die Verbindung der mod.


TAI06GR

Quote from: Garou on May 08, 2009, 07:19:57 AM
Übersetzung durch Google

Sie können versuchen, aber es wird sehr wahrscheinlich die Verbindung der mod.


upss sorry, my English is good enough, i'm only forgot  that this is the english part of SMF

Quote from: TAI06GR on May 06, 2009, 07:40:47 AM
Du solltest die Sourcezeile abändern, um eine Systemunabhängigkeit sicherzustellen, hatte auf meinen Linux-Server Probleme
nachdem ich die source zeile wie folgt geändert habe gings:

'source' => array('match' => '(.{1,192}?)', 'validate' => 'parse_bbc'),

You should change the line "source" because \w+ is not System independent, on my Linux Server the mod only run after change the line into:

'source' => array('match' => '(.{1,192}?)', 'validate' => 'parse_bbc'),

Garou

Thanks, Ill keep that in mind for a future update. Since I borrowed code from one of Yutt's old outdated mods, I assumed the w+ was needed to make the mod work the way I wanted.

marko_andres

for 1.1.10 is available  ??

Version SMF: 2.0 RC3
Theme        : Inferno
Portal          : Simple Portal 2.3.2


Por un cambio de conciencia --> http://thezeitgeistmovement.com/

Garou

Should work just fine under any 1.1.x or 2.x versions of SMF but I haven't had the chance to test with the latest versions.

Shannar

This mod don't work in my SMF 1.1.10.

Why it possible?
Sorry for terrible English. My native language is C++ Russian.

Garou

TAI06GR pointed out out several posts back that some servers can not handle the code "\w+".

He sugested that...
'source' => array('match' => '(\w+)'),
be replaced with...
'source' => array('match' => '(.{1,192}?)', 'validate' => 'parse_bbc'),

I never tested this myself as I could not find any information supporting his claim, in fact  \w+ is a pretty standard regular expression. I don't know why it wouldn't work unless maybe the host is using an outdated version of php or something.

None the less TAI06GR's suggestion should work, as SMF uses that variation in a few places.




Shannar

Quote from: Garou on October 08, 2009, 05:47:49 AM
TAI06GR pointed out out several posts back that some servers can not handle the code "\w+".

When he wrote this, I didn't understood, what he mean. Now fix — and all working! Thnx!
Sorry for terrible English. My native language is C++ Russian.

Shannar

How about change 'source' to 'author'? For uniformity?
Sorry for terrible English. My native language is C++ Russian.

Garou

October 08, 2009, 09:49:40 AM #13 Last Edit: October 08, 2009, 11:27:41 AM by Garou
When I originally wrote/borrowed the code from yutt's World of Warcraft Blizzard Quote BBC...

I was helping to moderate a friends site. He wanted the ability to quote and credit other websites and outside sources. After asking for help, I found Yutt's mod and that wasn't what my friend wanted. He said it worked if you wanted to quote Blizzard but he wanted it to be used for any site and to integrate into the forum better.

To then I decided to take apart Yutt's mod and make it do what I wanted. I couldn't make it work using "quote author link" without breaking the other "author" options in the existing quote function. I then set it up so that it used a different BBC tag altogether, [a-quote] instead of the quote tag. That worked well enough for my friend so I left it at that.

Then a couple years later I had an epiphany that "source" made more sense then "a-quote" and I planed on changing the tag to [source] but I decided to try to make it work with the existing quote tag again. Again it failed and just for fun I though what if I changed "author" with "source" and it magically started working. So I went ahead and packaged it up as an official mod.

There are two other things I have thought of changing, to better differentiate the mod from the standard quote function. The first was either changing the BBC tag to [source] as originally planned and or changing the language string where it says "Quote from:" to "Source:"

Garou

Oops! I accidentally uploaded the development version of version 1.4 of the mod.   :-[

The old file may not install or work properly with the public version of SMF 2.0 RC2. There were some changes  between the charter and public versions of the SMF release but the file on the downloads page now should work. :)

PalmBeachPreps

Great mod.  Worry-free install on RC2

shadav

while I see that this mod is no longer supported but thank you for the mod :)

you missed a closing div, so that everything after the quote is still surrounded by the quoteheader ;)

the code to add should be

array(
'tag' => 'quote',
'parameters' => array(
'source' => array('match' => '(.{1,192}?)', 'validate' => 'parse_bbc'),
'link' => array('match' => '(((https?|ftps?)+(:\/\/)|www?)+(.+?))'),
),
'before' => '<div class="quoteheader"><div class="topslice_quote">' . $txt['quote_from'] . ': <a href="{link}">{source}</a></div><blockquote>',
'after' => '</blockquote><div class="quotefooter"><div class="botslice_quote"></div></div></div><br />',
'block_level' => true,
),

Arantor

Why use it when the description makes it clear that you can do it without changes to SMF?
No good deed goes unpunished
All helpful urges should be circumvented

shadav

Quote from: Arantor on September 30, 2019, 11:49:48 AM
Why use it when the description makes it clear that you can do it without changes to SMF?
maybe something i've added messed it up but I tried with
[quote="[url=http://somesite.com]Name[/url]"]Quoted Text[/quote]
and it came out all messed up  :laugh:
Quote from: "Name[/url" class="bbc_link" target="_blank">"]Quoted Text

Arantor

Quote from: NameQuoted Text

Works for me...
No good deed goes unpunished
All helpful urges should be circumvented

Advertisement: