Advertisement:

Author Topic: See PDF in Posts  (Read 150073 times)

Offline FaSan

  • Sophist Member
  • *****
  • Posts: 1,053
  • Gender: Male
  • http://www.smitaly.net
    • SMitaly - Supporto a SMF
See PDF in Posts
« on: May 13, 2005, 05:10:06 PM »
Little Tips ;)


Code: [Select]
<search>
// Match a table... hopefully with everything in the right place.
'~\[table\](?:\s|\xA0|<br />|&nbsp;)*((?:\[tr\](?:\s|\xA0|<br />|&nbsp;)*\[td\]).*?(?:(?:\s|\xA0|<br />|&nbsp;)*\[/td\]\[/tr\])*)(?:\s|\xA0|<br />|&nbsp;)*\[/table\](?:\s|\xA0|<br />|&nbsp;)?~i' => '<table>$1</table>',
</search>


<add after>
// PDF [pdf]example.pdf[/pdf]
'~\[pdf\](?:<br />)*([^<>]+?)(?:<br />)*\[/pdf\]~i' => isset($disabled['pdf']) ? 'PDF: $1' : '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1"><a href="$1" target="_blank">$1</a></object>',
</add after>


Use with tag [pdf]example.pdf[/pdf]


It's work if you have in your browser the appropriate plugin (adobe acrobat o similar)


FaSan

Offline xenovanis

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,988
  • Gender: Female
Re: See PDF in Posts
« Reply #1 on: May 13, 2005, 05:16:09 PM »
Thank you, very usefull!

I 'read' the Italian post, it's supposed to be added in Subs.php?
"Insanity: doing the same thing over and over again and expecting different results."

Offline FaSan

  • Sophist Member
  • *****
  • Posts: 1,053
  • Gender: Male
  • http://www.smitaly.net
    • SMitaly - Supporto a SMF
Re: See PDF in Posts
« Reply #2 on: May 13, 2005, 05:17:58 PM »
Yes  ! Excuse Me :)


On file Sub.php  ;)

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: See PDF in Posts
« Reply #3 on: September 02, 2005, 11:52:40 AM »
anyone to make it work for smf 1.1 beta 3 ?
i couldnt find the given strings in Subs.php
Home of Elmacik

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: See PDF in Posts
« Reply #4 on: September 03, 2005, 03:57:40 AM »
Before this:

Code: [Select]
array(
'tag' => 'pre',
'before' => '<pre>',
'after' => '</pre>',
),

Add:

Code: [Select]
array(
'tag' => 'pdf',
'type' => 'unparsed_content',
'content' => '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1" /><a href="$1" target="_blank">$1</a></object>',
'disabled_content' => '<div>PDF: $1</div>',
'block_level' => true,
),

Then, in Subs-Post.php (this may be Beta 4 and after, though...) find:

Code: [Select]
// [flash]http://...[/flash]
array(
'tag' => 'flash',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
'hasExtra' => true,
),

Add after:

Code: [Select]
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),

-[Unknown]
« Last Edit: September 03, 2005, 06:33:55 PM by [Unknown] »

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: See PDF in Posts
« Reply #5 on: September 03, 2005, 09:47:38 AM »
thanks [unknown] but it give parse error :(

Parse error: parse error, unexpected ',' in /home/elmacik/public_html/forum/Sources/Subs-Post.php on line 303
Home of Elmacik

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: See PDF in Posts
« Reply #6 on: September 03, 2005, 06:40:33 PM »
thanks [unknown] but it give parse error :(

Parse error: parse error, unexpected ',' in /home/elmacik/public_html/forum/Sources/Subs-Post.php on line 303

Can you post 5 lines above and below your change to that file?

-[Unknown]

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: See PDF in Posts
« Reply #7 on: September 04, 2005, 05:06:48 PM »
here are the lines above, lines themselves, lines below;

Code: [Select]
// [flash]http://...[/flash]
array('tag' => 'flash', 'protocol' => 'http', 'embeddedUrl' => false, 'hasEqualSign' => false, 'hasExtra' => true)
);
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),

// Fix each type of tag.
Home of Elmacik

Offline dtm.exe

  • SMF Hero
  • ******
  • Posts: 5,465
Re: See PDF in Posts
« Reply #8 on: September 04, 2005, 05:26:45 PM »
here are the lines above, lines themselves, lines below;

