function checkCurl() { // Ouput text to user based on test if (_is_curl_installed()) { echo "cURL is <span style=\"color:blue\">installed</span> on this server<br>"; } else { echo "cURL is NOT <span style=\"color:red\">installed</span> on this server<br>"; } }
function sys_private_profile_func(WP_REST_Request $request) { //get headers to look for a key $headers = array(getallheaders()); $api_key = $headers[0]["Apikey"]; //api key from database $stored_api_key = get_option('wp-sys-profile_key'); //evaluate api key if ($api_key == $stored_api_key) { //look for cURL. thanks to http://www.mattsbits.co.uk/item-164.html for this bit // Define function to test function _is_curl_installed() { if (in_array('curl', get_loaded_extensions())) { return true; } else { return false; } } // Output text to user based on test if (_is_curl_installed()) { $got_curl = true; } else { $got_curl = false; } // Check if get_plugins() function exists. This is required on the front end of the // site, since it is in a file that is normally only loaded in the admin. if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); $plugin_info = array(); foreach ($all_plugins as $key => $value) { $plugin_private_info = $value["Name"] . ',' . $value["Version"] . ',' . $value["PluginURI"]; array_push($plugin_info, $plugin_private_info); } global $required_php_version; global $required_mysql_version; //profile this WordPress account private $output = array('url' => get_site_url(), 'server_info' => $_SERVER['SERVER_SOFTWARE'], 'php_version' => PHP_VERSION, 'required_php_version' => $required_php_version, 'php_memory_limit' => ini_get("memory_limit"), 'mysql_info' => mysql_get_server_info(), 'required_mysql_version' => $required_mysql_version, 'curl_enabled' => $got_curl, 'wordpress_version' => get_bloginfo('version'), 'encoding' => get_bloginfo('charset'), 'wp_mem_limit' => WP_MEMORY_LIMIT, 'wp_max_mem_limit' => WP_MAX_MEMORY_LIMIT, 'permalink_structure' => get_option('permalink_structure'), 'multi_site' => is_multisite(), 'current_theme' => get_current_theme(), 'installed_plugins' => $plugin_info); } else { $output = "{'api_key':'no'}"; } return $output; }
function getKurs() { global $dna; $dna = true; if (_is_curl_installed()) { $url = "https://api.privatbank.ua/p24api/pubinfo?exchange&coursid=5"; $curl = curl_init($url); if ($curl) { // Скачанные данные не выводить поток curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Скачиваем $page = curl_exec($curl); //В переменную $page помещается страница curl_close($curl); unset($curl); $xml = new SimpleXMLElement($page); return $xml->row[2]->exchangerate['sale'][0]; } } }
<div class="panel-heading"> <h3 class="panel-title">Simplex v3 Installer</h3> </div> <div class="panel-body"> <?php $successful = "success"; #Check if cURL Is installed function _is_curl_installed() { if (in_array('curl', get_loaded_extensions())) { return true; } else { return false; } } if (_is_curl_installed()) { echo '<div class="alert alert-' . $successful . '" role="alert"><i class="fa fa-check fa-fw"></i>cURL is installed.</div>'; } else { echo '<div class="alert alert-danger" role="alert"><i class="fa fa-exclamation-triangle fa-fw"></i>cURL is not installed!</div>'; } //Check PHP Version if (phpversion() > 5.0) { echo '<div class="alert alert-' . $successful . '" role="alert"><i class="fa fa-check fa-fw"></i>Your PHP version is up to date!</div>'; } else { echo '<div class="alert alert-danger" role="alert"><i class="fa fa-exclamation-triangle fa-fw"></i>Your PHP version is ' . phpversion() . ' which is out dated! Please update to 5.4+</div>'; } //Check MySQLi is installed if (function_exists('mysqli_connect')) { echo '<div class="alert alert-' . $successful . '" role="alert"><i class="fa fa-check fa-fw"></i>MySQLi is installed/enabled!</div>'; } else { echo '<div class="alert alert-danger" role="alert"><i class="fa fa-exclamation-triangle fa-fw"></i>MySQLi is not installed/disabled!</div>';