latex_src

The Jetpack by WordPress.com latex src function.

Description

latex_src( $matches ); 

Parameters (1)

0. $matches
The matches.

Usage

  1. if ( !function_exists( 'latex_src' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/latex.php'; 
  3.  
  4. // The matches. 
  5. $matches = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = latex_src($matches); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/latex.php  
  1. function latex_src( $matches ) { 
  2. $latex = $matches[1]; 
  3.  
  4. $bg = latex_get_default_color( 'bg' ); 
  5. $fg = latex_get_default_color( 'text', '000' ); 
  6. $s = 0; 
  7.  
  8.  
  9. $latex = latex_entity_decode( $latex ); 
  10. if ( preg_match( '/.+(&fg=[0-9a-f]{6}).*/i', $latex, $fg_matches ) ) { 
  11. $fg = substr( $fg_matches[1], 4 ); 
  12. $latex = str_replace( $fg_matches[1], '', $latex ); 
  13. if ( preg_match( '/.+(&bg=[0-9a-f]{6}).*/i', $latex, $bg_matches ) ) { 
  14. $bg = substr( $bg_matches[1], 4 ); 
  15. $latex = str_replace( $bg_matches[1], '', $latex ); 
  16. if ( preg_match( '/.+(&s=[0-9-]{1, 2}).*/i', $latex, $s_matches ) ) { 
  17. $s = (int) substr( $s_matches[1], 3 ); 
  18. $latex = str_replace( $s_matches[1], '', $latex ); 
  19.  
  20. return latex_render( $latex, $fg, $bg, $s );