Support » Plugin: LaTeX for WordPress » [Plugin: LaTeX for WordPress] Deprecated use of snoopy class

  • use of snoopy class needs to be replaced with WP_Http as per http://wpquestions.com/question/show/id/1925

    This is the fixed section of latex.php:

    if ( !is_file($cache_formula_path) || filesize($cache_formula_path) < 10) {
    if( !class_exists( ‘WP_Http’ ) )
    include_once( ABSPATH . WPINC. ‘/class-http.php’ );

    $request = new WP_Http;

    $formula_text_html = str_replace(‘%C2%A0’, ‘%20’,
    rawurlencode(html_entity_decode(preg_replace(‘/\\\\label{.*?}/’, ”, $formula_text))));
    $result = $request->request(get_option(‘latex_img_server’).$formula_text_html);
    if (strlen($result[‘body’]) < 10)
    $result = $request->request(‘http://www.quantnet.com/cgi-bin/mathtex.cgi?’.rawurlencode(($formula_text)));
    $cache_file = fopen($cache_formula_path, ‘w’);
    fputs($cache_file, $result[‘body’]);

    http://wordpress.org/extend/plugins/latex/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Seems you removed a row:

    if (strlen($result['body']) < 10)
    $result = $request->request('http://www.quantnet.com/cgi-bin/mathtex.cgi?'.rawurlencode(($formula_text)));
    $cache_file = fopen($cache_formula_path, 'w');
    fputs($cache_file, $result['body']);

    The first row here, is that needed?

    It looks like the indenting gets lost when posted in the comments here.

    The original code has:

    $snoopy->fetch(get_option('latex_img_server').$formula_text_html);
                                    if (strlen($snoopy->results) < 10)
                                       $snoopy->fetch('http://www.quantnet.com/cgi-bin/mathtex.cgi?'.rawurlencode(($formula_text)));

    So the new code is intended to behave exactly the same as the original code.

    O… ic, I got the same problem while posting the above post. LOL
    Thanks for sharing!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: LaTeX for WordPress] Deprecated use of snoopy class’ is closed to new replies.