Ejemplo n.º 1
0
 /**
  * Function return true if html in $content is supported by Block Editor
  *
  * @param string $content
  * @return boolean
  */
 public static function isContentForBlockEditor($content)
 {
     return \Bitrix\Fileman\Block\Editor::isContentSupported($content);
 }
Ejemplo n.º 2
0
 /**
  * @param string $templateName
  * @return array|null
  */
 public static function getById($templateName)
 {
     $result = null;
     $localPathOfIcon = static::LOCAL_DIR_IMG . bx_basename($templateName) . '.png';
     $fullPathOfIcon = \Bitrix\Main\Loader::getLocal($localPathOfIcon);
     $fullPathOfFile = \Bitrix\Main\Loader::getLocal(static::LOCAL_DIR_TMPL . bx_basename($templateName) . '.php');
     if ($fullPathOfFile) {
         $fileContent = File::getFileContents($fullPathOfFile);
     } else {
         $fileContent = '';
     }
     if (!empty($fileContent) || $templateName == 'empty') {
         \Bitrix\Main\Loader::includeModule('fileman');
         if (\Bitrix\Fileman\Block\Editor::isContentSupported($fileContent)) {
             $fileContent = static::replaceTemplateByDefaultData($fileContent);
         }
         $fileContent = str_replace(array('%TEXT_UNSUB_TEXT%', '%TEXT_UNSUB_LINK%'), array(Loc::getMessage('PRESET_MAILBLOCK_unsub_TEXT_UNSUB_TEXT'), Loc::getMessage('PRESET_MAILBLOCK_unsub_TEXT_UNSUB_LINK')), $fileContent);
         $result = array('TYPE' => 'BASE', 'ID' => $templateName, 'NAME' => Loc::getMessage('PRESET_TEMPLATE_' . $templateName), 'ICON' => !empty($fullPathOfIcon) ? '/bitrix' . $localPathOfIcon : '', 'HTML' => $fileContent);
     }
     return $result;
 }