本文整理汇总了PHP中stream_get_transports函数的典型用法代码示例。如果您正苦于以下问题:PHP stream_get_transports函数的具体用法?PHP stream_get_transports怎么用?PHP stream_get_transports使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stream_get_transports函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: UseSSL
/**
* @param int $iPort
* @param int $iSecurityType
*
* @return bool
*/
public static function UseSSL($iPort, $iSecurityType)
{
$iPort = (int) $iPort;
$iResult = (int) $iSecurityType;
if (self::AUTO_DETECT === $iSecurityType) {
switch (true) {
case 993 === $iPort:
case 995 === $iPort:
case 465 === $iPort:
$iResult = self::SSL;
break;
}
}
if (self::SSL === $iResult && !\in_array('ssl', \stream_get_transports())) {
$iResult = self::NONE;
}
return self::SSL === $iResult;
}
开发者ID:Git-Host,项目名称:email,代码行数:24,代码来源:ConnectionSecurityType.php
示例17: __construct
/**
* Set URL the client connects to.
* SSL, port and authentication can be set in the URL.
*
* examples:
* http://www.dummy.com/index.php
* https://www.dummy.com/index.php
* http://www.dummy.com:8080/index.php
* http://user:[email protected]/index.php
*
* @param string $url
* @throws BillsafeException
*/
public function __construct($url)
{
$parsedUrl = parse_url($url);
if (!is_array($parsedUrl) || !isset($parsedUrl['host'])) {
throw new BillsafeException('Invalid url specified');
}
$this->_host = $parsedUrl['host'];
if (!empty($parsedUrl['path'])) {
$query = empty($parsedUrl['query']) ? '' : '?' . $parsedUrl['query'];
$this->_path = $parsedUrl['path'] . $query;
}
if (!empty($parsedUrl['port'])) {
$this->_port = $parsedUrl['port'];
}
if (!empty($parsedUrl['scheme'])) {
switch ($parsedUrl['scheme']) {
case 'http':
if (empty($parsedUrl['port'])) {
$this->_port = 80;
}
$this->_protocol = 'tcp://';
break;
case 'https':
if (empty($parsedUrl['port'])) {
$this->_port = 443;
}
if (function_exists('stream_get_transports')) {
$transports = stream_get_transports();
if (!in_array('ssl', $transports)) {
throw new BillsafeException('Missing SSL transport support in PHP');
}
}
$this->_protocol = 'ssl://';
break;
}
}
if (!empty($parsedUrl['user'])) {
$this->_user = $parsedUrl['user'];
}
if (!empty($parsedUrl['pass'])) {
$this->_password = $parsedUrl['pass'];
}
}
开发者ID:ernestwisniewski,项目名称:billsafe-php-sdk,代码行数:56,代码来源:Client.php
示例18: run
public function run()
{
$arMods = ['fsockopen' => \Yii::t('skeeks/cms', "Functions to work with sockets"), 'xml_parser_create' => \Yii::t('skeeks/cms', "{p} support", ['p' => 'XML']), 'preg_match' => \Yii::t('skeeks/cms', 'Support for regular expressions') . " (Perl-Compatible)", 'imagettftext' => \Yii::t('skeeks/cms', "Free Type Text"), 'gzcompress' => "Zlib", 'imagecreatetruecolor' => \Yii::t('skeeks/cms', 'GD Library'), 'imagecreatefromjpeg' => \Yii::t('skeeks/cms', "Jpeg support in GD"), 'json_encode' => \Yii::t('skeeks/cms', "{p} support", ['p' => 'JSON']), 'mcrypt_encrypt' => \Yii::t('skeeks/cms', 'The encryption function {mcrypt}', ['mcrypt' => 'MCrypt']), 'highlight_file' => 'PHP Syntax Highlight', 'mb_substr' => \Yii::t('skeeks/cms', "{p} support", ['p' => 'mbstring']), 'curl_init' => \Yii::t('skeeks/cms', "{p} support", ['p' => 'curl'])];
$strError = '';
foreach ($arMods as $func => $desc) {
if (!function_exists($func)) {
$this->addError($desc);
} else {
$this->addSuccess($desc);
}
}
if (!in_array('ssl', stream_get_transports())) {
$this->addError(\Yii::t('skeeks/cms', "{ssl} support is not configured in {php}", ['ssl' => 'ssl', 'php' => 'php']));
}
if (!extension_loaded('fileinfo')) {
$this->addError(\Yii::t('skeeks/cms', 'Do not set extension {ext}. Do not set extension {ext}. Will not work on the file download link (for those files which can not parse file extension in the url, for example {smpl})', ['ext' => 'fileinfo', 'smpl' => 'https://im3-tub-ru.yandex.net/i?id=7bc5907fe7558cf8f2e97e7a760c6fdd&n=21']));
} else {
$this->addSuccess(\Yii::t('skeeks/cms', 'Extension {ext} is installed', ['ext' => 'php fileinfo']));
}
}
开发者ID:skeeks-cms,项目名称:cms,代码行数:20,代码来源:PhpModulesCheck.php
示例19: __construct
public function __construct($server, $port, $timeout)
{
$sslAvailable = false;
$xportlist = stream_get_transports();
if (in_array('ssl', $xportlist)) {
$sslAvailable = true;
} else {
if (in_array('ss', $xportlist)) {
// Debian linux fix: missing first letter in transports list
$sslAvailable = true;
}
}
if (!$sslAvailable) {
throw new Exception("Error: This server does not support SSL connections.");
}
$this->server = $server;
$this->port = $port;
$this->timeout = $timeout;
$this->connection = false;
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:20,代码来源:SimpleSSLClient.class.php
示例20: __construct
/**
* Creates a new client.
* @param string $server
* @param string $path
* @param int|string $port 'ssl' can be used for https connections, or port number
* @param string $protocol use 'https' (or bool true, for backward compatibility) to specify https connections
* @todo add a simplified syntax for constructor, using parse_url and a single string
*/
function __construct($server, $path = '/', $port = 80, $protocol = null)
{
// backward compat with ezsoap client
if ($protocol === true) {
$protocol = 'https';
}
$this->Login = '';
$this->Password = '';
$this->Server = $server;
if ($path == '' || $path[0] != '/') {
$path = '/' . $path;
}
$this->Path = $path;
$this->Port = $port;
// this assumes 0 is a valid port. Weird, but useful for unix domain sockets..
if (is_numeric($port)) {
$this->Port = (int) $port;
} elseif (strtolower($port) == 'ssl' || $protocol == 'https') {
$this->Port = 443;
} else {
$this->Port = 80;
}
if ($protocol == null) {
// lame, but we know no better
if ($this->Port == 443) {
$this->Protocol = 'https';
} else {
$this->Protocol = 'http';
}
} else {
$this->Protocol = $protocol;
}
if ($this->Protocol == 'https' && !in_array('ssl', stream_get_transports())) {
$this->ForceCURL = true;
}
// if ZLIB is enabled, let the client by default accept compressed responses
if (function_exists('gzinflate') || function_exists('curl_init') && (($info = curl_version()) && (is_string($info) && strpos($info, 'zlib') !== null || isset($info['libz_version'])))) {
$this->AcceptedCompression = 'gzip, deflate';
}
}
开发者ID:gggeek,项目名称:ggwebservices,代码行数:48,代码来源:ggwebservicesclient.php
注:本文中的stream_get_transports函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论