Advertisement:

Author Topic: Ohara YouTube Embed  (Read 199207 times)

Offline Maniaka

  • Newbie
  • *
  • Posts: 7
Re: Ohara YouTube Embed
« Reply #100 on: February 20, 2013, 07:10:37 AM »
Hello you need add tag for:

https://www....

Offline phantomm

  • Sophist Member
  • *****
  • Posts: 1,064
  • Gender: Male
    • pages/smfpl/171860759503032 on Facebook
    • Polish ElkArte community
Re: Ohara YouTube Embed
« Reply #101 on: February 20, 2013, 07:24:13 AM »
@up,
Open Sources/OharaYTEmbed.php  and find:

Code: [Select]
(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

There are 2 instances of this string, make the change to both.

and replace with this:

Code: [Select]
((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

Back up the file first before doing the change as I haven't tested this change.
Polskie wsparcie SMF na simplemachines.org

My mods

Offline akc42

  • Jr. Member
  • **
  • Posts: 128
  • Gender: Male
    • Melinda's Backups
Re: Ohara YouTube Embed
« Reply #102 on: February 23, 2013, 04:45:19 AM »
The mod doesn't modify Subs.php at all, the mod sues it's own file: OharaYTEmbed.php

Make sure the following code is presented on that file:

Code: [Select]
/* The bbc button */
function OYTE_bbc_add_button($buttons)
{
global $txt, $modSettings;

loadLanguage('OharaYTEmbed');

if (empty($modSettings['OYTE_master']))
return;

$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
}

If there is, try to change this:

function OYTE_bbc_add_button($buttons)

with this:

function OYTE_bbc_add_button(&$buttons)

I've just run over this bug having just today downloaded the latest release of this this mod. Is there a reason you haven't released a new version with this problem fixed?

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #103 on: February 23, 2013, 08:58:21 AM »
Yes, there is, multiple reasons actually.

- There are other bugs that needs to be fixed too.
- Lack of time to properly build a regex pattern that will be able to cover most if not all of the new and valid youtube urls.
- Lack of interest on keep working on SMF mods.

The mod is open source so anyone can update the mod at will, anyone can redistribute modified version of this mod providing they comply with the license.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline johnpaul2k2

  • Sr. Member
  • ****
  • Posts: 738
  • Gender: Male
  • Okija amaka
    • Mgbenka
Re: Ohara YouTube Embed
« Reply #104 on: March 05, 2013, 11:31:17 AM »
i had an issue with my post.php . and since then , it stop working

even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???

Offline akc42

  • Jr. Member
  • **
  • Posts: 128
  • Gender: Male
    • Melinda's Backups
Re: Ohara YouTube Embed
« Reply #105 on: March 05, 2013, 12:06:58 PM »
i had an issue with my post.php . and since then , it stop working

even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???

Can you be more specific.  What issue with post.php and what do you mean by stop working?

If that is the only mod installed, why not un-install it and then refresh post.php from the SMF distribution you used.


Offline johnpaul2k2

  • Sr. Member
  • ****
  • Posts: 738
  • Gender: Male
  • Okija amaka
    • Mgbenka
Re: Ohara YouTube Embed
« Reply #106 on: March 05, 2013, 12:24:17 PM »
i had an issue with my post.php . and since then , it stop working

even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???

Can you be more specific.  What issue with post.php and what do you mean by stop working?

If that is the only mod installed, why not un-install it and then refresh post.php from the SMF distribution you used.



i had issues with my post.php, so i removed it and added fresh post.php.
i have found out that some of my mod that got to do with post are no longer working. i removed and reinstall all of them including this Mod . but this seems not to respond.

i embedded a youtube video yet it's not working while the previous videos (before the issue came up) are all working but new one refuses to work!

Offline akc42

  • Jr. Member
  • **
  • Posts: 128
  • Gender: Male
    • Melinda's Backups
Re: Ohara YouTube Embed
« Reply #107 on: March 05, 2013, 12:47:56 PM »
i had an issue with my post.php . and since then , it stop working

even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???

Can you be more specific.  What issue with post.php and what do you mean by stop working?

If that is the only mod installed, why not un-install it and then refresh post.php from the SMF distribution you used.



i had issues with my post.php, so i removed it and added fresh post.php.
i have found out that some of my mod that got to do with post are no longer working. i removed and reinstall all of them including this Mod . but this seems not to respond.

i embedded a youtube video yet it's not working while the previous videos (before the issue came up) are all working but new one refuses to work!

You keep saying things like "has issues" or "not working" without being more specific.  When you say these words add some more detail.

When you are editing a post do you see the youtube button?

When you have [youtube]some youtube url[/youtube] in your post what is the url you use (soo we can see it) and what happens. (do you see the youtube markers or do they disappear)

Did you make these changes

Quote
If there is, try to change this:

function OYTE_bbc_add_button($buttons)

with this:

function OYTE_bbc_add_button(&$buttons)

or this one

Open Sources/OharaYTEmbed.php  and find:

Code: [Select]
(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

There are 2 instances of this string, make the change to both.

and replace with this:

Code: [Select]
((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

Back up the file first before doing the change as I haven't tested this change.

Much much more detail, else we have nothing to go on to help you.

Offline johnpaul2k2

  • Sr. Member
  • ****
  • Posts: 738
  • Gender: Male
  • Okija amaka
    • Mgbenka
Re: Ohara YouTube Embed
« Reply #108 on: March 05, 2013, 01:23:24 PM »
not working

this is what i meant.  i mistakenly remove some files inside post.php and i was unable to create New Topic or Reply

i was told to remove and replace the existing post.php with FRESH post.php

i guess that's why the youtube is not working again

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #109 on: March 05, 2013, 08:46:34 PM »
You never NEVER replace a file with a new fresh copy, NEVER!

What you did not only didn't solve your first issue but it has created a lot more, whoever told you to upload a fresh file just doesn't know what are doing and I will strongly suggest not to follow their advices anymore.

Follow the mod's parser and make sure you have all the proper edits on your Post.php file: http://custom.simplemachines.org/mods/index.php?action=parse;mod=3268;attach=193586;smf_version=2.0.2
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline johnpaul2k2

  • Sr. Member
  • ****
  • Posts: 738
  • Gender: Male
  • Okija amaka
    • Mgbenka
Re: Ohara YouTube Embed
« Reply #110 on: March 06, 2013, 12:45:04 AM »
did as the link said but didn't work

i uninstalled and installed it back and it's working now :D

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #111 on: March 06, 2013, 08:02:52 AM »
It didn't work possibly because you blindly deleted other files this mod needed.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline johnpaul2k2

  • Sr. Member
  • ****
  • Posts: 738
  • Gender: Male
  • Okija amaka
    • Mgbenka
Re: Ohara YouTube Embed
« Reply #112 on: March 23, 2013, 01:09:22 PM »
sometimes, this mod will stop working

except you uninstall and install back?

why?

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #113 on: March 23, 2013, 03:36:16 PM »
When you stop playing and modifying your files then the mod will cease "stop working". As simple as that.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline johnpaul2k2

  • Sr. Member
  • ****
  • Posts: 738
  • Gender: Male
  • Okija amaka
    • Mgbenka
Re: Ohara YouTube Embed
« Reply #114 on: March 23, 2013, 06:13:12 PM »
When you stop playing and modifying your files then the mod will cease "stop working" ;D. As simple as that.


i haven't touch any part of my file since 3 weeks now. so i do not know the problem

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #115 on: March 24, 2013, 09:18:01 AM »
Care to explain more details then?  simply stating "doesn't work" or "stop working" is not really helpful.

Since you said the only thing that fixes it is reinstalling, I gotta say is not really a bug but its you messing around with your files, removing or changing things this mod needs, if that is the case, simply stopping doing it will solve your problem.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline pwhodges

  • Newbie
  • *
  • Posts: 7
Re: Ohara YouTube Embed
« Reply #116 on: March 31, 2013, 09:55:04 AM »
Since no working version of this that accepts http:// has been published, and lots of people have trouble with the button not showing (this happened to my forum recently), I thought I'd publish the corrections I have made for my own use.  To make the corrections you need to take the file OharaYTEmbed.php out of the zip file, edit in the changes, and then put it back in the zip file, replacing the original.

I have these changes running on my forum, and the code below is cut and pasted from my installed files; but obviously you make the changes at your own risk as I can't control your editing.

(1) To accept https URLs, and those with the "v=" parameter not the first:

Change both copies of the regex (in the routines OYTE_bbc_add_code and OYTE_Main) to:

Code: [Select]
'(https?://(?:www\.)?youtu(?:be\.com/watch\?(?:[\w\?=]*&(?:amp;)?)*v=|\.be/)(\w*)(?:&(?:amp;)?[\w\?=]*)*)'
Note that the regex to accept "https://" posted earlier by the author in this thread does not work; this is because the extra parentheses around the "http|https" options change the numbering of the strings collected by the regex, and this is not corrected for.

(2) To ensure that the YouTube BBC button is displayed in the editor:

This fault is because the mod uses a method of adding the button which is no longer supported in the final version of the 2.0 code; the change here uses the supported method instead (the button array is found from the context instead of being passed as a parameter). 

Change the routine OYTE_bbc_add_button to read as follows:

Code: [Select]
function OYTE_bbc_add_button($dummy)
{
global $txt, $modSettings, $context;

loadLanguage('OharaYTEmbed');

if (empty($modSettings['OYTE_master']))
return;

$context['bbc_tags'][count($context['bbc_tags']) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
}

I haven't tried the author's simpler suggestion of adding an & in front of the routine parameter in the original code; I had already found my correction, which works, and so have stuck with it.

I have not yet fixed the fact that smileys are not rendered following each odd-numbered video in a post, nor that quick editing of posts with no content other than the youtube tags and content fails; if I do, I will add the fixes here.

« Last Edit: March 31, 2013, 05:50:29 PM by pwhodges »

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #117 on: April 02, 2013, 10:06:42 AM »
Oh, you edited your message and deleted the part where you said I won't provide more support to this.

Question is, why do I need to offer support? am I forced to do so? why do I want to keep working on a mod if I got nothing in return except complains?

People here only complains about this mod not working properly but not a single person has giving me a thank you for it, yes, this is a very small mod, however, this applies for all my modifications, people just remember you when the mod stops working or it doesn't do what you expect it to do. This whole ingratitude has pretty much driving me away.

As for your solutions.

1.- Will fail with recent and valid youtube urls.
2.- Is valid but is only valid because how SMF works by using globals vars indiscriminately. And the & thing is not solely a bug with this mod, it affects all mods that works with hooks, it has to do with passing by reference: http://www.simplemachines.org/community/index.php?topic=477624.msg3341560#msg3341560  oh and it has nothing to do with been "no longer supported on 2.0 final"  that is simple nonsense, hooks have been in SMF code as earlier as 1.1 version and the most widely used hooks are here since early RC versions of 2.0

So, yes, I no longer want to keep working on this or any other mod for that matter, it doesn't matter how much time I spent working on mods, I got nothing in return except complains.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline pwhodges

  • Newbie
  • *
  • Posts: 7
Re: Ohara YouTube Embed
« Reply #118 on: April 03, 2013, 01:52:30 PM »
I think you for providing this mod in the first place; it is entirely up to you whether you wish to support it - in your place, I would not wish to see a faulty mod going out under my name, but whatever.  I removed my earlier comment about support because, although I'd put the link to your blog, I thought it ungracious of me to point it out, and that people could find it or not as they pleased; I apologise for highlighting it for a time.

I wanted https support, and your suggestion didn't work, so I worked out why and added it my way instead, which did.  The other regex changes I made increased the number of URLs accepted, but (as I found out today) still miss some (and the original regex would have missed the same ones as well).

The missing button; yes, your solution is better - why not put it in the download so that people don't need to think you got it wrong?  My solution (and explanation) came from another thread, and fixed the problem for me - now I know it's inappropriate I will no longer do it that way.  Thanks for the correction.  (What I don't understand is why the original, without the &, ever worked at all - which it assuredly did; this is why I rather naively accepted the story about the change of supported method.)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,821
    • StoryBB/StoryBB on GitHub
Re: Ohara YouTube Embed
« Reply #119 on: April 03, 2013, 01:58:21 PM »
Quote
that is simple nonsense, hooks have been in SMF code as earlier as 1.1 version and the most widely used hooks are here since early RC versions of 2.0

Hate to contradict you but that's not entirely accurate.

The hook system in 1.1 and all the way up to 2.0 RC3 could only support one function call per hook. There are a few extra hooks in 2.0 for things like the menu, the bbc handling and so on, but these were introduced in 2.0 RC4 along with the other hook changes like multiple functions per hook.

Quote
I haven't tried the author's simpler suggestion of adding an & in front of the routine parameter in the original code; I had already found my correction, which works, and so have stuck with it

Putting the & in front of the variable inside the function declaration is the correct way to handle such things.

Quote
What I don't understand is why the original, without the &, ever worked at all

Because PHP 5.2 allowed it, PHP 5.3 deprecated it, PHP 5.4 doesn't support it at all. When this mod was originally developed, PHP 5.4 was not exactly what you would call widespread.

Quote
So, yes, I no longer want to keep working on this or any other mod for that matter, it doesn't matter how much time I spent working on mods, I got nothing in return except complains.

This is why I stopped writing mods for SMF, I fully sympathise. It seems like no good deed goes unpunished.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.