/** * Transforms text based on formatting preferences. Original $input is also changed (passed by reference). * Can be called as: * 1) $output = AC_print($input, $name); * echo $output; * * 2) echo AC_print($input, $name); // prefered method * * @access public * @param string $input text being transformed * @param string $name the unique name of this field (convension: table_name.field_name) * @param boolean $runtime_html forcefully disables html formatting for $input (only used by fields that * have the 'formatting' option * @return string transformed $input * @see AC_FORMAT constants in include/lib/constants.inc.php * @see query_bit() in include/vitals.inc.php * @author Joel Kronenberg */ function AC_print($input, $name, $runtime_html = true) { global $_field_formatting; if (!isset($_field_formatting[$name])) { /* field not set, check if there's a global setting */ $parts = explode('.', $name); /* check if wildcard is set: */ if (isset($_field_formatting[$parts[0] . '.*'])) { $name = $parts[0] . '.*'; } else { /* field not set, and there's no global setting */ /* same as AC_FORMAT_NONE */ return $input; } } if (query_bit($_field_formatting[$name], AC_FORMAT_QUOTES)) { $input = str_replace('"', '"', $input); } if (query_bit($_field_formatting[$name], AC_FORMAT_HTML) && $runtime_html) { /* what special things do we have to do if this is HTML ? remove unwanted HTML? validate? */ } else { $input = str_replace('<', '<', $input); $input = nl2br($input); } /* this has to be here, only because AC_FORMAT_HTML is the only check that has an else-block */ if ($_field_formatting[$name] === AC_FORMAT_NONE) { return $input; } if (query_bit($_field_formatting[$name], AC_FORMAT_EMOTICONS)) { $input = smile_replace($input); } if (query_bit($_field_formatting[$name], AC_FORMAT_ATCODES)) { $input = trim(myCodes(' ' . $input . ' ')); } if (query_bit($_field_formatting[$name], AC_FORMAT_LINKS)) { $input = trim(make_clickable(' ' . $input . ' ')); } if (query_bit($_field_formatting[$name], AC_FORMAT_IMAGES)) { $input = trim(image_replace(' ' . $input . ' ')); } return $input; }
/** * Transforms text based on formatting preferences. Original $input is also changed (passed by reference). * Can be called as: * 1) $output = AT_print($input, $name); * echo $output; * * 2) echo AT_print($input, $name); // prefered method * * @access public * @param string $input text being transformed * @param string $name the unique name of this field (convension: table_name.field_name) * @param boolean $runtime_html forcefully disables html formatting for $input (only used by fields that * have the 'formatting' option * @return string transformed $input * @see AT_FORMAT constants in include/lib/constants.inc.php * @see query_bit() in include/vitals.inc.php * @author Joel Kronenberg */ function AT_print($input, $name, $runtime_html = true) { global $_field_formatting, $_config; if (!isset($_field_formatting[$name])) { /* field not set, check if there's a global setting */ $parts = explode('.', $name); /* check if wildcard is set: */ if (isset($_field_formatting[$parts[0].'.*'])) { $name = $parts[0].'.*'; } else { /* field not set, and there's no global setting */ /* same as AT_FORMAT_NONE */ return $input; } } if (query_bit($_field_formatting[$name], AT_FORMAT_QUOTES)) { $input = str_replace('"', '"', $input); $input = str_replace('\'', ''', $input); } if (query_bit($_field_formatting[$name], AT_FORMAT_CONTENT_DIR)) { $input = str_replace('CONTENT_DIR/', '', $input); } if (query_bit($_field_formatting[$name], AT_FORMAT_HTML) && $runtime_html) { /* what special things do we have to do if this is HTML ? remove unwanted HTML? validate? */ } else { $input = str_replace('<', '<', $input); $input = nl2br($input); } if (isset($_config['latex_server']) && $_config['latex_server']) { $input = preg_replace('/\[tex\](.*?)\[\/tex\]/sie', "'<img src=\"'.\$_config['latex_server'].rawurlencode('$1').'\" align=\"middle\" alt=\"'.'$1'.'\" title=\"'.'$1'.'\">'", $input); } /* this has to be here, only because AT_FORMAT_HTML is the only check that has an else-block */ if ($_field_formatting[$name] === AT_FORMAT_NONE) { return $input; } if (query_bit($_field_formatting[$name], AT_FORMAT_EMOTICONS)) { $input = smile_replace($input); } if (query_bit($_field_formatting[$name], AT_FORMAT_ATCODES)) { $input = trim(myCodes(' ' . $input . ' ')); } if (query_bit($_field_formatting[$name], AT_FORMAT_LINKS)) { $input = trim(make_clickable(' ' . $input . ' ')); } if (query_bit($_field_formatting[$name], AT_FORMAT_IMAGES)) { $input = trim(image_replace(' ' . $input . ' ')); } return $input; }
echo _AT('emoticons'); ?> :</strong></small></td> <td><small><?php echo '<a href="javascript:smilie(\':)\')" title=":)">' . smile_replace(':)') . '</a> '; echo '<a href="javascript:smilie(\';)\')" title=";)">' . smile_replace(';)') . '</a> '; echo '<a href="javascript:smilie(\':(\')" title=":(">' . smile_replace(':(') . '</a> '; echo '<a href="javascript:smilie(\'::ohwell::\')" title=":\\">' . smile_replace('::ohwell::') . '</a> '; echo '<a href="javascript:smilie(\':P\')" title=":P">' . smile_replace(':P') . '</a> '; echo '<a href="javascript:smilie(\'::angry::\')" title="::angry::">' . smile_replace('::angry::') . '</a> '; echo '<a href="javascript:smilie(\'::evil::\')" title="::evil::">' . smile_replace('::evil::') . '</a> '; echo '<a href="javascript:smilie(\'::lol::\')" title="::lol::">' . smile_replace('::lol::') . '</a> '; echo '<a href="javascript:smilie(\'::confused::\')" title="::confused::">' . smile_replace('::confused::') . '</a> '; echo '<a href="javascript:smilie(\'::crazy::\')" title="::crazy::">' . smile_replace('::crazy::') . '</a> '; echo '<a href="javascript:smilie(\'::tired::\')" title="::tired::">' . smile_replace('::tired::') . '</a> '; echo '<a href="javascript:smilie(\'::muah::\')" title="::muah::">' . smile_replace('::muah::') . '</a>'; ?> </small></td> </tr>--> <tr> <td align="right"><small><strong><?php echo _AT('codes'); ?> :</strong></small></td> <td> <small><a href="javascript:smilie('[b] [/b]')" title="[b] [/b]"><?php echo _AT('bold'); ?> </a>, <a href="javascript:smilie('[i] [/i]')" title="[i] [/i]"><?php echo _AT('italic'); ?>