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


PHP eZTextCodec::internalCharset方法代码示例

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


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

示例1: _connect

 /**
  * Reimplement parent's method to make use of a tracing dfs backend class
  */
 public function _connect()
 {
     $siteINI = eZINI::instance('site.ini');
     // DB Connection setup
     // This part is not actually required since _connect will only be called
     // once, but it is useful to run the unit tests. So be it.
     // @todo refactor this using eZINI::setVariable in unit tests
     if (parent::$dbparams === null) {
         $fileINI = eZINI::instance('file.ini');
         parent::$dbparams = array();
         parent::$dbparams['host'] = $fileINI->variable('eZDFSClusteringSettings', 'DBHost');
         $dbPort = $fileINI->variable('eZDFSClusteringSettings', 'DBPort');
         parent::$dbparams['port'] = $dbPort !== '' ? $dbPort : null;
         parent::$dbparams['socket'] = $fileINI->variable('eZDFSClusteringSettings', 'DBSocket');
         parent::$dbparams['dbname'] = $fileINI->variable('eZDFSClusteringSettings', 'DBName');
         parent::$dbparams['user'] = $fileINI->variable('eZDFSClusteringSettings', 'DBUser');
         parent::$dbparams['pass'] = $fileINI->variable('eZDFSClusteringSettings', 'DBPassword');
         parent::$dbparams['max_connect_tries'] = $fileINI->variable('eZDFSClusteringSettings', 'DBConnectRetries');
         parent::$dbparams['max_execute_tries'] = $fileINI->variable('eZDFSClusteringSettings', 'DBExecuteRetries');
         parent::$dbparams['sql_output'] = $siteINI->variable("DatabaseSettings", "SQLOutput") == "enabled";
         parent::$dbparams['cache_generation_timeout'] = $siteINI->variable("ContentSettings", "CacheGenerationTimeout");
     }
     $serverString = parent::$dbparams['host'];
     if (parent::$dbparams['socket']) {
         $serverString .= ':' . parent::$dbparams['socket'];
     } elseif (parent::$dbparams['port']) {
         $serverString .= ':' . parent::$dbparams['port'];
     }
     $maxTries = parent::$dbparams['max_connect_tries'];
     $tries = 0;
     eZPerfLogger::accumulatorStart('mysql_cluster_connect', 'MySQL Cluster', 'Cluster database connection');
     while ($tries < $maxTries) {
         if ($this->db = mysqli_connect(parent::$dbparams['host'], parent::$dbparams['user'], parent::$dbparams['pass'], parent::$dbparams['dbname'], parent::$dbparams['port'])) {
             break;
         }
         ++$tries;
     }
     eZPerfLogger::accumulatorStop('mysql_cluster_connect');
     if (!$this->db) {
         throw new eZClusterHandlerDBNoConnectionException($serverString, parent::$dbparams['user'], parent::$dbparams['pass']);
     }
     /*if ( !mysql_select_db( parent::$dbparams['dbname'], $this->db ) )
       throw new eZClusterHandlerDBNoDatabaseException( parent::$dbparams['dbname'] );*/
     // DFS setup
     if ($this->dfsbackend === null) {
         $this->dfsbackend = new eZDFSFileHandlerTracing46DFSBackend();
     }
     $charset = trim($siteINI->variable('DatabaseSettings', 'Charset'));
     if ($charset === '') {
         $charset = eZTextCodec::internalCharset();
     }
     if ($charset) {
         if (!mysqli_set_charset($this->db, eZMySQLCharset::mapTo($charset))) {
             $this->_fail("Failed to set Database charset to {$charset}.");
         }
     }
 }
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:60,代码来源:tracingmysqli.php

