Esempio n. 1
0
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     if ($adrotate_config['widgetalign'] == 'Y') {
         echo '<ul><li>';
     }
     echo adrotate_banner($instance['group'], $instance['banner'], $instance['block'], $instance['column'], false, $adrotate_config['fallbackads']);
     if ($adrotate_config['widgetalign'] == 'Y') {
         echo '</li></ul>';
     }
     echo $after_widget;
 }
Esempio n. 2
0
/**
 * Template part for leaderboard ad
 *
 * @package WordPress
 * @subpackage FoundationPress
 * @since FoundationPress 1.0.0
 */
?>

	<div class="ad-container">
	<?php 
// echo adrotate_group('1');
if ($astused > 0) {
    // ast used defined   How to do this in the new?
} else {
    $pageadset = $_GET['ast'];
    if (filter_var($pageadset, FILTER_VALIDATE_INT)) {
        //reserved for default ad set
        $astused = $pageadset;
    } else {
        // Retrieve adset info from URL query vars
        $astused = 1;
    }
}
echo '    <!-- leaderboard banner ' . $astused . ' --> ';
if (function_exists(adrotate_banner)) {
    echo adrotate_banner($astused, 34);
}
?>
        
	</div>
/**
 * Template part for from page lower box ad
 *
 * @package WordPress
 * @subpackage FoundationPress
 * @since FoundationPress 1.0.0
 */
?>

	<div class="small-12 large-12 columns ad-container">
			<?php 
// echo adrotate_group('1');
if ($astused > 0) {
    // ast used defined   How to do this in the new?
} else {
    $pageadset = $_GET['ast'];
    if (filter_var($pageadset, FILTER_VALIDATE_INT)) {
        //reserved for default ad set
        $astused = $pageadset;
    } else {
        // Retrieve adset info from URL query vars
        $astused = 1;
    }
}
echo '    <!-- front page lower box banner ' . $astused . ' --> ';
if (function_exists(adrotate_banner)) {
    echo adrotate_banner($astused, 15);
}
?>
	</div>
Esempio n. 4
0
?>

	<div class="ad-container">
		<div class="row">
			<div class="small-12 columns">
				
			
	<?php 
// echo adrotate_group('1');
if ($astused > 0) {
    // ast used defined   How to do this in the new?
} else {
    $pageadset = $_GET['ast'];
    if (filter_var($pageadset, FILTER_VALIDATE_INT)) {
        //reserved for default ad set
        $astused = $pageadset;
    } else {
        // Retrieve adset info from URL query vars
        $astused = 1;
    }
}
echo '    <!-- billboard banner ' . $astused . ' --> ';
if (function_exists(adrotate_banner)) {
    echo adrotate_banner($astused, 23);
}
?>

	</div>
		</div>
        
	</div>
Esempio n. 5
0
/**
 * Template part for center ad
 *
 * @package WordPress
 * @subpackage FoundationPress
 * @since FoundationPress 1.0.0
 */
?>

	<div class="small-12 large-12 columns ad-container">
			<?php 
// echo adrotate_group('1');
if ($astused > 0) {
    // ast used defined   How to do this in the new?
} else {
    $pageadset = $_GET['ast'];
    if (filter_var($pageadset, FILTER_VALIDATE_INT)) {
        //reserved for default ad set
        $astused = $pageadset;
    } else {
        // Retrieve adset info from URL query vars
        $astused = 1;
    }
}
echo '    <!-- center banner ' . $astused . ' --> ';
if (function_exists(adrotate_banner)) {
    echo adrotate_banner($astused, 8);
}
?>
	</div>
