/** * Constructor * FIXME - we must found anoither way... now it is antipattern Public Morozov * * @return void */ public function __construct() { parent::__construct(); }
/** * Remove entity * * @param \XLite\Model\AEntity $entity Entity * * @return boolean */ protected function removeEntity(\XLite\Model\AEntity $entity) { $pathSkin = 'theme_tweaker/default'; $localPath = $entity->getTemplate(); $shortPath = substr($localPath, strpos($localPath, LC_DS, strlen($pathSkin . LC_DS)) + strlen(LC_DS)); $fullPath = $this->getFullPathByShortPath($shortPath); \Includes\Utils\FileManager::deleteFile($fullPath); \XLite\Core\FlexyCompiler::getInstance()->remove($fullPath); parent::removeEntity($entity); return true; }
/** * Constructor * * @return void */ protected function __construct() { parent::__construct(); $this->checkTemplateStatus = $this->checkTemplateStatus || \XLite\Core\Config::getInstance()->XC->ThemeTweaker->edit_mode; }
/** * Populate model object properties by the passed data * * @param array $data Data to set * * @return void */ protected function setModelProperties(array $data) { $body = $data['body']; unset($data['body']); $data['date'] = LC_START_TIME; $localPath = ''; if (\XLite\Core\Request::getInstance()->template) { $localPath = \XLite\Core\Request::getInstance()->template; } elseif ($this->getModelObject()->getId()) { $localPath = $this->getModelObjectValue('template'); } if ($localPath) { $fullPath = $this->getFullPathByLocalPath($localPath, 'theme_tweaker/default'); \Includes\Utils\FileManager::write($fullPath, $body); $data['template'] = substr($fullPath, strlen(LC_DIR_SKINS)); \XLite\Core\FlexyCompiler::getInstance()->remove($fullPath); } parent::setModelProperties($data); }