from strings
// Modified in v4.5.1 to not check tags but |
// Modified in v4.5.5 to work with | and not only with |
function sts_strip_unwanted_tags($tmpstr, $commentlabel) {
// Now lets remove the | | that the require puts in front of the tableBox
$tablestart = strpos($tmpstr, " | \n$tmpstr\n\n";
}
$tmpstr = substr($tmpstr, strpos ($tmpstr,">",$tablestart)+1); // strip off stuff before (and including | , v4.5.5
// Now lets remove the | at the end of the tableBox output
// strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
$tmpstr = strrev($tmpstr);
$tableend = strpos($tmpstr, strrev(""), 1);
$tmpstr = substr($tmpstr, $tableend+5); // strip off stuff after
// Now let's un-reverse it
$tmpstr = strrev($tmpstr);
// print " After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[". htmlspecialchars($tmpstr) . "] \n";
return "\n\n$tmpstr\n\n";
}
// STRIP_CONTENT_TAGS() - Remove text before "body_text" and after "body_text_eof"
function sts_strip_content_tags($tmpstr, $commentlabel) {
/*
// Now lets remove the | that the require puts in front of the tableBox
$tablestart = strpos($tmpstr, " tag before the tag, keep it
if ($formstart !== false and $formstart < $tablestart) {
$tablestart = $formstart;
$formfirst = true;
}
// If empty, return nothing
if ($tablestart < 1) {
return "\n\n$tmpstr\n\n";
}
$tmpstr = substr($tmpstr, $tablestart); // strip off stuff before
// Now lets remove the at the end of the tableBox output
// strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
$tmpstr = strrev($tmpstr);
if ($formfirst == true) {
$tableend = strpos($tmpstr, strrev(""), 1);
} else {
$tableend = strpos($tmpstr, strrev(" "), 1);
}
$tmpstr = substr($tmpstr, $tableend); // strip off stuff after
// Now let's un-reverse it
$tmpstr = strrev($tmpstr);
*/
// print " After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[". htmlspecialchars($tmpstr) . "] \n";
return "\n\n$tmpstr\n\n";
}
function sts_read_template_file ($template_file){
// Open Template file and read into a variable
if (! file_exists($template_file)) {
print 'Template file does not exist: ['.$template_file.']';
return '';
}
ob_start(); // Start capture to buffer
require $template_file; // Includes the template, this way php code can be used in templates
$template_html = ob_get_contents(); // Get content of buffer
ob_end_clean(); // Clear out the capture buffer
return $template_html;
}
function get_javascript($tmpstr, $commentlabel) {
// Now lets remove the | that the require puts in front of the tableBox
$tablestart = strpos($tmpstr, ""), 1);
$tmpstr = substr($tmpstr, $tableend); // strip off stuff after |
// Now let's un-reverse it
$tmpstr = strrev($tmpstr);
// print " After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[". htmlspecialchars($tmpstr) . "] \n";
return "\n\n$tmpstr\n\n";
}
// Return the value between $startstr and $endstr in $tmpstr
function str_between($tmpstr, $startstr, $endstr) {
$startpos = strpos($tmpstr, $startstr);
// If empty, return nothing
if ($startpos === false) {
return "";
}
$tmpstr = substr($tmpstr, $startpos + strlen($startstr)); // strip off stuff before $start
// Now lets remove the at the end of the tableBox output
// strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
$tmpstr = strrev($tmpstr);
$endpos = strpos($tmpstr, strrev($endstr), 1);
$tmpstr = substr($tmpstr, $endpos + strlen($endstr)); // strip off stuff after
// Now let's un-reverse it
$tmpstr = strrev($tmpstr);
return $tmpstr;
}
function sortbykeylength($a,$b) {
$alen = strlen($a);
$blen = strlen($b);
if ($alen == $blen) $r = 0;
if ($alen < $blen) $r = 1;
if ($alen > $blen) $r = -1;
return $r;
}
?> |