示例2: transformByGroup

 function transformByGroup($text, $group, $charset = false, $useCache = true)
 {
     if ($text === '') {
         return $text;
     }
     $charsetName = $charset === false ? eZTextCodec::internalCharset() : eZCharsetInfo::realCharsetCode($charset);
     if ($useCache) {
         // CRC32 is used for speed, MD5 would be more unique but is slower
         $keyText = 'Group:' . $group;
         $key = eZSys::ezcrc32($keyText . '-' . $charset);
         $filepath = $this->cacheFilePath('g-' . $group . '-', '-' . $charsetName, $key);
         // Try to execute code in the cache file, if it succeeds
         // \a $text will/ transformated
         $retText = $this->executeCacheFile($text, $filepath);
         if ($retText !== false) {
             return $retText;
         }
     }
     $commands = $this->groupCommands($group);
     if ($commands === false) {
         return false;
     }
     $mapper = new eZCodeMapper();
     $mapper->loadTransformationFiles($charsetName, $group);
     $rules = array();
     foreach ($commands as $command) {
         $rules = array_merge($rules, $mapper->decodeCommand($command['command'], $command['parameters']));
     }
     // First generate a unicode based mapping table from the rules
     $unicodeTable = $mapper->generateMappingCode($rules);
     unset($unicodeTable[0]);
     // Then transform that to a table that works with the current charset
     // Any character not available in the current charset will be removed
     $charsetTable = $mapper->generateCharsetMappingTable($unicodeTable, $charset);
     $transformationData = array('table' => $charsetTable);
     unset($unicodeTable);
     if ($useCache) {
         $extraCode = '';
         foreach ($commands as $command) {
             $code = $mapper->generateCommandCode($command, $charsetName);
             if ($code !== false) {
                 $extraCode .= $code . "\n";
             }
         }
         $this->storeCacheFile($filepath, $transformationData, $extraCode, 'Group:' . $group, $charsetName);
     }
     // Execute transformations
     $text = strtr($text, $transformationData['table']);
     // Execute custom code
     foreach ($commands as $command) {
         $mapper->executeCommandCode($text, $command, $charsetName);
     }
     return $text;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:54,代码来源:ezchartransform.php

示例3: _connect

 function _connect()
 {
     $siteINI = eZINI::instance('site.ini');
     if (!isset($GLOBALS['eZDBFileHandlerMysqlBackend_dbparams'])) {
         $fileINI = eZINI::instance('file.ini');
         $params['host'] = $fileINI->variable('ClusteringSettings', 'DBHost');
         $params['port'] = $fileINI->variable('ClusteringSettings', 'DBPort');
         $params['socket'] = $fileINI->variable('ClusteringSettings', 'DBSocket');
         $params['dbname'] = $fileINI->variable('ClusteringSettings', 'DBName');
         $params['user'] = $fileINI->variable('ClusteringSettings', 'DBUser');
         $params['pass'] = $fileINI->variable('ClusteringSettings', 'DBPassword');
         $params['chunk_size'] = $fileINI->variable('ClusteringSettings', 'DBChunkSize');
         $params['max_connect_tries'] = $fileINI->variable('ClusteringSettings', 'DBConnectRetries');
         $params['max_execute_tries'] = $fileINI->variable('ClusteringSettings', 'DBExecuteRetries');
         $params['sql_output'] = $siteINI->variable("DatabaseSettings", "SQLOutput") == "enabled";
         $params['cache_generation_timeout'] = $siteINI->variable("ContentSettings", "CacheGenerationTimeout");
         $GLOBALS['eZDBFileHandlerMysqlBackend_dbparams'] = $params;
     } else {
         $params = $GLOBALS['eZDBFileHandlerMysqlBackend_dbparams'];
     }
     $this->dbparams = $params;
     $maxTries = $params['max_connect_tries'];
     $tries = 0;
     eZDebug::accumulatorStart('mysql_cluster_connect', 'mysql_cluster_total', 'Cluster_database_connection');
     while ($tries < $maxTries) {
         /// @todo what if port is null, '' ??? to be tested
         if ($this->db = mysqli_connect($params['host'], $params['user'], $params['pass'], $params['dbname'], $params['port'])) {
             break;
         }
         ++$tries;
     }
     eZDebug::accumulatorStop('mysql_cluster_connect');
     if (!$this->db) {
         return $this->_die("Unable to connect to storage server");
     }
     $charset = trim($siteINI->variable('DatabaseSettings', 'Charset'));
     if ($charset === '') {
         $charset = eZTextCodec::internalCharset();
     }
     if ($charset) {
         if (!mysqli_set_charset($this->db, eZMySQLCharset::mapTo($charset))) {
             return $this->_die("Failed to set Database charset to {$charset}.");
         }
     }
 }
开发者ID:legende91,项目名称:ez,代码行数:45,代码来源:mysqli.php

示例4: instance

 public static function instance()
 {
     if ( is_null(self::$_instance) )
     {
         $ini = eZINI::instance();
         if ( !$ini->hasSection( 'MMDatabaseSettings') )
             return eZDB::instance();
         
         list( $server, $port, $user, $pwd, $db ) =
             $ini->variableMulti( 'MMDatabaseSettings', array( 'Server', 'Port', 'User', 'Password', 'Database' ) );
         list( $charset, $retries, $usePersistentConnection ) =
             $ini->variableMulti( 'DatabaseSettings', array( 'Charset', 'ConnectRetries', 'UserPersistentConnection' ) );
         
         $isInternalCharset = false;
         if ( trim( $charset ) == '' )
         {
             $charset = eZTextCodec::internalCharset();
             $isInternalCharset = true;
         }
         $builtinEncoding = ( $ini->variable( 'DatabaseSettings', 'UseBuiltinEncoding' ) == 'true' );
         
         $params = array('server' => $server,
                         'port' => $port,
                         'user' => $user,
                         'password' => $pwd,
                         'database' => $db,
                         'use_slave_server' => false,
                         'slave_server' => null,
                         'slave_port' => null,
                         'slave_user' => null,
                         'slave_password' => null,
                         'slave_database' => null,
                         'charset' => $charset,
                         'is_internal_charset' => $isInternalCharset,
                         'socket' => false,
                         'builtin_encoding' => $builtinEncoding,
                         'connect_retries' => $retries,
                         'use_persistent_connection' => $usePersistentConnection,
                         'show_errors' => true );
         self::$_instance = new eZMySQLiDB( $params );
     }
     
     return self::$_instance;
 }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:44,代码来源:mmdb.php

示例5: __construct

 function __construct()
 {
     $this->ReceiverElements = array();
     $this->MobileElements = array();
     $this->From = false;
     $this->CcElements = array();
     $this->BccElements = array();
     $this->ReplyTo = false;
     $this->Subject = false;
     $this->BodyText = false;
     $this->ExtraHeaders = array();
     $this->TextCodec = false;
     $this->MessageID = false;
     $this->Date = false;
     // Sets some default values
     $version = eZPublishSDK::version();
     $this->MIMEVersion = '1.0';
     $this->ContentType = array('type' => 'text/plain', 'charset' => eZTextCodec::internalCharset(), 'transfer-encoding' => '8bit', 'disposition' => 'inline', 'boundary' => false);
     $this->UserAgent = "eZ publish, Version {$version}";
     $ini = eZINI::instance();
     // HACK! Ignore system content type
     //if ( $ini->hasVariable( 'MailSettings', 'ContentType' ) )
     //    $this->setContentType( $ini->variable( 'MailSettings', 'ContentType' ) );
     if (!defined('EZ_MAIL_LINE_SEPARATOR')) {
         $ini = eZINI::instance('site.ini');
         $ending = $ini->variable('MailSettings', 'HeaderLineEnding');
         if ($ending == 'auto') {
             $sys = eZSys::instance();
             // For windows we use \r\n which is the endline defined in RFC 2045
             if ($sys->osType() == 'win32') {
                 $separator = "\r\n";
             } else {
                 $separator = "\n";
             }
         } else {
             $separator = urldecode($ending);
         }
         define('EZ_MAIL_LINE_SEPARATOR', $separator);
     }
 }
开发者ID:stevoland,项目名称:ez_patch,代码行数:40,代码来源:eznewslettermail.php

示例6: _connect

 function _connect($newLink = false)
 {
     $siteINI = eZINI::instance('site.ini');
     if (!isset($GLOBALS['eZDBFileHandlerMysqlBackend_dbparams'])) {
         $fileINI = eZINI::instance('file.ini');
         $params['host'] = $fileINI->variable('ClusteringSettings', 'DBHost');
         $params['port'] = $fileINI->variable('ClusteringSettings', 'DBPort');
         $params['socket'] = $fileINI->variable('ClusteringSettings', 'DBSocket');
         $params['dbname'] = $fileINI->variable('ClusteringSettings', 'DBName');
         $params['user'] = $fileINI->variable('ClusteringSettings', 'DBUser');
         $params['pass'] = $fileINI->variable('ClusteringSettings', 'DBPassword');
         $params['chunk_size'] = $fileINI->variable('ClusteringSettings', 'DBChunkSize');
         $params['max_connect_tries'] = $fileINI->variable('ClusteringSettings', 'DBConnectRetries');
         $params['max_execute_tries'] = $fileINI->variable('ClusteringSettings', 'DBExecuteRetries');
         $params['sql_output'] = $siteINI->variable("DatabaseSettings", "SQLOutput") == "enabled";
         $params['cache_generation_timeout'] = $siteINI->variable("ContentSettings", "CacheGenerationTimeout");
         $GLOBALS['eZDBFileHandlerMysqlBackend_dbparams'] = $params;
     } else {
         $params = $GLOBALS['eZDBFileHandlerMysqlBackend_dbparams'];
     }
     $this->dbparams = $params;
     $serverString = $params['host'];
     if ($params['socket']) {
         $serverString .= ':' . $params['socket'];
     } elseif ($params['port']) {
         $serverString .= ':' . $params['port'];
     }
     $maxTries = $params['max_connect_tries'];
     $tries = 0;
     while ($tries < $maxTries) {
         if ($this->db = mysql_connect($serverString, $params['user'], $params['pass'], $newLink)) {
             break;
         }
         ++$tries;
     }
     if (!$this->db) {
         return $this->_die("Unable to connect to storage server");
     }
     if (!mysql_select_db($params['dbname'], $this->db)) {
         return $this->_die("Unable to select database {$params['dbname']}");
     }
     $charset = trim($siteINI->variable('DatabaseSettings', 'Charset'));
     if ($charset === '') {
         $charset = eZTextCodec::internalCharset();
     }
     if ($charset) {
         if (!mysql_query("SET NAMES '" . eZMySQLCharset::mapTo($charset) . "'", $this->db)) {
             return $this->_die("Failed to set Database charset to {$charset}.");
         }
     }
 }
开发者ID:rmiguel,项目名称:ezpublish,代码行数:51,代码来源:mysql.php

示例7:

            if ( $customMatch['match_file'] == $template )
            {
                $originalTemplate = $overrideSetting['template'];
                break 2;
            }
        }
    }
}

