/**
  * @return bool
  */
 public function Init()
 {
     if (Config::Get('plugin.beautypo.enable_formatter')) {
         Config::Set('head.rules.beautypo', array('path' => '___path.root.web___/', 'js' => array('include' => array(Plugin::GetTemplateWebPath(__CLASS__) . 'js/markitup-settings.js?'))));
     }
     return true;
 }
 public function Init()
 {
     $this->Viewer_AppendScript('https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&key=' . Config::Get('plugin.gmappost.google_api_key'));
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath(__CLASS__) . 'js/markerclusterer_compiled.js');
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath(__CLASS__) . 'js/gmappost.js');
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath(__CLASS__) . 'css/styles.css');
 }
 /**
  * Инициализация плагина
  *
  * @return void
  */
 public function Init()
 {
     // @todo в LS r986 эти пути добавили в ядро движка
     // http://trac.lsdev.ru/livestreet/changeset/986
     // путь к папке темплейтов плагина
     $this->Viewer_Assign('sTemplateWebPathPluginSitemap', Plugin::GetTemplateWebPath(__CLASS__));
 }
Beispiel #4
0
 public function InitAction($aVars)
 {
     $oLang = $this->Lang_Dictionary();
     $this->Viewer_Assign('oLang', $oLang);
     $oUser = $this->GetUser();
     if ($oUser && $oUser->IsAdministrator() && Config::Get('plugin.' . $this->sPlugin . '.' . 'icon_menu')) {
         $sScript = Plugin::GetTemplateWebPath($this->sPlugin) . 'js/' . 'icon_menu.js';
         $this->Viewer_AppendScript($sScript);
     }
     if (Router::GetAction() == 'admin' || Router::GetAction() == 'error') {
         return;
     }
     if (!$oUser) {
         if (Router::GetAction() == 'registration') {
             $aIp = admGetAllUserIp();
             foreach ($aIp as $sIp) {
                 if ($this->PluginAceadminpanel_Admin_IsBanIp($sIp)) {
                     $this->Message_AddErrorSingle($this->Lang_Get('adm_banned2_text'), $this->Lang_Get('adm_denied_title'));
                     return $this->UserBanned(null);
                 }
             }
         }
         return;
     }
     if (defined('ADMIN_SITE_CLOSED') && ADMIN_SITE_CLOSED && !$oUser->IsAdministrator()) {
         $this->SiteClosed();
     }
     if ($oUser->IsBannedByLogin() || $oUser->IsBannedByIp() && !$oUser->IsAdministrator()) {
         return $this->UserBanned($oUser);
     }
 }
 public function InjectDoMany()
 {
     $oUserCurrent = $this->User_GetUserCurrent();
     if ($oUserCurrent) {
         $this->Viewer_Assign('sTWPTalkbell', rtrim(Plugin::GetTemplateWebPath('talkbell'), '/'));
         return $this->Viewer_Fetch(Plugin::GetTemplatePath('talkbell') . 'window_message.tpl');
     }
 }
 /**
  * Инициализация плагина
  *
  * @return void
  */
 public function Init()
 {
     $this->Viewer_Assign("sTemplateWebPathLsgallery", Plugin::GetTemplateWebPath(__CLASS__));
     $this->Viewer_Assign("sTemplatePathLsgallery", Plugin::GetTemplatePath(__CLASS__));
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath('lsgallery') . 'css/gallery-style.css');
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath('lsgallery') . 'lib/jQuery/plugins/jquery.tools.min.js');
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath('lsgallery') . 'js/common.js');
 }
Beispiel #7
0
 public function Emojify($sText)
 {
     Emojione::$ascii = Config::Get('plugin.emoji.use_ascii');
     if (!Config::Get('plugin.emoji.use_cdn')) {
         Emojione::$imagePathPNG = Plugin::GetTemplateWebPath(__CLASS__) . 'images/';
     }
     $sText = Emojione::toImage($sText);
     return $sText;
 }
 public function Init()
 {
     Emojione::$ascii = Config::Get('plugin.emoji.use_ascii');
     if (!Config::Get('plugin.emoji.use_cdn')) {
         Emojione::$imagePathPNG = Plugin::GetTemplateWebPath(__CLASS__) . 'images/';
     }
     $this->Viewer_AppendStyle(Plugin::GetTemplatePath(__CLASS__) . "css/style.css");
     $this->Viewer_AppendScript(Plugin::GetTemplatePath(__CLASS__) . "js/emo.js");
 }
 public function Init()
 {
     $this->oUserCurrent = $this->User_GetUserCurrent();
     if (!$this->oUserCurrent or !$this->oUserCurrent->isAdministrator()) {
         return $this->EventNotFound();
     }
     $sWebPluginSkin = Plugin::GetTemplateWebPath(__CLASS__);
     $this->Viewer_Assign('sWebPluginSkin', $sWebPluginSkin);
 }