Code: [Select]
// [flash]http://...[/flash]
array('tag' => 'flash', 'protocol' => 'http', 'embeddedUrl' => false, 'hasEqualSign' => false, 'hasExtra' => true)
);
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),

// Fix each type of tag.

Should that last comma not be a semicolon?

Offline Joshua Dickerson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,775
  • Gender: Male
    • joshuaadickerson on GitHub
    • joshuaadickerson on LinkedIn
Re: See PDF in Posts
« Reply #9 on: September 04, 2005, 05:45:38 PM »
That semicolon should be a comma
Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: See PDF in Posts
« Reply #10 on: September 04, 2005, 05:51:15 PM »
Don't add the code in Subs-Post.php.  As I described, it doesn't apply to your version.

-[Unknown]

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: See PDF in Posts
« Reply #11 on: September 04, 2005, 05:58:57 PM »
Should that last comma not be a semicolon?

no, as i tried replacing the semicolong that is placed at the end of [flash] and i put a semicolon instead of the comma in the codes that [unknown] gave. its no use.
That semicolon should be a comma

i tried but not to make [unknown] say "you havent done like i said" i just didnt post it.

Don't add the code in Subs-Post.php.  As I described, it doesn't apply to your version.

-[Unknown]

please look above, i asked for 1.1 beta 3, you gave the codes and now you say "it doesnt apply to your version" not weird in your opinion too? :)
« Last Edit: September 04, 2005, 06:00:54 PM by elmacik »
Home of Elmacik

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: See PDF in Posts
« Reply #12 on: September 04, 2005, 06:00:33 PM »
Then, in Subs-Post.php (this may be Beta 4 and after, though...) find:

As I said.

It will still work, just don't make that change.

-[Unknown]

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: See PDF in Posts
« Reply #13 on: September 04, 2005, 06:02:49 PM »
which change?
you mean even if i DONT put the codes (i dont use anywhere..) still pdf will work?

how can it if there isnt a [pdf] description tag in subs-post.php?
i couldnt get the point can you please clarify?
Home of Elmacik

Offline Joshua Dickerson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,775
  • Gender: Male
    • joshuaadickerson on GitHub
    • joshuaadickerson on LinkedIn
Re: See PDF in Posts
« Reply #14 on: September 04, 2005, 06:04:09 PM »
Looking at my copy of beta 3 / 4 ...
Code: [Select]
// [ftp=ftp://...]name[/ftp]
array(
'tag' => 'ftp',
'protocols' => array('ftp', 'ftps'),
'embeddedUrl' => true,
'hasEqualSign' => true,
),
// [flash]http://...[/flash]
array(
'tag' => 'flash',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
'hasExtra' => true,
),
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),
);

You should probably grab a new copy or maybe it is only for Beta 4.
Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: See PDF in Posts
« Reply #15 on: September 04, 2005, 06:06:04 PM »
you mean [pdf] [/pdf] tags are already included in beta 3? so why are the codes given when i asked for 1.1 beta 3 ???

your codes are beta 4 i think and public dont have it.
Home of Elmacik

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: See PDF in Posts
« Reply #16 on: September 04, 2005, 06:11:33 PM »
No.  As I said, you make the change to Subs.php, but not the change to Subs-Post.php.  That's all you need to do.  That is what I said.

-[Unknown]

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: See PDF in Posts
« Reply #17 on: September 04, 2005, 06:28:32 PM »
i made the change in subs.php and didnt touch subs.post.php
now it shows the exact words i typed. while posting, i write  [pdf]http://something/something.pdf[/pdf]

it shows what i type just like;  [pdf]http://something/something.pdf[/pdf]

if there is no need, why did you sent that codes for subs.post.php .. ? sorry for my dumbness but couldnt still understand.
Home of Elmacik

Offline ivo2296

  • Full Member
  • ***
  • Posts: 514
  • Gender: Male
  • SMF Bulgarian Translator
Re: See PDF in Posts
« Reply #18 on: May 12, 2006, 10:24:34 PM »
Would be if someone let me know how to make this work for smf 1.0.7 and 1.0.5.


Thanks!

Offline ivo2296

  • Full Member
  • ***
  • Posts: 514
  • Gender: Male
  • SMF Bulgarian Translator
Re: See PDF in Posts
« Reply #19 on: August 04, 2007, 12:12:18 PM »
Any chance for smf1.1.3 ?


Thanks!