本文整理汇总了PHP中eZExecution类的典型用法代码示例。如果您正苦于以下问题:PHP eZExecution类的具体用法?PHP eZExecution怎么用?PHP eZExecution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZExecution类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: redirectToErrorPage
public static function redirectToErrorPage()
{
$acessErrorPage = '/page/gift-law';
header( 'Location: ' . $acessErrorPage );
eZExecution::cleanExit();
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:7,代码来源:externallinkhandlerclinicalkeys.php
示例2: create
/**
* Creates a new test database
*
* @param ezpDsn $dsn
* @param array $sqlFiles array( array( string => string ) )
* @param bool $removeExisting
* @return mixed
*/
public static function create(ezpDsn $dsn)
{
//oracle unit test doesn't support creating database, just use database string
if ($dsn->parts['phptype'] === 'oracle') {
$db = ezpDatabaseHelper::useDatabase($dsn);
eZDBTool::cleanup($db);
return $db;
}
$dsnRoot = clone $dsn;
$dsnRoot->parts['database'] = null;
try {
$dbRoot = ezpDatabaseHelper::dbAsRootInstance($dsnRoot);
if (!$dbRoot->IsConnected) {
throw new Exception($dbRoot->ErrorMessage);
}
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
eZExecution::cleanExit();
}
if (self::exists($dbRoot, $dsn->database)) {
$db = ezpDatabaseHelper::useDatabase($dsn);
self::clean($db);
} else {
$dbRoot->createDatabase($dsn->database);
$db = ezpDatabaseHelper::useDatabase($dsn);
}
return $db;
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:36,代码来源:ezptestdatabasehelper.php
示例3: __construct
public function __construct()
{
$ini = eZINI::instance('mugo_varnish.ini');
if ($ini->hasVariable('PurgeUrlBuilder', 'PathPrefixModifier')) {
$this->pathPrefixModifier = $ini->variable('PurgeUrlBuilder', 'PathPrefixModifier');
}
if ($ini->hasVariable('PurgeUrlBuilder', 'UriTransformation')) {
$this->uriTransformation = $ini->variable('PurgeUrlBuilder', 'UriTransformation') == 'enabled' ? true : false;
}
if ($ini->hasVariable('PurgeUrlBuilder', 'ModifierMatch')) {
$this->urlModifierMatch = $ini->variable('PurgeUrlBuilder', 'ModifierMatch');
$this->urlModifierReplace = $ini->variable('PurgeUrlBuilder', 'ModifierReplace');
}
if ($ini->hasVariable('PurgeUrlBuilder', 'OmitUrlPatterns')) {
$this->omitUrlPatterns = $ini->variable('PurgeUrlBuilder', 'OmitUrlPatterns');
}
if ($ini->hasVariable('PurgeUrlBuilder', 'PurgeSystemURL')) {
$this->purgeSystemUrls = $ini->variable('PurgeUrlBuilder', 'PurgeSystemURL') == 'enabled' ? true : false;
}
// Register Cleanup Hanlder to purge urls at the end of the request
if (!self::$cleanUpHandlerRegistered) {
self::$cleanUpHandlerRegistered = true;
eZExecution::addCleanupHandler(array('MugoVarnishCleanUpHandler', 'purgeList'));
}
}
开发者ID:yannschepens,项目名称:mugo_varnish,代码行数:25,代码来源:StaticCacheMugoVarnish.php
示例4: trackTransaction
public static function trackTransaction()
{
eZExecution::addCleanupHandler(function () {
$newrelic = new Newrelic(true);
$newrelic->nameTransaction(self::buildCurrentTransactionName());
});
}
开发者ID:Opencontent,项目名称:ezpublish-newrelic,代码行数:7,代码来源:newrelichandler.php
示例5: handleFileDownload
function handleFileDownload($contentObject, $contentObjectAttribute, $type, $fileInfo)
{
$fileName = $fileInfo['filepath'];
$file = eZClusterFileHandler::instance($fileName);
if ($fileName != "" and $file->exists()) {
$fileSize = $file->size();
if (isset($_SERVER['HTTP_RANGE']) && preg_match("/^bytes=(\\d+)-(\\d+)?\$/", trim($_SERVER['HTTP_RANGE']), $matches)) {
$fileOffset = $matches[1];
$contentLength = isset($matches[2]) ? $matches[2] - $matches[1] + 1 : $fileSize - $matches[1];
} else {
$fileOffset = 0;
$contentLength = $fileSize;
}
// Figure out the time of last modification of the file right way to get the file mtime ... the
$fileModificationTime = $file->mtime();
// stop output buffering, and stop the session so that browsing can be continued while downloading
eZSession::stop();
ob_end_clean();
eZFile::downloadHeaders($fileName, self::dispositionType($fileInfo['mime_type']) === 'attachment', false, $fileOffset, $contentLength, $fileSize);
try {
$file->passthrough($fileOffset, $contentLength);
} catch (eZClusterFileHandlerNotFoundException $e) {
eZDebug::writeError($e->getMessage, __METHOD__);
header($_SERVER["SERVER_PROTOCOL"] . ' 500 Internal Server Error');
} catch (eZClusterFileHandlerGeneralException $e) {
eZDebug::writeError($e->getMessage, __METHOD__);
header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
}
eZExecution::cleanExit();
}
return eZBinaryFileHandler::RESULT_UNAVAILABLE;
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:32,代码来源:ezfilepassthroughhandler.php
示例6: run
/**
*
* Builds the response-data.
*
* @return mixed|void
*
*/
public function run()
{
$content = $this->content;
$status = $this->options['status'];
$options = $this->options;
// Give response header for status code
header('HTTP/1.1 ' . $status . ' ' . $this->codes[$status]);
switch ($options['type']) {
case 'json':
$options['headers'] += array('Content-type' => 'application/json');
$this->headers($options['headers']);
echo json_encode($content);
break;
case 'jsonEncoded':
$options['headers'] += array('Content-type' => 'application/json');
$this->headers($options['headers']);
return compact('content');
case 'tpl':
/** Default pagelayout. */
$options += array('pagelayout' => 'pagelayout.tpl');
return $this->renderTpl($content, $options);
case 'text':
return array('pagelayout' => false, 'content' => $this->content);
case 'xml':
$options['headers'] += array('Content-type' => 'text/xml');
$this->headers($options['headers']);
echo $content;
break;
}
Router::handleEZXFormToken(true);
return \eZExecution::cleanExit();
}
开发者ID:keyteqlabs,项目名称:ezote,代码行数:39,代码来源:Response.php
示例7: fill
/**
* @param string $clusterIdentifier
* @throws eZDBException
*/
public static function fill($clusterIdentifier)
{
$configPath = "extension/ezoscar/bin/php/seo/config.json";
$cli = eZCLI::instance();
$config = file_get_contents($configPath);
if(!$config)
{
$cli->output("Bad filepath for config file");
eZExecution::cleanExit();
}
$config = json_decode($config, true);
$db = MMDB::instance();
$rows = $db->arrayQuery(sprintf("SELECT * FROM mm_seo WHERE cluster_identifier = '%s'", $clusterIdentifier));
$progressBar = new ezcConsoleProgressbar( new ezcConsoleOutput(), count($rows), array(
'emptyChar' => ' ',
'barChar' => '='
) );
$progressBar->start();
foreach($rows as $row)
{
if(!array_key_exists($clusterIdentifier, $config))
{
continue;
}
$fq = $config[$clusterIdentifier][$row["application_identifier"]]["filters"];
$solrBase = new eZSolrBase();
$params = array(
'indent' => 'on',
'q' => '"'.$row['keyword'].'"',
'fq' => $fq,
'start' => 0,
'rows' => 0,
'fl' => '',
'qt' => 'ezpublish',
'explainOther' => '',
'hl.fl' => '',
);
$results = $solrBase->rawSolrRequest('/select', $params);
$num_found = $results['response']['numFound'];
$db->query(sprintf("UPDATE mm_seo SET nb_results=%d, speciality_url='%s', keyword_url='%s' WHERE id=%d",
$num_found,
self::sanitize($row["speciality"]),
self::sanitize($row["keyword"]),
$row["id"]));
$progressBar->advance();
}
$progressBar->finish();
$cli->output();
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:62,代码来源:seoTools.php
示例8: exitError
function exitError($msg = false)
{
$erroMsg = 'Newsletter image error ' . $_SERVER['REQUEST_URI'];
if ($msg)
{
$erroMsg .= "\n$msg";
}
eZDebug::writeError( $erroMsg );
header('HTTP/1.0 404 Not Found');
eZExecution::cleanExit();
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:11,代码来源:image.php
示例9: contentBuildResult
public function contentBuildResult()
{
$errorCode = empty( $this->errorCode ) ? '500' : $this->errorCode;
$errorCodeList = HttpTool::$statusReason;
$errorCodeKey = array_key_exists( $errorCode, $errorCodeList ) ? $errorCode : '500';
$errorMsg = $errorCode . ' ' . $errorCodeList[$errorCodeKey];
header( "HTTP/1.1 $errorMsg" );
header( "Status: $errorMsg" );
echo "ERROR: $errorMsg";
eZExecution::cleanExit();
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:14,代码来源:applicationHttpError.php
示例10: exitWithInternalError
function exitWithInternalError( $errorText )
{
header( $_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error' );
//include_once( 'extension/ezjscore/classes/ezjscajaxcontent.php' );
$contentType = ezjscAjaxContent::getHttpAccept();
// set headers
if ( $contentType === 'xml' )
header('Content-Type: text/xml; charset=utf-8');
else if ( $contentType === 'json' )
header('Content-Type: text/javascript; charset=utf-8');
echo ezjscAjaxContent::autoEncode( array( 'error_text' => $errorText, 'content' => '' ), $contentType );
eZExecution::cleanExit();
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:15,代码来源:run.php
示例11: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
$redirectUri = $namedParameters['url'];
// if $redirectUri is not starting with scheme://
if (!preg_match('#^\\w+://#', $redirectUri)) {
// path to eZ Publish index
$indexDir = eZSys::indexDir();
/* We need to make sure we have one
and only one slash at the concatenation point
between $indexDir and $redirectUri. */
$redirectUri = rtrim($indexDir, '/') . '/' . ltrim($redirectUri, '/');
}
// Redirect to $redirectUri by returning status code 301 and exit.
eZHTTPTool::redirect($redirectUri, array(), 301);
eZExecution::cleanExit();
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:16,代码来源:redirectoperator.php
示例12: __construct
public function __construct($theClass = '', $name = '')
{
parent::__construct($theClass, $name);
if (!self::$script instanceof eZScript) {
self::$script = eZScript::instance(array('description' => "eZ Publish Test Runner\n\nsets up an eZ Publish testing environment\n", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
// Override INI override folder from settings/override to
// tests/settings to not read local override settings
$ini = eZINI::instance();
$ini->setOverrideDirs(array(array('tests/settings', true)), 'override');
$ini->loadCache();
// Be sure to have clean content language data
eZContentLanguage::expireCache();
self::$script->startup();
self::$script->initialize();
// Avoids Fatal error: eZ Publish did not finish its request if die() is used.
eZExecution::setCleanExit();
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:18,代码来源:ezptestsuite.php
示例13: instance
/**
* Returns the configured instance of an eZClusterFileHandlerInterface
* See ClusteringSettings.FileHandler in file.ini
*
* @param string|bool $filename
* Optional filename the handler should be initialized with
*
* @return eZClusterFileHandlerInterface
*/
static function instance( $filename = false )
{
if ( self::$isShutdownFunctionRegistered !== true )
{
eZExecution::addCleanupHandler( array( __CLASS__, 'cleanupGeneratingFiles' ) );
self::$isShutdownFunctionRegistered = true;
}
if( $filename !== false )
{
$optionArray = array( 'iniFile' => 'file.ini',
'iniSection' => 'ClusteringSettings',
'iniVariable' => 'FileHandler',
'handlerParams'=> array( $filename ) );
$options = new ezpExtensionOptions( $optionArray );
$handler = eZExtension::getHandlerClass( $options );
return $handler;
}
else
{
// return Filehandler from GLOBALS based on ini setting.
if ( self::$globalHandler === null )
{
$optionArray = array( 'iniFile' => 'file.ini',
'iniSection' => 'ClusteringSettings',
'iniVariable' => 'FileHandler' );
$options = new ezpExtensionOptions( $optionArray );
$handler = eZExtension::getHandlerClass( $options );
self::$globalHandler = $handler;
}
else
$handler = self::$globalHandler;
return $handler;
}
}
开发者ID:nottavi,项目名称:ezpublish,代码行数:51,代码来源:ezclusterfilehandler.php
示例14: downloadFile
/**
* Passthrough file, and exit cleanly
*/
function downloadFile($filePath)
{
if (!file_exists($filePath)) {
header("HTTP/1.1 404 Not Found");
eZExecution::cleanExit();
}
ob_clean();
header("Pragma: public");
header("Expires: 0");
// set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=" . basename($filePath));
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filePath));
ob_end_clean();
@readfile($filePath);
eZExecution::cleanExit();
}
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:24,代码来源:mailbox_item_view.php
示例15: connect
private function connect()
{
if (is_resource($this->ConnectionResource)) {
eZDebug::writeError('No Connexion Resource available', __METHOD__);
return false;
}
$ini = eZINI::instance('ezsi.ini');
$host = $ini->variable('FTPSettings', 'Host');
$port = $ini->variable('FTPSettings', 'Port');
$timeout = $ini->variable('FTPSettings', 'Timeout');
$login = $ini->variable('FTPSettings', 'Login');
$password = $ini->variable('FTPSettings', 'Password');
$destinationFolder = $ini->variable('FTPSettings', 'DestinationFolder');
if ($cr = @ftp_connect($host, $port, $timeout) and ftp_login($cr, $login, $password)) {
eZDebug::writeNotice('Connecting to FTP server', 'eZSIFTPFileHandler');
$this->ConnectionResource = $cr;
$GLOBALS['eZSIFTPFileHandler'] = $this;
unset($cr);
// creating basic stucture if does not exists
// the directory does not exists
if (!@ftp_chdir($this->ConnectionResource, $destinationFolder)) {
// create it
//if( !@ftp_mkdir( $this->ConnectionResource, 'si-blocks' ) )
if (!$this->mkDir($destinationFolder)) {
eZDebug::writeError('Unable to create dir ' . $destinationFolder, __METHOD__);
}
// dir should exists now
eZDebug::writeNotice('CWD : ' . ftp_pwd($this->ConnectionResource), __METHOD__);
ftp_chdir($this->ConnectionResource, $destinationFolder);
}
// make sure the connection is closed at the
// end of the script
eZExecution::addCleanupHandler('eZSIFTPCloseConnexion');
return true;
} else {
eZDebug::writeError('Unable to connect to FTP server', __METHOD__);
return false;
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:39,代码来源:ezsiftpfilehandler.php
示例16: defaultExceptionHandler
/**
* Installs the default Exception handler
*
* @params Exception the exception
* @return void
*/
static public function defaultExceptionHandler( Exception $e )
{
if( PHP_SAPI != 'cli' )
{
header( 'HTTP/1.x 500 Internal Server Error' );
header( 'Content-Type: text/html' );
echo "An unexpected error has occurred. Please contact the webmaster.<br />";
if( eZDebug::isDebugEnabled() )
{
echo $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine();
}
}
else
{
$cli = eZCLI::instance();
$cli->error( "An unexpected error has occurred. Please contact the webmaster.");
if( eZDebug::isDebugEnabled() )
{
$cli->error( $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() );
}
}
eZLog::write( 'Unexpected error, the message was : ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine(), 'error.log' );
eZExecution::cleanup();
eZExecution::setCleanExit();
exit( 1 );
}
开发者ID:nottavi,项目名称:ezpublish,代码行数:37,代码来源:ezexecution.php
示例17: shutdown
/**
* Runs the shutdown process
*/
protected function shutdown($reInitialize = true)
{
eZExecution::cleanup();
eZExecution::setCleanExit();
eZExpiryHandler::shutdown();
if ($reInitialize) {
$this->isInitialized = false;
}
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:12,代码来源:ezpkernelrest.php
示例18: download
/**
* Prepares a file for Download and terminates the execution.
* This method will:
* - empty the output buffer
* - stop buffering
* - stop the active session (in order to allow concurrent browsing while downloading)
*
* @param string $file Path to the local file
* @param bool $isAttachedDownload Determines weather to download the file as an attachment ( download popup box ) or not.
* @param string $overrideFilename
* @param int $startOffset Offset to start transfer from, in bytes
* @param int $length Data size to transfer
*
* @return bool false if error
*/
static function download($file, $isAttachedDownload = true, $overrideFilename = false, $startOffset = 0, $length = false)
{
if (!file_exists($file)) {
return false;
}
ob_end_clean();
eZSession::stop();
self::downloadHeaders($file, $isAttachedDownload, $overrideFilename, $startOffset, $length);
self::downloadContent($file, $startOffset, $length);
eZExecution::cleanExit();
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:26,代码来源:ezfile.php
示例19: die
}
}
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish Test Runner\n\n" . "sets up an eZ Publish testing environment" . "\n", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
// Override INI override folder from settings/override to
// tests/settings to not read local override settings
$ini = eZINI::instance();
$ini->setOverrideDirs(array(array('tests/settings', true)), 'override');
$ini->loadCache();
// Be sure to have clean content language data
eZContentLanguage::expireCache();
$script->startup();
// $options = $script->getOptions();
$script->initialize();
// Avoids Fatal error: eZ Publish did not finish its request if die() is used.
eZExecution::setCleanExit();
$version = PHPUnit_Runner_Version::id();
if (version_compare($version, '3.5.0') == -1 && $version !== '@package_version@') {
die("PHPUnit 3.5.0 (or later) is required to run this test suite.\n");
}
require_once 'PHP/CodeCoverage.php';
$codeCoverage = new PHP_CodeCoverage();
$codeCoverage->filter()->addFileToBlacklist(__FILE__, 'PHPUNIT');
//require_once 'bootstrap.php';
try {
$runner = ezpTestRunner::instance();
$runner->run($_SERVER['argv']);
} catch (Exception $e) {
$cli->error($e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
$cli->error($e->getTraceAsString());
}
开发者ID:nfrp,项目名称:ezpublish,代码行数:31,代码来源:runtests.php
示例20: eZIEImagePreAction
<?php
/**
* File containing the pixelate tool handler
*
* @copyright Copyright (C) eZ Systems AS.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version //autogentag//
* @package ezie
*/
$prepare_action = new eZIEImagePreAction();
$http = eZHTTPTool::instance();
$region = null;
if ($prepare_action->hasRegion()) {
$region = $prepare_action->getRegion();
}
// retrieve image dimensions
$analyzer = new eZIEImageAnalyzer($prepare_action->getImagePath());
$imageconverter = new eZIEezcImageConverter(eZIEImageToolPixelate::filter($analyzer->data->width, $analyzer->data->height, $region));
$imageconverter->perform($prepare_action->getImagePath(), $prepare_action->getNewImagePath());
eZIEImageToolResize::doThumb($prepare_action->getNewImagePath(), $prepare_action->getNewThumbnailPath());
echo (string) $prepare_action;
eZExecution::cleanExit();
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:23,代码来源:tool_pixelate.php
注:本文中的eZExecution类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论