Esempio n. 6
0
function adrotate_wizard()
{
    global $wpdb, $userdata;
    $thetime = current_time('timestamp');
    $endtime = $thetime + 31536000;
    $step = $_GET['step'];
    $message = $_GET['message'];
    $back = $_GET['back'];
    $magic_id = $_GET['magic_id'];
    ?>
	<div class="wrap">
		<?php 
    $groupcheck = $wpdb->get_var("SELECT COUNT(*) FROM `" . $wpdb->prefix . "adrotate_groups`");
    if ($groupcheck > 0) {
        ?>

	  	<?php 
        if ($step == '' or $step == 1) {
            ?>
	  	<!-- Title and Code -->

		<?php 
            if (strlen($magic_id) < 1 and strlen($back) < 1) {
                // Try to re-use old records
                $SQL = "SELECT `id` FROM `" . $wpdb->prefix . "adrotate` WHERE (`title` = '' AND `bannercode` = '') OR `magic` = 2 ORDER BY `id` DESC LIMIT 1";
                $empty = $wpdb->get_var($SQL);
                if ($empty == 0) {
                    $wpdb->query("INSERT INTO `" . $wpdb->prefix . "adrotate` (`title`, `bannercode`, `thetime`, `updated`, `author`, `active`, `startshow`, `endshow`, `group`, `image`, `link`, `tracker`, `clicks`, `maxclicks`, `shown`, `magic`) VALUES ('', '', '{$thetime}', '{$thetime}', '{$userdata->display_name}', 'no', '{$thetime}', '{$endtime}', '', 'none', '', 'N', 0, 0, 0, 2)");
                }
                $magic_id = $wpdb->get_var($SQL);
            } else {
                $edit = $wpdb->get_row("SELECT `title`, `bannercode` FROM `" . $wpdb->prefix . "adrotate` WHERE `id` = '{$magic_id}'");
            }
            ?>

	  	<h2>Banner Wizard - Step 1 of 3 - Create the banner</h2>

		<?php 
            if ($message == 'field_error') {
                ?>
			<div id="message" class="updated fade"><p>Not all fields met the requirements.</p></div>
		<?php 
            }
            ?>

	  	<form method="post" action="admin.php?page=adrotate2">
	    	<input type="hidden" name="adrotate_step" value="1" />
	    	<input type="hidden" name="adrotate_magic_id" value="<?php 
            echo $magic_id;
            ?>
" />

	    	<table class="widefat" style="margin-top: .5em">

				<thead>
				<tr valign="top">
					<th colspan="2" bgcolor="#DDD">Use this step by step guide to create referrer banners, for example from Google AdSense.
					<br />Fill in the title as a reference for the banner manager.
					<br />The code field holds your referrer code. This can be a snippet of JavaScript or simply an HTML link. That depends on your banner program.</th>
				</tr>
				</thead>

				<tbody>
		      	<tr>
			        <th scope="row" width="25%">Title:</th>
			        <td><input tabindex="1" name="adrotate_title" type="text" size="67" class="search-input" autocomplete="off" value="<?php 
            echo $edit->title;
            ?>
" /></td>
		      	</tr>
		      	<tr>
			        <th scope="row" width="25%">Code:</th>
			        <td><textarea tabindex="2" name="adrotate_bannercode" cols="70" rows="10"><?php 
            echo stripslashes($edit->bannercode);
            ?>
</textarea>
			        <br /><em>HTML/JavaScript allowed, use with care!</em></td>
		      	</tr>
			</table>
	    	<p class="submit">
				<input tabindex="3" type="submit" name="adrotate_magic_submit" class="button-primary" value="Continue" />
				<a href="admin.php?page=adrotate&magic_id=<?php 
            echo $magic_id;
            ?>
&cancel=true" class="button">Cancel</a>
	    	</p>
		</form>

	  	<?php 
        } else {
            if ($step == 2) {
                ?>
	  	<!-- Extra options (Timespan, group) -->

		<?php 
                $edit = $wpdb->get_row("SELECT `id`, `group`, `startshow`, `endshow`, `maxclicks`, `maxshown` FROM `" . $wpdb->prefix . "adrotate` WHERE `id` = '{$magic_id}'");
                list($sday, $smonth, $syear) = split(" ", gmdate("d m Y", $edit->startshow));
                list($eday, $emonth, $eyear) = split(" ", gmdate("d m Y", $edit->endshow));
                ?>

	  	<h2>Banner Wizard - Step 2 of 3 - Setting some options</h2>

		<?php 
                if ($message == 'field_error') {
                    ?>
			<div id="message" class="updated fade"><p>Not all fields met the requirements.</p></div>
		<?php 
                }
                ?>

	  	<form method="post" action="admin.php?page=adrotate2">
	    	<input type="hidden" name="adrotate_step" value="2" />
	    	<input type="hidden" name="adrotate_magic_id" value="<?php 
                echo $magic_id;
                ?>
" />

	    	<table class="widefat" style="margin-top: .5em">

				<thead>
				<tr valign="top">
					<th colspan="4" bgcolor="#DDD">Pick a group where you banner will be in. Groups of banners are useful and relate to locations on your website. You can put multiple banners in a group and show that group somewhere on your website. Thus restricting banners to that one location.
					<br />Optionally, set a date from when to when the banner should be shown. You will be alerted when the time has run out.</th>
				</tr>
				</thead>

				<tbody>
		      	<tr>
				    <th scope="row">Select a group:</th>
			        <td colspan="3">
			        <select tabindex="1" name='adrotate_group' id='cat' class='postform'>
			        	<option value="" <?php 
                if ($edit->group == "") {
                    echo 'selected';
                }
                ?>
>New Group</option>
					<?php 
                $groups = $wpdb->get_results("SELECT `id`, `name` FROM `" . $wpdb->prefix . "adrotate_groups` ORDER BY `name`");
                foreach ($groups as $group) {
                    ?>
					    <option value="<?php 
                    echo $group->id;
                    ?>
" <?php 
                    if ($edit->group == $group->id) {
                        echo 'selected';
                    }
                    ?>
><?php 
                    echo $group->id;
                    ?>
 - <?php 
                    echo $group->name;
                    ?>
</option>
			    	<?php 
                }
                ?>
			    	</select>
					</td>
				</tr>
		      	<tr>
				    <th scope="row">Or make a group:</th>
			        <td colspan="3"><input tabindex="2" name="adrotate_newgroup" type="text" size="40" class="search-input" autocomplete="off" value="" /><br /><em>Leave this field empty if you select a group from the dropdown menu!</em></td>
				</tr>
		      	<tr>
			        <th scope="row">Display From:</th>
			        <td>
			        	<input tabindex="3" name="adrotate_sday" class="search-input" type="text" size="4" maxlength="2" value="<?php 
                echo $sday;
                ?>
" /> /
						<select tabindex="4" name="adrotate_smonth">
							<option value="" <?php 
                if ($smonth == "") {
                    echo 'selected';
                }
                ?>
>Pick month...</option>
							<option value="01" <?php 
                if ($smonth == "01") {
                    echo 'selected';
                }
                ?>
>January</option>
							<option value="02" <?php 
                if ($smonth == "02") {
                    echo 'selected';
                }
                ?>
>February</option>
							<option value="03" <?php 
                if ($smonth == "03") {
                    echo 'selected';
                }
                ?>
>March</option>
							<option value="04" <?php 
                if ($smonth == "04") {
                    echo 'selected';
                }
                ?>
>April</option>
							<option value="05" <?php 
                if ($smonth == "05") {
                    echo 'selected';
                }
                ?>
>May</option>
							<option value="06" <?php 
                if ($smonth == "06") {
                    echo 'selected';
                }
                ?>
>June</option>
							<option value="07" <?php 
                if ($smonth == "07") {
                    echo 'selected';
                }
                ?>
>July</option>
							<option value="08" <?php 
                if ($smonth == "08") {
                    echo 'selected';
                }
                ?>
>August</option>
							<option value="09" <?php 
                if ($smonth == "09") {
                    echo 'selected';
                }
                ?>
>September</option>
							<option value="10" <?php 
                if ($smonth == "10") {
                    echo 'selected';
                }
                ?>
>October</option>
							<option value="11" <?php 
                if ($smonth == "11") {
                    echo 'selected';
                }
                ?>
>November</option>
							<option value="12" <?php 
                if ($smonth == "12") {
                    echo 'selected';
                }
                ?>
>December</option>
						</select> /
						<input tabindex="5" name="adrotate_syear" class="search-input" type="text" size="4" maxlength="4" value="<?php 
                echo $syear;
                ?>
" />
			        </td>
			        <th scope="row">Until:</th>
			        <td>
			        	<input tabindex="6" name="adrotate_eday" class="search-input" type="text" size="4" maxlength="2" value="<?php 
                echo $eday;
                ?>
" /> /
						<select tabindex="7" name="adrotate_emonth">
							<option value="" <?php 
                if ($emonth == "") {
                    echo 'selected';
                }
                ?>
>Pick month...</option>
							<option value="01" <?php 
                if ($emonth == "01") {
                    echo 'selected';
                }
                ?>
>January</option>
							<option value="02" <?php 
                if ($emonth == "02") {
                    echo 'selected';
                }
                ?>
>February</option>
							<option value="03" <?php 
                if ($emonth == "03") {
                    echo 'selected';
                }
                ?>
>March</option>
							<option value="04" <?php 
                if ($emonth == "04") {
                    echo 'selected';
                }
                ?>
>April</option>
							<option value="05" <?php 
                if ($emonth == "05") {
                    echo 'selected';
                }
                ?>
>May</option>
							<option value="06" <?php 
                if ($emonth == "06") {
                    echo 'selected';
                }
                ?>
>June</option>
							<option value="07" <?php 
                if ($emonth == "07") {
                    echo 'selected';
                }
                ?>
>July</option>
							<option value="08" <?php 
                if ($emonth == "08") {
                    echo 'selected';
                }
                ?>
>August</option>
							<option value="09" <?php 
                if ($emonth == "09") {
                    echo 'selected';
                }
                ?>
>September</option>
							<option value="10" <?php 
                if ($emonth == "10") {
                    echo 'selected';
                }
                ?>
>October</option>
							<option value="11" <?php 
                if ($emonth == "11") {
                    echo 'selected';
                }
                ?>
>November</option>
							<option value="12" <?php 
                if ($emonth == "12") {
                    echo 'selected';
                }
                ?>
>December</option>
						</select> /
						<input tabindex="8" name="adrotate_eyear" class="search-input" type="text" size="4" maxlength="4" value="<?php 
                echo $eyear;
                ?>
" />
					</td>
		      	</tr>
				</tbody>

			</table>
	    	<p class="submit">
				<input tabindex="11" type="submit" name="adrotate_magic_submit" class="button-primary" value="Continue" />
				<a href="admin.php?page=adrotate2&magic_id=<?php 
                echo $magic_id;
                ?>
&step=1&back=true" class="button">Back</a>
				<a href="admin.php?page=adrotate&magic_id=<?php 
                echo $magic_id;
                ?>
&cancel=true" class="button">Cancel</a>
	    	</p>
		</form>

	  	<?php 
            } else {
                if ($step == 3) {
                    ?>
	  	<!-- Preview and Confirm -->

		<?php 
                    $edit = $wpdb->get_row("SELECT * FROM `" . $wpdb->prefix . "adrotate` WHERE `id` = '{$magic_id}'");
                    $group = $wpdb->get_var("SELECT `name` FROM `" . $wpdb->prefix . "adrotate_groups` WHERE `id` = '{$edit->group}'");
                    list($sday, $smonth, $syear) = split(" ", gmdate("d m Y", $edit->startshow));
                    list($eday, $emonth, $eyear) = split(" ", gmdate("d m Y", $edit->endshow));
                    ?>

	  	<h2>Banner Wizard - Step 3 of 3 - Preview and implement your banner</h2>

	  	<form method="post" action="admin.php?page=adrotate2">
	    	<input type="hidden" name="adrotate_step" value="3" />
	    	<input type="hidden" name="adrotate_magic_id" value="<?php 
                    echo $magic_id;
                    ?>
" />

	    	<table class="widefat" style="margin-top: .5em">

				<thead>
				<tr valign="top">
					<th bgcolor="#DDD" colspan="4">Note: While this preview is an accurate one, it might look different as it would on the website.
					<br />This is because of CSS differences. Your themes CSS file is not active here!
					<br />If you are not happy with the result just press back and edit the appropriate fields.</th>
				</tr>
				</thead>

				<tbody>
			      	<tr>
				        <td colspan="4"><?php 
                    echo adrotate_banner($edit->group, $edit->id, null, null, true);
                    ?>
			      	</tr>
				</tbody>

				<thead>
			      	<tr valign="top">
				        <th bgcolor="#DDD" colspan="4">How do i use this banner? Paste the following example code where you want the ad to show:</th>
			      	</tr>
				</thead>

				<tbody>
			      	<tr>
				        <th>In a post or page:</th>
				        <td>[adrotate group="<?php 
                    echo $edit->group;
                    ?>
" banner="<?php 
                    echo $edit->id;
                    ?>
"]</td>
				        <th>Directly in a theme:</th>
				        <td>&lt;?php echo adrotate_banner('<?php 
                    echo $edit->group;
                    ?>
', '<?php 
                    echo $edit->id;
                    ?>
'); ?&gt;</td>
			      	</tr>
			      	<tr>
				        <th>&nbsp;</th>
				        <td>[adrotate group="<?php 
                    echo $edit->group;
                    ?>
"]</td>
				        <th>&nbsp;</th>
				        <td>&lt;?php echo adrotate_banner('<?php 
                    echo $edit->group;
                    ?>
'); ?&gt;</td>
			      	</tr>
				</tbody>

				<thead>
			      	<tr valign="top">
				        <th bgcolor="#DDD" colspan="4">Some specifications</th>
			      	</tr>
				</thead>

				<tbody>
			      	<tr>
				        <td colspan="4">This banner, '<strong><?php 
                    echo $edit->title;
                    ?>
</strong>' (ID: <?php 
                    echo $edit->id;
                    ?>
)<br />
				        Is to be shown from <strong><?php 
                    echo date('l j F, Y', $edit->startshow);
                    ?>
</strong> to <strong><?php 
                    echo date('l j F, Y', $edit->endshow);
                    ?>
</strong><br /> 
				        Attached to group '<strong><?php 
                    echo $group;
                    ?>
</strong>' (ID: <?php 
                    echo $edit->group;
                    ?>
).<br />
				        </td>
			      	</tr>
				</tbody>

			</table>
	    	<p class="submit">
				<input tabindex="1" type="submit" name="adrotate_magic_submit" class="button-primary" value="Confirm and save" />
				<a href="admin.php?page=adrotate2&magic_id=<?php 
                    echo $magic_id;
                    ?>
&step=2&back=true" class="button">Back</a>
				<a href="admin.php?page=adrotate&magic_id=<?php 
                    echo $magic_id;
                    ?>
&cancel=true" class="button">Cancel</a>
	    	</p>
		</form>
	  	<?php 
                } else {
                    ?>
		    <table class="widefat" style="margin-top: .5em">
		    	<thead>
				<tr valign="top">
					<th>Error!</th>
				</tr>
				</thead>

				<tbody>
		      	<tr>
			        <td><strong>Stop messing about and follow the right procedure! <a href="admin.php?page=adrotate2&magic_id=<?php 
                    echo $magic_id;
                    ?>
">Try again</a>.</strong></td>
		      	</tr>
		      	</tbody>
			</table>
	  	<?php 
                }
            }
        }
        ?>

		<?php 
    } else {
        ?>
		    <table class="widefat" style="margin-top: .5em">
		    	<thead>
				<tr valign="top">
					<th>Error!</th>
				</tr>
				</thead>

				<tbody>
		      	<tr>
			        <td><strong>You should create atleast one group before adding banners! <a href="admin.php?page=adrotate4">Add a group now</a>.</strong></td>
		      	</tr>
		      	</tbody>
			</table>
		<?php 
    }
    ?>

	</div>
<?php 
}
function adrotate_shortcode($atts, $content = null)
{
    if (!empty($atts['group'])) {
        $group_ids = $atts['group'];
    }
    if (!empty($atts['block'])) {
        $block = $atts['block'];
    }
    if (!empty($atts['column'])) {
        $column = $atts['column'];
    }
    if (!empty($atts['banner'])) {
        $banner_id = $atts['banner'];
    }
    return adrotate_banner($group_ids, $banner_id, $block, $column, false);
}
Esempio n. 8
0
/**
 * Template part for leaderboard ad
 *
 * @package WordPress
 * @subpackage FoundationPress
 * @since FoundationPress 1.0.0
 */
?>

	<div class="ad-container">
	<?php 
// echo adrotate_group('1');
if ($astused > 0) {
    // ast used defined   How to do this in the new?
} else {
    $pageadset = $_GET['ast'];
    if (filter_var($pageadset, FILTER_VALIDATE_INT)) {
        //reserved for default ad set
        $astused = $pageadset;
    } else {
        // Retrieve adset info from URL query vars
        $astused = 1;
    }
}
echo '    <!-- leaderboard banner ' . $astused . ' --> ';
if (function_exists(adrotate_banner)) {
    echo adrotate_banner($astused, 41);
}
?>
        
	</div>