includes/functions.php
changeset 906 c949e82b8f49
parent 898 c75754f5b1da
child 909 94c1ff984286
equal deleted inserted replaced
905:1e40b33f2e3e 906:c949e82b8f49
  2150     $byte = '(&\\#([0]*){0,7}' . $ch1 . ';|\\\\([0]*){0,7}' . $ch1 . ';|\\\\([0]*){0,7}' . $ch2 . ';|&\\#x([0]*){0,7}' . $ch2 . ';|%([0]*){0,7}' . $ch2 . '|' . preg_quote($chr) . ')';
  2150     $byte = '(&\\#([0]*){0,7}' . $ch1 . ';|\\\\([0]*){0,7}' . $ch1 . ';|\\\\([0]*){0,7}' . $ch2 . ';|&\\#x([0]*){0,7}' . $ch2 . ';|%([0]*){0,7}' . $ch2 . '|' . preg_quote($chr) . ')';
  2151     $ret .= $byte;
  2151     $ret .= $byte;
  2152     $ret .= '([\s]){0,2}';
  2152     $ret .= '([\s]){0,2}';
  2153   }
  2153   }
  2154   return $ret;
  2154   return $ret;
       
  2155 }
       
  2156 
       
  2157 /**
       
  2158  * Generate HTML for a sprite image.
       
  2159  * @param string Path to sprite image
       
  2160  * @param int Width of resulting image
       
  2161  * @param int Height of resulting image
       
  2162  * @param int X offset
       
  2163  * @param int Y offset
       
  2164  * @return object HTMLImageElement
       
  2165  */
       
  2166 
       
  2167 function gen_sprite($path, $width, $height, $xpos, $ypos)
       
  2168 {
       
  2169   $html = '<img src="' . scriptPath . '/images/spacer.gif" width="' . $width . '" height="' . $height . '" ';
       
  2170   $xpos = ( $xpos == 0 ) ? '0' : '-' . strval($xpos);
       
  2171   $ypos = ( $ypos == 0 ) ? '0' : '-' . strval($ypos);
       
  2172   $html .= 'style="background-image: url(' . $path . '); background-repeat: no-repeat; background-position: ' . $ypos . 'px ' . $xpos . 'px;"';
       
  2173   $html .= ' />';
       
  2174   
       
  2175   return $html;
  2155 }
  2176 }
  2156 
  2177 
  2157 /**
  2178 /**
  2158  * Portal function allowing spam-filtering plugins.
  2179  * Portal function allowing spam-filtering plugins.
  2159  * Hooking guide:
  2180  * Hooking guide: