News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Function [code=

Started by Jean Prado, December 27, 2009, 09:50:39 PM

Previous topic - Next topic

Jean Prado

Hey guys, know the funcion [code=] What after of the '=' you can also assign a name to the code, thus:
Code (name) Select
name
I want you to help me find this function, and, what makes it work ..
8)


JBlaze

./Sources/Subs.php

Located in the parse_bbc() function.
Jason Clemons
Former Team Member 2009 - 2012

Jean Prado

Which line?
Subs.php attached,


JBlaze

I don't have a text editor handy (I'm on vacation and I don't have my computer with me) so I can't look at the file.

Just look under the parse_bbc() function and look for the 'code' = array() in the array. There are two instances so just look for them.
Jason Clemons
Former Team Member 2009 - 2012

Jean Prado

array(
'tag' => 'code',
'type' => 'unparsed_content',
'content' => '$1',
// !!! Maybe this can be simplified?
'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
global $context, $txt, $settings;

if (!isset($disabled[\'code\']))
{
$php_parts = preg_split(\'~(<\?php|\?>)~\', $data, -1, PREG_SPLIT_DELIM_CAPTURE);

for ($php_i = 0, $php_n = count($php_parts); $php_i < $php_n; $php_i++)
{
// Do PHP code coloring?
if ($php_parts[$php_i] != \'&lt;?php\')
continue;

$php_string = \'\';
while ($php_i + 1 < count($php_parts) && $php_parts[$php_i] != \'?&gt;\')
{
$php_string .= $php_parts[$php_i];
$php_parts[$php_i++] = \'\';
}
$php_parts[$php_i] = highlight_php_code($php_string . $php_parts[$php_i]);
}

// Fix the PHP code stuff...
$data = str_replace("<pre style=\"display: inline;\">\t</pre>", "\t", implode(\'\', $php_parts));

// select all and copy code to clipboard mod
static $codecounter = 0;
$codecounter++;
$data = \'<div class="codeheader">\' . $txt[\'smf238\'] . \': \'
.\'<a href="javascript:void(0)" title="\'.$txt[\'codeselectall\'].\'" onclick="javascript:selectall(\\\'code_a\'.$codecounter.\'\\\');return false;">\'.$txt[\'codeselectall\'].\'</a>\'
.\' \'.$txt[\'codedivider\'].\' <a href="javascript:void(0)" title="\'.$txt[\'codecopytoclipboard\'].\'" onclick="javascript:copy(\\\'code_a\'.$codecounter.\'\\\');return false;">\'.$txt[\'codecopytoclipboard\'].\'</a>\'
.\'</div><div class="code" id="code_a\'.$codecounter.\'">\' . ($context[\'browser\'][\'is_gecko\'] ? \'<pre style="margin-top: 0; display: inline;">\'.$data.\'</pre>\' : $data) . \'</div>\';
// end of select all and copy to clipboard mod

// Older browsers are annoying, aren\'t they?
if ($context[\'browser\'][\'is_ie4\'] || $context[\'browser\'][\'is_ie5\'] || $context[\'browser\'][\'is_ie5.5\'])
$data = str_replace("\t", "<pre style=\"display: inline;\">\t</pre>", $data);
elseif (!$context[\'browser\'][\'is_gecko\'])
$data = str_replace("\t", "<span style=\"white-space: pre;\">\t</span>", $data);
}'),


where?


Jean Prado



H

We're all volunteers. Please wait 24 before bumping your posts!
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Arantor

What exactly do you want to know? As ever, tell us what you're trying to do.

Basically, type unparsed_equals_content (the second code block) covers it.

Jean Prado

I want to configure my spoiler equal to the code, and which is entered after the '=' can put the name quser, because my spoiler does not have it.


Arantor

So, [spoiler=something]content[/spoiler]

What happens to the 'something'?

Jean Prado

Nooooooooooo , My spoiler don't have this function, i want to add , how i add?


Arantor

That's what I mean.

So, again, what is supposed to happen to the 'something' when you use that code?

Jean Prado

Not appear .
It is [spoiler=something] as if it don't have the BBC CODE .


Arantor

*sigh*

So if a user puts that code in, what is supposed to happen to the 'something'? What is it supposed to do?

Or should [spoiler=something] be the same as [spoiler] ?

Jean Prado

I want to put a function of '=something', because only the [spoiler] works!


Arantor

Right.... AND WHAT SHOULD IT DO IF YOU ADD IT?

Yahmez


Arantor

While I appreciate there may be a language barrier, having to ask the same question multiple times doesn't make me want to help much.

JBlaze

Let me try...

OK, so you want to make a spoiler mod, and you want to know how to code it. First, we need to know what kind of effect it will have on the content inside of the [spoiler] tags. What does it do? How does it work to display the content?

These are the things we need to know in order to help you.
Jason Clemons
Former Team Member 2009 - 2012

Jean Prado

I want to run the [spoiler =] my forum, if I put [spoiler = something] does not work [/ spoiler], only with normal spoiler [spoiler] work [/ spoiler]!
Quote from: JBlaze on December 28, 2009, 09:01:34 PM
Let me try...

OK, so you want to make a spoiler mod, and you want to know how to code it. First, we need to know what kind of effect it will have on the content inside of the [spoiler] tags. What does it do? How does it work to display the content?

These are the things we need to know in order to help you.
The spoiler is a spoiler normal, except that the [spoiler = something] does not work if I put this, it is only the tag, has no effect, only work if I just put [spoiler]


Advertisement: