' . 'Download plugin' . '';
$links[] = '' . '"Donate / Don" - PayPal' . '';
}
return $links;
}
if( is_admin() )
{
add_filter( 'plugin_row_meta', 'widget_google_adsense_set_plugin_meta', 10, 2 );
}
function widget_google_adsense_control($number) {
$options = $newoptions = get_option('widget_google_adsense');
if ( $_POST["google_adsensesubmit-$number"] ) {
$newoptions[$number]['title'] = strip_tags(stripslashes($_POST["google_adsensetitle-$number"]));
$newoptions[$number]['ID'] = strip_tags(stripslashes($_POST["google_adsenseID-$number"]));
$newoptions[$number]['width'] = strip_tags(stripslashes($_POST["google_adsensewidth-$number"]));
$newoptions[$number]['height'] = strip_tags(stripslashes($_POST["google_adsenseheight-$number"]));
$newoptions[$number]['format'] = strip_tags(stripslashes($_POST["google_adsenseformat-$number"]));
$newoptions[$number]['content'] = strip_tags(stripslashes($_POST["google_adsensecontent-$number"]));
$newoptions[$number]['type'] = strip_tags(stripslashes($_POST["google_adsensetype-$number"]));
$newoptions[$number]['b_color'] = strip_tags(stripslashes($_POST["google_adsense_b_color-$number"]));
$newoptions[$number]['bg_color'] = strip_tags(stripslashes($_POST["google_adsense_bg_color-$number"]));
$newoptions[$number]['l_f_color'] = strip_tags(stripslashes($_POST["google_adsense_l_f_color-$number"]));
$newoptions[$number]['f_color'] = strip_tags(stripslashes($_POST["google_adsense_f_color-$number"]));
$newoptions[$number]['l_f_hover'] = strip_tags(stripslashes($_POST["google_adsense_l_f_hover-$number"]));
$newoptions[$number]['show'] = strip_tags(stripslashes($_POST["google_adsenseshow-$number"]));
$newoptions[$number]['numero'] = strip_tags(stripslashes($_POST["numero-$number"]));
}
if ($options[$number]['title']=='') {
$newoptions[$number]['title'] = 'Google Adsense';
}
if ($options[$number]['ID']=='') {
$newoptions[$number]['ID'] = 'pub-1697768673775509'; /* pub-6795014292675223 */
}
if ($options[$number]['width']=='') {
$newoptions[$number]['width'] = '300';
}
if ($options[$number]['height']=='') {
$newoptions[$number]['height'] = '250';
}
if ($options[$number]['content']=='') {
$newoptions[$number]['content'] = '300|250';
}
if ($options[$number]['type']=='') {
$newoptions[$number]['type'] = 'text_image';
}
if ($options[$number]['b_color']=='') {
$newoptions[$number]['b_color'] = 'EBEAEA';
}
if ($options[$number]['bg_color']=='') {
$newoptions[$number]['bg_color'] = 'ffffff';
}
if ($options[$number]['l_f_color']=='') {
$newoptions[$number]['l_f_color'] = 'DB4304';
}
if ($options[$number]['f_color']=='') {
$newoptions[$number]['f_color'] = '000000';
}
if ($options[$number]['l_f_hover']=='') {
$newoptions[$number]['l_f_hover'] = '000000';
}
if ( $options != $newoptions ) {
$options = $newoptions;
update_option('widget_google_adsense', $options);
}
$allSelected = $homeSelected = $postSelected = $pageSelected = $categorySelected = false;
switch ($options[$number]['show']) {
case "all":
$allSelected = true;
break;
case "":
$allSelected = true;
break;
case "home":
$homeSelected = true;
break;
case "post":
$postSelected = true;
break;
case "page":
$pageSelected = true;
break;
case "category":
$categorySelected = true;
break;
}
$predefini = ($options[$number]['format']==0?0:1);
?>
" id="google_adsensesubmit-" value="" />
" id="numero-" value="" />
';
$ending = '
';
$show = $options[$number]['show']; // Get the setting on where to show the widget
$width = $options[$number]['width']; // User specified with of player
$height = $options[$number]['height']; // User specified height of player
$google_pub = $options[$number]['ID'];
$google_advaced = $options[$number]['width'];
$google_prefixed = $options[$number]['height'];
if($options[$number]['format']==1){
$width = $pieces[0];
$height = $pieces[1];
}
else{
$width = $options[$number]['width'];
$height = $options[$number]['height'];
}
$b_color = $options[$number]['b_color'];
$f_color = $options[$number]['f_color'];
$l_f_color = $options[$number]['l_f_color'];
$l_f_hover = $options[$number]['l_f_hover'];
$bg_color = $options[$number]['bg_color'];
$type = $options[$number]['type'];
if ($height=='') {
if ($width==''){$width = 300;}
}
if ($width=='') {
if ($height==''){$height = 250;}
}
/* Check the optional parameters and change the link and leading text accordingly */
/*
if ($pieces[3]==''){$mediaURL = $medialoc.$mediaID;}
else {$mediaURL=$pieces[3]; $leadingtext = $pieces[2];}
*/
$embeddedAdsense = '
';
/* Put it all together */
$fulltext = $starting.$embeddedAdsense.$ending;
/* And do the widget dance! */
?>
";
/* Do the conditional tag checks. */
switch ($show) {
case "all":
$title ? print($before_title . $title . $after_title) : null;
echo $fulltext;
break;
case "home":
if (is_home()) {
$title ? print($before_title . $title . $after_title) : null;
echo $fulltext;
}
else {
echo "";
}
break;
case "post":
if (is_single($slug)) {
$title ? print($before_title . $title . $after_title) : null;
echo $fulltext;
}
else {
echo "";
}
break;
case "page":
if (is_page($slug)) {
$title ? print($before_title . $title . $after_title) : null;
echo $fulltext;
}
else {
echo "";
}
break;
case "category":
if (is_category($slug)) {
$title ? print($before_title . $title . $after_title) : null;
echo $fulltext;
}
else {
echo "";
}
break;
}
echo ""; ?>
widget_max_nbre ) $number = widget_max_nbre;
if ( $number < 1 ) $number = 1;
$newoptions['number'] = $number;
}
else {
$number = widget_max_nbre;
if ( $number > widget_max_nbre ) $number = widget_max_nbre;
if ( $number < 1 ) $number = 1;
$newoptions['number'] = $number;
}
if ( $options != $newoptions ) {
$options = $newoptions;
update_option('widget_google_adsense', $newoptions);
widget_google_adsense_register($newoptions['number']);
}
}
function widget_google_adsense_page() {
$options = $newoptions = get_option('widget_google_adsense');
?>
widget_max_nbre ) $number = widget_max_nbre;
for ($i = 1; $i <= widget_max_nbre; $i++) {
$name = array('Google Adsense Widget %s', 'widgets', $i);
if ( function_exists( 'register_sidebar_widget') ){
register_sidebar_widget($name, $i <= $number ? 'widget_google_adsense' : 'widget_google_adsense', $i);
// register_sidebar_widget takes the name of the widget and the function that will be used to display it.
}
elseif ( function_exists( 'wp_register_sidebar_widget') ){
wp_register_sidebar_widget( $i, $name, $i <= $number ? 'widget_google_adsense' : 'widget_google_adsense', $options );
}
if ( function_exists( 'register_widget_control') ){
register_widget_control($name, $i <= $number ? 'widget_google_adsense_control' : 'widget_google_adsense_control', 490, 455, $i);
// register_widget_control takes the name of the widget and the function that will be used to to change options (in the design panel).
}
elseif ( function_exists( 'wp_register_widget_control') ){
wp_register_widget_control( $i, $name, $i <= $number ? 'widget_google_adsense_control' : 'widget_google_adsense_control' );
}
}
add_action('sidebar_admin_setup', 'widget_google_adsense_setup');
add_action('sidebar_admin_page', 'widget_google_adsense_page');
}
for ($i = 1; $i <= widget_max_nbre; $i++) {
$name = array('Google Adsense Widget %s', 'widgets', $i);
if ( function_exists( 'register_sidebar_widget') ){
register_sidebar_widget($name, $i <= $number ? 'widget_google_adsense' : 'widget_google_adsense', $i);
// register_sidebar_widget takes the name of the widget and the function that will be used to display it.
}
elseif ( function_exists( 'wp_register_sidebar_widget') ){
wp_register_sidebar_widget( $i, $name, $i <= $number ? 'widget_google_adsense' : 'widget_google_adsense', $options );
}
if ( function_exists( 'register_widget_control') ){
register_widget_control($name, $i <= $number ? 'widget_google_adsense_control' : 'widget_google_adsense_control', 490, 455, $i);
// register_widget_control takes the name of the widget and the function that will be used to to change options (in the design panel).
}
elseif ( function_exists( 'wp_register_widget_control') ){
wp_register_widget_control( $i, $name, $i <= $number ? 'widget_google_adsense_control' : 'widget_google_adsense_control' );
}
}
add_action('init', 'widget_google_adsense_register', 12);
}
function google_adsense_display($args){
$options = get_option('google_adsense_widget');
extract (shortcode_atts(
array(
'url'=> get_permalink(),
'title' => get_the_title()
),$args));
$embeddedAdsense = '
';
return $embeddedAdsense;
}
add_shortcode('google_adsense_display','google_adsense_display');
add_action('widgets_init', 'widget_google_adsense_init');
//add_action('plugins_loaded', 'widget_google_adsense_init');
/*
}
add_action('widgets_init', create_function('', 'return register_widget("widget_google_adsense_init");'));
*/
?>