/* Check if we need to do characterset conversions for editting and saving
 * templates. */
$templateConfig = eZINI::instance( 'template.ini' );
$i18nConfig = eZINI::instance( 'i18n.ini' );

/* First we check the HTML Output Charset */
$outputCharset = eZTextCodec::internalCharset();

if ( $module->isCurrentAction( 'Save' ) )
{
    if ( $http->hasPostVariable( 'TemplateContent' ) )
    {
        $templateContent = $http->postVariable( 'TemplateContent' );

        if ( $templateConfig->variable( 'CharsetSettings', 'AutoConvertOnSave') == 'enabled' )
        {
            $outputCharset = eZCharsetInfo::realCharsetCode( $outputCharset );
            if ( preg_match( '|{\*\?template.*charset=([a-zA-Z0-9-]*).*\?\*}|', $templateContent, $matches ) )
            {
                $templateContent = preg_replace( '|({\*\?template.*charset=)[a-zA-Z0-9-]*(.*\?\*})|',
                                                 '\\1'. $outputCharset. '\\2',
                                                 $templateContent );
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:31,代码来源:templateedit.php

示例8: md5

eZURI::setTransformURIMode('full');
if ($cacheTime <= 0) {
    $xmlDoc = $RSSExport->attribute('rss-xml-content');
    $rssContent = $xmlDoc;
} else {
    $cacheDir = eZSys::cacheDirectory();
    $currentSiteAccessName = $GLOBALS['eZCurrentAccess']['name'];
    $cacheFilePath = $cacheDir . '/rss/' . md5($currentSiteAccessName . $feedName) . '.xml';
    if (!is_dir(dirname($cacheFilePath))) {
        eZDir::mkdir(dirname($cacheFilePath), false, true);
    }
    $cacheFile = eZClusterFileHandler::instance($cacheFilePath);
    if (!$cacheFile->exists() or time() - $cacheFile->mtime() > $cacheTime) {
        $xmlDoc = $RSSExport->attribute('rss-xml-content');
        // Get current charset
        $charset = eZTextCodec::internalCharset();
        $rssContent = trim($xmlDoc);
        $cacheFile->storeContents($rssContent, 'rsscache', 'xml');
    } else {
        $lastModified = gmdate('D, d M Y H:i:s', $cacheFile->mtime()) . ' GMT';
        if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
            $ifModifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
            // Internet Explorer specific
            $pos = strpos($ifModifiedSince, ';');
            if ($pos !== false) {
                $ifModifiedSince = substr($ifModifiedSince, 0, $pos);
            }
            if (strcmp($lastModified, $ifModifiedSince) == 0) {
                header('HTTP/1.1 304 Not Modified');
                header('Last-Modified: ' . $lastModified);
                header('X-Powered-By: ' . eZPublishSDK::EDITION);
开发者ID:nfrp,项目名称:ezpublish,代码行数:31,代码来源:feed.php

示例9: instance

 /**
  * Returns a shared instance of the eZDBInterface class aka database object.
  * If you want to change the current database values you should use $forceNewInstance.
  *
  * @param string|false $databaseImplementation
  * @param array|false $databaseParameters If array, then key 'use_defaults' (bool) is used.
  * @param bool $forceNewInstance
  * @return eZDBInterface
  */
 static function instance($databaseImplementation = false, $databaseParameters = false, $forceNewInstance = false)
 {
     $impl =& $GLOBALS['eZDBGlobalInstance'];
     $fetchInstance = false;
     if (!$impl instanceof eZDBInterface) {
         $fetchInstance = true;
     }
     if ($forceNewInstance) {
         unset($impl);
         $impl = false;
         $fetchInstance = true;
     }
     $useDefaults = true;
     if (is_array($databaseParameters) and isset($databaseParameters['use_defaults'])) {
         $useDefaults = $databaseParameters['use_defaults'];
     }
     if ($fetchInstance) {
         $ini = eZINI::instance();
         if ($databaseImplementation === false and $useDefaults) {
             $databaseImplementation = $ini->variable('DatabaseSettings', 'DatabaseImplementation');
         }
         $server = $user = $pwd = $db = $usePersistentConnection = $port = false;
         if ($useDefaults) {
             list($server, $port, $user, $pwd, $db, $usePersistentConnection) = $ini->variableMulti('DatabaseSettings', array('Server', 'Port', 'User', 'Password', 'Database', 'UsePersistentConnection'));
         }
         $socketPath = false;
         if ($useDefaults) {
             $socket = $ini->variable('DatabaseSettings', 'Socket');
             if (trim($socket != "") and $socket != "disabled") {
                 $socketPath = $socket;
             }
         }
         // Check slave servers
         $slaveServer = null;
         $slaveServerPort = null;
         $slaveServerUser = null;
         $slaveServerPassword = null;
         $slaveServerDatabase = null;
         $useSlave = $ini->variable('DatabaseSettings', 'UseSlaveServer');
         if ($useSlave == "enabled") {
             $slaveServers = $ini->variable('DatabaseSettings', 'SlaveServerArray');
             $slaveServerPorts = $ini->variable('DatabaseSettings', 'SlaveServerPort');
             $slaveServerUsers = $ini->variable('DatabaseSettings', 'SlaverServerUser');
             $slaveServerPasswords = $ini->variable('DatabaseSettings', 'SlaverServerPassword');
             $slaveServerDatabases = $ini->variable('DatabaseSettings', 'SlaverServerDatabase');
             $numberServers = count($slaveServers);
             if ($numberServers > 1) {
                 $index = mt_rand(1, $numberServers) - 1;
             } else {
                 $index = 0;
             }
             $slaveServer = $slaveServers[$index];
             $slaveServerPort = $slaveServerPorts[$index];
             $slaveServerUser = $slaveServerUsers[$index];
             $slaveServerPassword = $slaveServerPasswords[$index];
             $slaveServerDatabase = $slaveServerDatabases[$index];
         }
         list($charset, $retries) = $ini->variableMulti('DatabaseSettings', array('Charset', 'ConnectRetries'));
         $isInternalCharset = false;
         if (trim($charset) == '') {
             $charset = eZTextCodec::internalCharset();
             $isInternalCharset = true;
         }
         $builtinEncoding = $ini->variable('DatabaseSettings', 'UseBuiltinEncoding') == 'true';
         $impl = null;
         $useSlaveServer = false;
         if ($useSlave == "enabled") {
             $useSlaveServer = true;
         }
         $defaultDatabaseParameters = array('server' => $server, 'port' => $port, 'user' => $user, 'password' => $pwd, 'database' => $db, 'use_slave_server' => $useSlaveServer, 'slave_server' => $slaveServer, 'slave_port' => $slaveServerPort, 'slave_user' => $slaveServerUser, 'slave_password' => $slaveServerPassword, 'slave_database' => $slaveServerDatabase, 'charset' => $charset, 'is_internal_charset' => $isInternalCharset, 'socket' => $socketPath, 'builtin_encoding' => $builtinEncoding, 'connect_retries' => $retries, 'use_persistent_connection' => $usePersistentConnection, 'show_errors' => true);
         /* This looks funny, but is needed to fix a crash in PHP */
         $b = $databaseParameters;
         $databaseParameters = $defaultDatabaseParameters;
         if (isset($b['server'])) {
             $databaseParameters['server'] = $b['server'];
         }
         if (isset($b['port'])) {
             $databaseParameters['port'] = $b['port'];
         }
         if (isset($b['user'])) {
             $databaseParameters['user'] = $b['user'];
         }
         if (isset($b['password'])) {
             $databaseParameters['password'] = $b['password'];
         }
         if (isset($b['database'])) {
             $databaseParameters['database'] = $b['database'];
         }
         if (isset($b['use_slave_server'])) {
             $databaseParameters['use_slave_server'] = $b['use_slave_server'];
         }
//.........这里部分代码省略.........
开发者ID:nfrp,项目名称:ezpublish,代码行数:101,代码来源:ezdb.php

示例10: cacheFileName

 protected function cacheFileName($placement = false)
 {
     $cacheFileName = $this->FileName . '-' . $this->RootDir . '-' . $this->DirectAccess;
     if (!$this->DirectAccess) {
         $cacheFileName .= '-' . serialize($this->overrideDirs());
     }
     if ($this->UseTextCodec) {
         $cacheFileName .= '-' . eZTextCodec::internalCharset();
     }
     if ($placement) {
         $cacheFileName .= '-placement:' . $placement;
     }
     $filePreFix = explode('.', $this->FileName);
     return $filePreFix[0] . '-' . md5($cacheFileName) . '.php';
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:15,代码来源:ezini.php

示例11: compilationFilename

 static function compilationFilename($key, $resourceData)
 {
     $internalCharset = eZTextCodec::internalCharset();
     $templateFilepath = $resourceData['template-filename'];
     $extraName = '';
     if (preg_match("#^.+/(.*)\\.tpl\$#", $templateFilepath, $matches)) {
         $extraName = $matches[1] . '-';
     } else {
         if (preg_match("#^(.*)\\.tpl\$#", $templateFilepath, $matches)) {
             $extraName = $matches[1] . '-';
         }
     }
     $accessText = false;
     if (isset($GLOBALS['eZCurrentAccess']['name'])) {
         $accessText = '-' . $GLOBALS['eZCurrentAccess']['name'];
     }
     $locale = eZLocale::instance();
     $language = $locale->localeFullCode();
     $http = eZHTTPTool::instance();
     $useFullUrlText = $http->UseFullUrl ? 'full' : 'relative';
     $pageLayoutVariable = "";
     if (isset($GLOBALS['eZCustomPageLayout'])) {
         $pageLayoutVariable = $GLOBALS['eZCustomPageLayout'];
     }
     $ini = eZINI::instance();
     $shareTemplates = $ini->hasVariable('TemplateSettings', 'ShareCompiledTemplates') ? $ini->variable('TemplateSettings', 'ShareCompiledTemplates') == 'enabled' : false;
     if ($shareTemplates) {
         $cacheFileKey = $key . '-' . $language;
     } else {
         $cacheFileKey = $key . '-' . $internalCharset . '-' . $language . '-' . $useFullUrlText . $accessText . "-" . $pageLayoutVariable . '-' . eZSys::indexFile();
     }
     $cacheFileName = $extraName . md5($cacheFileKey) . '.php';
     return $cacheFileName;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:34,代码来源:eztemplatecompiler.php

示例12: sendNewsletterMail

 static function sendNewsletterMail($newsletter, $sendPreview = false, $previewFormat = false, $receiverLimit = null)
 {
     $sendMailSettings = eZINI::instance('ezsendmailsettings.ini');
     $replaceMsgIDHost = $sendMailSettings->variable('SendNewsletter', 'ReplaceMessageIDHost');
     $newSendHost = $sendMailSettings->variable('SendNewsletter', 'Host');
     $hostSettings['replace'] = $replaceMsgIDHost;
     $hostSettings['host'] = $newSendHost;
     $mail = new eZNewsletterMail();
     $sys = eZSys::instance();
     $newsletterMailData = array();
     // Check that the newsletter type exists, if not, process next newsletter
     if (!$newsletter->attribute('newsletter_type')) {
         return;
     }
     $newsletterMailData[eZNewsletter::OutputFormatText] = $newsletter->generateNewsletter(eZNewsletter::OutputFormatText, $sendPreview);
     $newsletterMailData[eZNewsletter::OutputFormatHTML] = $newsletter->generateNewsletter(eZNewsletter::OutputFormatHTML, $sendPreview);
     $newsletterMailData[eZNewsletter::OutputFormatExternalHTML] = $newsletter->generateNewsletter(eZNewsletter::OutputFormatExternalHTML, $sendPreview);
     $newsletterMailData[eZNewsletter::OutputFormatSMS] = $newsletter->generateNewsletter(eZNewsletter::OutputFormatSMS, $sendPreview);
     $newsletterOutputFormatList = $newsletter->attribute('output_format_list');
     $noMimeMessage = "This message is in MIME format. Since your mail reader does not understand\nthis format, some or all of this message may not be legible.";
     $lineBreak = "\r\n";
     $partCounter = 0;
     $boundary = date("YmdGHjs") . ':' . getmypid() . ':' . $partCounter++;
     $charset = eZTextCodec::internalCharset();
     $contentTypeHtmlPart = "Content-Type: text/html; charset={$charset}";
     foreach (array(eZNewsletter::OutputFormatHTML, eZNewsletter::OutputFormatExternalHTML) as $key) {
         $htmlOutput =& $newsletterMailData[$key];
         if ($htmlOutput['imageNameMap']) {
             $data = $noMimeMessage . $lineBreak;
             $data .= $lineBreak . '--' . $boundary . $lineBreak;
             $data .= $contentTypeHtmlPart . $lineBreak;
             $data .= "Content-Transfer-Encoding: 8bit" . $lineBreak . $lineBreak;
             $data .= $htmlOutput['body'] . $lineBreak;
             foreach ($htmlOutput['imageNameMap'] as $id => $filename) {
                 $filename = trim($filename);
                 if (is_readable($filename)) {
                     $mime = eZMimeType::findByURL($filename);
                     $encodedFileContent = chunk_split(base64_encode(file_get_contents($filename)), 76, $lineBreak);
                     $data .= $lineBreak . '--' . $boundary . $lineBreak;
                     $data .= "Content-Type: " . $mime['name'] . ';' . $lineBreak . ' name="' . basename($filename) . '"' . $lineBreak;
                     $data .= "Content-ID: <" . $id . ">" . $lineBreak;
                     $data .= "Content-Transfer-Encoding: base64" . $lineBreak;
                     $original_filename = basename($filename);
                     if ($htmlOutput['imageNameMapName'][$id]) {
                         $original_filename = $htmlOutput['imageNameMapName'][$id];
                     }
                     $data .= 'Content-Disposition: INLINE;' . $lineBreak . ' filename="' . $original_filename . '"' . $lineBreak . $lineBreak;
                     $data .= $encodedFileContent;
                 }
             }
             $data .= $lineBreak . '--' . $boundary . '--';
             $htmlOutput['body'] = $data;
         } else {
             $data = $noMimeMessage . $lineBreak;
             $data .= $lineBreak . '--' . $boundary . $lineBreak;
             $data .= $contentTypeHtmlPart . $lineBreak;
             $data .= "Content-Transfer-Encoding: 8bit" . $lineBreak . $lineBreak;
             $data .= $htmlOutput['body'] . $lineBreak;
             $data .= $lineBreak . '--' . $boundary . '--';
             $htmlOutput['body'] = $data;
         }
     }
     // 4. Go through revceivers, and send emails.
     if (!$sendPreview) {
         $mail->setSender($newsletterMailData[eZNewsletter::OutputFormatText]['emailSender'], $newsletterMailData[eZNewsletter::OutputFormatText]['emailSenderName']);
         $idcounter = 0;
         $sendCount = 0;
         $skipCount = 0;
         // HACK!
         $receiverList = eZSendNewsletterItem::fetchByNewsletterID($newsletter->attribute('id'), 0, $receiverLimit);
         foreach ($receiverList as $receiver) {
             $msgid = eZNewsletter::generateMessageId($newsletterMailData[eZNewsletter::OutputFormatText]['emailSender'], $receiver->attribute('id'), $idcounter++, $hostSettings);
             $mail->setMessageID($msgid);
             $userData = $receiver->attribute('user_data');
             if (!$userData) {
                 //When no userdata is found, it is usually the result of a deleted subscription,
                 //we mark the mail as being sent, without sending it.
                 $receiver->setAttribute('send_status', eZSendNewsletterItem::SendStatusSent);
                 $receiver->setAttribute('send_ts', time());
                 $receiver->sync();
                 continue;
             }
             // #TODO# IDs expected
             $userOutputFormatList = explode(',', $userData['output_format']);
             // #TODO#
             #echo " ### userOutputFormatList\n";  ok
             #var_dump( $userOutputFormatList );
             #echo " ### newsletterOutputFormatList\n"; ok
             #var_dump( $newsletterOutputFormatList );
             $outputFormat = false;
             //special case for SMS sending
             if (in_array(eZNewsletter::OutputFormatSMS, $userOutputFormatList) && in_array(eZNewsletter::OutputFormatSMS, $newsletterOutputFormatList)) {
                 $mail->setContentType("sms", false, false, false, $boundary);
                 $outputFormat = eZNewsletter::OutputFormatSMS;
                 //$mail->setSubject( $userMailData['subject'] );                                        ### $userMailData is undefined
                 # echo " ### userMailData\n";
                 # var_dump( $userMailData );
                 # $mail->setSubject( $userMailData['subject'] );
                 # $mail->setReceiver( $userData['email'] );
                 # $mail->setMobile( $userData['mobile'] );
//.........这里部分代码省略.........
开发者ID:stevoland,项目名称:ez_patch,代码行数:101,代码来源:eznewsletter.php

示例13: modify

 function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
 {
     switch ($operatorName) {
         // Convert all alphabetical chars of operatorvalue to uppercase.
         case $this->UpcaseName:
             $funcName = function_exists('mb_strtoupper') ? 'mb_strtoupper' : 'strtoupper';
             $operatorValue = $funcName($operatorValue);
             break;
             // Convert all alphabetical chars of operatorvalue to lowercase.
         // Convert all alphabetical chars of operatorvalue to lowercase.
         case $this->DowncaseName:
             $funcName = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
             $operatorValue = $funcName($operatorValue);
             break;
             // Count and return the number of words in operatorvalue.
         // Count and return the number of words in operatorvalue.
         case $this->Count_wordsName:
             $operatorValue = preg_match_all("#(\\w+)#", $operatorValue, $dummy_match);
             break;
             // Count and return the number of chars in operatorvalue.
         // Count and return the number of chars in operatorvalue.
         case $this->Count_charsName:
             $funcName = function_exists('mb_strlen') ? 'mb_strlen' : 'strlen';
             $operatorValue = $funcName($operatorValue);
             break;
             // Insert HTML line breaks before newlines.
         // Insert HTML line breaks before newlines.
         case $this->BreakName:
             $operatorValue = nl2br($operatorValue);
             break;
             // Wrap line (insert newlines).
         // Wrap line (insert newlines).
         case $this->WrapName:
             $parameters = array($operatorValue);
             if ($namedParameters['wrap_at_position']) {
                 $parameters[] = $namedParameters['wrap_at_position'];
                 if ($namedParameters['break_sequence']) {
                     $parameters[] = $namedParameters['break_sequence'];
                     if ($namedParameters['cut']) {
                         $parameters[] = $namedParameters['cut'];
                     }
                 }
             }
             $operatorValue = call_user_func_array('wordwrap', $parameters);
             break;
             // Convert the first character to uppercase.
         // Convert the first character to uppercase.
         case $this->UpfirstName:
             $i18nIni = eZINI::instance('i18n.ini');
             $hasMBString = ($i18nIni->variable('CharacterSettings', 'MBStringExtension') == 'enabled' and function_exists("mb_strtoupper") and function_exists("mb_substr") and function_exists("mb_strlen"));
             if ($hasMBString) {
                 $encoding = eZTextCodec::internalCharset();
                 $firstLetter = mb_strtoupper(mb_substr($operatorValue, 0, 1, $encoding), $encoding);
                 $remainingText = mb_substr($operatorValue, 1, mb_strlen($operatorValue, $encoding), $encoding);
                 $operatorValue = $firstLetter . $remainingText;
             } else {
                 $operatorValue = ucfirst($operatorValue);
             }
             break;
             // Simplify / transform multiple consecutive characters into one.
         // Simplify / transform multiple consecutive characters into one.
         case $this->SimplifyName:
             $simplifyCharacter = $namedParameters['char'];
             if ($namedParameters['char'] === false) {
                 $replace_this = "/ {2,}/";
                 $simplifyCharacter = ' ';
             } else {
                 $replace_this = "/" . $simplifyCharacter . "{2,}/";
             }
             $operatorValue = preg_replace($replace_this, $simplifyCharacter, $operatorValue);
             break;
             // Convert all first characters [in all words] to uppercase.
         // Convert all first characters [in all words] to uppercase.
         case $this->UpwordName:
             $i18nIni = eZINI::instance('i18n.ini');
             $hasMBString = ($i18nIni->variable('CharacterSettings', 'MBStringExtension') == 'enabled' and function_exists("mb_strtoupper") and function_exists("mb_substr") and function_exists("mb_strlen"));
             if ($hasMBString) {
                 $encoding = eZTextCodec::internalCharset();
                 $words = explode(" ", $operatorValue);
                 $newString = array();
                 foreach ($words as $word) {
                     $firstLetter = mb_strtoupper(mb_substr($word, 0, 1, $encoding), $encoding);
                     $remainingText = mb_substr($word, 1, mb_strlen($word, $encoding), $encoding);
                     $newString[] = $firstLetter . $remainingText;
                 }
                 $operatorValue = implode(" ", $newString);
                 unset($newString, $words);
             } else {
                 $operatorValue = ucwords($operatorValue);
             }
             break;
             // Strip whitespace from the beginning and end of a string.
         // Strip whitespace from the beginning and end of a string.
         case $this->TrimName:
             if ($namedParameters['chars_to_remove'] === false) {
                 $operatorValue = trim($operatorValue);
             } else {
                 $operatorValue = trim($operatorValue, $namedParameters['chars_to_remove']);
             }
             break;
//.........这里部分代码省略.........
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:101,代码来源:eztemplatestringoperator.php

示例14: treeCacheFilename

 static function treeCacheFilename($key, $templateFilepath)
 {
     $internalCharset = eZTextCodec::internalCharset();
     $extraName = '';
     if (preg_match("#^.+/(.*)\\.tpl\$#", $templateFilepath, $matches)) {
         $extraName = '-' . $matches[1];
     } else {
         if (preg_match("#^(.*)\\.tpl\$#", $templateFilepath, $matches)) {
             $extraName = '-' . $matches[1];
         }
     }
     $cacheFileKey = "{$key}-{$internalCharset}";
     $cacheFileName = md5($cacheFileKey) . $extraName . '.php';
     return $cacheFileName;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:15,代码来源:eztemplatetreecache.php

示例15: import


//.........这里部分代码省略.........
                 // Convert space to _ in section names
                 foreach ($sectionNameArray as $key => $value) {
                     $sectionNameArray[$key] = str_replace(" ", "_", $value);
                 }
                 sort($attributeArray);
                 sort($sectionNameArray);
                 $diff = array_diff($attributeArray, $sectionNameArray);
                 if (empty($diff)) {
                     $importClassIdentifier = $className;
                     $customClassFound = true;
                     break;
                 }
             }
         }
         if ($customClassFound == true) {
             foreach ($sectionNodeArray as $sectionNode) {
                 $sectionName = str_replace(" ", "_", strtolower($sectionNode->getAttributeNS(self::NAMESPACE_TEXT, 'name')));
                 $xmlText = "";
                 $level = 1;
                 $childArray = $sectionNode->childNodes;
                 $nodeCount = 1;
                 foreach ($childArray as $childNode) {
                     if ($childNode->nodeType === XML_ELEMENT_NODE) {
                         $isLastTag = $nodeCount == $childArray->length;
                         $xmlText .= self::handleNode($childNode, $level, $isLastTag);
                     }
                     $nodeCount++;
                 }
                 $endSectionPart = "";
                 $levelDiff = 1 - $level;
                 if ($levelDiff < 0) {
                     $endSectionPart = str_repeat("</section>", abs($levelDiff));
                 }
                 $charset = eZTextCodec::internalCharset();
                 // Store the original XML for each section, since some datatypes needs to handle the XML specially
                 $sectionNodeHash[$sectionName] = $sectionNode;
                 $xmlTextArray[$sectionName] = "<?xml version='1.0' encoding='{$charset}' ?>" . "<section xmlns:image='http://ez.no/namespaces/ezpublish3/image/' " . "  xmlns:xhtml='http://ez.no/namespaces/ezpublish3/xhtml/'><section>" . $xmlText . $endSectionPart . "</section></section>";
             }
         }
     }
     if ($customClassFound == false) {
         // No defined sections. Do default import.
         $bodyNodeArray = $dom->getElementsByTagNameNS(self::NAMESPACE_OFFICE, 'text');
         // Added by Soushi
         // check the parent-style-name [ eZSectionDefinition ]
         $eZSectionDefinitionStyleName = array();
         foreach ($automaticStyleArray->item(0)->childNodes as $child) {
             if ($child->nodeType === XML_ELEMENT_NODE && $child->getAttributeNS(self::NAMESPACE_STYLE, 'parent-style-name') === 'eZSectionDefinition') {
                 $eZSectionDefinitionStyleName[] = $child->getAttributeNS(self::NAMESPACE_STYLE, 'name');
             }
         }
         $sectionNameArray = array();
         $sectionNodeArray = array();
         $paragraphSectionName = NULL;
         $firstChildFlag = false;
         $paragraphSectionNodeArray = array();
         foreach ($bodyNodeArray->item(0)->childNodes as $childNode) {
             $firstChildFlag = true;
             if ($childNode->nodeType === XML_ELEMENT_NODE && (in_array($childNode->getAttributeNS(self::NAMESPACE_TEXT, 'style-name'), $eZSectionDefinitionStyleName) || $childNode->getAttributeNS(self::NAMESPACE_TEXT, 'style-name') === 'eZSectionDefinition')) {
                 $firstChildFlag = false;
                 $childNodeChildren = $childNode->childNodes;
                 $paragraphSectionName = trim($childNodeChildren->item(0)->textContent);
                 $sectionNameArray[] = $paragraphSectionName;
             }
             if ($paragraphSectionName && $firstChildFlag) {
                 $paragraphSectionNodeArray[$paragraphSectionName][] = $childNode;
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:67,代码来源:ezooimport.php


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