News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Glossary

Started by slinouille, December 24, 2008, 10:33:47 AM

Previous topic - Next topic

Kindred

It should work just fine ... even with the original code that I replaced, it still worked fine, it just generated an error in the logs
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Harvester

Quote from: Kindred on March 07, 2017, 06:33:08 PM
It should work just fine ... even with the original code that I replaced, it still worked fine, it just generated an error in the logs

Mine seems to work fine but the words I have entered in the glossary do not show tooltips when they are present in a post. I'd like that to work. Perhaps I will check the rest of the files with the other parser. Maybe I am missing more code.

Kindred

or maybe another mod that you have conflicts with the javascript....   

When I used AEVA, I could not also use the embed glossary words/popup feature
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Harvester

Quote from: Kindred on March 08, 2017, 07:30:32 AM
or maybe another mod that you have conflicts with the javascript....   

When I used AEVA, I could not also use the embed glossary words/popup feature

I once had Aeva installed but I uninstalled that a week or so ago.

I checked all the code and im not missing anything in all the files.. Im gonna give it a shot on a clean install of SMF and see what happens.

petb

Got the same problem with the depricated  'e' in that preg_replace usage.

But without that modifier the code produces confusing chars bevor the real word in the topic is shown.
Any other suggestions about that warning error which is produced on every topic view, when the mod is active?

Kindred

Quote from: Kindred on March 06, 2017, 06:29:24 PM
Code (find in Subs.php) Select

      $message = preg_replace(
        '/((<a.+\/a>)|(\b'. preg_quote(strtr($word, array('\'' => '&#039;')), '/'). '(?=[^A-Za-z0-9&agrave;-??-??-?_\-s]))|(\b'.preg_quote(strtr($word, array('\'' => '&#039;')), '/').'\b))/'. (!empty($modSettings['glossary_none_sensitive']) ? 'i' : '') .'e' ,
        "'\$2' == '\$1' ? stripslashes('\$1') : '<span class=\"glossary\" title=\"".addslashes($definition)."\">$1</span>'",
        $message,
        (isset($modSettings['glossary_unique_word']) && $modSettings['glossary_unique_word']==1) ? 1 : -1
      );



Code (replace with (Thanks to Arantor)) Select

$message = preg_replace_callback(
'/((<a.+\/a>)|(\b'. preg_quote(strtr($word, array('\'' => '&#039;')), '/'). '(?=[^A-Za-z0-9&agrave;-??-??-?_\-s]))|(\b'.preg_quote(strtr($word, array('\'' => '&#039;')), '/').'\b))/'. (!empty($modSettings['glossary_none_sensitive']) ? 'i' : ''),
function ($matches) use ($definition) {
return $matches[2] == $matches[1] ? stripslashes($matches[1]) : '<span class="glossary" title="' . addslashes($definition) . '">' . $matches[1] . '</span>';
},
$message,
(isset($modSettings['glossary_unique_word']) && $modSettings['glossary_unique_word']==1) ? 1 : -1
);

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

petb

I apologize, i am sorry.
I thought you only stripped the  e   but you changed the function   to the .._callback.

Thanks for the repeated reference.

It is working.

shadav

