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


PHP eZExecution类代码示例

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


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


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