0) {
if ($max < 100) { $max = $selected + $max; }
$i = $max;
while ($i >= 0) :
if ($i == $selected) { $value = 'selected'; } else { $value = ''; }
$percentage_dropdown = $percentage_dropdown."";
$i--;
endwhile;
} else {
$i = 0;
while ($i<=$max) :
$percentage_dropdown = $percentage_dropdown."";
$i++;
endwhile;
}
$percentage_dropdown = " %";
return $percentage_dropdown;
}
function kd_clean_url($blog_url) {
/////////////////////////////////////////////////////////////////
$blog_url = str_ireplace('http://', '', $blog_url);
$blog_url = str_ireplace('http://www.', '', $blog_url);
$blog_url = str_ireplace('https://', '', $blog_url);
$blog_url = str_ireplace('https://www.', '', $blog_url);
$find_slash_pos = strpos($blog_url, "/");
if ($find_slash_pos > 3) {
$url_len = strlen($blog_url);
$char = $find_slash_pos - $url_len;
$clean_blog_url = substr($blog_url, 0, $char);
$blog_url = $clean_blog_url; }
return $blog_url;
}
function kd_admin_options(){
global $wpdb;
//check if Plugin need to install his db table.
$kd_need_install = kd_check_install();
//check if Plugin need to update db table column for a new version.
$kd_need_update = kd_check_update();
if ($kd_need_install) {
kd_installer();
} elseif ($kd_need_update) {
kd_updater();
} else {
$base_prefix = $wpdb->base_prefix;
$table_name = $base_prefix . "author_advertising";
$wp_roles = new WP_Roles;
$existingroles = $wp_roles->get_names();
$current_roles = $wp_roles->roles;
if(isset($_POST['update_kd_google'])) {
$google_values['debug_mode'] = $_POST['debug_mode'];
$google_values['admin_user_id'] = $_POST['admin_user_id'];
$google_values['admin_xc'] = $_POST['admin_xc'];
$google_values['editor_xc'] = $_POST['editor_xc'];
$google_values['full_editor_xc_option'] = $_POST['full_editor_xc_option'];
foreach($current_roles as $key => $role){
$role = urlencode($role["name"]);
if(isset($_POST[$role]) == $role){ $wp_roles->add_cap($key, 'author_advertising' ); }
else { $wp_roles->remove_cap( $key, 'author_advertising' ); }
}
$current_roles = $wp_roles->roles;
$google_values['level_user'] = $_POST['level_user'];
$google_values['myadsense_title'] = stripslashes($_POST['myadsense_title']);
$google_values['myadsense_text'] = stripslashes($_POST['myadsense_text']);
$google_values['adslot1'] = $_POST['adslot1'];
$google_values['adslot1_title'] = stripslashes($_POST['adslot1_title']);
$google_values['adslot2'] = $_POST['adslot2'];
$google_values['adslot2_title'] = stripslashes($_POST['adslot2_title']);
$google_values['adslot3'] = $_POST['adslot3'];
$google_values['adslot3_title'] = stripslashes($_POST['adslot3_title']);
$google_values['adslot4'] = $_POST['adslot4'];
$google_values['adslot4_title'] = stripslashes($_POST['adslot4_title']);
$google_values['adslot5'] = $_POST['adslot5'];
$google_values['adslot5_title'] = stripslashes($_POST['adslot5_title']);
$google_values['adslot6'] = $_POST['adslot6'];
$google_values['adslot6_title'] = stripslashes($_POST['adslot6_title']);
$google_values['ad_google_rotator_mode'] = $_POST['ad_google_rotator_mode'];
update_option("kd_author_advertising", $google_values);
/*if (isset($_POST['activation_code'])) {
$activation['code'] = $_POST['activation_code'];
//echo $activation['code'];
update_option('kd_activation_code', $activation);
}*/
$kd_referral_cfg = get_option('kd_referral_cfg');
if ($kd_referral_cfg['kd_referral_percentage'] > $google_values['admin_xc']) {
$kd_referral_cfg['kd_referral_percentage'] = $google_values['admin_xc'];
update_option('kd_referral_cfg',$kd_referral_cfg);
echo "
", _e('Poichè la percentuale dell\'admin è stata diminutita rispetto alla percentuale del Referral, di conseguenza è stato corretto anche il valore percentuale del Referral. Verifica le impostazioni del Referral Mode se vuoi modificare il suo valore.', 'author-advertising-pro'), "
Error
"; } } else { //file exist and plugin yet registered, check modify data and update its. //echo "file read: status registered yet! Only read and update data", _e('Lingua in uso:', 'author-advertising-pro'), " ", $language; ?>
", _e('Status Plugin:', 'author-advertising-pro'), " ";
$blog_url = get_bloginfo('url');
$blog_url = kd_clean_url($blog_url);
//ACTIVE CHECK
//echo $activation['code'] . "
";
//echo MD5($blog_url);
// $activation = get_option('kd_activation_code'); //fix 5.1.0
// if ($activation['code'] === MD5($blog_url)) { old function
if (@fopen($namefile, "r")) {
echo "", _e('Registrato', 'author-advertising-pro'), " "; //_e('(Codice Installazione:', 'author-advertising-pro'), " ", $activation['code'], ")";
echo "";
$plugin_is_active = true;
} else {
echo "", _e('Non Registrato', 'author-advertising-pro'), "";
$plugin_is_active = false;
//initialize send blog_values
$mail = get_bloginfo('admin_email');
echo "";
}
?>