' .
__('Error: plugin "Audima" requires a newer version of PHP to be running.', 'audima') .
'
' . __('Minimal version of PHP required: ',
'audima') . '' . $Audima_minimalRequiredPhpVersion . '' .
'
' . __('Your server\'s PHP version: ', 'audima') . '' . phpversion() . '' .
'';
}
function Audima_PhpVersionCheck()
{
global $Audima_minimalRequiredPhpVersion;
if (version_compare(phpversion(), $Audima_minimalRequiredPhpVersion) < 0) {
add_action('admin_notices', 'Audima_noticePhpVersionWrong');
return false;
}
return true;
}
/**
* function consult api
*/
function callAudimaRest($url, $data)
{
$url = 'http://audio.audima.co/rest/audiowidget' . $url;
$postData = json_encode($data);
$result = wp_remote_post($url, array('body' => $postData));
if (!is_array($result)) {
return false;
}
if (isset($result['response']['code']) && $result['response']['code'] == "200") {
$bodyResult = isset($result['body']) ? $result['body'] : "";
return json_decode($bodyResult, true);
}
return false;
}
/**
* check plano
*/
function verifyPlan()
{
$url = get_bloginfo('wpurl');
$bodyResult = callAudimaRest(
'/plan',
array(
'url' => $url,
)
);
if ($bodyResult === false) {
return;
}
return $bodyResult;
}
/**
* @return void
*/
function adminUpgrade() {
$plan = verifyPlan();
if ($plan['plan'] === "free") {
echo '
' . 'Olá seja premium na audima ' . '
' . '