public function EventEsTheme() { if (!E::User() || !C::Get('plugin.estheme.use_client')) { return R::Action('error'); } $aProcessData = $this->PluginEstheme_Estheme_GetProcessData(); if (getRequest('submit_estheme')) { $sCSSDownloadPath = F::File_Dir2Url(C::Get('plugin.estheme.path_for_download') . E::UserId() . '/theme.custom.css'); $aCompiledData = $this->_processConfig($aProcessData, TRUE); $this->PluginEstheme_Estheme_CompileTheme($aCompiledData, TRUE); } else { $sCSSDownloadPath = FALSE; $this->_processConfig($aProcessData, FALSE); } E::ModuleViewer()->Assign('sCSSDownloadPath', $sCSSDownloadPath); }
public function Replace($sText) { foreach (Config::Get('plugin.smiles.smiles_array') as $img => $texts) { if (!is_array($texts)) { $texts = array($texts); } $img_url = F::File_Dir2Url(Config::Get('plugin.smiles.smiles_dir') . $img); foreach ($texts as $text) { $smiles_preg[] = '#(?<=\\s|^)(' . preg_quote($text, '/') . ')(?=\\s|$)#'; $smiles_masked = htmlspecialchars(trim($text), ENT_QUOTES); $smiles_text[] = ' <img src="' . $img_url . '" alt="' . $smiles_masked . '" title="' . $smiles_masked . '"/> '; } } $textarr = preg_split("/(<.*>)/U", $sText, -1, PREG_SPLIT_DELIM_CAPTURE); $sText = ''; for ($i = 0; $i < count($textarr); $i++) { $content = $textarr[$i]; if (strlen($content) > 0 && '<' != $content[0]) { $content = preg_replace($smiles_preg, $smiles_text, $content); } $sText .= $content; } return $sText; }
/** * Возвращает правильный web-адрес директории шаблонов * Если пользователь использует шаблон которого нет в плагине, то возвращает путь до шабона плагина 'default' * * @param string $sPluginName Название плагина или его класс * @param string $sCompatibility * * @return string */ public static function GetTemplateUrl($sPluginName, $sCompatibility = null) { $sPluginName = self::_pluginName($sPluginName); if (!isset(self::$aTemplateUrl[$sPluginName])) { if ($sTemplateDir = self::GetTemplateDir($sPluginName, $sCompatibility)) { self::$aTemplateUrl[$sPluginName] = F::File_Dir2Url($sTemplateDir); } else { self::$aTemplateUrl[$sPluginName] = null; } } return self::$aTemplateUrl[$sPluginName]; }
/** * Преобразует абсолютный путь к файлу в WEB-вариант * * @param string $sFile Серверный путь до файла * @return string */ protected function GetWebPath($sFile) { return F::File_Dir2Url($sFile); }
/** * Sets full dir path of resource * * @param $sFile */ public function SetFile($sFile) { if ($sFile) { if ($sPathDir = F::File_LocalDir($sFile)) { // Сохраняем относительный путь $this->SetPathFile('@' . $sPathDir); if (!$this->GetPathUrl()) { $this->SetUrl(F::File_Dir2Url($sFile)); } } else { // Сохраняем абсолютный путь $this->SetPathFile($sFile); } $this->SetLink(false); if (!$this->GetStorage()) { $this->SetStorage('file'); } } else { $this->SetPathFile(null); } $this->RecalcHash(); }
/** * Returns URL of preview if it exists * * @return string|null */ public function GetPreviewUrl() { $aScreen = $this->GetPreview(); if ($aScreen && isset($aScreen['file'])) { $sFile = ($this->getDir() ? $this->getDir() : Config::Get('path.skins.dir') . $this->GetId()) . '/settings/' . $aScreen['file']; $sUrl = F::File_Dir2Url($sFile); return $sUrl; } return null; }
/** * @param string $sFilePath * * @return string */ public function Dir2Url($sFilePath) { return F::File_Dir2Url($sFilePath); }