public function EventExec() { $sFile = ''; $sSourceFile = implode('/', $this->GetParams()); $sSourceFile = str_replace('[skin]', HelperPlugin::GetTemplatePath(), $sSourceFile); $sSourceFile = str_replace('[admin_skin]', HelperPlugin::GetPluginPath('aceadminpanel') . '/templates/skin/' . $this->Admin_GetAdminSkin(), $sSourceFile); if (isset($_SERVER['QUERY_STRING']) and $_SERVER['QUERY_STRING']) { $sSourceFile .= '?' . $_SERVER['QUERY_STRING']; } $sCachePath = Config::Get('path.smarty.cache') . '/' . $this->Admin_GetAdminSkin(); $aFileParts = ACE::PathInfo($sSourceFile); if (strtolower($aFileParts['extension']) == 'css' and getRequest('from', '', 'get') == 'less') { $sSourceFile = $aFileParts['dirname'] . '/' . $aFileParts['filename'] . '.less'; $sFileType = 'less'; } elseif (strtolower($aFileParts['extension']) == 'less') { $sFileType = 'less'; } else { $sFileType = 'other'; } if ($sFileType == 'less') { $sCachePath .= '/css/'; if (!is_dir($sCachePath)) { ACE::MakeDir($sCachePath); } $aLessParams = array('file' => $sSourceFile, 'config' => array('formatter' => 'compressed'), 'variables' => array('gridColumns' => 16, 'gridColumnWidth' => '65px', 'gridGutterWidth' => '12px', 'baseFontSize' => '12px', 'baseLineHeight' => '18px')); // определяем целевой CSS-файл $sFile = ACE::FilePath($sCachePath . '/' . md5(serialize($aLessParams)) . '.css'); // если целевого файла нет - компилируем его из исходного LESS-файла if (!is_file($sFile)) { $oLess = $this->PluginAceadminpanel_Aceless_GetLessCompiler(); $oLess->setVariables($aLessParams['variables'], true); $oLess->setFormatter('compressed'); $oLess->checkedCompile($sSourceFile, $sFile); $this->aFiles[] = array('source' => $sSourceFile, 'target' => $sFile); } $sContentType = 'text/css'; } else { $sCachePath .= '/' . basename($aFileParts['dirname']) . '/'; if (!is_dir($sCachePath)) { ACE::MakeDir($sCachePath); } $sFile = $sCachePath . $aFileParts['basename']; copy($sSourceFile, $sFile); $sContentType = 'image/' . strtolower($aFileParts['extension']); } if ($sFile and is_file($sFile)) { $sCssContent = file_get_contents($sFile); header('Content-type: ' . $sContentType); echo $sCssContent; } /* */ exit; }
/** * Инициализация плагина */ public function Init() { HelperPlugin::InitPlugin($this); $sDataFile = $this->PluginAceAdminPanel_Admin_GetCustomConfigFile(); if (!file_exists($sDataFile)) { $aConfigSet = $this->PluginAceAdminPanel_Admin_GetValueArrayByPrefix('config.all.'); @file_put_contents($sDataFile, serialize($aConfigSet)); } // поддержка именования старых классов if (defined('OLD_CLASS_LOADER') && OLD_CLASS_LOADER) { HelperPlugin::AutoLoadRegister(array($this, 'AutoLoaderOldClass')); } }
protected function SetTemplateAction($sTemplate) { $sResultTemplate = HelperPlugin::GetDelegate('template', $sTemplate . '.tpl', true); if ($sResultTemplate and is_file($sResultTemplate)) { return parent::SetTemplate($sResultTemplate); } else { parent::SetTemplateAction(HelperPlugin::GetDelegate('template', $sTemplate)); } /* parent::SetTemplateAction($sTemplate); $this->SetTemplate($this->sActionTemplate); */ }
/** * Инициализация плагина * * @return void */ public function Init() { if (version_compare(LS_VERSION, '0.5', '<')) { HelperPlugin::InitPlugin($this); } else { HelperPluginLoader::getInstance()->Init(); } $sDataFile = $this->PluginAceadminpanel_Admin_GetCustomConfigFile(); if (!file_exists($sDataFile)) { $aConfigSet = $this->PluginAceadminpanel_Admin_GetValueArrayByPrefix('config.all.'); @file_put_contents($sDataFile, serialize($aConfigSet)); } $this->LoadPluginsConfig(); }
protected function SetTemplateInclude($sTemplate) { list($sPlugin, $sAction) = explode('_', get_class($this), 2); $sPath = HelperPlugin::GetPluginPath() . '/templates/skin/'; if (is_dir($sPath . Config::Get('view.skin'))) { $sPath .= Config::Get('view.skin'); } elseif (is_dir($sPath . 'admin_default')) { $sPath .= 'admin_default'; } elseif (is_dir($sPath . 'default')) { $sPath .= 'default'; } else { $sPath = ''; } if ($sPath) { $sTemplate = $sPath . '/actions/ActionAdmin/' . $sTemplate . '.tpl'; } else { $sTemplate = Plugin::GetTemplatePath($this->sPluginAddon) . 'actions/' . $sAction . '/' . $sTemplate . '.tpl'; } $sTemplate = ACE::LocalPath($sTemplate, ACE::GetPluginsDir()); //var_dump($s);exit; $this->Viewer_Assign('include_tpl', $sTemplate); }
public function Init() { $this->oMapper = HelperPlugin::GetMapper(); }
public function HtmlHeadEnd() { $sTpl = HelperPlugin::GetPluginSkinPath($this->sPlugin) . 'hook.html_head_end.tpl'; return $this->Viewer_Fetch($sTpl); }
public function PluginConfigSave($sPlugin = null) { if (!$this->sPluginAddon) { $this->sPluginAddon = HelperPlugin::GetPluginName($this, true); } if (!$sPlugin) { $sPlugin = $this->sPluginAddon; } $sFile = admFilePath(Config::Get('sys.cache.dir') . 'adm.' . $sPlugin . '.cfg'); if (@file_put_contents($sFile, serialize(Config::Get('plugin.' . $sPlugin)))) { $this->Message('notice', $this->Lang_Get('adm_saved_ok')); } else { $this->Message('error', $this->Lang_Get('adm_saved_err')); } }
/** * Преобразование класса в путь к файлу плагина * * @param array|string $xClass - либо имя класса (строка), либо описание класса (массив) * @return string */ protected function ClassToPath($xClass) { if (is_array($xClass)) { $aClassElements = $xClass; } else { $aClassElements = HelperPlugin::ClassNameExplode($xClass); } $sFilePath = Config::Get('path.root.server'); if (isset($aClassElements['Plugin'])) { // класс внутри плагина if (is_string($xClass) and false !== strpos($aClassElements['Plugin'], '_') or sizeof($aClassElements) > 1) { $sFilePath .= '/plugins/' . strtolower($aClassElements['Plugin']); } else { $sFilePath .= '/plugins/Plugin' . ucfirst(strtolower($aClassElements['Plugin'])) . '.class.php'; } } if (isset($aClassElements['Action'])) { $sFilePath .= '/classes/actions/Action' . $aClassElements['Action'] . '.class.php'; } elseif (isset($aClassElements['Block'])) { $sFilePath .= '/classes/blocks/Block' . $aClassElements['Block'] . '.class.php'; } elseif (isset($aClassElements['Hook'])) { $sFilePath .= '/classes/hooks/Hook' . $aClassElements['Hook'] . '.class.php'; } elseif (isset($aClassElements['Module'])) { $sFilePath .= '/classes/modules/' . strtolower($aClassElements['Module']); if (isset($aClassElements['Mapper'])) { $sFilePath .= '/mapper/' . $aClassElements['Mapper'] . '.mapper.class.php'; } elseif (isset($aClassElements['Entity'])) { $sFilePath .= '/entity/' . $aClassElements['Entity'] . '.entity.class.php'; } else { $sFilePath .= '/' . ucfirst($aClassElements['Module']) . '.class.php'; } } elseif (isset($aClassElements['Mapper'])) { if (!isset($aClassElements['Plugin'])) { $sFilePath .= '/classes/modules/' . strtolower($aClassElements['Mapper']) . '/mapper/' . ucfirst(strtolower($aClassElements['Mapper'])) . '.mapper.class.php'; } } if (DIRECTORY_SEPARATOR != '/') { $sFilePath = str_replace(DIRECTORY_SEPARATOR, '/', $sFilePath); } return $sFilePath; }
public function EventShutdown() { $this->Viewer_AddHtmlTitle($this->Lang_Get('adm_title') . ' v.' . $this->PluginAceadminpanel_Admin_getVersion()); $this->Viewer_Assign('sMenuHeadItemSelect', $this->sMenuHeadItemSelect); $this->Viewer_Assign('sMenuItemSelect', $this->sMenuItemSelect); $this->Viewer_Assign('sMenuSubItemSelect', $this->sMenuSubItemSelect); $this->Viewer_Assign('sMenuNavItemSelect', $this->sMenuNavItemSelect); $this->Viewer_Assign('aModConfig', $this->aConfig); $this->Viewer_Assign('DIR_PLUGIN_SKIN', Plugin::GetTemplatePath($this->sPlugin)); $sWebPluginSkin = admPath2Url(Plugin::GetTemplatePath($this->sPlugin)); $this->Viewer_Assign('sWebPluginPath', Config::Get('path.root.web') . '/plugins/' . $this->sPlugin); $this->Viewer_Assign('sWebPluginSkin', $sWebPluginSkin); if (Config::Get('plugin.avalogs.admin_enable') && $this->oLogs && $this->aLogsMsg) { $str = ''; foreach ($this->aLogsMsg as $key => $val) { if ($key) { $str .= str_repeat(' ', 20); } $str .= $val; if ($key < sizeof($this->aLogsMsg) - 1) { $str .= "\n"; } } $this->oLogs->Out('admin', $str); } foreach ($this->aBlocks as $sGroup => $aGroupBlocks) { $this->Viewer_AddBlocks($sGroup, $aGroupBlocks); } if ($this->aConfig['check_password'] && !$this->PluginAceadminpanel_Admin_IsPasswordQuality($this->oUserCurrent)) { $this->Message_AddError($this->Lang_Get('adm_password_quality')); } $this->MakeMenu(); $this->Viewer_Assign('sTemplatePath', HelperPlugin::GetTemplatePath()); $this->Viewer_Assign('sTemplatePathAction', HelperPlugin::GetTemplateActionPath()); $this->Viewer_Assign('aPluginInfo', $this->aPluginInfo); $this->Viewer_Assign('sPageRef', $this->sPageRef); $this->Viewer_Assign('LS_VERSION', LS_VERSION); $this->Hook_AddExecFunction('template_body_begin', array($this, '_CssUrls')); }
public function IsNeedUpgrade() { return floatVal($this->sVersionDB) < floatVal(HelperPlugin::GetConfig('version')); }
protected function _checkAdminAddon($sAddon) { $sAddonId = strtolower($sAddon); if (isset($this->aAddons[$sAddonId])) { return $sAddonId; } if ($this->bAddonsAutoCheck) { $sFile = HelperPlugin::GetPluginPath() . '/classes/actions/ActionAdmin' . $sAddon . '.class.php'; if (file_exists($sFile)) { $sTemplate = HelperPlugin::GetTemplatePath('admin_' . admStrUnderScore($sAddon) . '.tpl'); $this->aAddons[$sAddonId] = array('file' => $sFile, 'class' => 'PluginAceadminpanel_Admin' . $sAddon, 'template' => file_exists($sTemplate) ? $sTemplate : ''); return $sAddonId; } } return false; }
static function AutoLoadRegister($xFunc) { return HelperPlugin::AutoLoadRegister($xFunc); }
protected function ClassNameExplode($sClassName) { if (preg_match('/^Plugin(\\w+)_(\\w+)Entity_(\\w+)/', $sClassName, $match)) { $aClassElements['Plugin'] = $match[1]; $aClassElements['Module'] = $match[2]; $aClassElements['Entity'] = $match[3]; } else { $aClassElements = HelperPlugin::ClassNameExplode($sClassName); } return $aClassElements; }
public function EventShutdown() { parent::EventShutdown(); $this->Viewer_Assign('sMenuHeadItemSelect', $this->sMenuHeadItemSelect); $this->Viewer_Assign('sMenuItemSelect', $this->sMenuItemSelect); $this->Viewer_Assign('sMenuSubItemSelect', $this->sMenuSubItemSelect); $this->Viewer_Assign('sMenuNavItemSelect', $this->sMenuNavItemSelect); $this->Viewer_Assign('aModConfig', $this->aConfig); $this->Viewer_Assign('DIR_PLUGIN_SKIN', Plugin::GetTemplatePath($this->sPlugin)); //$sWebPluginSkin=ACE::Path2Url(Plugin::GetTemplatePath($this->sPlugin)); $sWebPluginSkin = Config::Get('path.admin.skin') . '/'; $this->Viewer_Assign('sWebPluginPath', Config::Get('path.root.web') . '/plugins/' . $this->sPlugin); $this->Viewer_Assign('sWebPluginSkin', $sWebPluginSkin); $this->Viewer_Assign('sTemplatePath', HelperPlugin::GetTemplatePath()); $this->Viewer_Assign('sTemplatePathAction', HelperPlugin::GetTemplateActionPath()); $this->Viewer_Assign('aPluginInfo', $this->aPluginInfo); $this->Viewer_Assign('sPageRef', $this->sPageRef); $this->Viewer_Assign('sFormAction', $this->sFormAction); $this->Viewer_Assign('LS_VERSION', LS_VERSION); //$this->Hook_AddExecFunction('template_body_begin', array($this, '_CssUrls')); }
public function Display($sTemplate) { // ajax-запросы нас не интересуют ? if (!$this->sResponseAjax) { if ($sTemplate) { $sTemplate = ACE::FilePath($this->Plugin_GetDelegate('template', $sTemplate), '/'); if (!$this->TemplateExists($sTemplate)) { if (dirname($sTemplate) == '.') { if (strpos($sClass = Router::GetActionClass(), 'Plugin') === 0) { $sTemplate = HelperPlugin::GetPluginSkinPath($sClass) . 'actions/Action' . ucfirst(Router::GetAction()) . '/' . $sTemplate; } } $sTemplate = $this->_getRealTeplate($sTemplate); } $sPathRoot = ACE::FilePath(Config::Get('path.root.server'), '/'); if ($this->bAddPluginDirs and strpos($sTemplate, $sPathRoot) === 0 and is_file($sTemplate)) { // добавляем пути к шаблонам $sPath = dirname($sTemplate); if ($sPath and $sPath != '.') { $this->AddTemplateDir($sPath, true); if (basename(dirname($sPath)) == 'actions') { $this->AddTemplateDir(dirname(dirname($sPath)), true); } } } } } $this->_initTplHooks(); return parent::Display($sTemplate); }
/** * Инициализация плагина * * @return void */ public function Init() { if (preg_match('/^([\\d\\.]+)([^\\d\\.].*)$/', ACEADMINPANEL_VERSION, $m)) { $sVersion = $m[1] . '.' . ACEADMINPANEL_VERSION_BUILD . $m[2]; } else { $sVersion = ACEADMINPANEL_VERSION . '.' . ACEADMINPANEL_VERSION_BUILD; } Config::Set('plugin.aceadminpanel.version', $sVersion); //HelperPlugin::InitPlugin($this); HelperPlugin::AutoLoadRegister(array($this, 'Autoloader')); $sDataFile = $this->PluginAceadminpanel_Admin_GetCustomConfigFile(); if (!file_exists($sDataFile)) { $aConfigSet = $this->PluginAceadminpanel_Admin_GetValueArrayByPrefix('config.all.'); @file_put_contents($sDataFile, serialize($aConfigSet)); } $this->_loadPluginsConfig(); $this->_ActionAdminInerits(); }
public function Init() { $this->Viewer_Assign('tpl_include', HelperPlugin::GetTemplateActionPath('plugins_list.tpl')); }