/** * Meta hook * * @return void */ public function hook_meta() { $sAction = Router::GetAction(); $sUrl = E::ModuleSeopack()->ClearUrl(R::Url('path')); $oSeopack = E::ModuleSeopack()->GetSeopackByUrl($sUrl); E::ModuleViewer()->Assign('sCurrentUrl', $sUrl); if ($oSeopack) { E::ModuleViewer()->Assign('oSeopack', $oSeopack); } $sMetaDescriptionTemplate = Plugin::GetTemplateDir(__CLASS__) . 'tpls/meta/description/' . $sAction . '.tpl'; if (E::ModuleViewer()->TemplateExists($sMetaDescriptionTemplate)) { $sMetaDescription = E::ModuleViewer()->Fetch($sMetaDescriptionTemplate); if ($oSeopack && $oSeopack->getDescription()) { E::ModuleViewer()->Assign('sHtmlDescription', htmlspecialchars($oSeopack->getDescription())); } else { E::ModuleViewer()->Assign('sHtmlDescription', htmlspecialchars($sMetaDescription)); } } $sMetaKeywordsTemplate = Plugin::GetTemplateDir(__CLASS__) . 'tpls/meta/keywords/' . $sAction . '.tpl'; if (E::ModuleViewer()->TemplateExists($sMetaKeywordsTemplate)) { $sMetaKeywords = E::ModuleViewer()->Fetch($sMetaKeywordsTemplate); if ($oSeopack && $oSeopack->getKeywords()) { E::ModuleViewer()->Assign('sHtmlKeywords', htmlspecialchars($oSeopack->getKeywords())); } else { E::ModuleViewer()->Assign('sHtmlKeywords', htmlspecialchars($sMetaKeywords)); } } if ($oSeopack && $oSeopack->getTitle()) { E::ModuleViewer()->Assign('sHtmlTitle', htmlspecialchars($oSeopack->getTitle())); } }
protected function EventAjaxSet() { if (!F::isPost('url')) { return false; } if (!$this->CheckSeopackFields()) { return false; } $sUrl = E::ModuleSeopack()->ClearUrl(F::GetRequest('url')); if (!($oSeopack = E::ModuleSeopack()->GetSeopackByUrl($sUrl))) { $oSeopack = Engine::GetEntity('PluginSeopack_ModuleSeopack_EntitySeopack'); $oSeopack->setUrl($sUrl); } if (F::GetRequest('title_auto') && F::GetRequest('description_auto') && F::GetRequest('keywords_auto')) { $oSeopack->Delete(); E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok')); return; } $oSeopack->setTitle(F::GetRequest('title_auto') ? null : strip_tags(F::GetRequest('title'))); $oSeopack->setDescription(F::GetRequest('description_auto') ? null : strip_tags(F::GetRequest('description'))); $oSeopack->setKeywords(F::GetRequest('keywords_auto') ? null : strip_tags(F::GetRequest('keywords'))); if ($oSeopack->Save()) { if ($oSeopack->getTitle()) { E::ModuleViewer()->AssignAjax('title', $oSeopack->getTitle()); } E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok')); } return; }
protected function EventSeopackDelete() { $this->sMainMenuItem = 'content'; E::ModuleSecurity()->ValidateSendForm(); if ($oSeopack = E::ModuleSeopack()->GetSeopackBySeopackId($this->GetParam(0))) { $oSeopack->Delete(); E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_admin_action_delete_ok') . null, true); Router::Location('admin/seopack/'); } else { E::ModuleMessage()->AddError(E::ModuleLang()->Get('plugin.seopack.seopack_admin_action_delete_error'), E::ModuleLang()->Get('error')); } $this->SetTemplateAction('seopack_list'); }