本文整理汇总了PHP中eZTemplate::autoload方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplate::autoload方法的具体用法?PHP eZTemplate::autoload怎么用?PHP eZTemplate::autoload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplate
的用法示例。
在下文中一共展示了eZTemplate::autoload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
/**
* @param $tpl eZTemplate
* @param $operatorName array
* @param $operatorParameters array
* @param $rootNamespace string
* @param $currentNamespace string
* @param $operatorValue mixed
* @param $namedParameters array
*
* @return mixed
*/
function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$ini = eZINI::instance('ocoperatorscollection.ini');
$appini = eZINI::instance('app.ini');
switch ($operatorName) {
case 'related_attribute_objects':
$object = $operatorValue;
$identifier = $namedParameters['identifier'];
$dataMap = $object instanceof eZContentObject || $object instanceof eZContentObjectTreeNode ? $object->attribute('data_map') : array();
$data = array();
if (isset($dataMap[$identifier])) {
$ids = $dataMap[$identifier] instanceof eZContentObjectAttribute ? explode('-', $dataMap[$identifier]->toString()) : array();
if (!empty($ids)) {
$data = eZContentObject::fetchList(true, array("id" => array($ids)));
}
}
$operatorValue = $data;
break;
case 'smart_override':
$identifier = $namedParameters['identifier'];
$view = $namedParameters['view'];
$node = $operatorValue;
$operatorValue = $this->findSmartTemplate($identifier, $view, $node);
break;
case 'parse_link_href':
$href = $operatorValue;
$hrefParts = explode(':', $href);
$hrefFirst = array_shift($hrefParts);
if (!in_array($hrefFirst, array('http', 'https', 'file', 'mailto', 'ftp'))) {
if (!empty($hrefFirst)) {
$nodeID = eZURLAliasML::fetchNodeIDByPath('/' . $hrefFirst);
if ($nodeID) {
$contentNode = eZContentObjectTreeNode::fetch($nodeID);
if ($contentNode instanceof eZContentObjectTreeNode) {
$keyArray = array(array('node', $contentNode->attribute('node_id')), array('object', $contentNode->attribute('contentobject_id')), array('class_identifier', $contentNode->attribute('class_identifier')), array('class_group', $contentNode->attribute('object')->attribute('content_class')->attribute('match_ingroup_id_list')));
$tpl = new eZTemplate();
$ini = eZINI::instance();
$autoLoadPathList = $ini->variable('TemplateSettings', 'AutoloadPathList');
$extensionAutoloadPath = $ini->variable('TemplateSettings', 'ExtensionAutoloadPath');
$extensionPathList = eZExtension::expandedPathList($extensionAutoloadPath, 'autoloads/');
$autoLoadPathList = array_unique(array_merge($autoLoadPathList, $extensionPathList));
$tpl->setAutoloadPathList($autoLoadPathList);
$tpl->autoload();
$tpl->setVariable('node', $contentNode);
$tpl->setVariable('object', $contentNode->attribute('object'));
$tpl->setVariable('original_href', $href);
$res = new eZTemplateDesignResource();
$res->setKeys($keyArray);
$tpl->registerResource($res);
$result = trim($tpl->fetch('design:link/href.tpl'));
if (!empty($result)) {
$href = $result;
}
}
}
}
}
return $operatorValue = $href;
break;
case 'gmap_static_image':
try {
$cacheFileNames = array();
//@todo
$operatorValue = OCOperatorsCollectionsTools::gmapStaticImage($namedParameters['parameters'], $namedParameters['attribute'], $cacheFileNames);
} catch (Exception $e) {
eZDebug::writeError($e->getMessage(), 'gmap_static_image');
}
break;
case 'fa_class_icon':
$faIconIni = eZINI::instance('fa_icons.ini');
$node = $operatorValue;
$data = $namedParameters['fallback'] != '' ? $namedParameters['fallback'] : $faIconIni->variable('ClassIcons', '_fallback');
if ($node instanceof eZContentObjectTreeNode) {
if ($faIconIni->hasVariable('ClassIcons', $node->attribute('class_identifier'))) {
$data = $faIconIni->variable('ClassIcons', $node->attribute('class_identifier'));
}
}
$operatorValue = $data;
break;
case 'fa_object_icon':
$faIconIni = eZINI::instance('fa_icons.ini');
$object = $operatorValue;
$data = $namedParameters['fallback'] != '' ? $namedParameters['fallback'] : '';
if ($object instanceof eZContentObject) {
if ($faIconIni->hasVariable('ObjectIcons', $object->attribute('id'))) {
$data = $faIconIni->variable('ObjectIcons', $object->attribute('id'));
}
} else {
if ($faIconIni->hasVariable('ObjectIcons', $node)) {
//.........这里部分代码省略.........