public function setEncoding($encoding)
 {
     self::$encoding = $encoding;
 }
 public static function initVariables()
 {
     if (self::$_request) {
         self::$_rootUrl = self::$_request->getBaseUrl();
     }
     if (preg_match('{\\.php$}i', self::$_rootUrl)) {
         self::$_rootUrl = dirname(self::$_rootUrl);
     }
     Lms_Text::setEncoding('CP1251');
     Lms_Text::enableMultiByte();
     Lms_Api_Formatter_Ajax::setEncoding('CP1251');
     Lms_Api_Formatter_Json::setEncoding('CP1251');
     Lms_Thumbnail::setHttpClient(self::getHttpClient());
     Lms_Thumbnail::setThumbnailScript(self::getConfig('thumbnail', 'script'), self::getConfig('thumbnail', 'key'));
     Lms_Thumbnail::setImageDir(rtrim($_SERVER['DOCUMENT_ROOT'] . self::$_rootUrl, '/\\') . '/media/images');
     Lms_Thumbnail::setThumbnailDir(rtrim($_SERVER['DOCUMENT_ROOT'] . self::$_rootUrl, '/\\') . '/media/thumbnails');
     Lms_Thumbnail::setCache(self::getConfig('thumbnail', 'cache'));
 }