本文整理汇总了PHP中MainWP_Utility::getCURLSSLVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::getCURLSSLVersion方法的具体用法?PHP MainWP_Utility::getCURLSSLVersion怎么用?PHP MainWP_Utility::getCURLSSLVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::getCURLSSLVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSite
public static function addSite($website)
{
$error = '';
$message = '';
if ($website) {
$error = __('Your site is already added to MainWP', 'mainwp');
} else {
try {
//Add
if (function_exists('openssl_pkey_new')) {
$conf = array('private_key_bits' => 384);
$conf_loc = MainWP_System::get_openssl_conf();
if (!empty($conf_loc)) {
$conf['config'] = $conf_loc;
}
$res = openssl_pkey_new($conf);
@openssl_pkey_export($res, $privkey, null, $conf);
$pubkey = openssl_pkey_get_details($res);
$pubkey = $pubkey['key'];
} else {
$privkey = '-1';
$pubkey = '-1';
}
$url = $_POST['managesites_add_wpurl'];
$pluginConflicts = get_option('mainwp_pluginConflicts');
if ($pluginConflicts !== false) {
$pluginConflicts = array_keys($pluginConflicts);
}
$themeConflicts = get_option('mainwp_themeConflicts');
if ($themeConflicts !== false) {
$themeConflicts = array_keys($themeConflicts);
}
// to fix bug
if (is_array($pluginConflicts)) {
$pluginConflicts = array_filter($pluginConflicts);
}
if (is_array($themeConflicts)) {
$themeConflicts = array_filter($themeConflicts);
}
$verifyCertificate = !isset($_POST['verify_certificate']) || empty($_POST['verify_certificate']) ? null : $_POST['verify_certificate'];
$sslVersion = MainWP_Utility::getCURLSSLVersion(!isset($_POST['ssl_version']) || empty($_POST['ssl_version']) ? null : $_POST['ssl_version']);
$addUniqueId = isset($_POST['managesites_add_uniqueId']) ? $_POST['managesites_add_uniqueId'] : '';
$http_user = isset($_POST['managesites_add_http_user']) ? $_POST['managesites_add_http_user'] : '';
$http_pass = isset($_POST['managesites_add_http_pass']) ? $_POST['managesites_add_http_pass'] : '';
$information = MainWP_Utility::fetchUrlNotAuthed($url, $_POST['managesites_add_wpadmin'], 'register', array('pubkey' => $pubkey, 'server' => get_admin_url(), 'uniqueId' => $addUniqueId, 'pluginConflicts' => json_encode($pluginConflicts), 'themeConflicts' => json_encode($themeConflicts)), false, $verifyCertificate, $http_user, $http_pass, $sslVersion);
if (isset($information['error']) && $information['error'] != '') {
$error = $information['error'];
} else {
if (isset($information['register']) && $information['register'] == 'OK') {
//Add website to database
$groupids = array();
$groupnames = array();
if (isset($_POST['groupids'])) {
foreach ($_POST['groupids'] as $group) {
$groupids[] = $group;
}
}
if (isset($_POST['groupnames']) && $_POST['groupnames'] != '' || isset($_POST['groupnames_import']) && $_POST['groupnames_import'] != '') {
if ($_POST['groupnames']) {
$tmpArr = explode(',', $_POST['groupnames']);
} else {
if ($_POST['groupnames_import']) {
$tmpArr = explode(';', $_POST['groupnames_import']);
}
}
foreach ($tmpArr as $tmp) {
$group = MainWP_DB::Instance()->getGroupByNameForUser(trim($tmp));
if ($group) {
if (!in_array($group->id, $groupids)) {
$groupids[] = $group->id;
}
} else {
$groupnames[] = trim($tmp);
}
}
}
if (!isset($information['uniqueId']) || empty($information['uniqueId'])) {
$addUniqueId = '';
}
$http_user = isset($_POST['managesites_add_http_user']) ? $_POST['managesites_add_http_user'] : '';
$http_pass = isset($_POST['managesites_add_http_pass']) ? $_POST['managesites_add_http_pass'] : '';
global $current_user;
$id = MainWP_DB::Instance()->addWebsite($current_user->ID, $_POST['managesites_add_wpname'], $_POST['managesites_add_wpurl'], $_POST['managesites_add_wpadmin'], base64_encode($pubkey), base64_encode($privkey), $information['nossl'], isset($information['nosslkey']) ? $information['nosslkey'] : null, $groupids, $groupnames, $verifyCertificate, $addUniqueId, $http_user, $http_pass, $sslVersion);
$message = sprintf(__('Site successfully added - Visit the Site\'s %sDashboard%s now.', 'mainwp'), '<a href="admin.php?page=managesites&dashboard=' . $id . '" style="text-decoration: none;" title="' . __('Dashboard', 'mainwp') . '">', '</a>');
$website = MainWP_DB::Instance()->getWebsiteById($id);
MainWP_Sync::syncInformationArray($website, $information);
} else {
$error = __('Undefined error.', 'mainwp');
}
}
} catch (MainWP_Exception $e) {
if ($e->getMessage() == 'HTTPERROR') {
$error = 'HTTP error' . ($e->getMessageExtra() != null ? ' - ' . $e->getMessageExtra() : '');
} else {
if ($e->getMessage() == 'NOMAINWP') {
$error = __('No MainWP Child plugin detected, first install and activate the plugin and add your site to MainWP afterwards. If you continue experiencing this issue please ', 'mainwp');
if ($e->getMessageExtra() != null) {
$error .= sprintf(__('test your connection %shere%s or ', 'mainwp'), '<a href="' . admin_url('admin.php?page=managesites&do=test&site=' . urlencode($e->getMessageExtra())) . '">', '</a>');
}
$error .= sprintf(__('post as much information as possible on the error in the %ssupport forum%s.', 'mainwp'), '<a href="https://mainwp.com/forum/">', '</a>');
//.........这里部分代码省略.........
示例2: mainwp_testwp
function mainwp_testwp()
{
$this->secure_request('mainwp_testwp');
$url = null;
$name = null;
$http_user = null;
$http_pass = null;
$verifyCertificate = 1;
$sslVersion = 0;
if (isset($_POST['url'])) {
$url = $_POST['url'];
$verifyCertificate = $_POST['test_verify_cert'];
$sslVersion = MainWP_Utility::getCURLSSLVersion($_POST['test_ssl_version']);
$http_user = $_POST['http_user'];
$http_pass = $_POST['http_pass'];
} else {
if (isset($_POST['siteid'])) {
$website = MainWP_DB::Instance()->getWebsiteById($_POST['siteid']);
if ($website) {
$url = $website->url;
$name = $website->name;
$verifyCertificate = $website->verify_certificate;
$sslVersion = $website->ssl_version;
$http_user = $website->http_user;
$http_pass = $website->http_pass;
}
}
}
$rslt = MainWP_Utility::tryVisit($url, $verifyCertificate, $http_user, $http_pass, $sslVersion);
if (isset($rslt['error']) && $rslt['error'] != '' && substr($url, -9) != 'wp-admin/') {
if (substr($url, -1) != '/') {
$url .= '/';
}
$url .= 'wp-admin/';
$newrslt = MainWP_Utility::tryVisit($url, $verifyCertificate, $http_user, $http_pass, $sslVersion);
if (isset($newrslt['error']) && $rslt['error'] != '') {
$rslt = $newrslt;
}
}
if ($name != null) {
$rslt['sitename'] = $name;
}
die(json_encode($rslt));
}