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


PHP eZTemplate::instance方法代码示例

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


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

示例1: runModify

    private function runModify( $operatorName, $method )
    {
        $operator = new eZURLOperator();
        $tpl = eZTemplate::instance();

        $operatorValue = null;

        $argument = 'zeargument';
        $expectedResult = 'zevalue';

        switch( $method )
        {
            case 'get'    : $_GET[$argument]     = $expectedResult; break;
            case 'post'   : $_POST[$argument]    = $expectedResult; break;
            case 'cookie' : $_COOKIE[$argument]  = $expectedResult; break;
            case 'session': $_SESSION[$argument] = $expectedResult; break;
        }

        $operatorParameters = array(
            array( array( 1, $argument, false, ), ),
            array( array( 1, $method, false, ), ),
        );

        $namedParameters = array(
            'quote_val'  => $argument,
            'server_url' => $method
        );

        $operator->modify(
            $tpl, $operatorName, $operatorParameters, '', '', $operatorValue, $namedParameters, false
        );

        $this->assertEquals( $expectedResult, $operatorValue );
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:34,代码来源:ezurloperator_test.php

示例2: simplify

 /**
  * Function for simplifying a content object or node
  *
  * @param mixed $obj
  * @param array $params
  * @return array
  */
 public static function simplify($obj, $params = array())
 {
     if (!$obj) {
         return array();
     } else {
         if ($obj instanceof eZContentObject) {
             $node = $obj->attribute('main_node');
             $contentObject = $obj;
         } else {
             if ($obj instanceof eZContentObjectTreeNode || $obj instanceof eZFindResultNode) {
                 $node = $obj;
                 $contentObject = $obj->attribute('object');
             } else {
                 if (isset($params['fetchNodeFunction']) && method_exists($obj, $params['fetchNodeFunction'])) {
                     // You can supply fetchNodeFunction parameter to be able to support other node related classes
                     $node = call_user_func(array($obj, $params['fetchNodeFunction']));
                     if (!$node instanceof eZContentObjectTreeNode) {
                         return '';
                     }
                     $contentObject = $node->attribute('object');
                 } else {
                     if (is_array($obj)) {
                         return $obj;
                         // Array is returned as is
                     } else {
                         return '';
                         // Other passed objects are not supported
                     }
                 }
             }
         }
     }
     $ini = eZINI::instance('site.ini');
     $params = array_merge(array('dataMap' => array(), 'fetchPath' => false, 'fetchSection' => false, 'fetchChildrenCount' => false, 'dataMapType' => array(), 'loadImages' => false, 'imagePreGenerateSizes' => array('small')), $params);
     if (!isset($params['imageSizes'])) {
         $imageIni = eZINI::instance('image.ini');
         $params['imageSizes'] = $imageIni->variable('AliasSettings', 'AliasList');
     }
     if ($params['imageSizes'] === null || !isset($params['imageSizes'][0])) {
         $params['imageSizes'] = array();
     }
     if (!isset($params['imageDataTypes'])) {
         $params['imageDataTypes'] = $ini->variable('ImageDataTypeSettings', 'AvailableImageDataTypes');
     }
     $ret = array();
     $attrtibuteArray = array();
     $ret['name'] = htmlentities($contentObject->attribute('name'), ENT_QUOTES, "UTF-8");
     $ret['contentobject_id'] = $ret['id'] = (int) $contentObject->attribute('id');
     $ret['contentobject_remote_id'] = $contentObject->attribute('remote_id');
     $ret['contentobject_state'] = implode(", ", $contentObject->attribute('state_identifier_array'));
     $ret['main_node_id'] = (int) $contentObject->attribute('main_node_id');
     $ret['version'] = (int) $contentObject->attribute('current_version');
     $ret['modified'] = $contentObject->attribute('modified');
     $ret['published'] = $contentObject->attribute('published');
     $ret['section_id'] = (int) $contentObject->attribute('section_id');
     $ret['current_language'] = $contentObject->attribute('current_language');
     $ret['owner_id'] = (int) $contentObject->attribute('owner_id');
     $ret['class_id'] = (int) $contentObject->attribute('contentclass_id');
     $ret['class_name'] = $contentObject->attribute('class_name');
     $ret['path_identification_string'] = $node->attribute('path_identification_string');
     $ret['translations'] = eZContentLanguage::decodeLanguageMask($contentObject->attribute('language_mask'), true);
     $ret['can_edit'] = $contentObject->attribute('can_edit');
     if (isset($params['formatDate'])) {
         $ret['modified_date'] = self::formatLocaleDate($contentObject->attribute('modified'), $params['formatDate']);
         $ret['published_date'] = self::formatLocaleDate($contentObject->attribute('published'), $params['formatDate']);
     }
     if (isset($params['fetchCreator'])) {
         $creator = $contentObject->attribute('current')->attribute('creator');
         if ($creator instanceof eZContentObject) {
             $ret['creator'] = array('id' => $creator->attribute('id'), 'name' => $creator->attribute('name'));
         } else {
             $ret['creator'] = array('id' => $contentObject->attribute('current')->attribute('creator_id'), 'name' => null);
             // user has been deleted
         }
     }
     if (isset($params['fetchClassIcon'])) {
         $operator = new eZWordToImageOperator();
         $tpl = eZTemplate::instance();
         $operatorValue = $contentObject->attribute('class_identifier');
         $operatorParameters = array(array(array(1, 'small')));
         $namedParameters = array();
         $operatorName = 'class_icon';
         $operator->modify($tpl, $operatorName, $operatorParameters, '', '', $operatorValue, $namedParameters, array());
         $ret['class_icon'] = $operatorValue;
     }
     if (isset($params['fetchThumbPreview'])) {
         $thumbUrl = '';
         $thumbWidth = 0;
         $thumbHeight = 0;
         $thumbDataType = isset($params['thumbDataType']) ? $params['thumbDataType'] : 'ezimage';
         $thumbImageSize = isset($params['thumbImageSize']) ? $params['thumbImageSize'] : 'small';
         foreach ($contentObject->attribute('data_map') as $key => $atr) {
             if ($atr->attribute('data_type_string') == $thumbDataType && $atr->attribute('has_content')) {
//.........这里部分代码省略.........
开发者ID:nfrp,项目名称:ezpublish,代码行数:101,代码来源:ezjscajaxcontent.php

示例3: templatesUsageStatistics

 static function templatesUsageStatistics()
 {
     $tpl = eZTemplate::instance();
     return $tpl->TemplatesUsageStatistics;
 }
开发者ID:,项目名称:,代码行数:5,代码来源:

示例4: eZMail

}
$sub = $NewsletterItem->userData();
$subscription = eZSubscription::fetch($NewsletterItem->attribute('subscription_id'));
$tpl->setVariable('NewsletterItem', $NewsletterItem);
$tpl->setVariable('UserHash', $Params['UserHash']);
$tpl->setVariable('subscriptions', $subscription);
if ($http->hasPostVariable('OKButton')) {
    $subscription->unsubscribe();
    $siteini = eZINI::instance();
    $sender = $siteini->variable('MailSettings', 'EmailSender');
    $mail = new eZMail();
    $mail->setReceiver($sub['email']);
    $mail->setSender($sender);
    $mail->setSubject(ezpI18n::tr('newsletteraddons', "Your subscription removal"));
    $hostName = eZSys::hostname();
    $mailtpl = eZTemplate::instance();
    $mailtpl->setVariable('hostname', $hostName);
    $mailtpl->setVariable('siteaccess', $GLOBALS['eZCurrentAccess']['name']);
    $mailtpl->setVariable('NewsletterItem', $NewsletterItem);
    $mailtext = $mailtpl->fetch('design:eznewsletter/unregister_subscription_email.tpl');
    $mail->setBody($mailtext);
    eZMailTransport::send($mail);
    $Result = array();
    $Result['content'] = $tpl->fetch("design:eznewsletter/unregister_subscription_success.tpl");
    $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('eznewsletter', 'Remove subscription')));
    return;
}
if ($http->hasPostVariable('CancelButton')) {
    $ini = eZINI::instance();
    return $Module->redirectTo($ini->variable('SiteSettings', 'DefaultPage'));
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:unregister_subscription.php


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