コード例 #1
0
ファイル: Template.php プロジェクト: kirkbauer2/kirkxc
 /**
  * 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;
 }
コード例 #2
0
ファイル: Template.php プロジェクト: kirkbauer2/kirkxc
 /**
  * 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);
 }