Ejemplo n.º 1
0
 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;
 }
 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);
 }
Ejemplo n.º 3
0
 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;
 }
 protected function _PluginLoadLangFile($sFile)
 {
     $sFile = HelperPlugin::GetPluginPath() . '/templates/language/' . $sFile . '.php';
     $this->Lang_LoadFile($sFile);
 }
Ejemplo n.º 5
0
 protected function InitParams()
 {
     $this->aConfig = array('reserverd_urls' => array('admin'), 'votes_per_page' => 15, 'items_per_page' => 15, 'vote_value' => 10, 'edit_footer_text' => '<div style="border-top:1px solid #CCC;color:#F99;text-align:right;font-size:0.9em;">Edited by admin at [@date]</div>', 'path_themes' => Config::Get('path.root.server') . '/templates/skin', 'path_languages' => Config::Get('path.root.server') . '/templates/language', 'check_password' => 1);
     $sReserverdUrls = $this->PluginAceAdminPanel_Admin_GetValue('param_reserved_urls');
     if ($sReserverdUrls) {
         $this->aConfig['reserverd_urls'] = array_unique(array_merge($this->aConfig['reserverd_urls'], explode(',', $sReserverdUrls)));
     }
     $this->aConfig['items_per_page'] = $this->PluginAceAdminPanel_Admin_GetValue('param_items_per_page', $this->aConfig['items_per_page']);
     $this->aConfig['votes_per_page'] = $this->PluginAceAdminPanel_Admin_GetValue('param_votes_per_page', $this->aConfig['votes_per_page']);
     $this->aConfig['edit_footer_text'] = $this->PluginAceAdminPanel_Admin_GetValue('param_edit_footer', $this->aConfig['edit_footer_text']);
     $this->aConfig['vote_value'] = $this->PluginAceAdminPanel_Admin_GetValue('param_vote_value', $this->aConfig['vote_value']);
     //$this->bParamSiteClosed=defined('adm_SITE_CLOSED')?ADMIN_SITE_CLOSED:false;
     //$this->sParamSiteClosedPage=$this->Admin_GetValue('param_site_closed_page', $this->sParamSiteClosedPage);
     //$this->sParamSiteClosedText=$this->Admin_GetValue('param_site_closed_text', $this->sParamSiteClosedText);
     //$this->sParamSiteClosedFile=$this->Admin_GetValue('param_site_closed_file', $this->sParamSiteClosedFile);
     //$this->sParamPathThemes=Config::Get('path.root.server').'/templates/skin';
     //$this->sParamPathLanguages=Config::Get('path.root.server').'/templates/language';
     $this->aConfig['check_password'] = $this->PluginAceAdminPanel_Admin_GetValue('param_check_password', $this->aConfig['check_password']);
     $oLang = $this->Lang_Dictionary();
     $this->Viewer_Assign('oLang', $oLang);
     $this->aAddons = array('sitesettings' => array('path' => 'admin/site/settings', 'class' => 'PluginAceadminpanel_AdminSiteSettings', 'file' => Config::Get('root.path.server') . 'plugins/aceadminpanel/classes/actions/ActionAdminSiteSettings.class.php', 'template' => HelperPlugin::GetTemplatePath('admin_site_settings.tpl'), 'language' => HelperPlugin::GetPluginPath() . '/templates/language/%%language%%.site_settings.php'), 'sitereset' => array('path' => 'admin/site/reset', 'class' => 'PluginAceadminpanel_AdminSiteReset', 'file' => Config::Get('root.path.server') . 'plugins/aceadminpanel/classes/actions/ActionAdminSiteReset.class.php', 'template' => HelperPlugin::GetTemplatePath('admin_site_reset.tpl')), 'toolscomments' => array('path' => 'admin/tools/comments', 'class' => 'PluginAceadminpanel_AdminToolsComments', 'file' => Config::Get('root.path.server') . 'plugins/aceadminpanel/classes/actions/ActionAdminToolsComments.class.php', 'template' => HelperPlugin::GetTemplatePath('admin_tools_comments.tpl')));
 }