Example #1
0
 public function registerBlock($content, $__FUNCTION__)
 {
     $contextParams = null;
     if ($content === null) {
         $this->setContext(PSSmartyTools::getFunctionName($__FUNCTION__));
         $this->LOGGER->info('{' . $this->getContextIdent() . '}');
     } else {
         $this->LOGGER->info('{/' . $this->getContextIdent() . '}');
         $contextParams = $this->getParams();
         $this->dropContext();
     }
     return $contextParams;
 }
Example #2
0
 /**
  * Основной метод, вызываемый для регистрации плагинов, предоставляемых данным классом для выполнения смарти-функций
  */
 public final function registerPlugins(Smarty $smarty)
 {
     $this->LOGGER->info('Регистрируем плагины класса [{}]', $this->CLASS);
     foreach ($this->getPlugins() as $tagName => $pluginType) {
         PSSmartyTools::checkFunctionType($pluginType);
         if (array_key_exists($pluginType, $smarty->registered_plugins) && array_key_exists($tagName, $smarty->registered_plugins[$pluginType])) {
             $this->LOGGER->info('Не зарeгистрирован плагин [{}]', 'smarty_' . $pluginType . '_' . $tagName);
         } else {
             $smarty->registerPlugin($pluginType, $tagName, array($this, 'do_' . $pluginType . '_' . $tagName));
             $this->LOGGER->info('Зарeгистрирован плагин [{}]', 'smarty_' . $pluginType . '_' . $tagName);
         }
     }
 }
 /**
  * Методы, позволяющие зарегистрировать плагины.
  * 
  * @param string $tagName - название тега для вызова
  * @param string $pluginType - тип плагина
  */
 protected final function register($tagName, $pluginType)
 {
     check_condition(is_array($this->PLUGINS), 'Регистрация функций Smarty допускается только в методе #registerPluginsImpl');
     $this->PLUGINS[PsCheck::notEmptyString($tagName)] = PSSmartyTools::checkFunctionType($pluginType);
 }