コード例 #1
0
ファイル: CssSpritesCreator.php プロジェクト: ilivanoff/www
 private function __construct(array $params)
 {
     ExternalPluginsManager::SpriteGenerator();
     $this->CssSpriteGen = new CssSpriteGen($params);
     $this->LOGGER = PsLogger::inst(__CLASS__);
     $this->PROFILER = PsProfiler::inst(__CLASS__);
 }
コード例 #2
0
 /**
  * Функция, выполняющая обработку php ошибок, выбрасываемых через trigger_error
  */
 public static function processError($errorLevel, $message, $file, $line)
 {
     if (!error_reporting()) {
         //Вывод ошибок для данного метода - @отключен
         return;
         //---
     }
     if (ExternalPluginsManager::isExternalFile($file)) {
         //Данный файл относится к файлам внешних плагинов
         //Возвращаем управление встроенному обработчику
         return false;
         //---
     }
     throw new PsErrorException($message, $errorLevel, $file, $line);
 }
コード例 #3
0
 /**
  * Метод, вызываемый извне.
  * Главная его задача - проследить за освобождением ресурсов, 
  * т.к. создаются тяжёлые объекты.
  */
 protected function doFinalize($pattern)
 {
     ExternalPluginsManager::SimpleHtmlDom();
     /* http://simplehtmldom.sourceforge.net/ */
     $html = str_get_html($pattern);
     try {
         $this->finaliseImpl($html);
     } catch (Exception $e) {
         if ($html) {
             $html->clear();
             unset($html);
         }
         throw $e;
     }
     if ($html) {
         $pattern = $html->save();
         $html->clear();
         unset($html);
     }
     return $pattern;
 }
コード例 #4
0
ファイル: PsGifEncoder.php プロジェクト: ilivanoff/www
 public function getAnimation()
 {
     if (isset($this->animation)) {
         return $this->animation;
     }
     check_condition($this->IMAGES, 'No images for gif');
     ExternalPluginsManager::GifEncored();
     $frames = array();
     $framed = array();
     foreach ($this->IMAGES as $path => $delay) {
         ob_start();
         SimpleImage::inst()->load($path)->output(IMAGETYPE_GIF)->close();
         $frames[] = ob_get_contents();
         $framed[] = $delay;
         // Delay in the animation.
         ob_end_clean();
     }
     // Generate the animated gif and output to screen.
     $gif = new GIFEncoder($frames, $framed, 0, 2, 0, 0, 0, 'bin');
     $this->animation = $gif->GetAnimation();
     return $this->animation;
 }
コード例 #5
0
ファイル: PsCensure.php プロジェクト: ilivanoff/www
 public static function parse($string)
 {
     ExternalPluginsManager::Censure();
     return $string ? Text_Censure::parse($string, '2', "…", false) : false;
 }
コード例 #6
0
ファイル: Lite.php プロジェクト: ilivanoff/www
 /**
  * Trigger a PEAR error
  *
  * To improve performances, the PEAR.php file is included dynamically.
  * The file is so included only when an error is triggered. So, in most
  * cases, the file isn't included and perfs are much better.
  *
  * @param string $msg error message
  * @param int $code error code
  * @access public
  */
 function raiseError($msg, $code)
 {
     //include_once('PEAR.php');
     ExternalPluginsManager::Pear();
     return PEAR::raiseError($msg, $code, $this->_pearErrorMode);
 }
コード例 #7
0
ファイル: PSCache.php プロジェクト: ilivanoff/www
 protected function __construct()
 {
     $this->CACHE = new SimpleDataCache();
     $this->LOGGER = PsLogger::inst(__CLASS__);
     /**
      * Подключаем cache lite
      */
     ExternalPluginsManager::CacheLite();
     $liteOptions = array('readControl' => true, 'writeControl' => true, 'readControlType' => 'md5', 'automaticSerialization' => true, 'cacheDir' => DirManager::autogen('cache')->absDirPath(), 'lifeTime' => CACHE_LITE_LIFE_TIME * 60, 'caching' => true);
     $this->CACHELITE = new Cache_Lite($liteOptions);
     $GROUPS = self::getCacheGroups();
     $TREE[self::CHILD_FOLDING] = Mappings::CACHE_FOLDINGS()->getAllMappedEntitys($GROUPS);
     $TREE[self::CHILD_DBENTITY] = Mappings::CACHE_DBENTITYS()->getAllMappedEntitys($GROUPS);
     $this->TREE = new PSCacheTree($this->LOGGER, $TREE);
 }
