Пример #1
0
/**
* Show the main options menu
*/
function showMainMenu()
{
    global $options_url;
    $donate = get_option('wpads_donate');
    $bannersManager = new Banners();
    $banners = $bannersManager->getBanners();
    $zones = $bannersManager->getZones($banners, $donate);
    ?>
<div class="wrap"> 
	<h2><?php 
    _e('WPAds');
    ?>
</h2> 

	<h3><?php 
    _e('Banners');
    ?>
 (<a href="<?php 
    echo $options_url;
    ?>
&amp;action=new"><?php 
    _e('Add new');
    ?>
</a>)</h3>
	<?php 
    if (is_array($banners)) {
        ?>
	<table border="0" cellpadding="3" width="100%">
		<tr>
			<th><?php 
        _e('ID');
        ?>
</th>
			<th align='left'><?php 
        _e('Description');
        ?>
</th>
			<th align="left"><?php 
        _e('Zones');
        ?>
</th>
			<th><?php 
        _e('Active');
        ?>
</th>
			<th><?php 
        _e('Weight');
        ?>
</th>
			<th><?php 
        _e('Max views');
        ?>
</th>
			<th><?php 
        _e('Views served');
        ?>
</th>
			<th>&nbsp;</th>
			<th>&nbsp;</th>
		</tr>
		<?php 
        foreach ($banners as $banner) {
            $class = 'alternate' == $class ? '' : 'alternate';
            ?>
		<tr class='<?php 
            echo $class;
            ?>
'>
			<td><?php 
            echo $banner->banner_id;
            ?>
</td>
			<td><?php 
            echo $banner->banner_description;
            ?>
</td>
			<td><?php 
            echo $banner->banner_zones;
            ?>
</td>
			<td align="center"><?php 
            echo $banner->banner_active;
            ?>
</td>
			<td align="center"><?php 
            echo $banner->banner_weight;
            ?>
</td>
			<td align="center"><?php 
            echo $banner->banner_maxviews;
            ?>
</td>
			<td align="center"><?php 
            echo $banner->banner_views;
            ?>
</td>
			<td><a href="<?php 
            echo $options_url;
            ?>
&amp;action=edit&amp;id=<?php 
            echo $banner->banner_id;
            ?>
" class="edit"><?php 
            _e('Edit');
            ?>
</a></td>
			<td><a href="<?php 
            echo $options_url;
            ?>
&amp;action=delete&amp;id=<?php 
            echo $banner->banner_id;
            ?>
" class="delete"><?php 
            _e('Delete');
            ?>
</a></td>
		</tr>	
		<?php 
        }
        ?>
	</table>
	
	<a href="<?php 
        echo $options_url;
        ?>
&amp;action=new"><?php 
        _e('Add new banner');
        ?>
</a><br />
	<?php 
    } else {
        ?>
		You have not defined any banners yet. <a href="<?php 
        echo $options_url;
        ?>
&amp;action=new">Add a new banner</a> to begin using WPAds.
	<?php 
    }
    ?>

	<h3><?php 
    _e('Zones');
    ?>
</h3>
	<?php 
    if (count($zones) > 0) {
        ?>
	<p>These are the zones you have defined in your banners. Next to each zone you can see all the <b>banners associated with that zone</b>, together with the <b>probability</b> of each banner in that zone. The third and fourth column give you the <b>code</b> you have to copy and paste in your templates or inside your posts, wherever you want the zone to show up</p>
	<table border="0" cellpadding="3" width="100%">
		<tr>
			<th align="left" valign="top"><?php 
        _e('Zone');
        ?>
</th>
			<th align="left"><?php 
        _e('Banners');
        ?>
 (<?php 
        _e('Probability');
        ?>
)</th>
			<th align="left" valign="top"><?php 
        _e('Code in templates');
        ?>
</th>
			<th align="left" valign="top"><?php 
        _e('Code in posts');
        ?>
</th>
		</tr>
		<?php 
        foreach ($zones as $zone) {
            $class = 'alternate' == $class ? '' : 'alternate';
            ?>
		<tr class='<?php 
            echo $class;
            ?>
'>
			<td valign="top"><?php 
            echo $zone->zone_name;
            ?>
</td>
			<td>
				<?php 
            foreach ($zone->banners as $banner) {
                ?>
					<?php 
                if ($banner->banner_description != "WPAds Support") {
                    ?>
						<a href="<?php 
                    echo $options_url;
                    ?>
&amp;action=edit&amp;id=<?php 
                    echo $banner->banner_id;
                    ?>
">
							<?php 
                    echo $banner->banner_description;
                    ?>
 
						</a> (<?php 
                    echo sprintf("%d", $banner->banner_probability);
                    ?>
%)
					<?php 
                } else {
                    ?>
						<font color="#f00"><?php 
                    echo $banner->banner_description;
                    ?>
 (<?php 
                    echo sprintf("%d", $banner->banner_probability);
                    ?>
%)</font>
					<?php 
                }
                ?>
				<br/>
				<?php 
            }
            ?>
			</td>
			<td valign="top">
				&lt;?php wpads('<?php 
            echo $zone->zone_name;
            ?>
'); ?&gt;<br />
			</td>
			<td valign="top">
				&lt;!--wpads#<?php 
            echo $zone->zone_name;
            ?>
--&gt;
			</td>
		</tr>
		<?php 
        }
        ?>
	</table>
	<?php 
    } else {
        ?>
	There are no zones because you have not defined any banners yet.
	<?php 
    }
    ?>
<br /><br />
	<h3>Support this plugin</h3>
	<p>If you want to support the development of this plugin, we would appreciaty if you consider <b>donating some of your ad impressions to us</b>.<br/>
	If you check this option, <b>3% of you Google AdSense impressions will include our AdSense client-id</b> 
	(in case you're wondering, this is not against <a href="https://www.google.com/adsense/localized-terms?hl=en_US" target="_blank">Google AdSense Terms and Conditions</a>).
	This change will be completely transparent to your readers, who will not see anything different on your blog.<br />
	By checking this option, you will reward us for our efforts and help us release new versions. Of course, if you decide you don't want to
	donate, you're welcome to do so and this plugin will still be fully functional.<br/>
	</p>
	<form name="donate" method="post" action="<?php 
    echo $options_url;
    ?>
">
		<input type="hidden" name="action" value="donate" />
		<input name="wpads_donate" type="checkbox" value="Y" <?php 
    echo $donate > 0 ? "checked" : "";
    ?>
 />
		Yes, I want to donate 3% of my ad impressions to the developers of this plugin<br />
		<input type="submit" name="submit" value="<?php 
    _e('Update');
    ?>
" />
	</form>
		
</div>

<?php 
}
Пример #2
0
 public function getBanners($args)
 {
     //$args[0] - alias banner, $args[1] - id banner
     include_once ENGINE_PATH . 'class/classBanners.php';
     $banners = new Banners();
     if (is_array($args)) {
         $banneritems = $banners->getBanners(array('alias' => $args[0], 'id' => $args[1]));
     } else {
         $banneritems = $banners->getBanners();
     }
     return $banneritems;
 }
Пример #3
0
<?php

return array('id' => 'pageUpdateForm', 'showErrorSummary' => true, 'elements' => array('content' => array('type' => 'form', 'title' => Yii::t('BannersModule.core', 'Содержимое'), 'elements' => array('name' => array('type' => 'text'), 'banner_id' => array('type' => 'dropdownlist', 'items' => Banners::getBanners()), 'width' => array('type' => 'text'), 'height' => array('type' => 'text'), 'status' => array('type' => 'dropdownlist', 'items' => Banners::statuses())))));