コード例 #1
0
 private static function getCacheDir()
 {
     $dir = sfConfig::get('app_rt_math_cache_dir', '/uploads/_math_cache');
     if (!is_dir(sfConfig::get('sf_web_dir') . $dir)) {
         rtAssetToolkit::makeDir(sfConfig::get('sf_web_dir') . $dir);
     }
     return sfConfig::get('sf_web_dir') . $dir;
 }
コード例 #2
0
 /**
  * Return a string, after replacing Latex math sections with n image equivelant.
  *
  * @param   string  $text
  * @return  string
  */
 public static function transform($text)
 {
     if (trim($text) === '') {
         return $text;
     }
     // relative from the sf_web_root
     $dir = sfConfig::get('app_rt_math_cache_dir', '/uploads/_math_cache');
     $size = sfConfig::get('app_rt_math_mathpublisher_size', 14);
     if (!is_dir(sfConfig::get('sf_web_dir') . $dir)) {
         rtAssetToolkit::makeDir(sfConfig::get('sf_web_dir') . $dir);
     }
     $dir = $dir . '/';
     try {
         $text = mathfilter($text, $size, $dir);
     } catch (Exception $e) {
         // eat the exception
     }
     return $text;
 }