예제 #1
0
 static function onUninstall()
 {
     $ver_opt = 'bsa_pro_plugin' . '_version';
     if (get_option('bsa_pro_plugin_' . 'installation') == 'yes') {
         $model = new BSA_PRO_Model();
         $model->dropTable();
         // Reset dashboard statistics
         delete_option($ver_opt . '_dashboard_clicks');
         delete_option($ver_opt . '_dashboard_views');
     }
     // Stop CRON - views counter
     wp_clear_scheduled_hook('bsa_cron_views_stats');
     // Delete version number
     delete_option($ver_opt);
 }
예제 #2
0
     // -- START -- HEADER
     echo '<div class="bsaProHeader" style="background-color:' . bsa_space($sid, 'header_bg') . '">';
     // -- START -- HEADER
     echo '<h3 class="bsaProHeader__title" style="color:' . bsa_space($sid, 'header_color') . '"><span>' . bsa_space($sid, 'title') . '</span></h3>';
     // -- HEADER -- TITLE
     echo '<a class="bsaProHeader__formUrl" href="' . $form_url . '" target="_blank" style="color:' . bsa_space($sid, 'link_color') . '"><span>' . bsa_space($sid, 'add_new') . '</span></a>';
     // -- HEADER -- LINK TO ORDERING FORM
     echo '</div>';
     // -- END -- HEADER
 }
 echo '<div class="bsaProItems ' . bsa_space($sid, "grid_system") . ' ' . (bsa_space($sid, "display_type") == 'carousel' ? 'bsa-owl-carousel bsa-owl-carousel-' . $sid : '') . '" style="background-color:' . bsa_space($sid, 'ads_bg') . '">';
 // -- START -- ITEMS
 foreach ($ads as $key => $ad) {
     if ($ad['id'] != 0 && bsa_ad($ad['id']) != NULL) {
         // -- COUNTING FUNCTION (DO NOT REMOVE!)
         $model = new BSA_PRO_Model();
         $model->bsaProCounter($ad['id']);
     }
     echo '<div class="bsaProItem ' . ($key % $col_per_row == 0 ? "bsaReset" : "") . '" data-animation="' . bsa_space($sid, "animation") . '" style="' . ((bsa_space($sid, "animation") == "none" or bsa_space($sid, "animation") == NULL) ? "opacity:1" : "") . '">';
     // -- START -- ITEM
     $url = parse_url($ad['url']);
     // -- START -- LINK
     $agency_form = get_option('bsa_pro_plugin_agency_ordering_form_url');
     if ($ad['url'] != '') {
         if (isset($example)) {
             // url to form if example in ad space
             echo '<a class="bsaProItem__url" href="' . $form_url . '" target="_blank">';
         } else {
             if (isset($type) && $type == 'agency') {
                 echo '<a class="bsaProItem__url" href="' . $agency_form . (strpos($agency_form, '?') ? '&' : '?') . 'bsa_pro_id=' . $ad['id'] . '&bsa_pro_url=1" target="_blank">';
             } else {
예제 #3
0
<?php

if (get_option('bsa_pro_plugin_symbol_position') == 'before') {
    $before = '<small>' . get_option('bsa_pro_plugin_currency_symbol') . '</small> ';
} else {
    $before = '';
}
if (get_option('bsa_pro_plugin_symbol_position') != 'before') {
    $after = ' <small>' . get_option('bsa_pro_plugin_currency_symbol') . '</small>';
} else {
    $after = '';
}
$model = new BSA_PRO_Model();
$countSpaces = $model->countSpaces();
$countAds = $model->countAds();
$countEarnings = $model->countEarnings();
$getPendingAds = $model->getPendingAds('admin_dashboard');
$getLastAds = $model->getLastAds();
$getAffiliateWithdrawals = $model->getAffiliateWithdrawals('pending', bsa_role());
$getSites = $model->getSites(bsa_role(), 'pending');
$getWithdrawals = $model->getWithdrawals('pending', bsa_role());
?>
<div style="float:right;">
	<strong><a href="http://codecanyon.net/item/ads-pro-multipurpose-wordpress-ad-manager/10275010?ref=scripteo">ADS PRO</a></strong> - Version <?php 
echo get_option('bsa_pro_plugin_version');
?>
</div>
<h2>
	<i class="dashicons dashicons-megaphone"></i> ADS PRO - Dashboard
</h2>
<div class="bsaDashboard">
예제 #4
0
<?php

if (get_option('bsa_pro_plugin_symbol_position') == 'before') {
    $before = '<small>' . get_option('bsa_pro_plugin_currency_symbol') . '</small>';
} else {
    $before = '';
}
if (get_option('bsa_pro_plugin_symbol_position') != 'before') {
    $after = '<small>' . get_option('bsa_pro_plugin_currency_symbol') . '</small>';
} else {
    $after = '';
}
$model = new BSA_PRO_Model();
$getAffiliateWithdrawals = $model->getAffiliateWithdrawals(NULL, bsa_role());
$affiliateMinToWithdrawal = get_option('bsa_pro_plugin_' . 'ap_minimum_withdrawal') > 0 ? get_option('bsa_pro_plugin_' . 'ap_minimum_withdrawal') : 50;
?>

<h2>
	<span class="dashicons dashicons-vault"></span> <?php 
echo bsa_get_trans('affiliate_program', 'affiliate');
?>
	<?php 
if (bsa_role() == 'user') {
    ?>
		<p><span class="dashicons dashicon-14 dashicons-plus-alt"></span> <a class="bsaMakeWithdrawal" style="cursor: pointer"><?php 
    echo bsa_get_trans('affiliate_program', 'make');
    ?>
</a></p>
	<?php 
}
?>
<?php

require_once dirname(__FILE__) . '/BSA_PRO_Agency_Ordering_form.php';
// require ordering form if stats
$ad_id = $_GET['bsa_pro_id'];
$model = new BSA_PRO_Model();
$statsFrom = $model->bsaIntervalStats($ad_id, 'from') != null ? $model->bsaIntervalStats($ad_id, 'from') : 0;
$countClicks = $model->bsaIntervalStats($ad_id, 'from') != null ? $model->bsaCountClicks($ad_id, $statsFrom[0]) : 0;
$countViews = $model->bsaIntervalStats($ad_id, 'from') != null ? $model->bsaCountViews($ad_id, $statsFrom[0]) : 0;
echo '
<div class="bsaStatsWrapperBg"></div>
<div class="bsaStatsWrapper" data-ad-id="' . $ad_id . '" data-days="7" data-from="' . $statsFrom[0] . '" data-time="' . time() . '">
	<div class="bsaStatsWrapperInner">
		<h2><span>' . get_option("bsa_pro_plugin_trans_stats_header") . '</span> <span class="bsaLoader bsaLoaderStats" style="display: none"></span></h2>
		<div class="bsaStatsButtons">
			<a class="bsaPrevWeek" href="#" onclick="bsaPrevStats()">' . get_option("bsa_pro_plugin_trans_stats_prev_week") . '</a>
			<a class="bsaNextWeek" href="#" onclick="bsaNextStats()">' . get_option("bsa_pro_plugin_trans_stats_next_week") . '</a>
		</div>
		<div class="bsaStatsChart">
			<div class="bsaSumStats">
				' . get_option("bsa_pro_plugin_trans_stats_clicks") . ' <strong>' . $countClicks[0] . '</strong>
			</div>
			<div class="bsaSumStats" style="margin: 0 5%">
				' . get_option("bsa_pro_plugin_trans_stats_views") . ' <strong>' . $countViews[0] . '</strong>
			</div>
			<div class="bsaSumStats">
				' . get_option("bsa_pro_plugin_trans_stats_ctr") . ' <strong>' . ($countViews[0] > 1 ? number_format($countClicks[0] / $countViews[0] * 100, 2) . " %" : " - ") . '</strong>
			</div>
			<div class="bsaChart ct-chart"></div>
		</div>';
echo '<h3 class="bsaHeaderClicks">' . get_option("bsa_pro_plugin_trans_stats_clicks") . '</h3>';
예제 #6
0
}
if (get_option('bsa_pro_plugin_symbol_position') != 'before') {
    $after = get_option('bsa_pro_plugin_currency_symbol');
} else {
    $after = '';
}
// active order by column
function get_order_ads($sid, $column)
{
    if (isset($sid) && bsa_space($sid, 'order_ads') == $column) {
        return 'bsaOrderActive';
    } else {
        return null;
    }
}
$model = new BSA_PRO_Model();
$get_spaces = $model->getSpaces('both');
$first_space = $get_spaces[0]['id'];
if (isset($_GET['space_id']) && $_GET['space_id'] != NULL && $_GET['space_id'] != '') {
    $space_id = $_GET['space_id'];
} elseif ($get_spaces != NULL) {
    $space_id = $first_space;
} else {
    $space_id = 0;
}
$getActiveAds = $model->getActiveAds($space_id, bsa_space($space_id, 'max_items'), 'admin');
$getPendingAds = $model->getPendingAds('pending_ads', $space_id);
$getNotPaidAds = $model->getNotPaidAds($space_id);
$getBlockedAds = $model->getBlockedAds($space_id);
$getArchiveAds = $model->getArchiveAds($space_id);
?>
예제 #7
0
 public function getTasksPages()
 {
     $page = $this->getPage();
     $pages = array();
     $model = new BSA_PRO_Model();
     if ($model->getCronTasks(null, $page, self::PAGE_SIZE)) {
         foreach ($model->getCronTasks(null, $page, self::PAGE_SIZE) as $entry) {
             $pages[] = $entry;
         }
     }
     if ($page > 1 and !count($pages)) {
         return 'not_found';
     }
     return $pages;
 }
<?php

$bsaTrans = 'bsa_pro_plugin_trans_';
$model = new BSA_PRO_Model();
if (isset($_POST) && isset($_POST['bsaProSubmit']) && isset($_GET['site_id'])) {
    $getForm = $model->getForm('agency', $_GET['site_id']);
} else {
    $getForm = '';
}
// get notify action
if (isset($_GET['bsa_pro_payment']) && $_GET['bsa_pro_payment'] == 'notify' || isset($_POST['stripeToken'])) {
    $model->notifyAction('agency');
}
echo '
<div class="bsaProOrderingForm">
	<div class="bsaProOrderingFormInner">
		';
if (isset($_GET["bsa_pro_notice"]) && $_GET["bsa_pro_notice"] == 'success') {
    ?>
		<div class="bsaProAlert bsaProAlertSuccess bsaProAlertSuccessNotice">
			<strong><?php 
    echo get_option($bsaTrans . "alert_success");
    ?>
</strong>
			<p><?php 
    echo get_option($bsaTrans . "payment_success");
    ?>
</p>
		</div>
	<?php 
} elseif (isset($_GET["bsa_pro_notice"]) && $_GET["bsa_pro_notice"] == 'failed') {
예제 #9
0
function bsa_function_views_stats()
{
    $model = new BSA_PRO_Model();
    $get_views_counter = get_option('bsa_pro_plugin_dashboard_views');
    $get_daily_counter = $model->getDailyViews(time() - 30 * 60);
    if ($get_daily_counter[0] > 0) {
        update_option('bsa_pro_plugin_dashboard_views', $get_views_counter + $get_daily_counter[0]);
        // increase views stats
    }
    wp_schedule_single_event(time() + 30 * 60, 'bsa_cron_views_stats', array(time()));
}
<?php

$bsaTrans = 'bsa_pro_plugin_trans_';
$model = new BSA_PRO_Model();
if (isset($_POST) && isset($_POST['bsaProSubmit'])) {
    $getForm = $model->getForm();
} else {
    $getForm = '';
}
// get notify action
if (isset($_GET['bsa_pro_payment']) && $_GET['bsa_pro_payment'] == 'notify' || isset($_POST['stripeToken'])) {
    $model->notifyAction();
}
echo '
<div class="bsaProOrderingForm">
	<div class="bsaProOrderingFormInner">
		';
if (isset($_GET["bsa_pro_notice"]) && $_GET["bsa_pro_notice"] == 'success') {
    ?>
		<div class="bsaProAlert bsaProAlertSuccess bsaProAlertSuccessNotice">
			<strong><?php 
    echo get_option($bsaTrans . "alert_success");
    ?>
</strong>
			<p><?php 
    echo get_option($bsaTrans . "payment_success");
    ?>
</p>
		</div>
	<?php 
} elseif (isset($_GET["bsa_pro_notice"]) && $_GET["bsa_pro_notice"] == 'failed') {
예제 #11
0
function bsa_sortable_callback()
{
    if ($_POST && isset($_POST['bsa_order'])) {
        $ads = $_POST['bsa_order'];
        $model = new BSA_PRO_Model();
        foreach ($ads as $key => $ad) {
            $model->changeAdPriority($ad, count($ads) - $key);
        }
    }
    die;
}
예제 #12
0
<?php

$model = new BSA_PRO_Model();
$role = bsa_role() == 'admin' ? 'a' : 'u';
$decode_ids = $model->getUserCol(get_current_user_id());
$get_ids = json_decode($decode_ids['ad_ids']);
$get_free_ads = $model->getUserCol(get_current_user_id(), 'free_ads');
function getAdValue($val)
{
    if (isset($_GET['ad_id'])) {
        return bsa_ad($_GET['ad_id'], $val);
    } else {
        if (isset($_POST[$val]) || isset($_SESSION['bsa_ad_status'])) {
            if (isset($_SESSION['bsa_ad_status']) == 'ad_added') {
                $_SESSION['bsa_clear_form'] = 'ad_added';
                unset($_SESSION['bsa_ad_status']);
            }
            $status = isset($_SESSION['bsa_clear_form']) ? $_SESSION['bsa_clear_form'] : '';
            if ($status == 'ad_added') {
                return '';
            } else {
                return $_POST[$val];
            }
        } else {
            return '';
        }
    }
}
?>
<h2>
	<?php