コード例 #8
0
ファイル: PsMailSender.php プロジェクト: ilivanoff/www
<?php

ExternalPluginsManager::PhpMailer();
/**
 * Базовый класс для отправки почты
 *
 * @author azazello
 */
final class PsMailSender extends PHPMailer
{
    /** @var PsMailSender */
    private static $inst;
    /**
     * В конструкторе выполним все необходимые подготовки.
     * Доступ public как в PHPMailer.
     */
    public function __construct()
    {
        check_condition(!self::$inst, 'Экземпляр ' . __CLASS__ . ' должен быть единственным');
        $this->exceptions = true;
        $this->CharSet = 'UTF-8';
        $this->SetLanguage('ru');
        $this->IsSMTP();
        $this->SMTPKeepAlive = true;
        //Need SmtpClose in __destruct()
        $this->SMTPAuth = true;
        // Enable SMTP authentication
        $this->Host = SMTP_HOST;
        // Specify main and backup server
        $this->Sender = SMTP_USERNAME;
        $this->Username = SMTP_USERNAME;
コード例 #9
0
ファイル: PsMathEvaluator.php プロジェクト: ilivanoff/www
 protected function __construct()
 {
     ExternalPluginsManager::MathEvaluator();
     $this->EVALUATOR = new EvalMath();
     $this->EVALUATOR->suppress_errors = false;
 }
コード例 #10
0
ファイル: PSSmarty.php プロジェクト: ilivanoff/www
 protected function __construct()
 {
     ExternalPluginsManager::Smarty();
     /**
      * Начиная с версии 5.4 в функции htmlentities параметр encoding был изменён на UTF-8, 
      * до этого момента после применения данного метода к тексту шаблона мы будем получать кракозябру.
      */
     SmartyCompilerException::$escape = is_phpver_is_or_greater(5, 4);
     $this->smarty = new Smarty();
     $this->smarty->compile_check = true;
     $this->smarty->force_compile = false;
     //        $this->smarty->caching = TRUE;
     $SMARTY_BASE_PATH = DirManager::smarty()->absDirPath();
     /*
      * УПРАВЛЯЮЩИЕ ДИРЕКТОРИИ
      */
     $this->smarty->setTemplateDir($SMARTY_BASE_PATH . '/templates/');
     $this->smarty->setCompileDir($SMARTY_BASE_PATH . '/templates_c/');
     $this->smarty->setCacheDir($SMARTY_BASE_PATH . '/cache/');
     $this->smarty->setConfigDir($SMARTY_BASE_PATH . '/configs/');
     /*
      * ПЛАГИНЫ
      */
     //1. Функции
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/functions/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/functions/content/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/functions/mmedia/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/functions/gym/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/functions/replacements/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/functions/discussion/comments/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/functions/discussion/feedback/';
     //2. Модификаторы
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/modifiers/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/modifiers/content/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/modifiers/discussion/comments/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/modifiers/discussion/feedback/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/modifiers/rubric/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/modifiers/post/';
     //3. Блочные функции
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/blocks/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/blocks/content/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/blocks/text/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/blocks/child/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/blocks/post/';
     /*
      * ADMIN
      */
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/functions/admin/';
     $plugins_dir[] = $SMARTY_BASE_PATH . '/plugins/modifiers/admin/';
     $this->smarty->addPluginsDir($plugins_dir);
     /*
      * Импортируем константы некоторых классов, чтобы на них можно было ссылаться через 
      * {$smarty.const.CONST_NAME}
      */
     PsConstJs::defineAllConsts();
     /*
      * Подключим фильтры
      */
     new SmartyFilters($this->smarty);
     /*
      * Зарегистрируем наши функции
      */
     /* @var $plugin AbstractSmartyPlugin */
     foreach (Classes::getDirClasses(__DIR__, 'plugins/impl', 'AbstractSmartyPlugin') as $plugin) {
         $plugin->registerPlugins($this->smarty);
     }
 }