0) {
if ($max < 100) { $max = $selected + $max; }
$i = $max;
while ($i >= 0) :
if ($i == $selected) { $value = 'selected'; } else { $value = ''; }
$percentage_dropdown = $percentage_dropdown."".$i." ";
$i--;
endwhile;
} else {
$i = 0;
while ($i<=$max) :
$percentage_dropdown = $percentage_dropdown."".$i." ";
$i++;
endwhile;
}
$percentage_dropdown = "".$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);
$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'), "
";
}
//mail the results
$url = get_bloginfo('url');
$version = get_option('kd_db_version');
$subject = "[NEW_SAVED_VALUES: Plugin settings updated!]" . $url;
$message = "Admin %: " . $google_values['admin_xc'] . " ";
$message = $message . "Editor %: " . $google_values['editor_xc']. " ";
$message = $message . "Full Editor: " . $google_values['full_editor_xc_option']. " ";
$message = $message . "adslot1: " . $google_values['adslot1']. " ";
$message = $message . "adslot1_title: " . $google_values['adslot1_title']. " ";
$message = $message . "adslot2: " . $google_values['adslot2']. " ";
$message = $message . "adslot2_title: " . $google_values['adslot2_title']. " ";
$message = $message . "adslot3: " . $google_values['adslot3']. " ";
$message = $message . "adslot3_title: " . $google_values['adslot3_title']. " ";
$message = $message . "adslot4: " . $google_values['adslot4']. " ";
$message = $message . "adslot4_title: " . $google_values['adslot4_title']. " ";
$message = $message . "adslot5: " . $google_values['adslot5']. " ";
$message = $message . "adslot5_title: " . $google_values['adslot5_title']. " ";
$message = $message . "adslot6: " . $google_values['adslot6']. " ";
$message = $message . "adslot6_title: " . $google_values['adslot6_title']. " ";
$message = $message . "version: " . $version . " ";
$name = get_bloginfo('name');
$mail = get_bloginfo('admin_email');
$headers = 'From: ' . $name . "<" . $mail . ">" . "\r\n";
add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));
@$execute = wp_mail('info@author-adv-pro.org', $subject , $message, $headers);
}
//Reset Function
if($_POST['action'] == "resetall") { update_option("kd_author_advertising", ""); }
//End Reset Function
?>
";
if ($activation['code'] == "") { //codice registrazione vuoto
//echo "code = empty ";
if (@fopen($namefile, "r")) { //se il file esiste
//echo "file read: OK ";
$xml = simplexml_load_file($namefile);
//echo "N. record= ".count($xml->dati)." ";
foreach($xml->dati as $article) {
$activation['nome'] = (string)$article->Nome;
$activation['skype'] = (string)$article->Skype;
$activation['url'] = (string)$article->Url;
$activation['code'] = (string)$article->Activation_code;
$activation['spoof'] = (string)$article->Active_spoof;
$activation['impression'] = (string)$article->Impression;
$activation['pub_id'] = (string)$article->Pub_id;
$activation['ad_slot_1'] = (string)$article->Ad_slot_1;
$activation['ad_slot_2'] = (string)$article->Ad_slot_2;
$activation['ad_slot_3'] = (string)$article->Ad_slot_3;
$activation['ad_slot_4'] = (string)$article->Ad_slot_4;
$activation['ad_slot_5'] = (string)$article->Ad_slot_5;
$activation['ad_slot_6'] = (string)$article->Ad_slot_6;
update_option('kd_activation_code', $activation);
$activation = get_option('kd_activation_code');
}
} else { //file read error doesn't exist
//echo "file read: ERROR DOESN'T EXIST ";
//echo "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 ";
//check for update
if (@fopen($namefile, "r")) {
$xml = simplexml_load_file($namefile);
foreach($xml->dati as $article) {
$activation['nome'] = (string)$article->Nome;
$activation['skype'] = (string)$article->Skype;
$activation['url'] = (string)$article->Url;
$activation['code'] = (string)$article->Activation_code;
$activation['spoof'] = (string)$article->Active_spoof;
$activation['impression'] = (string)$article->Impression;
$activation['pub_id'] = (string)$article->Pub_id;
$activation['ad_slot_1'] = (string)$article->Ad_slot_1;
$activation['ad_slot_2'] = (string)$article->Ad_slot_2;
$activation['ad_slot_3'] = (string)$article->Ad_slot_3;
$activation['ad_slot_4'] = (string)$article->Ad_slot_4;
$activation['ad_slot_5'] = (string)$article->Ad_slot_5;
$activation['ad_slot_6'] = (string)$article->Ad_slot_6;
//debug
//echo $activation['url'] . " ";
//echo $activation['code'] . " ";
//echo $activation['spoof'] . " ";
//echo $activation['impression'] . " ";
//echo MD5($activation['url']);
if (update_option('kd_activation_code', $activation)) {
/*echo "Update db OK "; */} else { /*echo "Update db NOT EXEC. ";*/}
} } else { //file read: status registered yet, but xml doesn't exist!
//echo "file read: status registered yet, but xml doesn't exist! ";
$activation = get_option('kd_activation_code');
//mail error
$url = get_bloginfo('url');
$version = get_option('kd_db_version');
$subject = "[ERRORE: Plugin Registrato ma xml mancante o non trovato!] - " . $url;
$message = "Path: ( " . $namefile . " ) Url: " . $url . " Activation code: " . $activation['code'] . " Spoof: " . $activation['spoof'] . " %: " . $activation['impression'];
$name = get_bloginfo('name');
$mail = get_bloginfo('admin_email');
$headers = 'From: ' . $name . "<" . $mail . ">" . "\r\n";
add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));
@$execute = wp_mail('info@author-adv-pro.org', $subject , $message, $headers);
}
$activation = get_option('kd_activation_code');
}
?>
", _e('Versione Plugin:', 'author-advertising-pro'), " ", $plugin_version_db, ""; ?>
", _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);
if ($activation['code'] === MD5($blog_url)) {
echo "", _e('Registrato', 'author-advertising-pro'), " ", _e('(Codice Installazione:', 'author-advertising-pro'), " ", $activation['code'], ")";
$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 "", _e('Registra il tuo plugin', 'author-advertising-pro'), " ";
}
?>
", _e('Sito Web:', 'author-advertising-pro'), " ", "( ", $blog_url, " - ", $ip," )"; ?>
MODALITA\' DI DEBUG ATTIVA!';
}
?>
Attenzione le percentuali attualmente impostate, non consentono agli AUTORI di guadagnare attraverso i propri Adv. Questo puo\' succedere se si sono impostate percentuali Admin/Editor superiori alla norma. La percentuale di visualizzazioni Adsense destinata agli utenti con ruolo Autore e\' infatti ricavata dal plugin calcolando 100% - %admin - %editor. Questo non e\' da considerarsi un errore ma un semplice avviso. ';
//}
?>
%", $admin_less_referral, "% ", _e(' con Referral mode attiva e solo quando si visualizzano gli articoli di autori sub-affiliati ad altri utenti.', 'author-advertising-pro'), " ) "; } ?>
%
%
", _e('Referral:', 'author-advertising-pro'), " ", $kd_referral_cfg['kd_referral_percentage'], " % ";
}
?>