当前位置: 首页>>代码示例>>PHP>>正文


PHP eZTemplateDesignResource::instance方法代码示例

本文整理汇总了PHP中eZTemplateDesignResource::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateDesignResource::instance方法的具体用法?PHP eZTemplateDesignResource::instance怎么用?PHP eZTemplateDesignResource::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZTemplateDesignResource的用法示例。


在下文中一共展示了eZTemplateDesignResource::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendConfirmation

 function sendConfirmation()
 {
     if ($this->attribute('status') != eZSubscription::StatusPending) {
         return;
     }
     $res = eZTemplateDesignResource::instance();
     $ini = eZINI::instance();
     $hostname = eZSys::hostname();
     $template = 'design:eznewsletter/sendout/registration.tpl';
     $tpl = eZNewsletterTemplateWrapper::templateInit();
     $tpl->setVariable('userData', eZUserSubscriptionData::fetch($this->attribute('email')));
     $tpl->setVariable('hostname', $hostname);
     $tpl->setVariable('subscription', $this);
     $tpl->setVariable('subscriptionList', $this->attribute('subscription_list'));
     $templateResult = $tpl->fetch($template);
     if ($tpl->hasVariable('subject')) {
         $subject = $tpl->variable('subject');
     }
     $mail = new eZMail();
     $mail->setSender($ini->variable('MailSettings', 'EmailSender'), $ini->variable('SiteSettings', 'SiteName'));
     $mail->setReceiver($this->attribute('email'));
     $mail->setBody($templateResult);
     $mail->setSubject($subject);
     eZMailTransport::send($mail);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:25,代码来源:ezsubscription.php

示例2: displayAttribute

 /**
  * Invoca il template per il form di attributo
  *
  * @see SearchFormOperator::modify
  * @param OCClassSearchFormHelper $instance
  * @param OCClassSearchFormAttributeField $field
  *
  * @return array|null|string
  */
 public static function displayAttribute(OCClassSearchFormHelper $instance, OCClassSearchFormAttributeField $field)
 {
     $keyArray = array(array('class', $instance->getContentClass()->attribute('id')), array('class_identifier', $instance->getContentClass()->attribute('identifier')), array('class_group', $instance->getContentClass()->attribute('match_ingroup_id_list')), array('attribute', $field->contentClassAttribute->attribute('id')), array('attribute_identifier', $field->contentClassAttribute->attribute('identifier')));
     $tpl = eZTemplate::factory();
     $tpl->setVariable('class', $instance->getContentClass());
     $tpl->setVariable('attribute', $field->contentClassAttribute);
     $res = eZTemplateDesignResource::instance();
     $res->setKeys($keyArray);
     $templateName = $field->contentClassAttribute->attribute('data_type_string');
     return $tpl->fetch('design:class_search_form/datatypes/' . $templateName . '.tpl');
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:20,代码来源:occlasssearchformhelper.php

示例3: contentPDFGenerate

function contentPDFGenerate($cacheFile, $node, $object = false, $viewCacheEnabled = true, $languageCode = false, $viewParameters = array())
{
    if ($languageCode) {
        $node->setCurrentLanguage($languageCode);
    }
    if ($object == false) {
        $object = $node->attribute('object');
    }
    $res = eZTemplateDesignResource::instance();
    $res->setKeys(array(array('object', $node->attribute('contentobject_id')), array('remote_id', $object->attribute('remote_id')), array('node_remote_id', $node->attribute('remote_id')), array('section', $object->attribute('section_id')), array('node', $node->attribute('node_id')), array('parent_node', $node->attribute('parent_node_id')), array('class', $object->attribute('contentclass_id')), array('depth', $node->attribute('depth')), array('url_alias', $node->attribute('url_alias')), array('class_group', $object->attribute('match_ingroup_id_list')), array('class_identifier', $object->attribute('class_identifier'))));
    $tpl = eZTemplate::factory();
    $tpl->setVariable('view_parameters', $viewParameters);
    $tpl->setVariable('node', $node);
    $tpl->setVariable('generate_toc', 0);
    $tpl->setVariable('tree_traverse', 0);
    $tpl->setVariable('class_array', 0);
    $tpl->setVariable('show_frontpage', 0);
    if ($viewCacheEnabled) {
        $tpl->setVariable('generate_file', 1);
        $tpl->setVariable('filename', $cacheFile);
    } else {
        $tpl->setVariable('generate_file', 0);
        $tpl->setVariable('generate_stream', 1);
    }
    $textElements = array();
    $uri = 'design:node/view/pdf.tpl';
    $tpl->setVariable('pdf_root_template', 1);
    eZTemplateIncludeFunction::handleInclude($textElements, $uri, $tpl, '', '');
    $pdf_definition = implode('', $textElements);
    $pdf_definition = str_replace(array(' ', "\r\n", "\t", "\n"), '', $pdf_definition);
    $tpl->setVariable('pdf_definition', $pdf_definition);
    $uri = 'design:node/view/execute_pdf.tpl';
    $textElements = '';
    eZTemplateIncludeFunction::handleInclude($textElements, $uri, $tpl, '', '');
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:35,代码来源:pdf.php

示例4: restore

    static function restore( $siteDesign, $nodeID, $viewMode, $language, $offset, $roleList, $discountList, $layout,
                      $parameters = array() )
    {
        $result = array();
        $cachePathInfo = eZContentCache::cachePathInfo( $siteDesign, $nodeID, $viewMode, $language, $offset, $roleList, $discountList,
                                                        $layout, false, $parameters );
        $cacheDir = $cachePathInfo['dir'];
        $cacheFile = $cachePathInfo['file'];
        $cachePath = $cachePathInfo['path'];
        $timestamp = false;

        $cacheFile = eZClusterFileHandler::instance( $cachePath );

        if ( $cacheFile->exists() )
        {
            $timestamp = $cacheFile->mtime();
            if ( eZContentObject::isCacheExpired( $timestamp ) )
            {
                eZDebugSetting::writeDebug( 'kernel-content-view-cache', 'cache expired #2' );
                return false;
            }
            eZDebugSetting::writeDebug( 'kernel-content-view-cache', "checking viewmode '$viewMode' #1" );
            if ( eZContentObject::isComplexViewModeCacheExpired( $viewMode, $timestamp ) )
            {
                eZDebugSetting::writeDebug( 'kernel-content-view-cache', "viewmode '$viewMode' cache expired #2" );
                return false;
            }

        }

        if ( $viewMode == 'pdf' )
        {
            return $cachePath;
        }

        eZDebugSetting::writeDebug( 'kernel-content-view-cache', 'cache used #2' );

        $fileName = $cacheDir . "/" . $cacheFile;

        $cacheFile = eZClusterFileHandler::instance( $fileName );
        $contents = $cacheFile->fetchContents();

        $cachedArray = unserialize( $contents );

        $cacheTTL = $cachedArray['cache_ttl'];

        // Check if cache has expired
        if ( $cacheTTL > 0 )
        {
            $expiryTime = $timestamp + $cacheTTL;
            if ( time() > $expiryTime )
            {
                return false;
            }
        }

        // Check for template language timestamp
        $cacheCodeDate = $cachedArray['cache_code_date'];
        if ( $cacheCodeDate != self::CODE_DATE )
            return false;

        $viewMode = $cachedArray['content_info']['viewmode'];

        $res = eZTemplateDesignResource::instance();
        $res->setKeys( array( array( 'node', $nodeID ),
                              array( 'view_offset', $offset ),
                              array( 'viewmode', $viewMode ),
                              array( 'section', $cachedArray['section_id'] )
                              ) );
        $result['content_info'] = $cachedArray['content_info'];
        $result['content'] = $cachedArray['content'];

        $result['view_parameters'] = $cachedArray['content_info']['view_parameters'];

        foreach ( array( 'path', 'node_id', 'section_id', 'navigation_part' ) as $item )
        {
            if ( isset( $cachedArray[$item] ) )
            {
                $result[$item] = $cachedArray[$item];
            }
        }

        return $result;
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:84,代码来源:ezcontentcache.php

示例5: DOMDocument

 function &outputText()
 {
     if (!$this->XMLData) {
         $output = '';
         return $output;
     }
     $this->Tpl = eZTemplate::factory();
     $this->Res = eZTemplateDesignResource::instance();
     if ($this->ContentObjectAttribute) {
         $this->Res->setKeys(array(array('attribute_identifier', $this->ContentObjectAttribute->attribute('contentclass_attribute_identifier'))));
     }
     $this->Document = new DOMDocument('1.0', 'utf-8');
     $success = $this->Document->loadXML($this->XMLData);
     if (!$success) {
         $this->Output = '';
         return $this->Output;
     }
     $this->prefetch();
     $this->XMLSchema = eZXMLSchema::instance();
     // Add missing elements to the OutputTags array
     foreach ($this->XMLSchema->availableElements() as $element) {
         if (!isset($this->OutputTags[$element])) {
             $this->OutputTags[$element] = array();
         }
     }
     $this->NestingLevel = 0;
     $params = array();
     $output = $this->outputTag($this->Document->documentElement, $params);
     $this->Output = $output[1];
     unset($this->Document);
     $this->Res->removeKey('attribute_identifier');
     return $this->Output;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:33,代码来源:ezxmloutputhandler.php

示例6: checkContentActions

    function checkContentActions( $module, $class, $object, $version, $contentObjectAttributes, $EditVersion, $EditLanguage, $FromLanguage, &$Result )
    {
        if ( $module->isCurrentAction( 'Preview' ) )
        {
            $module->redirectToView( 'versionview', array( $object->attribute('id'), $EditVersion, $EditLanguage, $FromLanguage ) );
            return eZModule::HOOK_STATUS_CANCEL_RUN;
        }

        if ( $module->isCurrentAction( 'Translate' ) )
        {
            $module->redirectToView( 'translate', array( $object->attribute( 'id' ), $EditVersion, $EditLanguage, $FromLanguage ) );
            return eZModule::HOOK_STATUS_CANCEL_RUN;
        }

        if ( $module->isCurrentAction( 'VersionEdit' ) )
        {
            if ( isset( $GLOBALS['eZRequestedURI'] ) and is_object( $GLOBALS['eZRequestedURI'] ) )
            {
                $uri = $GLOBALS['eZRequestedURI'];
                $uri = $uri->originalURIString();
                $http = eZHTTPTool::instance();
                $http->setSessionVariable( 'LastAccessesVersionURI', $uri );
            }
            $module->redirectToView( 'history', array( $object->attribute( 'id' ), $EditVersion, $EditLanguage ) );
            return eZModule::HOOK_STATUS_CANCEL_RUN;
        }

        if ( $module->isCurrentAction( 'EditLanguage' ) )
        {
            if ( $module->hasActionParameter( 'SelectedLanguage' ) )
            {
                $EditLanguage = $module->actionParameter( 'SelectedLanguage' );
                // We reset the from language to disable the translation look
                $FromLanguage = false;
                $module->redirectToView( 'edit', array( $object->attribute('id'), $EditVersion, $EditLanguage, $FromLanguage ) );
                return eZModule::HOOK_STATUS_CANCEL_RUN;
            }
        }

        if ( $module->isCurrentAction( 'TranslateLanguage' ) )
        {
            if ( $module->hasActionParameter( 'SelectedLanguage' ) )
            {
                $FromLanguage = $EditLanguage;
                $EditLanguage = $module->actionParameter( 'SelectedLanguage' );
                $module->redirectToView( 'edit', array( $object->attribute('id'), $EditVersion, $EditLanguage, $FromLanguage ) );
                return eZModule::HOOK_STATUS_CANCEL_RUN;
            }
        }

        if ( $module->isCurrentAction( 'FromLanguage' ) )
        {
            $FromLanguage = $module->actionParameter( 'FromLanguage' );
            $module->redirectToView( 'edit', array( $object->attribute('id'), $EditVersion, $EditLanguage, $FromLanguage ) );
            return eZModule::HOOK_STATUS_CANCEL_RUN;
        }

        if ( $module->isCurrentAction( 'Discard' ) )
        {
            $http = eZHTTPTool::instance();
            $objectID = $object->attribute( 'id' );
            $discardConfirm = true;
            if ( $http->hasPostVariable( 'DiscardConfirm' ) )
                $discardConfirm = $http->postVariable( 'DiscardConfirm' );
            $http->setSessionVariable( 'DiscardObjectID', $objectID );
            $http->setSessionVariable( 'DiscardObjectVersion', $EditVersion );
            $http->setSessionVariable( 'DiscardObjectLanguage', $EditLanguage );
            $http->setSessionVariable( 'DiscardConfirm', $discardConfirm );
            $module->redirectTo( $module->functionURI( 'removeeditversion' ) . '/' );
            return eZModule::HOOK_STATUS_CANCEL_RUN;
        }

        // helper function which computes the redirect after
        // publishing and final store of a draft.
        function computeRedirect( $module, $object, $version, $EditLanguage = false )
        {
            $http = eZHTTPTool::instance();

            $node = $object->mainNode();

            if ( $http->hasSessionVariable( 'RedirectIfDiscarded' ) )
            {
                $http->removeSessionVariable( 'RedirectIfDiscarded' );
            }

            $hasRedirected = false;
            if ( $http->hasSessionVariable( 'ParentObject' ) && $http->sessionVariable( 'NewObjectID' ) == $object->attribute( 'id' ) )
            {
                $parentArray = $http->sessionVariable( 'ParentObject' );
                $parentURL = $module->redirectionURI( 'content', 'edit', $parentArray );
                $parentObject = eZContentObject::fetch( $parentArray[0] );
                $db = eZDB::instance();
                $db->begin();
                $parentObject->addContentObjectRelation( $object->attribute( 'id' ), $parentArray[1] );
                $db->commit();
                $http->removeSessionVariable( 'ParentObject' );
                $http->removeSessionVariable( 'NewObjectID' );
                $module->redirectTo( $parentURL );
                $hasRedirected = true;
            }
//.........这里部分代码省略.........
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:101,代码来源:edit.php

示例7: eZStepData

include_once "kernel/setup/ezsetuptests.php";
include_once 'kernel/setup/ezsetup_summary.php';
// Initialize template
$tpl = eZTemplate::instance();
//$tpl->registerFunction( "section", new eZTemplateSectionFunction( "section" ) );
//$tpl->registerFunction( "include", new eZTemplateIncludeFunction() );
$ini = eZINI::instance();
if ($ini->variable('TemplateSettings', 'Debug') == 'enabled') {
    eZTemplate::setIsDebugEnabled(true);
}
//eZDebug::setLogOnly( true );
//$ini->setVariable( 'RegionalSettings', 'TextTranslation', 'disabled' );
$Module = $Params['Module'];
$tpl->setAutoloadPathList($ini->variable('TemplateSettings', 'AutoloadPathList'));
$tpl->autoload();
$tpl->registerResource(eZTemplateDesignResource::instance());
// Initialize HTTP variables
$http = eZHTTPTool::instance();
$baseDir = 'kernel/setup/';
// Load step list data. See this file for install step references.
$stepDataFile = $baseDir . "steps/ezstep_data.php";
$stepData = null;
if (file_exists($stepDataFile)) {
    include_once $stepDataFile;
    $stepData = new eZStepData();
}
if ($stepData == null) {
    print "<h1>Setup step data file not found. Setup is exiting...</h1>";
    //TODO : i18n translate
    eZDisplayResult($templateResult);
    eZExecution::cleanExit();
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:ezsetup.php

示例8: getForm

 /**
  * @return string
  */
 protected function getForm()
 {
     $classKeyArray = array(array('class', $this->contentClass->attribute('id')), array('class_identifier', $this->contentClass->attribute('identifier')), array('class_group', $this->contentClass->attribute('match_ingroup_id_list')));
     $tpl = eZTemplate::factory();
     $tpl->setVariable('class', $this->contentClass);
     $tpl->setVariable('remote_class_id', $this->remoteContentClassDefinition->ID);
     $tpl->setVariable('client', $this);
     $attributeFields = array();
     $dataMap = $this->contentClass->attribute('data_map');
     $disabled = array();
     if (eZINI::instance('ocsearchtools.ini')->hasVariable('RemoteClassSearchFormSettings', 'DisabledAttributes')) {
         $disabled = eZINI::instance('ocsearchtools.ini')->variable('RemoteClassSearchFormSettings', 'DisabledAttributes');
     }
     /** @var $dataMap eZContentClassAttribute[] */
     foreach ($dataMap as $attribute) {
         if (!in_array($this->contentClass->attribute('identifier') . '/' . $attribute->attribute('identifier'), $disabled) && $attribute->attribute('is_searchable')) {
             if (isset($this->remoteContentClassDefinition->DataMap[0]->{$attribute->attribute('identifier')})) {
                 $inputField = OCRemoteClassSearchFormAttributeField::instance($attribute, $this->remoteContentClassDefinition->DataMap[0]->{$attribute->attribute('identifier')}, $this);
                 $keyArray = array(array('class', $this->contentClass->attribute('id')), array('class_identifier', $this->contentClass->attribute('identifier')), array('class_group', $this->contentClass->attribute('match_ingroup_id_list')), array('attribute', $inputField->contentClassAttribute->attribute('id')), array('attribute_identifier', $inputField->contentClassAttribute->attribute('identifier')));
                 $tpl = eZTemplate::factory();
                 $tpl->setVariable('class', $this->contentClass);
                 $tpl->setVariable('attribute', $inputField->contentClassAttribute);
                 $tpl->setVariable('input', $inputField);
                 $res = eZTemplateDesignResource::instance();
                 $res->setKeys($keyArray);
                 $templateName = $inputField->contentClassAttribute->attribute('data_type_string');
                 $attributeFields[$inputField->attribute('id')] = $tpl->fetch('design:class_search_form/datatypes/' . $templateName . '.tpl');
             }
         }
     }
     $tpl->setVariable('attribute_fields', $attributeFields);
     $parameters = array('action' => 'search');
     $tpl->setVariable('parameters', $parameters);
     $formAction = $this->attributes['definition']['ClientBasePath'];
     eZURI::transformURI($formAction);
     $tpl->setVariable('form_action', $formAction);
     $res = eZTemplateDesignResource::instance();
     $res->setKeys($classKeyArray);
     return $tpl->fetch('design:repository/contentclass_client/remote_class_search_form.tpl');
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:43,代码来源:ocrepositorycontentclassclient.php

示例9: sendConfirmation

function sendConfirmation($email, $subscription, $subscribe)
{
    //send mail
    $res = eZTemplateDesignResource::instance();
    $ini = eZINI::instance();
    $hostname = eZSys::hostname();
    if ($subscribe) {
        $template = 'design:eznewsletter/sendout/subscription.tpl';
    } else {
        $template = 'design:eznewsletter/sendout/unsubscription.tpl';
    }
    $tpl = eZNewsletterTemplateWrapper::templateInit();
    $tpl->setVariable('userData', eZUserSubscriptionData::fetch($email));
    $tpl->setVariable('hostname', $hostname);
    $tpl->setVariable('subscription', $subscription);
    $subscriptionList = eZSubscriptionList::fetch($subscription->attribute('subscriptionlist_id'), eZSubscriptionList::StatusPublished, true, true);
    $tpl->setVariable('subscriptionList', $subscriptionList);
    $templateResult = $tpl->fetch($template);
    if ($tpl->hasVariable('subject')) {
        $subject = $tpl->variable('subject');
    }
    $mail = new eZMail();
    $mail->setSender($ini->variable('MailSettings', 'EmailSender'));
    $mail->setReceiver($email);
    $mail->setBody($templateResult);
    $mail->setSubject($subject);
    eZMailTransport::send($mail);
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:28,代码来源:email_subscribe.php

示例10: getCacheKeysArray

 /**
  *  Generate cache  key array based on current user roles, requested url, layout
  *
  * @param $userKeys Array
  * @return array
  */
 public function getCacheKeysArray($userKeys)
 {
     if (!is_array($userKeys)) {
         $userKeys = array($userKeys);
     }
     $user = eZUser::currentUser();
     $limitedAssignmentValueList = $user->limitValueList();
     $roleList = $user->roleIDList();
     $discountList = eZUserDiscountRule::fetchIDListByUserID($user->attribute('contentobject_id'));
     $currentSiteAccess = isset($GLOBALS['eZCurrentAccess']['name']) ? $GLOBALS['eZCurrentAccess']['name'] : false;
     $res = eZTemplateDesignResource::instance();
     $keys = $res->keys();
     $layout = isset($keys['layout']) ? $keys['layout'] : false;
     $uri = eZURI::instance(eZSys::requestURI());
     $actualRequestedURI = $uri->uriString();
     $userParameters = $uri->userParameters();
     $cacheKeysArray = array('spdf2png', $currentSiteAccess, $layout, $actualRequestedURI, implode('.', $userParameters), implode('.', $roleList), implode('.', $limitedAssignmentValueList), implode('.', $discountList), implode('.', $userKeys));
     return $cacheKeysArray;
 }
开发者ID:stevoland,项目名称:ez_sbase,代码行数:25,代码来源:spdf2png.php

示例11: handlePublishEvent

 /**
  * @param eZNotificationEvent $event
  * @param array $parameters
  *
  * @return int
  */
 function handlePublishEvent($event, &$parameters)
 {
     /** @var eZContentObjectVersion $versionObject */
     $versionObject = $event->attribute('content');
     if (!$versionObject) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     /** @var eZContentObject $contentObject */
     $contentObject = $versionObject->attribute('contentobject');
     if (!$contentObject) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     /** @var eZContentObjectTreeNode $contentNode */
     $contentNode = $contentObject->attribute('main_node');
     if (!$contentNode) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     // Notification should only be sent out when the object is published (is visible)
     if ($contentNode->attribute('is_invisible') == 1) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     /** @var eZContentClass $contentClass */
     $contentClass = $contentObject->attribute('content_class');
     if (!$contentClass) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     if ($versionObject->attribute('version') != $contentObject->attribute('current_version')) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     try {
         $post = ITNewsletterPost::instanceFromEzContentObject($contentObject);
         if (!$post instanceof ITNewsletterPost) {
             throw new Exception("Post not found");
         }
         if (!$post->isValid()) {
             throw new Exception("Post not valid");
         }
         /*
                     if ( !$post->attribute( 'is_sent' ) )
                     {
            throw new Exception( "Post not already sent" );
                     }
         * 
         */
     } catch (Exception $e) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $tpl = eZTemplate::factory();
     $tpl->resetVariables();
     /** @var eZContentObjectTreeNode $parentNode */
     $parentNode = $contentNode->attribute('parent');
     if (!$parentNode instanceof eZContentObjectTreeNode) {
         eZDebug::writeError('DB corruption: Node id ' . $contentNode->attribute('node_id') . ' is missing parent node.', __METHOD__);
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     /** @var eZContentObject $parentContentObject */
     $parentContentObject = $parentNode->attribute('object');
     if (!$parentContentObject instanceof eZContentObject) {
         eZDebug::writeError('DB corruption: Node id ' . $parentNode->attribute('node_id') . ' is missing object.', __METHOD__);
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     /** @var eZContentClass $parentContentClass */
     $parentContentClass = $parentContentObject->attribute('content_class');
     if (!$parentContentClass instanceof eZContentClass) {
         eZDebug::writeError('DB corruption: Object id ' . $parentContentObject->attribute('id') . ' is missing class object.', __METHOD__);
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $res = eZTemplateDesignResource::instance();
     $res->setKeys(array(array('object', $contentObject->attribute('id')), array('node', $contentNode->attribute('node_id')), array('class', $contentObject->attribute('contentclass_id')), array('class_identifier', $contentClass->attribute('identifier')), array('parent_node', $contentNode->attribute('parent_node_id')), array('parent_class', $parentContentObject->attribute('contentclass_id')), array('parent_class_identifier', $parentContentClass != null ? $parentContentClass->attribute('identifier') : 0), array('depth', $contentNode->attribute('depth')), array('url_alias', $contentNode->attribute('url_alias'))));
     $tpl->setVariable('object', $contentObject);
     $notificationINI = eZINI::instance('notification.ini');
     $emailSender = $notificationINI->variable('MailSettings', 'EmailSender');
     $ini = eZINI::instance();
     if (!$emailSender) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
     }
     if (!$emailSender) {
         $emailSender = $ini->variable("MailSettings", "AdminEmail");
     }
     $tpl->setVariable('sender', $emailSender);
     $result = $tpl->fetch('design:notification/handler/templatepat/view/plain.tpl');
     $subject = $tpl->variable('subject');
     if ($tpl->hasVariable('message_id')) {
         $parameters['message_id'] = $tpl->variable('message_id');
     }
     if ($tpl->hasVariable('references')) {
         $parameters['references'] = $tpl->variable('references');
     }
     if ($tpl->hasVariable('reply_to')) {
         $parameters['reply_to'] = $tpl->variable('reply_to');
     }
     if ($tpl->hasVariable('from')) {
         $parameters['from'] = $tpl->variable('from');
     }
//.........这里部分代码省略.........
开发者ID:informaticatrentina,项目名称:pat_base,代码行数:101,代码来源:itnewsletterhandler.php

示例12: generateNewsletter

 function generateNewsletter($contentObject)
 {
     // 1. Set resource keys
     $res = eZTemplateDesignResource::instance();
     $res->setKeys(array(array('newslettertype_id', $this->attribute('newslettertype_id')), array('newsletter_id', $this->attribute('id')), array('class_identifier', ''), array('newsletter_type', 'mail')));
     // 2. Set general mail and template properties
     $ini = eZINI::instance();
     $hostname = eZSys::hostname();
     $newsletterType = $this->attribute('newsletter_type');
     // 3. get skin for newsletter
     if ($this->attribute('design_to_use')) {
         $skin_prefix = $this->attribute('design_to_use');
     } else {
         $skin_prefix = 'eznewsletter';
     }
     $mail = new ezpMailComposer();
     $mail->charset = 'utf-8';
     $tpl = eZTemplate::factory();
     $tpl->setVariable('hostname', $hostname);
     $tpl->setVariable('contentobject', $contentObject);
     $tpl->setVariable('newsletter', $this);
     $tpl->setVariable('SkipMIMEPart', false);
     $mail->plainText = $tpl->fetch('design:' . $skin_prefix . '/sendout/text.tpl');
     $mail->plainText = rtrim(preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->plainText));
     if ($tpl->hasVariable('SkipMIMEPart') && $tpl->variable('SkipMIMEPart') === true) {
         $mail->plainText = null;
     }
     $tpl->setVariable('SkipMIMEPart', false);
     $mail->htmlText = $tpl->fetch('design:' . $skin_prefix . '/sendout/html.tpl');
     $mail->htmlText = rtrim(preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->htmlText));
     if ($tpl->hasVariable('SkipMIMEPart') && $tpl->variable('SkipMIMEPart') === true) {
         $mail->htmlText = null;
     }
     if ($tpl->hasVariable('attachments')) {
         foreach ($tpl->hasVariable('attachments') as $attachment) {
             $mail->addFileAttachment($attachment);
         }
     }
     $emailSender = $newsletterType->attribute('sender_address') ? $newsletterType->attribute('sender_address') : $ini->variable('MailSettings', 'EmailSender');
     if ($tpl->hasVariable('emailSenderName')) {
         $mail->from = new ezcMailAddress($emailSender, $tpl->variable('emailSenderName'), 'utf-8');
     } else {
         $mail->from = new ezcMailAddress($emailSender, null, 'utf-8');
     }
     $subject = $this->attribute('name');
     if ($tpl->hasVariable('subject')) {
         $subject = $tpl->variable('subject');
     }
     $mail->subject = $subject;
     $mail->subjectCharset = 'utf-8';
     if (preg_match_all('/(<img)\\s (src="\\/([a-zA-Z0-9-\\.;:!\\/\\?&=_|\\r|\\n]{1,})")/isxmU', $mail->htmlText, $patterns)) {
         foreach ($patterns[3] as $key => $file) {
             if (file_exists($file) and !is_dir($file)) {
                 $mail->htmlText = preg_replace("/" . preg_quote($patterns[0][$key], '/') . "/", $patterns[1][$key] . ' src="file://' . str_replace("\\", "/", eZSys::rootDir()) . '/' . $file . "\"", $mail->htmlText);
             }
         }
     }
     //setting the reply-to head from site.ini
     if ($ini->variable('MailSettings', 'EmailReplyTo') != "") {
         $mail->setHeader('Reply-To', $ini->variable('MailSettings', 'EmailReplyTo'));
     }
     return $mail;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:63,代码来源:eznewsletter.php

示例13: handlePublishEvent

 function handlePublishEvent($event, &$parameters)
 {
     $versionObject = $event->attribute('content');
     if (!$versionObject) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $contentObject = $versionObject->attribute('contentobject');
     if (!$contentObject) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $contentNode = $contentObject->attribute('main_node');
     if (!$contentNode) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     // Notification should only be sent out when the object is published (is visible)
     if ($contentNode->attribute('is_invisible') == 1) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $contentClass = $contentObject->attribute('content_class');
     if (!$contentClass) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     if ($versionObject->attribute('version') != $contentObject->attribute('current_version')) {
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $tpl = eZTemplate::factory();
     $tpl->resetVariables();
     $parentNode = $contentNode->attribute('parent');
     if (!$parentNode instanceof eZContentObjectTreeNode) {
         eZDebug::writeError('DB corruption: Node id ' . $contentNode->attribute('node_id') . ' is missing parent node.', __METHOD__);
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $parentContentObject = $parentNode->attribute('object');
     if (!$parentContentObject instanceof eZContentObject) {
         eZDebug::writeError('DB corruption: Node id ' . $parentNode->attribute('node_id') . ' is missing object.', __METHOD__);
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $parentContentClass = $parentContentObject->attribute('content_class');
     if (!$parentContentClass instanceof eZContentClass) {
         eZDebug::writeError('DB corruption: Object id ' . $parentContentObject->attribute('id') . ' is missing class object.', __METHOD__);
         return eZNotificationEventHandler::EVENT_SKIPPED;
     }
     $res = eZTemplateDesignResource::instance();
     $res->setKeys(array(array('object', $contentObject->attribute('id')), array('node', $contentNode->attribute('node_id')), array('class', $contentObject->attribute('contentclass_id')), array('class_identifier', $contentClass->attribute('identifier')), array('parent_node', $contentNode->attribute('parent_node_id')), array('parent_class', $parentContentObject->attribute('contentclass_id')), array('parent_class_identifier', $parentContentClass != null ? $parentContentClass->attribute('identifier') : 0), array('depth', $contentNode->attribute('depth')), array('url_alias', $contentNode->attribute('url_alias'))));
     $tpl->setVariable('object', $contentObject);
     $notificationINI = eZINI::instance('notification.ini');
     $emailSender = $notificationINI->variable('MailSettings', 'EmailSender');
     $ini = eZINI::instance();
     if (!$emailSender) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
     }
     if (!$emailSender) {
         $emailSender = $ini->variable("MailSettings", "AdminEmail");
     }
     $tpl->setVariable('sender', $emailSender);
     $result = $tpl->fetch('design:notification/handler/ezsubtree/view/plain.tpl');
     $subject = $tpl->variable('subject');
     if ($tpl->hasVariable('message_id')) {
         $parameters['message_id'] = $tpl->variable('message_id');
     }
     if ($tpl->hasVariable('references')) {
         $parameters['references'] = $tpl->variable('references');
     }
     if ($tpl->hasVariable('reply_to')) {
         $parameters['reply_to'] = $tpl->variable('reply_to');
     }
     if ($tpl->hasVariable('from')) {
         $parameters['from'] = $tpl->variable('from');
     }
     if ($tpl->hasVariable('content_type')) {
         $parameters['content_type'] = $tpl->variable('content_type');
     }
     $collection = eZNotificationCollection::create($event->attribute('id'), self::NOTIFICATION_HANDLER_ID, self::TRANSPORT);
     $collection->setAttribute('data_subject', $subject);
     $collection->setAttribute('data_text', $result);
     $collection->store();
     $assignedNodes = $contentObject->parentNodes(true);
     $nodeIDList = array();
     foreach ($assignedNodes as $node) {
         if ($node) {
             $pathString = $node->attribute('path_string');
             $pathString = ltrim(rtrim($pathString, '/'), '/');
             $nodeIDListPart = explode('/', $pathString);
             $nodeIDList = array_merge($nodeIDList, $nodeIDListPart);
         }
     }
     $nodeIDList[] = $contentNode->attribute('node_id');
     $nodeIDList = array_unique($nodeIDList);
     $userList = eZSubtreeNotificationRule::fetchUserList($nodeIDList, $contentObject);
     $locale = eZLocale::instance();
     $weekDayNames = $locale->attribute('weekday_name_list');
     $weekDaysByName = array_flip($weekDayNames);
     foreach ($userList as $subscriber) {
         $item = $collection->addItem($subscriber['address']);
         if ($subscriber['use_digest'] == 0) {
             $settings = eZGeneralDigestUserSettings::fetchByUserId($subscriber['user_id']);
             if ($settings !== null && $settings->attribute('receive_digest') == 1) {
                 $time = $settings->attribute('time');
                 $timeArray = explode(':', $time);
                 $hour = $timeArray[0];
//.........这里部分代码省略.........
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:101,代码来源:ezsubtreehandler.php

示例14: sendSubcriptionMail

 /**
  * This function is only a helpfunction
  *
  * @param $mailTemplate
  * @return unknown_type
  */
 function sendSubcriptionMail($mailTemplate)
 {
     $tplResource = eZTemplateDesignResource::instance();
     $ini = eZINI::instance('site.ini');
     $cjwNewsletterIni = eZINI::instance('cjw_newsletter.ini');
     $hostName = eZSys::hostname();
     // $template = 'design:newsletter/mail/subscription_confirmation.tpl';
     $template = $mailTemplate;
     $newsletterUser = $this;
     include_once 'kernel/common/template.php';
     $tpl = templateInit();
     $tpl->setVariable('newsletter_user', $newsletterUser);
     $tpl->setVariable('hostname', $hostName);
     $templateResult = $tpl->fetch($template);
     // get subject from template var definition
     if ($tpl->hasVariable('subject')) {
         $subject = $tpl->variable('subject');
     }
     $emailSender = $cjwNewsletterIni->variable('NewsletterMailSettings', 'EmailSender');
     $emailSenderName = $cjwNewsletterIni->variable('NewsletterMailSettings', 'EmailSenderName');
     $emailReceiver = $newsletterUser->attribute('email');
     $emailReplyTo = $cjwNewsletterIni->variable('NewsletterMailSettings', 'EmailReplyTo');
     $emailReturnPath = $cjwNewsletterIni->variable('NewsletterMailSettings', 'EmailReturnPath');
     // TODO Namen extrahieren
     $emailReceiverName = '';
     $emailSubject = $subject;
     $emailBody['text'] = $templateResult;
     $cjwMail = new CjwNewsletterMail();
     // x header set for current user
     $cjwMail->setExtraMailHeadersByNewsletterUser($this);
     $cjwMail->setTransportMethodDirectlyFromIni();
     // trigger_error("test error", E_USER_ERROR);
     $sendResult = $cjwMail->sendEmail($emailSender, $emailSenderName, $emailReceiver, $emailReceiverName, $emailSubject, $emailBody, false, 'utf-8', $emailReplyTo, $emailReturnPath);
     return $sendResult;
 }
开发者ID:hudri,项目名称:cjw_newsletter,代码行数:41,代码来源:cjwnewsletteruser.php

示例15: contentViewRetrieve

 /**
  * Retrieve content view data
  *
  * @see contentViewGenerate()
  *
  * @param string $file
  * @param int $mtime File modification time
  * @param array $args Hash containing arguments, the used ones are:
  *  - ini
  *
  * @return \eZClusterFileFailure
  */
 public static function contentViewRetrieve($file, $mtime, $args)
 {
     extract($args);
     $cacheExpired = false;
     // Read Cache file
     if (!eZContentObject::isCacheExpired($mtime)) {
         //        $contents = $cacheFile->fetchContents();
         $contents = file_get_contents($file);
         $Result = unserialize($contents);
         if (!is_array($Result)) {
             $expiryReason = 'Unexpected cache file content';
             $cacheExpired = true;
         }
         // Check if a no_cache key has been set in the viewcache, and
         // return an eZClusterFileFailure if it has
         if (isset($Result['no_cache'])) {
             return new eZClusterFileFailure(3, "Cache has been disabled for this node");
         }
         // Check if cache has expired when cache_ttl is set
         $cacheTTL = isset($Result['cache_ttl']) ? $Result['cache_ttl'] : -1;
         if ($cacheTTL > 0) {
             $expiryTime = $mtime + $cacheTTL;
             if (time() > $expiryTime) {
                 $cacheExpired = true;
                 $expiryReason = 'Content cache is expired by cache_ttl=' . $cacheTTL;
             }
         }
         // Check if template source files are newer, but only if the cache is not expired
         if (!$cacheExpired) {
             $developmentModeEnabled = $ini->variable('TemplateSettings', 'DevelopmentMode') == 'enabled';
             // Only do filemtime checking when development mode is enabled.
             if ($developmentModeEnabled && isset($Result['template_list'])) {
                 foreach ($Result['template_list'] as $templateFile) {
                     if (!file_exists($templateFile)) {
                         $cacheExpired = true;
                         $expiryReason = "Content cache is expired by template file '" . $templateFile . "', it does not exist anymore";
                         break;
                     } else {
                         if (filemtime($templateFile) > $mtime) {
                             $cacheExpired = true;
                             $expiryReason = "Content cache is expired by template file '" . $templateFile . "'";
                             break;
                         }
                     }
                 }
             }
         }
         if (!$cacheExpired) {
             if (!isset($Result['content_info'])) {
                 // set error type & number for kernel errors (see https://jira.ez.no/browse/EZP-23046)
                 if (isset($Result['errorType']) && isset($Result['errorNumber'])) {
                     $res = eZTemplateDesignResource::instance();
                     $res->setKeys(array(array('error_type', $Result['errorType']), array('error_number', $Result['errorNumber'])));
                 }
                 return $Result;
             }
             $keyArray = array(array('object', $Result['content_info']['object_id']), array('node', $Result['content_info']['node_id']), array('parent_node', $Result['content_info']['parent_node_id']), array('parent_node_remote_id', $Result['content_info']['parent_node_remote_id']), array('parent_object_remote_id', $Result['content_info']['parent_object_remote_id']), array('class', $Result['content_info']['class_id']), array('view_offset', $Result['content_info']['offset']), array('navigation_part_identifier', $Result['content_info']['navigation_part_identifier']), array('viewmode', $Result['content_info']['viewmode']), array('depth', $Result['content_info']['node_depth']), array('remote_id', $Result['content_info']['remote_id']), array('node_remote_id', $Result['content_info']['node_remote_id']), array('url_alias', $Result['content_info']['url_alias']), array('persistent_variable', $Result['content_info']['persistent_variable']), array('class_group', $Result['content_info']['class_group']), array('parent_class_id', $Result['content_info']['parent_class_id']), array('parent_class_identifier', $Result['content_info']['parent_class_identifier']), array('state', $Result['content_info']['state']), array('state_identifier', $Result['content_info']['state_identifier']), array('section', $Result['section_id']));
             if (isset($Result['content_info']['class_identifier'])) {
                 $keyArray[] = array('class_identifier', $Result['content_info']['class_identifier']);
             }
             $res = eZTemplateDesignResource::instance();
             $res->setKeys($keyArray);
             return $Result;
         }
     } else {
         $expiryReason = 'Content cache is expired by eZContentObject::isCacheExpired(' . $mtime . ")";
     }
     // Cache is expired so return specialized cluster object
     if (!isset($expiryReason)) {
         $expiryReason = 'Content cache is expired';
     }
     return new eZClusterFileFailure(1, $expiryReason);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:85,代码来源:eznodeviewfunctions.php


注:本文中的eZTemplateDesignResource::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。