Beispiel #10
0
 /**
  * Инициализация плагина
  */
 public function Init()
 {
     $this->Viewer_Assign('sGeoPostPluginPath', Plugin::GetTemplatePath(__CLASS__));
     $this->Viewer_AppendScript('http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js');
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath(__CLASS__) . 'js/leaflet.markercluster.js');
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath(__CLASS__) . 'js/geopost.js');
     $this->Viewer_AppendStyle('http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css');
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath(__CLASS__) . 'css/geopost.css');
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath(__CLASS__) . 'css/cluster.css');
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath(__CLASS__) . 'js/Leaflet.fullscreen.min.js');
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath(__CLASS__) . 'css/leaflet.fullscreen.css');
 }
Beispiel #11
0
 /**
  * Выполняет загрузку необходимый(возможно даже системный :)) переменных в шалон
  *
  */
 public function VarAssign()
 {
     /**
      * Загружаем весь $_REQUEST, предварительно обработав его функцией func_htmlspecialchars()
      */
     $aRequest = $_REQUEST;
     func_htmlspecialchars($aRequest);
     $this->Assign("_aRequest", $aRequest);
     /**
      * Параметры стандартной сессии
      */
     $this->Assign("_sPhpSessionName", session_name());
     $this->Assign("_sPhpSessionId", session_id());
     /** 
      * Short Engine aliases
      */
     $this->Assign("LS", LS::getInstance());
     /** 
      * Загружаем объект доступа к конфигурации 
      */
     $this->Assign("oConfig", Config::getInstance());
     /**
      * Загружаем роутинг с учетом правил rewrite
      */
     $aRouter = array();
     $aPages = Config::Get('router.page');
     if (!$aPages or !is_array($aPages)) {
         throw new Exception('Router rules is underfined.');
     }
     foreach ($aPages as $sPage => $aAction) {
         $aRouter[$sPage] = Router::GetPath($sPage);
     }
     $this->Assign("aRouter", $aRouter);
     /**
      * Загружаем в шаблон блоки
      */
     $this->Assign("aBlocks", $this->aBlocks);
     /**
      * Загружаем HTML заголовки
      */
     $this->Assign("sHtmlTitle", htmlspecialchars($this->sHtmlTitle));
     $this->Assign("sHtmlKeywords", htmlspecialchars($this->sHtmlKeywords));
     $this->Assign("sHtmlDescription", htmlspecialchars($this->sHtmlDescription));
     $this->Assign("aHtmlHeadFiles", $this->aHtmlHeadFiles);
     $this->Assign("aHtmlRssAlternate", $this->aHtmlRssAlternate);
     /**
      * Загружаем список активных плагинов
      */
     $aPlugins = $this->oEngine->GetPlugins();
     $this->Assign("aPluginActive", array_fill_keys(array_keys($aPlugins), true));
     /**
      * Загружаем пути до шаблонов плагинов
      */
     $aTemplateWebPathPlugin = array();
     $aTemplatePathPlugin = array();
     foreach ($aPlugins as $k => $oPlugin) {
         $aTemplateWebPathPlugin[$k] = Plugin::GetTemplateWebPath(get_class($oPlugin));
         $aTemplatePathPlugin[$k] = Plugin::GetTemplatePath(get_class($oPlugin));
     }
     $this->Assign("aTemplateWebPathPlugin", $aTemplateWebPathPlugin);
     $this->Assign("aTemplatePathPlugin", $aTemplatePathPlugin);
 }
 public function Init()
 {
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath(__CLASS__) . 'css/main.css');
 }
 /**
  * Инициализация плагина
  * @return void
  */
 public function Init()
 {
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath(__CLASS__) . 'css/index.css');
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath(__CLASS__) . 'js/facebook.js');
     $this->Viewer_Assign('sFacebookTemplateWebPathPlugin', Plugin::GetTemplateWebPath(__CLASS__));
 }
