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


PHP stream_get_transports函数代码示例

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


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

示例1: checkOpenSSLSupport

 function checkOpenSSLSupport()
 {
     if (!in_array('ssl', stream_get_transports())) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:leehankyeol,项目名称:JaWeTip,代码行数:7,代码来源:syndication.class.php

示例2: supportSSL

/**
 * Detect SSL stream transport
 * @return boolean|string        If returns string has an problem, returns true if ok
*/
function supportSSL()
{
    if (defined('SOCKET_SSL_STREAM')) {
        return true;
    }
    if (function_exists('stream_get_transports')) {
        /* PHP 5 */
        $ok = in_array('ssl', stream_get_transports());
        if ($ok) {
            defined('SOCKET_SSL_STREAM', '1');
            return true;
        }
    } else {
        /* PHP 4 */
        ob_start();
        phpinfo(1);
        $info = strtolower(ob_get_clean());
        if (preg_match('/socket\\stransports/', $info) !== 0) {
            if (preg_match('/(ssl[,]|ssl [,]|[,] ssl|[,]ssl)/', $info) !== 0) {
                defined('SOCKET_SSL_STREAM', '1');
                return true;
            } else {
                return 'No SSL stream support detected';
            }
        }
    }
    return 'Don\'t detected streams (finder error), no SSL stream support';
}
开发者ID:CarlosAyala,项目名称:midas-codeigniter-modulo-emergencias,代码行数:32,代码来源:html2canvas.proxy.php

示例3: prepare

 /**
  * Setup archive directory and internal migrate data struct.
  *
  * @param array $environment
  *   Environment to migrate to, from NSPI acquia_agent_cloud_migration_environments()
  * @return array $migration
  */
 public function prepare($environment)
 {
     // Internal migration store is an array because objects cannot be stored
     // by Drupal's Batch API.
     $local_env = $this->checkEnv();
     if ($local_env['error'] !== FALSE) {
         return $local_env;
     }
     // Modify environment URL if SSL is available for use.
     if (in_array('ssl', stream_get_transports(), TRUE) && !defined('ACQUIA_DEVELOPMENT_NOSSL')) {
         $uri = parse_url($environment['url']);
         if (isset($uri['host'])) {
             $environment['url'] = $uri['host'];
         }
         $environment['url'] .= isset($uri['port']) ? ':' . $uri['port'] : '';
         $environment['url'] .= isset($uri['path']) && isset($uri['host']) ? $uri['path'] : '';
         $environment['url'] = 'https://' . $environment['url'];
     }
     $time = REQUEST_TIME;
     $date = gmdate('Ymd_his', $time);
     $migration = array('error' => FALSE, 'id' => uniqid() . '_' . $date, 'date' => $date, 'time' => $time, 'compression_ext' => $local_env['compression_ext'], 'request_params' => array('r' => Url::FromRoute('acquia_connector.settings', array(), array('absolute' => TRUE))->toString(), 'y' => 'sar', 'stage' => $environment['stage'], 'nonce' => $environment['nonce']), 'env' => $environment, 'no_data_tables' => array());
     // Set up local storage of archive.
     $this->destination($migration);
     return $migration;
 }
开发者ID:alexku,项目名称:travisintegrationtest,代码行数:32,代码来源:Migration.php

示例4: skip

 public function skip()
 {
     $streams = stream_get_transports();
     $this->skipIf(!in_array('ssl', $streams), 'SSL is not configured for your system.  It is not possible to run this test');
     $this->skipIf(!SWIFT_SSL_HOST, 'Cannot run test without an SSL enabled SMTP host to connect to (define ' . 'SWIFT_SSL_HOST in tests/acceptance.conf.php if you wish to run this test)');
     parent::skip();
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:7,代码来源:SslSocketAcceptanceTest.php

示例5: get

 /**
  * Get all enable transports.
  *
  * @return  array
  */
 public static function get()
 {
     static $_ = null;
     if (null === $_) {
         $_ = stream_get_transports();
     }
     return $_;
 }
开发者ID:Grummfy,项目名称:Central,代码行数:13,代码来源:Transport.php

示例6: setUp

 public function setUp()
 {
     // skip tests when this PHP has no SSL support
     $transports = stream_get_transports();
     if (!in_array('ssl', $transports)) {
         $this->markTestSkipped('No SSL support available.');
     }
     parent::setUp();
 }
开发者ID:neosunchess,项目名称:dokuwiki,代码行数:9,代码来源:httpclient_https.test.php

示例7: validate

 /**
  * Validate data.
  *
  * This ensures that unix socket transport is supported by this system.
  *
  * @param string $data
  * @return mixed True on success, else error message.
  */
 public function validate($data)
 {
     if ($data === 'unixsocket') {
         $supportedtransports = stream_get_transports();
         if (!array_search('unix', $supportedtransports)) {
             return get_string('errornounixsocketssupported', 'antivirus_clamav');
         }
     }
     return true;
 }
开发者ID:dg711,项目名称:moodle,代码行数:18,代码来源:adminlib.php

示例8: __construct

 /**
  * Constructor to initialize instance properties.
  *
  * @param int    $port      Port on which the daemon will listen or NULL
  *        to select a port automatically, defaults to NULL
  * @param string $transport Socket transport for the daemon to use,
  *        defaults to 'tcp'
  *
  * @return void
  */
 public function __construct($port = null, $transport = 'tcp')
 {
     if (in_array($transport, stream_get_transports())) {
         $this->transport = $transport;
     } else {
         $this->transport = 'tcp';
     }
     $this->port = $port ? $port : $this->findPort();
     $this->commands = array();
     $this->input = array();
 }
开发者ID:jellydoughnut,项目名称:phergie,代码行数:21,代码来源:FakeDaemon.php

示例9: setUp

 public function setUp()
 {
     $streams = stream_get_transports();
     if (!in_array('ssl', $streams)) {
         $this->markTestSkipped('SSL is not configured for your system.  It is not possible to run this test');
     }
     if (!defined('SWIFT_SSL_HOST')) {
         $this->markTestSkipped('Cannot run test without an SSL enabled SMTP host to connect to (define ' . 'SWIFT_SSL_HOST in tests/acceptance.conf.php if you wish to run this test)');
     }
     parent::setUp();
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:11,代码来源:SslSocketAcceptanceTest.php

示例10: IsSupported

 /**
  * Check to make sure all the critical dependencies are available
  *
  * @return boolean
  **/
 public function IsSupported()
 {
     if (function_exists('curl_exec') && defined('CURL_VERSION_SSL')) {
         return true;
     } else {
         if (in_array('ssl', stream_get_transports())) {
             return true;
         } else {
             $this->SetError(GetLang('AuthorizeNetSSLNotAvailable'));
             return false;
         }
     }
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:18,代码来源:module.authorizenet_apr29.php

示例11: getSwiftMailerFromConfig

 /**
  * Returns an instance of Swift_Mailer based on the config.s
  * @return \Swift_Mailer
  */
 public function getSwiftMailerFromConfig()
 {
     $encryptionType = $this->getMailConfig('smtp_encryption');
     // Workaround issue where smtp_encryption could == 1 in the past by
     // checking it is a valid transport
     if ($encryptionType && !in_array($encryptionType, stream_get_transports())) {
         $encryptionType = null;
     }
     /** @var \Swift_SmtpTransport $transport */
     $transport = \Swift_SmtpTransport::newInstance($this->getMailConfig('smtp_address'), $this->getMailConfig('smtp_port'), $encryptionType);
     $transport->setUsername($this->getMailConfig('smtp_username'));
     $transport->setPassword($this->getMailConfig('smtp_password'));
     return \Swift_Mailer::newInstance($transport);
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:18,代码来源:MailerFactory.php

示例12: buildSmtpEncryptSelector

 /**
  * Render a selector element that allows to select the encryption method for SMTP
  *
  * @param array $params Field information to be rendered
  *
  * @return string The HTML selector
  */
 public function buildSmtpEncryptSelector(array $params)
 {
     $extConf = GeneralUtility::removeDotsFromTS(unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mailcopy']));
     $transports = stream_get_transports();
     if (empty($transports)) {
         return '';
     }
     $markup = '<select class="valid" name="' . $params['fieldName'] . '" id=em-' . $params['propertyName'] . '">';
     $active = (string) self::extract($extConf, explode('.', $params['propertyName']));
     foreach ($transports as $transport) {
         $markup .= '<option value="' . $transport . '"' . ($transport === $active ? ' selected="selected"' : '') . '>' . $transport . '</option>';
     }
     $markup .= '</select>';
     return $markup;
 }
开发者ID:tantegerda1,项目名称:mailcopy,代码行数:22,代码来源:ExtensionManagerConfigurationUtility.php

示例13: __construct

 public function __construct()
 {
     if (function_exists('fsockopen')) {
         $this->socketExtension = true;
         $this->xportlist = stream_get_transports();
         if (in_array('ssl', $this->xportlist)) {
             $this->sslAvailable = true;
         } else {
             if (in_array('ss', $this->xportlist)) {
                 array_push($this->xportlist, 'ssl');
                 $this->sslAvailable = true;
             }
         }
     } else {
         $this->setError("This class need 'Sockets' extension!");
     }
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:17,代码来源:SocketStream.class.php

示例14: establish

 private function establish()
 {
     $unix = in_array("unix", \stream_get_transports(), true);
     if ($unix) {
         $promise = \Amp\Socket\connect("unix://{$this->path}.sock");
     } else {
         $promise = \Amp\pipe(\Amp\file\get($this->path), 'Amp\\Socket\\connect');
     }
     $promise->when(function ($e, $sock) {
         if ($e) {
             $this->failAll();
             return;
         }
         $this->sock = $sock;
         $this->writeWatcher = \Amp\onWritable($sock, $this->writer);
     });
 }
开发者ID:amphp,项目名称:aerys,代码行数:17,代码来源:CommandClient.php

示例15: is_supported

 /**
  * Checks if minimum system requirements are met for vivvo_ga to function properly
  *
  * @param	&string	$missing	If function returns false passed variable will hold info about missing component
  * @return	bool
  */
 public static function is_supported(&$missing = null)
 {
     $missing = 'php';
     if (version_compare(PHP_VERSION, '5.1.4', '>=') !== false) {
         $missing = 'curl';
         if (extension_loaded('curl')) {
             return !($missing = false);
         }
         $missing = 'socket';
         if (function_exists('stream_socket_client')) {
             $missing = 'ssl';
             if (in_array('ssl', stream_get_transports())) {
                 return !($missing = false);
             }
         }
     }
     return false;
 }
开发者ID:ahanjir07,项目名称:vivvo-dev,代码行数:24,代码来源:vivvo_ga.php


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