/**
  * Loads template engine
  *
  * @return bool|Fenom
  */
 public function getFenom()
 {
     if (!$this->fenom) {
         try {
             if (!class_exists('Fenom')) {
                 require dirname(dirname(__FILE__)) . '/fenom/Fenom.php';
                 Fenom::registerAutoload();
             }
             $cache = MODX_CORE_PATH . 'cache/';
             if (!file_exists($cache)) {
                 mkdir($cache);
             }
             $this->fenom = Fenom::factory($cache, $cache);
             if (!$this->modx->getOption('pdotools_fenom_php', null, false)) {
                 $this->fenom->removeAccessor('php');
             }
             if ($options = $this->modx->getOption('pdotools_fenom_options')) {
                 if (is_numeric($options) || ($options = $this->modx->fromJSON($options))) {
                     $this->fenom->setOptions($options);
                 }
             }
             // Add line function for lexicons
             $this->fenom->addFunction('lexicon', function (array $params) {
                 global $modx;
                 $pdo = $modx->getService('pdoTools');
                 return $pdo->fenomFunction('lexicon', $params);
             });
             // Add line function for making urls
             $this->fenom->addFunction('url', function (array $params) {
                 global $modx;
                 $pdo = $modx->getService('pdoTools');
                 return $pdo->fenomFunction('url', $params);
             });
         } catch (Exception $e) {
             $this->modx->log(xPDO::LOG_LEVEL_ERROR, $e->getMessage());
             return false;
         }
     }
     return $this->fenom;
 }