#527
Following this post
https://www.simplemachines.org/community/index.php?topic=282158.msg3485881#msg3485881
and this post
https://www.simplemachines.org/community/index.php?topic=282158.msg3917465#msg3917465
and the tips from Aranator about the database...
QuoteAs to the install issues, this is because the installer predates 2.0 RC2 or RC3 where the DB code changed. The tables will likely exist but not have the smf_ prefix in which case you just need to rename the tables.
====
Go into the tables in phpMyAdmin and go to the Operations tab where you can rename them.
I was able to get this seemingly to work on 2.0.15, we shall see :D
a few more alterations though....
before you install it (You can do all the edits that were mentioned above to the files and the install.xml but you will also need to fix in the install.xml
find
<search position="before"><![CDATA['quote' => array('code' => 'quote', 'before' => '[quote]', 'after' => '[/quote]', 'description' => $txt['bbc_quote']),]]></search>
<add><![CDATA[
'glossary' => array('code' => 'glossary', 'before' => '[glossary]', 'after' => '[/glossary]', 'description' => $txt['bbc_glossary']),]]></add>
</operation>

replace with
<operation>
<search position="before"><![CDATA[
array(
'image' => 'quote',
'code' => 'quote',
'before' => '[quote]',
'after' => '[/quote]',
'description' => $txt['bbc_quote']
),]]></search>
<add><![CDATA[
array(
'image' => 'glossary',
'code' => 'glossary',
'before' => '[glossary]',
'after' => '[/glossary]',
'description' => $txt['bbc_glossary']
),]]></add>
</operation>

[edit again] Ignore all of that what is quoted, you do not need it, please skip that part of SDMiller's fix completely and ignore what I said to fix of their fix ;) the above mentioned fix takes care of that and is already in the install.xml (I think for SDMiller, it was just because they installed ignoring the warnings, please don't do that :D ) so just forget everything below :D and do the above except for that one part
and then you will need to fix one thing that SDMiller posted in their fix [edit]just skip it, don't even do it[/edit]
they had said
Quote from: SDMiller on February 07, 2013, 02:27:11 PM
FIND in $sourcedir/Subs-Editor.php:

array(),
array(
'image' => 'list',
'code' => 'list',
'before' => '[list]\n[li]',
'after' => '[/li]\n[li][/li]\n[/list]',
'description' => $txt['list_unordered']

Add this before it:

array(
'image' => 'glossary',
'code' => 'glossary',
'before' => '[glossary]',
'after' => '[/glossary]',
'description' => $txt['bbc_glossary']
),
[edit]removing my "fix" to the above fix, as it is not needed[/edit]
[edit] just skip the above part, don't do it ;) it's not needed[/edit]

hope it helps (hope it works, so far seems to be working after doing all the above, but haven't fully tested it)


[edit] just noticed, I don't need to add it both times do I? (after the quote and after the list....it only needs to be added once, correct....) [edit again]nope, it's not needed as it's in the install file already :) it just needed fixed[/edit] ok I think i'm done editing my edited edits now  :laugh:

shadav

#528
so i installed this onto a new project, 2.0.17, following my post above....
it installed fine, added the db prefixes....
the problem is, when I click on Add a new key word or Administration the page just reload, the box will pop up to add a word but then the page loads and it's gone...the administration's dropdown box will appear and the page reloads.....

any thoughts on how to fix this?
if i can't add or edit words, kind of makes the mod useless  :o


[edit]ok after reading through 16 pages, it's a conflict with pretty urls....anyone have a fix?
tested and it works if i disable pretty urls, so I mean meh ok, i'll just have to remember to turn it off, add/edit glossary and turn it back on. hehehehe

Jotade29

@Kindred

Followed the steps posted at: https://www.simplemachines.org/community/index.php?topic=282158.msg3485881#msg3485881
but the mod is still not working, and as far as I know, there are people who work for them in version 2.0.19. I have made the modifications indicated in the above message, and I have changed the name of the tables, but I get an error when I go to see a message ...

Call to undefined function parse_glossary ()
I have the mod activated, I have the words activated in the glossary, the tooltip activated ... I don't know what to do. Thanks.
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

Kindred

I dunno...  it's working for me on 2.0.19

I was in the process of trying to convert to hooks and update for php 7.4/8 but real life took over and I haven't gotten around to finishing
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Jotade29

@Kindred the glossary appears to me perfectly, but when I see any message, it does not allow me to enter the post. If I uncheck the box -> Enable tooltip glossary in the messages "It lets me enter the post, but if I use the BBC it also throws me an error that it cannot find a certain function. Clean installation, that is, I have version 2.0.19 and just the glossary mod installed following the above message.

Ohh, it would be great if you could adapt it, do you think it will be next year? :)
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

Kindred

Ah, yeah...  I think I may have turned off the tooltip...

Not sure about the missing function, I don't recall if I've seen that.  Are you sure it all got installed?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: