tag so that March 25, 2019 changes due to the needs of PHP_7.2, aditional parameters 'style' and 'id', 'border' could be used for backward compatibility but should not in new installation, use 'style' instead. rearangement of the evaluation of the parameters */ SDV($DefaultWidth, '600'); // pixels SDV($DefaultHeight,'400'); // pixels SDV($DefaultAlign, 'left'); // left, right, middle, top, bottom SDV($DefaultScroll,'auto'); // auto, yes, no SDV($DefaultStyle, 'border:3px outset #aaa; '); function includeSite($m) { # [modified for PHP5.5 and younger] global $DefaultWidth, $DefaultHeight, $DefaultAlign, $DefaultScroll; global $DefaultStyle, $UrlExcludeChars; // no longer a $DefaultBorder // $m -> an array with the matches // $m[0] -> the whole match /between '(:includeSite' and ':)' // $m[1] -> subgroup 1 : the url // $m[2] -> subgroup 2 : the parameters // valid values for scroling and align $scroll_vals = ['no','yes', 'auto']; $align_vals = ['left', 'right', 'middle', 'top' ,'bottom']; // parse the parameters $pattern = '/(id|align|width|height|scroll|style|border)=((\\d+)|(["\'])(.*?)\4)/'; $results = preg_match_all($pattern,$m[2],$match,PREG_SET_ORDER); foreach ($match as $part) { switch (substr($part[0],0,2)) { case 'id': # id $id = $part[5]; break; case 'wi': # width $width = $part[3]; break; case 'he': # height $height = $part[3]; break; case 'sc': # scroll $scroll = $part[5]; if (!in_array($scroll,$scroll_vals)) { $scroll = 'auto'; } break; case 'st': # style $style = $part[5]; break; case 'bo': # border $border = $part[3]; $replace_me = "border: ".$border."$2"; $style = preg_replace("/.*?(\\d+)(px .*)/", $replace_me, $DefaultStyle); break; case 'al': $align = $part[5]; if (!in_array($align,$align_vals)){ $align = "left"; } break; } } // Set defaults for parameters not specified SDV($width, $DefaultWidth); SDV($height, $DefaultHeight); SDV($align, $DefaultAlign); SDV($scroll, $DefaultScroll); SDV($style, $DefaultStyle); $Output .= "\n\n\n\n"; if ($id=="") { $Output .= "
"; # [modified for PHP5.5 and younger] }else{ $Output .= "
"; # [modified for PHP5.5 and younger] } $Output .= "\n\n\n\n"; return $Output; } // end of function includeSite($m) #### fit for PHP5.5 and higher (even PHP7.x) $iSpattern = "/\\(:includeSite\\s+(https?:[^$UrlExcludeChars]*?)\\s+(.*):\\)/"; Markup('includeSite', 'directives', $iSpattern, "includeSite");