本文整理汇总了PHP中Pimcore\Model\Document\Service::isValidType方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::isValidType方法的具体用法?PHP Service::isValidType怎么用?PHP Service::isValidType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Document\Service
的用法示例。
在下文中一共展示了Service::isValidType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDocTypesAction
public function getDocTypesAction()
{
$list = new Document\DocType\Listing();
if ($this->getParam("type")) {
$type = $this->getParam("type");
if (Document\Service::isValidType($type)) {
$list->setCondition("type = ?", $type);
}
}
$list->setOrderKey(array("priority", "name"));
$list->setOrder(array("desc", "ASC"));
$list->load();
$docTypes = array();
foreach ($list->getDocTypes() as $type) {
$docTypes[] = $type;
}
$this->_helper->json(array("docTypes" => $docTypes));
}
示例2: postDispatch
//.........这里部分代码省略.........
}
}
}
//manipulate path for frontend
if (is_array($pluginCssPaths) and count($pluginCssPaths) > 0) {
for ($i = 0; $i < count($pluginCssPaths); $i++) {
if (is_file(PIMCORE_PLUGINS_PATH . $pluginCssPaths[$i])) {
$cssPaths[] = "/plugins" . $pluginCssPaths[$i];
}
}
}
}
}
$editmodeScripts = array_merge($editmodeScripts, $jsPaths);
$editmodeStylesheets = array_merge($editmodeStylesheets, $cssPaths);
} catch (\Exception $e) {
\Logger::alert("there is a problem with the plugin configuration");
\Logger::alert($e);
}
$editmodeHeadHtml = "\n\n\n<!-- pimcore editmode -->\n";
// include stylesheets
foreach ($editmodeStylesheets as $sheet) {
$editmodeHeadHtml .= '<link rel="stylesheet" type="text/css" href="' . $sheet . '?_dc=' . Version::$revision . '" />';
$editmodeHeadHtml .= "\n";
}
$editmodeHeadHtml .= "\n\n";
$editmodeHeadHtml .= '<script type="text/javascript">var jQueryPreviouslyLoaded = (typeof jQuery == "undefined") ? false : true;</script>' . "\n";
// include script libraries
foreach ($editmodeLibraries as $script) {
$editmodeHeadHtml .= '<script type="text/javascript" src="' . $script . '?_dc=' . Version::$revision . '"></script>';
$editmodeHeadHtml .= "\n";
}
// combine the pimcore scripts in non-devmode
if ($conf->general->devmode) {
foreach ($editmodeScripts as $script) {
$editmodeHeadHtml .= '<script type="text/javascript" src="' . $script . '?_dc=' . Version::$revision . '"></script>';
$editmodeHeadHtml .= "\n";
}
} else {
$scriptContents = "";
foreach ($editmodeScripts as $scriptUrl) {
$scriptContents .= file_get_contents(PIMCORE_DOCUMENT_ROOT . $scriptUrl) . "\n\n\n";
}
$editmodeHeadHtml .= '<script type="text/javascript" src="' . \Pimcore\Tool\Admin::getMinimizedScriptPath($scriptContents) . '?_dc=' . Version::$revision . '"></script>' . "\n";
}
$user = \Pimcore\Tool\Authentication::authenticateSession();
$lang = $user->getLanguage();
$editmodeHeadHtml .= '<script type="text/javascript" src="/admin/misc/json-translations-system/language/' . $lang . '/?_dc=' . Version::$revision . '"></script>' . "\n";
$editmodeHeadHtml .= '<script type="text/javascript" src="/admin/misc/json-translations-admin/language/' . $lang . '/?_dc=' . Version::$revision . '"></script>' . "\n";
$editmodeHeadHtml .= "\n\n";
// set var for editable configurations which is filled by Document\Tag::admin()
$editmodeHeadHtml .= '<script type="text/javascript">
var editableConfigurations = new Array();
var pimcore_document_id = ' . $request->getParam("document")->getId() . ';
if(jQueryPreviouslyLoaded) {
jQuery.noConflict( true );
}
</script>';
$editmodeHeadHtml .= "\n\n<!-- /pimcore editmode -->\n\n\n";
// add scripts in html header for pages in editmode
if ($this->controller->editmode && Document\Service::isValidType($this->controller->document->getType())) {
//ckogler
include_once "simple_html_dom.php";
$body = $this->getResponse()->getBody();
$html = str_get_html($body);
if ($html) {
$htmlElement = $html->find("html", 0);
$head = $html->find("head", 0);
$bodyElement = $html->find("body", 0);
// if there's no head and no body, create a wrapper including these elements
// add html headers for snippets in editmode, so there is no problem with javascript
if (!$head && !$bodyElement && !$htmlElement) {
$body = "<!DOCTYPE html>\n<html>\n<head></head><body>" . $body . "</body></html>";
$html = str_get_html($body);
// get them again with the updated html markup
$htmlElement = $html->find("html", 0);
$head = $html->find("head", 0);
$bodyElement = $html->find("body", 0);
}
if ($head && $bodyElement && $htmlElement) {
$head->innertext = $head->innertext . "\n\n" . $editmodeHeadHtml;
$bodyElement->onunload = "pimcoreOnUnload();";
if (\Pimcore\Tool\Admin::isExtJS6()) {
$bodyElement->innertext = $bodyElement->innertext . "\n\n" . '<script type="text/javascript" src="/pimcore/static6/js/pimcore/document/edit/startup.js?_dc=' . Version::$revision . '"></script>' . "\n\n";
} else {
$bodyElement->innertext = $bodyElement->innertext . "\n\n" . '<script type="text/javascript" src="/pimcore/static/js/pimcore/document/edit/startup.js?_dc=' . Version::$revision . '"></script>' . "\n\n";
}
$body = $html->save();
$this->getResponse()->setBody($body);
} else {
$this->getResponse()->setBody('<div style="font-size:30px; font-family: Arial; font-weight:bold; color:red; text-align: center; margin: 40px 0">You have to define a <html>, <head>, <body><br />HTML-tag in your view/layout markup!</div>');
}
$html->clear();
unset($html);
}
}
// IE compatibility
//$this->getResponse()->setHeader("X-UA-Compatible", "IE=8; IE=9", true);
}
示例3: getDocTypesAction
public function getDocTypesAction()
{
$list = new Document\DocType\Listing();
if ($this->getParam("type")) {
$type = $this->getParam("type");
if (Document\Service::isValidType($type)) {
$list->setFilter(function ($row) use($type) {
if ($row["type"] == $type) {
return true;
}
return false;
});
}
}
$list->load();
$docTypes = array();
foreach ($list->getDocTypes() as $type) {
$docTypes[] = $type;
}
$this->_helper->json(array("docTypes" => $docTypes));
}