Beispiel #14
0
 public function ShowBlockSelectLang()
 {
     if ($priority = Config::Get('plugin.l10n.lang_block.priority')) {
         $this->Viewer_AddBlock('right', 'L10nSelectLang', array('plugin' => 'l10n'), $priority);
     }
     $this->Viewer_PrependStyle(Plugin::GetTemplateWebPath(__CLASS__) . 'css/style.css');
 }
 /**
  * Выполняет загрузку необходимых (возможно даже системных :)) переменных в шаблон
  *
  */
 public function VarAssign()
 {
     /**
      * Загружаем весь $_REQUEST, предварительно обработав его функцией func_htmlspecialchars()
      */
     $aRequest = $_REQUEST;
     func_htmlspecialchars($aRequest);
     $this->Assign("_aRequest", $aRequest);
     /**
      * Параметры стандартной сессии
      */
     $this->Assign("_sPhpSessionName", session_name());
     $this->Assign("_sPhpSessionId", session_id());
     /**
      * Short Engine aliases
      */
     $this->Assign("LS", LS::getInstance());
     /**
      * Загружаем объект доступа к конфигурации
      */
     $this->Assign("oConfig", Config::getInstance());
     /**
      * Загружаем роутинг с учетом правил rewrite
      */
     $aRouter = array();
     if ($aPages = Config::Get('router.page')) {
         foreach ($aPages as $sPage => $aAction) {
             $aRouter[$sPage] = Router::GetPath($sPage);
         }
     }
     $this->Assign("aRouter", $aRouter);
     /**
      * Загружаем в шаблон блоки
      */
     $this->Assign("aBlocks", $this->aBlocks);
     /**
      * Загружаем в шаблон JS переменные
      */
     $this->Assign("aVarsJs", $this->aVarsJs);
     /**
      * Загружаем HTML заголовки
      */
     $this->Assign("sHtmlTitle", htmlspecialchars($this->GetHtmlTitle(Config::Get('view.title_sort_reverse'))));
     $this->Assign("sHtmlKeywords", htmlspecialchars($this->sHtmlKeywords));
     $this->Assign("sHtmlDescription", htmlspecialchars($this->sHtmlDescription));
     $this->Assign("aHtmlHeadFiles", $this->aHtmlHeadFiles);
     $this->Assign("aHtmlRssAlternate", $this->aHtmlRssAlternate);
     $this->Assign("sHtmlCanonical", func_urlspecialchars($this->sHtmlCanonical));
     $this->Assign("sHtmlRobots", $this->sHtmlRobots);
     /**
      * Загружаем список активных плагинов
      */
     $aPlugins = Engine::getInstance()->GetPlugins();
     $this->Assign("aPluginActive", array_fill_keys(array_keys($aPlugins), true));
     /**
      * Загружаем пути до шаблонов плагинов
      */
     $aTemplateWebPathPlugin = array();
     $aTemplatePathPlugin = array();
     foreach ($aPlugins as $k => $oPlugin) {
         $aTemplateWebPathPlugin[$k] = Plugin::GetTemplateWebPath(get_class($oPlugin));
         $aTemplatePathPlugin[$k] = Plugin::GetTemplatePath(get_class($oPlugin));
     }
     $this->Assign("aTemplateWebPathPlugin", $aTemplateWebPathPlugin);
     $this->Assign("aTemplatePathPlugin", $aTemplatePathPlugin);
     /**
      * Загружаем security-ключ
      */
     $this->Assign("LIVESTREET_SECURITY_KEY", $this->Security_GetSecurityKey());
 }
 /**
  * Выполняется каждый раз при загрузке сайта, если плагин активирован
  */
 public function Init()
 {
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath(__CLASS__) . "assets/css/main.css");
     // Добавление своего CSS
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath(__CLASS__) . "assets/js/main.js");
     // Добавление своего JS
     //$this->Viewer_AddMenu('blog',Plugin::GetTemplatePath(__CLASS__).'menu.blog.tpl'); // например, задаем свой вид меню
 }
 public function HookInsertOpenGraphHeaders()
 {
     if (!self::$oTopic) {
         return;
     }
     // список media-данных
     $aMedia = $this->PluginFacebook_ModuleFacebook_getMedia(self::$oTopic, true);
     if (count($aMedia) > 0) {
         switch ($aMedia[0]['type']) {
             case 'flash':
                 $sImage = $aMedia[0]['imgsrc'];
                 break;
             case 'image':
                 $sImage = $aMedia[0]['src'];
                 break;
         }
     } else {
         // В случае отсутствия media-данных подставляем картинку по умолчанию
         $sImage = Config::Get('plugin.facebook.default_post_image');
         // если не задана своя картинка, использовать дефолтную
         if (!$sImage) {
             $sImage = Plugin::GetTemplateWebPath('facebook') . 'images/default.jpg';
         }
     }
     // Передаем в шаблон данные
     $this->Viewer_Assign('sTitle', self::$oTopic->getTitle());
     $this->Viewer_Assign('sImage', $sImage);
     return $this->Viewer_Fetch(Plugin::GetTemplatePath('facebook') . '/inject.header.tpl');
 }
