本文整理汇总了PHP中get_loaded_extensions函数的典型用法代码示例。如果您正苦于以下问题:PHP get_loaded_extensions函数的具体用法?PHP get_loaded_extensions怎么用?PHP get_loaded_extensions使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_loaded_extensions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: system_information
function system_information()
{
global $mysqli, $server, $redis_server, $mqtt_server;
$result = $mysqli->query("select now() as datetime, time_format(timediff(now(),convert_tz(now(),@@session.time_zone,'+00:00')),'%H:%i') AS timezone");
$db = $result->fetch_array();
@(list($system, $host, $kernel) = preg_split('/[\\s,]+/', php_uname('a'), 5));
@exec('ps ax | grep feedwriter.php | grep -v grep', $feedwriterproc);
$meminfo = false;
if (@is_readable('/proc/meminfo')) {
$data = explode("\n", file_get_contents("/proc/meminfo"));
$meminfo = array();
foreach ($data as $line) {
if (strpos($line, ':') !== false) {
list($key, $val) = explode(":", $line);
$meminfo[$key] = 1024 * floatval(trim(str_replace(' kB', '', $val)));
}
}
}
$emoncms_modules = "";
$emoncmsModulesPath = substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/')) . '/Modules';
// Set the Modules path
$emoncmsModuleFolders = glob("{$emoncmsModulesPath}/*", GLOB_ONLYDIR);
// Use glob to get all the folder names only
foreach ($emoncmsModuleFolders as $emoncmsModuleFolder) {
// loop through the folders
if ($emoncms_modules != "") {
$emoncms_modules .= " ";
}
$emoncms_modules .= str_replace($emoncmsModulesPath . "/", '', $emoncmsModuleFolder);
}
return array('date' => date('Y-m-d H:i:s T'), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => function_exists('zend_version') ? zend_version() : 'n/a', 'db_server' => $server, 'db_ip' => gethostbyname($server), 'db_version' => 'MySQL ' . $mysqli->server_info, 'db_stat' => $mysqli->stat(), 'db_date' => $db['datetime'] . " (UTC " . $db['timezone'] . ")", 'redis_server' => $redis_server['host'] . ":" . $redis_server['port'], 'redis_ip' => gethostbyname($redis_server['host']), 'feedwriter' => !empty($feedwriterproc), 'mqtt_server' => $mqtt_server['host'], 'mqtt_ip' => gethostbyname($mqtt_server['host']), 'mqtt_port' => $mqtt_server['port'], 'hostbyaddress' => @gethostbyaddr(gethostbyname($host)), 'http_proto' => $_SERVER['SERVER_PROTOCOL'], 'http_mode' => $_SERVER['GATEWAY_INTERFACE'], 'http_port' => $_SERVER['SERVER_PORT'], 'php_modules' => get_loaded_extensions(), 'mem_info' => $meminfo, 'partitions' => disk_list(), 'emoncms_modules' => $emoncms_modules);
}
示例2: isCurlInstalled
/**
* This function checks the availability of cURL
* @access private
* @return bool
*/
private static function isCurlInstalled()
{
if (in_array('curl', get_loaded_extensions())) {
return true;
}
return false;
}
示例3: check_php
function check_php()
{
$data = array();
$data['errors'] = array();
$data['caninstall'] = true;
$ver = explode('.', PHP_VERSION);
$ver_num = $ver[0] . $ver[1] . $ver[2];
if ($ver_num < 500) {
$data['caninstall'] = false;
$data['errors'][] = array('level' => 'error', 'code' => 'php_version', 'message' => 'Votre version de PHP est trop vieille. Installez PHP 5.');
} elseif ($ver_num < 529) {
$data['errors'][] = array('level' => 'warning', 'code' => 'php_version', 'message' => 'Vous utilisez PHP ' . PHP_VERSION . ' !<br />Il est conseillé d\'utiliser au moins la version 5.2.9 de PHP.');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'php_version', 'message' => 'Votre version de PHP (' . PHP_VERSION . ') est supportée par Iconito.');
}
if (ini_get('session.auto_start')) {
$data['caninstall'] = false;
$data['errors'][] = array('level' => 'error', 'code' => 'session_autostart', 'message' => 'Vous devez désactiver la création de session automatique. Pour cela, modifiez la directive "session.auto_start" dans votre php.ini (pour tous vos sites), dans la configuration de votre virtualhost dans la configuration d\'Apache (pour ce site spécifiquement), ou dans le .htaccess d\'Iconito (dans le répertoire "Iconito/www").');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'session_autostart', 'message' => 'La création de session automatique est désactivée.');
}
$php_extensions = get_loaded_extensions();
if (!in_array('xml', $php_extensions)) {
$data['caninstall'] = false;
$data['errors'][] = array('level' => 'error', 'code' => 'php_ext_xml', 'message' => 'Vous devez activer l\'extension "xml" dans PHP.');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'php_ext_xml', 'message' => 'L\'extension "xml" est activée.');
}
if (!in_array('session', $php_extensions)) {
$data['caninstall'] = false;
$data['errors'][] = array('level' => 'error', 'code' => 'php_ext_session', 'message' => 'Vous devez activer l\'extension "session" dans PHP.');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'php_ext_session', 'message' => 'L\'extension "session" est activée.');
}
if (!in_array('mysql', $php_extensions)) {
$data['caninstall'] = false;
$data['errors'][] = array('level' => 'error', 'code' => 'php_ext_mysql', 'message' => 'Vous devez activer l\'extension "mysql" dans PHP.');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'php_ext_mysql', 'message' => 'L\'extension "mysql" est activée.');
}
if (!in_array('gd', $php_extensions)) {
$data['caninstall'] = false;
$data['errors'][] = array('level' => 'error', 'code' => 'php_ext_gd', 'message' => 'Vous devez activer l\'extension "gd" dans PHP.');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'php_ext_gd', 'message' => 'L\'extension "gd" est activée.');
if (!(imagetypes() & IMG_GIF)) {
$data['caninstall'] = true;
$data['errors'][] = array('level' => 'warning', 'code' => 'php_gd_gif', 'message' => 'Votre version de "gd" ne supporte pas l\'écriture du format GIF. Il est préférable de mettre à jour cette extension.');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'php_gd_gif', 'message' => 'Votre version de "gd" supporte le format GIF.');
}
}
if (!in_array('zlib', $php_extensions)) {
$data['caninstall'] = false;
$data['errors'][] = array('level' => 'error', 'code' => 'php_ext_zlib', 'message' => 'Vous devez activer l\'extension "zlib" dans PHP.');
} else {
$data['errors'][] = array('level' => 'good', 'code' => 'php_ext_zlib', 'message' => 'L\'extension "zlib" est activée.');
}
return $data;
}
示例4: form
function form($instance)
{
$defaults = $this->get_defaults();
$instance = wp_parse_args((array) $instance, $defaults);
$widget_title = $instance['title'];
$name = $instance['name'];
$tweets_count = $instance['tweets_cnt'];
$accessTokenSecret = trim($instance['accessTokenSecret']);
$replies_excl = $instance['replies_excl'];
$consumerSecret = trim($instance['consumerSecret']);
$accessToken = trim($instance['accessToken']);
$cache_transient = $instance['timeRef'];
$alter_ago_time = $instance['timeAgo'];
$twitterIntents = $instance['twitterIntents'];
//$dataShowCount = $instance['dataShowCount'];
$disp_screen_name = $instance['disp_scr_name'];
$timeto_store = $instance['store_time'];
$consumerKey = trim($instance['consumerKey']);
$intents_text = $instance['twitterIntentsText'];
$color_intents = $instance['intentColor'];
$slide_style = $instance['slide_style'];
$showAvatar = $instance['showAvatar'];
$border_rad_avatar = $instance['border_rad'];
$tweet_border = $instance['tweet_border'];
$tweet_theme = $instance['tweet_theme'];
if (!in_array('curl', get_loaded_extensions())) {
echo '<p style="background-color:pink;padding:10px;border:1px solid red;"><strong>cURL is not installed!</strong></p>';
}
include 'widget_html.php';
}
示例5: execute
public function execute()
{
$this->header('Version');
echo "PHP-", phpversion(), "\n\n";
$this->header('Constants');
$constants = get_defined_constants();
echo "PHP Prefix: ", $constants['PHP_PREFIX'], "\n";
echo "PHP Binary: ", $constants['PHP_BINARY'], "\n";
echo "PHP Default Include path: ", $constants['DEFAULT_INCLUDE_PATH'], "\n";
echo "PHP Include path: ", get_include_path(), "\n";
echo "\n";
// DEFAULT_INCLUDE_PATH
// PEAR_INSTALL_DIR
// PEAR_EXTENSION_DIR
// ZEND_THREAD_SAFE
// zend_version
$this->header('General Info');
phpinfo(INFO_GENERAL);
echo "\n";
$this->header('Extensions');
$extensions = get_loaded_extensions();
$this->logger->info(join(', ', $extensions));
echo "\n";
$this->header('Database Extensions');
foreach (array_filter($extensions, function ($n) {
return in_array($n, array('PDO', 'pdo_mysql', 'pdo_pgsql', 'pdo_sqlite', 'pgsql', 'mysqli', 'mysql', 'oci8', 'sqlite3', 'mysqlnd'));
}) as $extName) {
$this->logger->info($extName, 1);
}
}
示例6: get_orientation_degrees
/**
* Get image orientation from exif
*/
public static function get_orientation_degrees($filename)
{
if (in_array("exif", get_loaded_extensions())) {
$raw_exif = @exif_read_data($filename);
switch ($raw_exif['Orientation']) {
case 1:
case 2:
$degrees = 0;
break;
case 3:
case 4:
$degrees = 180;
break;
case 5:
case 6:
$degrees = -90;
break;
case 7:
case 8:
$degrees = 90;
break;
default:
$degrees = 0;
}
} else {
$degrees = 0;
}
return $degrees;
}
示例7: _getSoapClient
/**
* Gets the singleton SoapClient which is used to connect to the TransIP Api.
*
* @param mixed $parameters Parameters.
* @return SoapClient The SoapClient object to which we can connect to the TransIP API
*/
public static function _getSoapClient($parameters = array())
{
$endpoint = Transip_ApiSettings::$endpoint;
if (self::$_soapClient === null) {
$extensions = get_loaded_extensions();
$errors = array();
if (!class_exists('SoapClient') || !in_array('soap', $extensions)) {
$errors[] = 'The PHP SOAP extension doesn\'t seem to be installed. You need to install the PHP SOAP extension. (See: http://www.php.net/manual/en/book.soap.php)';
}
if (!in_array('openssl', $extensions)) {
$errors[] = 'The PHP OpenSSL extension doesn\'t seem to be installed. You need to install PHP with the OpenSSL extension. (See: http://www.php.net/manual/en/book.openssl.php)';
}
if (!empty($errors)) {
die('<p>' . implode("</p>\n<p>", $errors) . '</p>');
}
$classMap = array('DomainCheckResult' => 'Transip_DomainCheckResult', 'Domain' => 'Transip_Domain', 'Nameserver' => 'Transip_Nameserver', 'WhoisContact' => 'Transip_WhoisContact', 'DnsEntry' => 'Transip_DnsEntry', 'DomainBranding' => 'Transip_DomainBranding', 'Tld' => 'Transip_Tld', 'DomainAction' => 'Transip_DomainAction');
$options = array('classmap' => $classMap, 'encoding' => 'utf-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'trace' => false);
$wsdlUri = "https://{$endpoint}/wsdl/?service=" . self::SERVICE;
try {
self::$_soapClient = new SoapClient($wsdlUri, $options);
} catch (SoapFault $sf) {
throw new Exception("Unable to connect to endpoint '{$endpoint}'");
}
self::$_soapClient->__setCookie('login', Transip_ApiSettings::$login);
self::$_soapClient->__setCookie('mode', Transip_ApiSettings::$mode);
}
$timestamp = time();
$nonce = uniqid('', true);
self::$_soapClient->__setCookie('timestamp', $timestamp);
self::$_soapClient->__setCookie('nonce', $nonce);
self::$_soapClient->__setCookie('clientVersion', self::API_VERSION);
self::$_soapClient->__setCookie('signature', self::_urlencode(self::_sign(array_merge($parameters, array('__service' => self::SERVICE, '__hostname' => $endpoint, '__timestamp' => $timestamp, '__nonce' => $nonce)))));
return self::$_soapClient;
}
示例8: __construct
function __construct()
{
$this->values = array();
//php core
$this->values['php_version'] = phpversion();
$this->values['php_sapi_name'] = php_sapi_name();
if (substr($this->values['php_sapi_name'], 0, 3) == 'cgi') {
$this->values['cgi-php'] = 1;
} else {
$this->values['cgi-php'] = 0;
}
$this->values['extensions'] = implode(', ', get_loaded_extensions());
$this->_set_ini('safe_mode');
$this->_set_ini('open_basedir');
//server
$ns = array('HTTP_HOST', 'SERVER_NAME', 'SCRIPT_FILENAME', 'SCRIPT_NAME', 'REQUEST_URI', 'PHP_SELF');
foreach ($ns as $n) {
$this->_set_server_ini($n);
}
$this->values['__FILE__'] = __FILE__;
//session
$ns = array('session.name', 'session.save_path', 'session.cookie_domain', 'session.cookie_path', 'session.save_path');
foreach ($ns as $n) {
$this->_set_ini($n);
}
//mbstring
foreach (array('mbstring.encoding_translation', 'mbstring.internal_encoding') as $n) {
$this->_set_ini($n);
}
//misc
$ns = array('allow_url_fopen', 'magic_quotes_gpc', 'upload_max_filesize', 'memory_limit');
foreach ($ns as $n) {
$this->_set_ini($n);
}
}
示例9: php
/**
* This static function returns php informations
*
* @returns an array with php info
*/
function php()
{
// Get the general PHP info
ob_start();
phpinfo(INFO_GENERAL);
$phpInfo .= ob_get_contents();
ob_end_clean();
// Get the right part
$phpInfo = substr($phpInfo, strpos($phpInfo, '<tr>'));
$phpInfo = substr($phpInfo, 0, strpos($phpInfo, '</table>'));
// Strip unneeded things
$phpInfo = str_replace('<tr><td class="e">', '', $phpInfo);
$phpInfo = str_replace(' </td></tr>', '', $phpInfo);
$phpInfo = trim($phpInfo);
// Get the settings
$settings = array();
foreach (explode("\n", $phpInfo) as $line) {
$line = explode(' </td><td class="v">', $line);
if (isset($line[1])) {
$settings[strtolower(str_replace(' ', '_', $line[0]))] = $line[1];
} else {
$settings[strtolower(str_replace(' ', '_', $line[0]))] = '';
}
}
// export other values
$settings['version'] = phpversion();
$settings['modules'] = implode(get_loaded_extensions(), ', ');
$settings['os'] = PHP_OS;
$settings['includePath'] = $GLOBALS['YD_INCLUDE_PATH'];
return $settings;
}
示例10: readURL
function readURL($url, $headers = false)
{
if (array_search('curl', get_loaded_extensions()) !== false) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, $headers);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$html_data = curl_exec($curl);
curl_close($curl);
} elseif (ini_get('allow_url_fopen') == 1) {
$html_data = @file_get_contents($url);
} else {
// Thanks to Aki Uusitalo
$url_array = parse_url($url);
$fp = fsockopen($url_array['host'], 80, $errno, $errstr, 5);
if (!$fp) {
return false;
} else {
$out = "GET " . $url_array['path'] . "?" . $url_array['query'] . " HTTP/1.0\r\n";
$out .= "Host: " . $url_array['host'] . " \r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$html_data = '';
// Read the raw data from the socket in 1kb chunks
// Hopefully, it's just HTML.
while (!feof($fp)) {
$html_data .= fgets($fp, 1024);
}
fclose($fp);
}
}
//if ($headers == true)
// $html_data = stripHeaders($html_data);
return $html_data;
}
示例11: update
public static function update()
{
$file_id = (int) $_REQUEST['file_id'];
$file = MediaFile::find_by_id($file_id);
if (isset($_REQUEST['slug'])) {
self::simulate_temporary_episode_slug($_REQUEST['slug']);
}
$info = $file->determine_file_size();
$file->save();
$result = array();
$result['file_url'] = $file->get_file_url();
$result['file_id'] = $file_id;
$result['reachable'] = podlove_is_resolved_and_reachable_http_status($info['http_code']);
$result['file_size'] = $file->size;
if (!$result['reachable']) {
$info['certinfo'] = print_r($info['certinfo'], true);
$info['php_open_basedir'] = ini_get('open_basedir');
$info['php_safe_mode'] = ini_get('safe_mode');
$info['php_curl'] = in_array('curl', get_loaded_extensions());
$info['curl_exec'] = function_exists('curl_exec');
$errorLog = "--- # Can't reach {$file->get_file_url()}\n";
$errorLog .= "--- # Please include this output when you report a bug\n";
foreach ($info as $key => $value) {
$errorLog .= "{$key}: {$value}\n";
}
\Podlove\Log::get()->addError($errorLog);
}
Ajax::respond_with_json($result);
}
示例12: index
public function index($name = '')
{
$this->document->setTitle('Step 1');
$data = array();
//PHP Version
$currentPhpVersion = phpversion();
$this->compareVersion($currentPhpVersion);
$data['currentPhpVersion'] = $currentPhpVersion;
if (isset($this->error['phpVersionError'])) {
$data['phpVersionError'] = $this->error['phpVersionError'];
} else {
$data['phpVersionError'] = '';
}
//PHP Extensions
$loadedExtensions = get_loaded_extensions();
foreach ($loadedExtensions as $key => $ext) {
$loadedExtensions[$key] = strtolower($ext);
}
$data['extensions'] = $this->checkExtensions($loadedExtensions);
if (!$this->error) {
$data['href'] = $this->url->link('step2');
} else {
$data['href'] = '';
}
$data['requiredPhpversion'] = $this->requiered['phpVersion'];
$data['header'] = $this->load->controller('gemeinsam/header');
$data['footer'] = $this->load->controller('gemeinsam/footer');
$data['navigation'] = $this->load->controller('gemeinsam/navigation');
$output = $this->load->view('default/template/step1/index', $data);
$this->response->setOutput($output);
}
示例13: __construct
/**
* Construct method. Start the object NimbleApi. Start the Object Authorization too.
*
* @param array $settings. (must contain at least clientId and clientSecret vars)
* @throws Exception. (Return exception if not exist clientId or clientSecret)
*/
public function __construct(array $settings)
{
if ($this->use_curl && !in_array('curl', get_loaded_extensions())) {
throw new Exception('You need to install cURL, see: http://curl.haxx.se/docs/install.html');
}
if (empty($settings['clientId']) || empty($settings['clientSecret'])) {
throw new Exception('secretKey or clientId cannot be null or empty!');
}
if (empty($settings['mode'])) {
throw new Exception('mode cannot be null or empty!');
}
try {
if ($settings['mode'] == 'real') {
$this->uri = ConfigSDK::NIMBLE_API_BASE_URL;
} else {
$this->uri = ConfigSDK::NIMBLE_API_BASE_URL_DEMO;
}
$this->authorization = new authorization();
$this->authorization->setClientId($settings['clientId']);
$this->authorization->setClientSecret($settings['clientSecret']);
if (!$this->authorization->IsAccessParams()) {
$this->authorization->getAuthorization($this);
}
} catch (Exception $e) {
throw new Exception('Failed to instantiate Authorization: ' . $e);
}
}
示例14: test
public function test()
{
print_r(get_loaded_extensions());
//phpinfo();
return;
$result = \App\Models\NestedSets::withDepth()->having('depth', '=', 1)->get();
return $result;
$parent = \App\Models\NestedSets::find(1);
\App\Models\NestedSets::create(['name' => 'Парфюмерия'], $parent);
return;
$node = new \App\Models\NestedSets();
$node->name = 'hello NS';
$node->save();
return '';
$catalog = \App\Helpers\CitynatureHelper::getCatalogArrayFromCsvFile(base_path('storage/app/price1.csv'));
foreach ($catalog as $item_level_1) {
foreach ($item_level_1['items'] as $item_level_2) {
//
foreach ($item_level_2['items'] as $item_level_3) {
//
foreach ($item_level_3['items'] as $item_level_4) {
//
foreach ($item_level_4 as $product) {
//
}
}
}
}
}
return view('test.page');
}
示例15: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
$lang = JFactory::getLanguage();
$lang->load('lib_syw.sys', JPATH_SITE);
$version = new JVersion();
$jversion = explode('.', $version->getShortVersion());
$extensions = get_loaded_extensions();
$html = '';
if (!in_array('intl', $extensions)) {
if (intval($jversion[0]) > 2) {
// Joomla! 3+
$html .= '<div class="alert alert-error">';
} else {
$html .= '<div style="clear: both; margin: 5px 0; padding: 8px 35px 8px 14px; border-radius: 4px; border: 1px solid #EED3D7; background-color: #F2DEDE; color: #B94A48;">';
}
$html .= '<span>';
$html .= JText::_('LIB_SYW_INTLTEST_NOTLOADED');
$html .= '</span>';
$html .= '</div>';
return $html;
} else {
if (intval($jversion[0]) > 2) {
// Joomla! 3+
$html .= '<div class="alert alert-success">';
} else {
$html .= '<div style="clear: both; margin: 5px 0; padding: 8px 35px 8px 14px; border-radius: 4px; border: 1px solid #D6E9C6; background-color: #DFF0D8; color: #468847;">';
}
$html .= '<span>';
$html .= JText::_('LIB_SYW_INTLTEST_LOADED');
$html .= '</span>';
$html .= '</div>';
}
return $html;
}