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


PHP eZSys类代码示例

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


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

示例1: writeAudit

    /**
     * Writes $auditName with $auditAttributes as content
     * to file name that will be fetched from ini settings by auditNameSettings() for logging.
     *
     * @param string $auditName
     * @param array $auditAttributes
     * @return bool
     */
    static function writeAudit( $auditName, $auditAttributes = array() )
    {
        $enabled = eZAudit::isAuditEnabled();
        if ( !$enabled )
            return false;

        $auditNameSettings = eZAudit::auditNameSettings();

        if ( !isset( $auditNameSettings[$auditName] ) )
            return false;

        $ip = eZSys::clientIP();
        if ( !$ip )
            $ip = eZSys::serverVariable( 'HOSTNAME', true );

        $user = eZUser::currentUser();
        $userID = $user->attribute( 'contentobject_id' );
        $userLogin = $user->attribute( 'login' );

        $message = "[$ip] [$userLogin:$userID]\n";

        foreach ( array_keys( $auditAttributes ) as $attributeKey )
        {
            $attributeValue = $auditAttributes[$attributeKey];
            $message .= "$attributeKey: $attributeValue\n";
        }

        $logName = $auditNameSettings[$auditName]['file_name'];
        $dir = $auditNameSettings[$auditName]['dir'];
        eZLog::write( $message, $logName, $dir );

        return true;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:41,代码来源:ezaudit.php

示例2: __construct

 public function __construct()
 {
     $this->cacheSettings = array('path' => eZSys::cacheDirectory() . '/' . static::$cacheDirectory . '/', 'ttl' => 60);
     $this->debugAccumulatorGroup = 'nxc_social_networks_feed_';
     $this->debugAccumulatorGroup .= strtolower(str_replace(__CLASS__, '', get_called_class()));
     eZDebug::createAccumulatorGroup($this->debugAccumulatorGroup, static::$debugMessagesGroup);
 }
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:7,代码来源:feed.php

示例3: getDataMember

 /**
  * Returns part of the data for the attribute
  *
  * @param string $dataMember
  *
  * @return string
  */
 public function getDataMember($dataMember)
 {
     if ($dataMember === 'related_images') {
         $images = array();
         $relations = $this->ContentObjectAttribute->attribute('content');
         foreach ($relations['relation_list'] as $relation) {
             $object = eZContentObject::fetch($relation['contentobject_id']);
             if ($object instanceof eZContentObject) {
                 $dataMap = $object->attribute('data_map');
                 foreach ($dataMap as $attribute) {
                     /** @var eZContentObjectAttribute $attribute */
                     if ($attribute->attribute('data_type_string') !== eZImageType::DATA_TYPE_STRING) {
                         continue;
                     }
                     if ($attribute->hasContent()) {
                         $imageAliasHandler = $attribute->attribute('content');
                         $imageAlias = $imageAliasHandler->imageAlias('opengraph');
                         if ($imageAlias['is_valid'] == 1) {
                             $images[] = eZSys::serverURL() . '/' . $imageAlias['full_path'];
                         }
                     }
                 }
             }
         }
         if (empty($images)) {
             $images[] = eZSys::serverURL() . eZURLOperator::eZImage(null, 'opengraph_default_image.png', '');
         }
         return $images;
     }
     return $this->getData();
 }
开发者ID:netgen,项目名称:ngopengraph,代码行数:38,代码来源:ngopengraphobjectrelationlist.php

示例4: 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

示例5: eZTemplateImageOperator

 function eZTemplateImageOperator($texttoimageName = "texttoimage", $imageName = "image", $imagefileName = "imagefile")
 {
     $this->Operators = array($texttoimageName, $imageName, $imagefileName);
     $ini = eZINI::instance('texttoimage.ini');
     $fontDirs = $ini->variable("PathSettings", "FontDir");
     $this->FontDir = array();
     foreach ($fontDirs as $fontDir) {
         $this->FontDir[] = $fontDir;
     }
     $this->CacheDir = $ini->variable("PathSettings", "CacheDir");
     $this->HTMLDir = eZSys::wwwDir() . $ini->variable("PathSettings", "HtmlDir");
     $this->DefaultClass = 'default';
     $this->Family = "arial";
     $this->Colors = array("bgcolor" => array(255, 255, 255), "textcolor" => array(0, 0, 0));
     $this->PointSize = 12;
     $this->Angle = 0;
     $this->XAdjust = 0;
     $this->YAdjust = 0;
     $this->WAdjust = 0;
     $this->HAdjust = 0;
     $this->UseCache = true;
     if ($ini->variable("ImageSettings", "UseCache") == "disabled") {
         $this->UseCache = false;
     }
     $functions = array("ImageTTFBBox", "ImageCreate", "ImageColorAllocate", "ImageColorAllocate", "ImageTTFText", "ImagePNG", "ImageJPEG", "ImageDestroy");
     $this->MissingGDFunctions = array();
     foreach ($functions as $function) {
         if (!function_exists($function)) {
             $this->MissingGDFunctions[] = $function;
         }
     }
     $this->ImageGDSupported = count($this->MissingGDFunctions) == 0;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:33,代码来源:eztemplateimageoperator.php

示例6: filePathForBinaryFile

function filePathForBinaryFile($fileName, $mimeType)
{
    $storageDir = eZSys::storageDirectory();
    list($group, $type) = explode('/', $mimeType);
    $filePath = $storageDir . '/original/' . $group . '/' . $fileName;
    return $filePath;
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:7,代码来源:clusterize.php

示例7: reCAPTCHAValidate

 static function reCAPTCHAValidate($http)
 {
     // check if the current user is able to bypass filling in the captcha and
     // return true without checking if so
     $currentUser = eZUser::currentUser();
     $accessAllowed = $currentUser->hasAccessTo('recaptcha', 'bypass_captcha');
     if ($accessAllowed["accessWord"] == 'yes') {
         return true;
     }
     $ini = eZINI::instance('recaptcha.ini');
     // If PrivateKey is an array try and find a match for the current host
     $privatekey = $ini->variable('Keys', 'PrivateKey');
     if (is_array($privatekey)) {
         $hostname = eZSys::hostname();
         if (isset($privatekey[$hostname])) {
             $privatekey = $privatekey[$hostname];
         } else {
             // try our luck with the first entry
             $privatekey = array_shift($privatekey);
         }
     }
     $recaptcha_challenge_field = $http->postVariable('recaptcha_challenge_field');
     $recaptcha_response_field = $http->postVariable('recaptcha_response_field');
     $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $recaptcha_challenge_field, $recaptcha_response_field);
     return $resp->is_valid;
 }
开发者ID:nfrp,项目名称:ezpublish-recaptcha,代码行数:26,代码来源:recaptchatype.php

示例8: eZSurveyFile

 function eZSurveyFile($row = false)
 {
     $bfsf_ini = eZINI::instance('bfsurveyfile.ini');
     $varPath = eZSys::storageDirectory();
     $survey_object_id = 0;
     //get survey object (lookup object ID, as the survey_id changes with each edit)
     $survey = new eZSurveyType();
     $surveyObject = $survey->fetchSurveyByID($row['survey_id']);
     if ($surveyObject) {
         $survey_object_id = $surveyObject->attribute('contentobject_id');
     }
     //set directory paths
     $surveyUploadDir = self::UPLOAD_DIR_BASE . '/' . self::UPLOAD_DIR_PREFIX . $survey_object_id . '/';
     // syntax example: surveryfiles/survey_123/
     $this->uploadPath = $varPath . '/' . $surveyUploadDir;
     //create directory if NOT exists
     if (!is_dir($this->uploadPath)) {
         mkdir($this->uploadPath, 0777, true);
     }
     //TODO: error if directory cannot be created
     //set allowed file extensions
     $allowedExtensions = $bfsf_ini->variable('SurveyFile', 'AllowedExtensions');
     if (isset($allowedExtensions)) {
         $this->allowedExtensions = $allowedExtensions;
     }
     //set max file size
     $sizeLimit = $bfsf_ini->variable('SurveyFile', 'MaxFileSize');
     $row['type'] = 'File';
     if (!isset($row['mandatory'])) {
         $row['mandatory'] = 0;
     }
     $this->eZSurveyQuestion($row);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:33,代码来源:ezsurveyfile.php

示例9: sendMail

 function sendMail(ezcMail $mail)
 {
     $separator = "/";
     $mail->appendExcludeHeaders(array('to', 'subject'));
     $headers = rtrim($mail->generateHeaders());
     // rtrim removes the linebreak at the end, mail doesn't want it.
     if (count($mail->to) + count($mail->cc) + count($mail->bcc) < 1) {
         throw new ezcMailTransportException('No recipient addresses found in message header.');
     }
     $additionalParameters = "";
     if (isset($mail->returnPath)) {
         $additionalParameters = "-f{$mail->returnPath->email}";
     }
     $sys = eZSys::instance();
     $fname = time() . '-' . rand() . '.mail';
     $qdir = eZSys::siteDir() . eZSys::varDirectory() . $separator . 'mailq';
     $data = $headers . ezcMailTools::lineBreak();
     $data .= ezcMailTools::lineBreak();
     $data .= $mail->generateBody();
     $data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $data);
     $success = eZFile::create($fname, $qdir, $data);
     if ($success === false) {
         throw new ezcMailTransportException('The email could not be sent by sendmail');
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:25,代码来源:eznewsletterfiletransport.php

示例10: getPHPCreatorInstance

 /**
  * @deprecated since 2.1
  * Get instance of PHPCreator to use for storing and loading
  * look up table.
  *
  * @return eZPHPCreator return instance of eZPHPCreator
  * @todo Refactor with ezcPhpGenerator
  *       http://ezcomponents.org/docs/api/trunk/classtrees_PhpGenerator.html
  */
 protected function getPHPCreatorInstance()
 {
     if (empty(self::$PHPCreator)) {
         self::$PHPCreator = new eZPHPCreator(eZDIR::path(array(eZSys::storageDirectory(), ezfSolrDocumentFieldName::LOOKUP_FILEDIR)), ezfSolrDocumentFieldName::LOOKUP_FILENAME);
     }
     return self::$PHPCreator;
 }
开发者ID:netbliss,项目名称:ezfind,代码行数:16,代码来源:ezfsolrdocumentfieldname.php

示例11: modify

 function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
 {
     switch ($operatorName) {
         case 'parsexml':
             $firstParam = $namedParameters['first_param'];
             if (trim($operatorValue) != '') {
                 $dom = new DOMDocument('1.0', 'utf-8');
                 if ($dom->loadXML($operatorValue)) {
                     $FileAttributeValue = $dom->getElementsByTagName($firstParam)->item(0)->textContent;
                     if (!$FileAttributeValue) {
                         $FileAttributeValue = $dom->getElementsByTagName($firstParam)->item(0)->getAttribute('value');
                     }
                 }
                 $operatorValue = $FileAttributeValue;
             }
             break;
         case 'filecheck':
             if (trim($operatorValue) != '') {
                 $dom = new DOMDocument('1.0', 'utf-8');
                 if ($dom->loadXML($operatorValue)) {
                     $FileAttributeValue = $dom->getElementsByTagName('Filename')->item(0)->textContent;
                     if (!$FileAttributeValue) {
                         $FileAttributeValue = $dom->getElementsByTagName('Filename')->item(0)->getAttribute('value');
                     }
                 }
                 if (file_exists(eZSys::wwwDir() . $FileAttributeValue)) {
                     $operatorValue = true;
                 } else {
                     $operatorValue = false;
                 }
             }
             break;
     }
 }
开发者ID:Alexnder,项目名称:enhancedezbinaryfile,代码行数:34,代码来源:templateparsexmloperator.php

示例12: modify

 function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'recaptcha_get_html':
             include_once 'extension/recaptcha/classes/recaptchalib.php';
             // Retrieve the reCAPTCHA public key from the ini file
             $ini = eZINI::instance('recaptcha.ini');
             $key = $ini->variable('Keys', 'PublicKey');
             if (is_array($key)) {
                 $hostname = eZSys::hostname();
                 if (isset($key[$hostname])) {
                     $key = $key[$hostname];
                 } else {
                     // try our luck with the first entry
                     $key = array_shift($key);
                 }
             }
             // check if the current user is able to bypass filling in the captcha and
             // return nothing so that no captcha is displayed
             $currentUser = eZUser::currentUser();
             $accessAllowed = $currentUser->hasAccessTo('recaptcha', 'bypass_captcha');
             if ($accessAllowed["accessWord"] == 'yes') {
                 $operatorValue = 'User bypasses CAPTCHA';
             } else {
                 // Run the HTML generation code from the reCAPTCHA PHP library
                 $operatorValue = recaptcha_get_html($key);
             }
             break;
     }
 }
开发者ID:landinsicht,项目名称:ezpublish-recaptcha,代码行数:30,代码来源:recaptchatemplateoperator.php

示例13: extension_path

/**
 * Loose extension path function for include use originally from ezextension.php
 *
 * @deprecated Since 4.3
 */
function extension_path($extension, $withWWWDir = false, $withHost = false, $withProtocol = false)
{
    $base = eZExtension::baseDirectory();
    $path = '';
    if ($withProtocol) {
        if (is_string($withProtocol)) {
            $path .= $withProtocol;
        } else {
            $path .= eZSys::serverProtocol();
        }
        $path .= ':';
    }
    if ($withHost) {
        $path .= '//';
        if (is_string($withHost)) {
            $path .= $withHost;
        } else {
            $path .= eZSys::hostname();
        }
    }
    if ($withWWWDir) {
        $path .= eZSys::wwwDir();
    }
    if ($withWWWDir) {
        $path .= '/' . $base . '/' . $extension;
    } else {
        $path .= $base . '/' . $extension;
    }
    return $path;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:35,代码来源:ezincludefunctions.php

示例14: sendMail

 function sendMail(eZMail $mail)
 {
     $ini = eZINI::instance();
     $sendmailOptions = '';
     $emailFrom = $mail->sender();
     $emailSender = isset($emailFrom['email']) ? $emailFrom['email'] : false;
     if (!$emailSender || count($emailSender) <= 0) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
     }
     if (!$emailSender) {
         $emailSender = $ini->variable('MailSettings', 'AdminEmail');
     }
     if (!eZMail::validate($emailSender)) {
         $emailSender = false;
     }
     $isSafeMode = ini_get('safe_mode') != 0;
     $sendmailOptionsArray = $ini->variable('MailSettings', 'SendmailOptions');
     if (is_array($sendmailOptionsArray)) {
         $sendmailOptions = implode(' ', $sendmailOptionsArray);
     } elseif (!is_string($sendmailOptionsArray)) {
         $sendmailOptions = $sendmailOptionsArray;
     }
     if (!$isSafeMode and $emailSender) {
         $sendmailOptions .= ' -f' . $emailSender;
     }
     if ($isSafeMode and $emailSender and $mail->sender() == false) {
         $mail->setSenderText($emailSender);
     }
     if (function_exists('mail')) {
         $message = $mail->body();
         $sys = eZSys::instance();
         $excludeHeaders = array('Subject');
         // If not Windows PHP mail() implementation, we can not specify a To: header in the $additional_headers parameter,
         // because then there will be 2 To: headers in the resulting e-mail.
         // However, we can use "undisclosed-recipients:;" in $to.
         if ($sys->osType() != 'win32') {
             $excludeHeaders[] = 'To';
             $receiverEmailText = count($mail->ReceiverElements) > 0 ? $mail->receiverEmailText() : 'undisclosed-recipients:;';
         } else {
             $receiverEmailText = $mail->receiverEmailText();
         }
         // If in debug mode, send to debug email address and nothing else
         if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
             $receiverEmailText = $ini->variable('MailSettings', 'DebugReceiverEmail');
             $excludeHeaders[] = 'To';
             $excludeHeaders[] = 'Cc';
             $excludeHeaders[] = 'Bcc';
         }
         $extraHeaders = $mail->headerText(array('exclude-headers' => $excludeHeaders));
         $returnedValue = mail($receiverEmailText, $mail->subject(), $message, $extraHeaders, $sendmailOptions);
         if ($returnedValue === false) {
             eZDebug::writeError('An error occurred while sending e-mail. Check the Sendmail error message for further information (usually in /var/log/messages)', __METHOD__);
         }
         return $returnedValue;
     } else {
         eZDebug::writeWarning("Unable to send mail: 'mail' function is not compiled into PHP.", __METHOD__);
     }
     return false;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:59,代码来源:ezsendmailtransport.php

示例15: __construct

 /**
  * Constructor
  */
 function __construct()
 {
     $this->Timestamps = array();
     $this->IsModified = false;
     $cacheDirectory = eZSys::cacheDirectory();
     $this->CacheFile = eZClusterFileHandler::instance($cacheDirectory . '/' . 'expiry.php');
     $this->restore();
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:11,代码来源:ezexpiryhandler.php


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