Beispiel #18
0
 /**
  * Конструктор
  *
  * @param Engine $oEngine
  * @param string $sAction
  */
 public function __construct(Engine $oEngine, $sAction)
 {
     parent::__construct($oEngine, $sAction);
     $this->Viewer_Assign('sTemplatePathPlugin', rtrim($this->getTemplatePathPlugin(), '/'));
     $this->Viewer_Assign('sTemplateWebPathPlugin', Plugin::GetTemplateWebPath(get_class($this)));
 }
 public function getIconPath($iSize = 48)
 {
     if ($sPath = $this->getIcon()) {
         return preg_replace("#_\\d{1,3}x\\d{1,3}(\\.\\w{3,4})\$#", ($iSize == 0 ? '' : "_{$iSize}x{$iSize}") . "\\1", $sPath);
     } else {
         return Plugin::GetTemplateWebPath(__CLASS__) . "icons/{$this->getTyped()}_icon_{$iSize}x{$iSize}.png";
     }
 }
 public function EventShutdown()
 {
     $this->Viewer_Assign('sMenuHeadItemSelect', $this->sMenuHeadItemSelect);
     $this->Viewer_Assign('sMenuItemSelect', $this->sMenuItemSelect);
     $this->Viewer_Assign('sMenuSubItemSelect', $this->sMenuSubItemSelect);
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath('lsgallery') . 'js/gallery.js');
 }
 public function AddStylesAndJS()
 {
     $sTemplateWebPath = Plugin::GetTemplateWebPath(__CLASS__);
     $this->Viewer_AppendStyle($sTemplateWebPath . 'css/style.css');
 }
 /**
  * Приводит путь до файла к единому виду
  *
  * @param       $sFile
  * @param array $aParams
  *
  * @return string
  */
 protected function NormalizeFilePath($sFile, $aParams = array())
 {
     /**
      * По дефолту считаем, что это локальный абсолютный путь до файла: /var/www/site.com  или c:\server\root\site.com
      */
     $sProtocol = '';
     $sPath = $sFile;
     $sSeparate = DIRECTORY_SEPARATOR;
     /**
      * Проверяем на URL https://site.com или http://site.com
      */
     if (preg_match('#^(https?://)(.*)#i', $sFile, $aMatch)) {
         $sProtocol = $aMatch[1];
         $sPath = $aMatch[2];
         $sSeparate = '/';
         /**
          * Если необходимо, то меняем протокол на https
          */
         if (Router::GetIsSecureConnection() and strtolower($sProtocol) == 'http://' and Config::Get('module.asset.force_https')) {
             $sProtocol = 'https://';
         }
         /**
          * Проверяем на //site.com
          */
     } elseif (strpos($sFile, '//') === 0) {
         $sProtocol = '//';
         $sPath = substr($sFile, 2);
         $sSeparate = '/';
         /**
          * Проверяем на относительный путь без протокола и без первого слеша
          */
     } elseif (strpos($sFile, '/') !== 0 and strpos($sFile, ':') === false) {
         /**
          * Считаем, что указывался путь относительно корня текущего шаблона
          */
         $sSeparate = '/';
         if (isset($aParams['plugin']) and $aParams['plugin']) {
             /**
              * Относительно шаблона плагина
              */
             $sPath = Plugin::GetTemplateWebPath($aParams['plugin']) . $sFile;
         } else {
             $sPath = Router::GetFixPathWeb(Config::Get('path.skin.web')) . $sSeparate . $sFile;
         }
         return $sPath;
     }
     /**
      * Могут встречаться двойные слеши, поэтому делаем замену
      */
     $sPath = preg_replace("#([\\\\/])+#", $sSeparate, $sPath);
     /**
      * Возвращаем результат
      */
     return $sProtocol . $sPath;
 }
 public function EventShutdown()
 {
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath(__CLASS__) . "js/main.js");
     $this->Viewer_Assign('sTemplatePath', Plugin::GetTemplatePath(__CLASS__));
 }
 protected function PluginAppendStyle($sStyle, $aParams = array())
 {
     $this->Viewer_AppendStyle(Plugin::GetTemplateWebPath($this->sPlugin) . 'css/' . $sStyle);
 }
Beispiel #25
0
 /**
  * Инициализация плагина
  *
  * @return void
  */
 public function Init()
 {
     // путь к папке темплейтов плагина
     $this->Viewer_Assign('sTemplateWebPathPluginL10n', Plugin::GetTemplateWebPath(__CLASS__));
 }
 /**
  * Инициализация плагина
  */
 public function Init()
 {
     $this->Viewer_AppendScript(Plugin::GetTemplateWebPath('umanager') . 'js/usersearch.js');
 }