Okay, first off, I'm going to warn you, I don't know much at all about php, but I'm working on learning it as I work on customizing my forum, which uses the Simple Machines 2.0.2 software. So far I've had some success changing things, and some things I've wanted to do are just way too complicated for me.
The specific problem I'm having is with smiley codes. Let's say my smiley code is like this - :strokebeard: Now, if the code doesn't have a space after it, and touches the next word, it won't display the smiley. For example: 🆒bob Well, would you look at that, it works on this site. lol. And that's my point - it does on another forum I frequent too, I prefer it to be this way, but with simple machines, it won't work.
Now, I'm not looking for instructions on how to do this because I'm not expecting anyone to know Simple Machines' code. I was working with an admin at another website to help me with this - he's really good at this stuff and intuitively suggested I try removing something from the code without having even seen it. I did but it didn't work, and he asked me to echo and print something and tell him the output.
Here's the problem, I don't know how to do that. I assume I have to create a file with an echo code and a print code, and then open it up in a browser to see what it shows, but I don't know how to write it so that it can access the relevant information from Simple Machines' coding.
Any clues? If it helps, I can clarify what I'm trying to do. This is what we both think is the relevant code:
// This smiley regex makes sure it doesn't parse smileys within code tags (so [url=mailto:David@bla.com] doesn't parse the :D smiley)
$smileyPregReplacements = array();
$searchParts = array();
for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
{
$smileyCode = '<img src="' . htmlspecialchars($modSettings['smileys_url'] . '/' . $user_info['smiley_set'] . '/' . $smileysto[$i]) . '" alt="' . strtr(htmlspecialchars($smileysfrom[$i], ENT_QUOTES), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr(htmlspecialchars($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley" />';
$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
$smileyPregReplacements[htmlspecialchars($smileysfrom[$i], ENT_QUOTES)] = $smileyCode;
$searchParts[] = preg_quote($smileysfrom[$i], '~');
$searchParts[] = preg_quote(htmlspecialchars($smileysfrom[$i], ENT_QUOTES), '~');
}
$smileyPregSearch = '~(?<=[>:\?\.\s' . $non_breaking_space . '[\]()*\\\;]|^)(' . implode('|', $searchParts) . ')(?=[^[:alpha:]0-9]|$)~e' . ($context['utf8'] ? 'u' : '');
He asked me to echo $smileyPregSearch and print_r($smileyPregReplacements), and then tell him what the output is. I told him I wasn't sure how to do this and he told me he wasn't going to have time to explain all that, being really busy. I'd like to figure this out, though, and give him that output and see what happens. :o
Also, before I showed him the code, he initially suggested that I remove the \s before the $non_breaking_space. Didn't resolve the problem, in fact it made all emoticons not display.
Any help would be tremendously appreciated! 🆒