Ejemplo n.º 1
0
function mt_toutrix_bank_page()
{
    global $toutrix_adserver;
    toutrix_get_token();
    $fields = new stdclass();
    $fields->id = $toutrix_adserver->userId;
    $bitcoin_addresse = $toutrix_adserver->get_bitcoin_address($fields);
    $bitcoin_addresse = $bitcoin_addresse->address->bitcoin_address;
    ?>
<h1>TouTrix Bank<h1>
<?php 
    toutrix_echo_funds_available();
    ?>
<h2>Make a deposit</h2>
We only accept BitCoin for the moment.<br/>
<br/>
<center><font size='4'>First deposit is doubled.</font></center>
<br/>
<h3>Bitcoin</h3>
Send any amount to this payment address: <?php 
    echo $bitcoin_addresse;
    ?>
<br/><br/>
<img src='https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=<?php 
    echo $bitcoin_addresse;
    ?>
'>
<br/><br/>
Deposit are automatic. But it take few minutes.

<h2>Withdrawal</h2>

Configure your account in settings to receive hourly payment. You never have to wait for your money. You can send the money directly to your exchanger or in your mobile wallet.<br/>
We may have to approve your account first.


<h1>Exchange Bitcoins</h1>

<!-- TODO Exchange recommendation -->

If you don't have BitCoin Wallet, you can use an exchanger and they will receive money on your behalf. <br/>
<br/>
We recommend <a href="https://www.coinbase.com/join/52cb9f042fe57d1d9400001f" target="_blank">CoinBase</a>. <br/>
<br/>

<h1>Need a lend?</h1>

<!-- TODO We should ask adserver with keyword: btc lend -->

<a href='https://btcjam.com/?r=688f61e1-439f-4b8a-93a5-e7f57068c158&utm_medium=direct&utm_source=referral_url&utm_campaign=ad_2' target="_blank">BTCjam</a>

<h1>Need a lend?</h1>

<!-- TODO We should ask adserver with keyword: btc lend -->

<a href='https://btcjam.com/?r=a4b60cb9-52a2-4a41-9dc3-7c1bc5e817e4&utm_medium=direct&utm_source=referral_url&utm_campaign=ad-2'>BTCjam</a>

<?php 
}
Ejemplo n.º 2
0
function mt_toutrix_page()
{
    //must check that the user has the required capability
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    global $toutrix_adserver;
    $cur_tab = 'homepage';
    if (isset($_GET['tab'])) {
        $cur_tab = $_GET['tab'];
    }
    $toutrix_username = get_option("ad_toutrix_username");
    $toutrix_password = get_option("ad_toutrix_password");
    $toutrix_access_token = get_option("ad_toutrix_access_token");
    $redirect = false;
    if (strlen($toutrix_username) == 0 && strlen($toutrix_password) == 0) {
        $redirect = true;
    }
    if ($redirect && $cur_tab != "setting") {
        echo "<a href='/wp-admin/admin.php?page=mt_toutrix_page-handle&tab=setting'>Redirecting....</a>";
        echo "<script>window.location.href='http://" . $_SERVER['SERVER_NAME'] . "/wp-admin/admin.php?page=mt_toutrix_page-handle&tab=setting';</script>";
        exit;
    }
    $tabs = array('homepage' => 'Homepage', 'setting' => 'Settings', 'coming' => 'Coming soon', 'support' => 'Support');
    echo '<div id="icon-themes" class="icon32"><br></div>';
    echo '<h2 class="nav-tab-wrapper">';
    foreach ($tabs as $tab => $name) {
        $class = $tab == $cur_tab ? ' nav-tab-active' : '';
        if ($tab == 'support') {
            echo "<a class='nav-tab' href='http://toutrix.com/forums/forum/wordpress-adserver-plugin/' target='_blank'>{$name}</a>";
        } else {
            echo "<a class='nav-tab{$class}' href='?page=mt_toutrix_page-handle&tab={$tab}'>{$name}</a>";
        }
    }
    echo '</h2>';
    if ($cur_tab == 'homepage') {
        echo "Current version: " . toutrix_plugin_version . "<br/><br/>";
        toutrix_echo_funds_available();
        ?>
<h2>Publishers</h2>

To earn money with ads, you drag a <a href='/wp-admin/widgets.php'>TouTrix Ad Widget</a> in your page.<br/><br/>

<a href='?page=mt_toutrix_stats_page'>Check your stats</a> here.

<h2>Advertisers</h2>

To buy traffic, you need to <a href='?page=mt_toutrix_bank'>make a deposit</a> first, <a href='?page=toutrix_creative'>create a creative</a>, <a href='?page=mt_toutrix_campaign'>create a campaign</a>, add a flight with your targetings and finally, add a creative to your flight.<br/><br/>

<?php 
    } elseif ($cur_tab == 'coming') {
        coming_soon();
    } else {
        toutrix_settings_page();
    }
}
Ejemplo n.º 3
0
function mt_toutrix_campaign_page()
{
    global $toutrix_adserver;
    toutrix_get_token();
    if (!empty($_GET['flightId']) && $_GET['action'] != 'delete') {
        toutrix_flight();
        return;
    }
    if ($_GET['action'] == 'new' && !isset($_GET['tab'])) {
        ?>
<h2>Create a new campaign</h2>
<?php 
        $new = new stdclass();
        toutrix_campaign_form($new);
    }
    if (isset($_GET['removetargetid']) && !isset($_GET['flightId']) && isset($_GET['campaignId'])) {
        $fields = new stdclass();
        $fields->campaignId = intval($_GET['campaignId']);
        $fields->id = intval($_GET['removetargetid']);
        $response = $toutrix_adserver->campaign_targets_delete($fields);
        ?>
<div class="updated"><p><strong><?php 
        _e('Targeting deleted', 'wp-toutrix');
        ?>
</strong></p></div>
<?php 
    }
    if (empty($_GET['campaignId'])) {
        if (!empty($_POST['b'])) {
            $fields = new stdclass();
            $fields->user_id = $adserver->userId;
            $fields->name = sanitize_text_field($_POST['camp_name']);
            $fields->isDeleted = 0;
            $fields->isActive = 1;
            stripslashes_deep($fields);
            $campaign = $toutrix_adserver->campaign_create($fields);
            ?>
<div class="updated"><p><strong><?php 
            _e('Campaign added', 'wp-toutrix');
            ?>
</strong></p></div>
<?php 
        }
        ?>
<div class='wrap'>

<a href="?page=toutrix_creative" class="page-title-action">Go to creatives</a><hr/>

<h1>Campaigns <a href="?page=mt_toutrix_campaign&action=new" class="page-title-action">Add New</a></h1>
<?php 
        toutrix_echo_funds_available();
        $table = new campaigns_table();
        $table->prepare_items();
        $table->display();
        ?>
</div>
<?php 
    } elseif (!empty($_GET['campaignId'])) {
        if (!empty($_POST['b']) && $_POST['target'] == 'yes') {
            $fields = get_form_target();
            $target = $toutrix_adserver->target_create($fields);
            ?>
<div class="updated"><p><strong><?php 
            _e('Target added', 'wp-toutrix');
            ?>
</strong></p></div>
<?php 
        } elseif (!empty($_POST['b']) && $_POST['flight'] == 'yes') {
            $fields = new stdclass();
            if (!empty($_POST['id'])) {
                $fields->id = intval($_POST['id']);
            }
            $fields->campaignId = intval($_POST['campaignId']);
            $fields->Name = sanitize_text_field($_POST['Name']);
            $fields->Price = $_POST['Price'];
            $fields->MaxPerIp = intval($_POST['MaxPerIp']);
            $fields->IsDeleted = false;
            $fields->IsActive = true;
            if ($_POST['IsActive'] == 'on') {
                $fields->IsActive = true;
            }
            $fields->IsUnlimited = true;
            $fields->NoEndDate = true;
            stripslashes_deep($fields);
            $flight = $toutrix_adserver->flight_create($fields);
            $_GET['action'] = "edit";
            $_GET['tab'] = 'flights';
        } elseif ($_GET['action'] == 'delete' && $_GET['campaignId'] > 0 && $_GET['flightId'] > 0) {
            $fields = new stdclass();
            $fields->id = intval($_GET['flightId']);
            $fields->IsDeleted = true;
            $fields->IsActive = false;
            $flight = $toutrix_adserver->flight_update($fields);
            $_GET['action'] = 'edit';
        } elseif (!empty($_POST['b'])) {
            $fields = new stdclass();
            $fields->id = intval($_POST['id']);
            $fields->name = sanitize_text_field($_POST['name']);
            $fields->isActive = 0;
            if ($_POST['isActive'] == 'on') {
                $fields->isActive = 1;
            }
            stripslashes_deep($fields);
            $campaign = $toutrix_adserver->campaign_update($fields);
            ?>
<div class="updated"><p><strong><?php 
            _e('Campaign saved', 'wp-toutrix');
            ?>
</strong></p></div>
<?php 
        }
        $fields = new stdclass();
        $fields->campaignId = intval($_GET['campaignId']);
        //var_dump($fields); echo "<br/>";
        $campaign = $toutrix_adserver->campaign_get($fields);
        $cur_tab = 'homepage';
        if (isset($_GET['tab'])) {
            $cur_tab = $_GET['tab'];
        }
        ?>
<div class='wrap'>
<a href="?page=mt_toutrix_campaign" class="page-title-action">All campaigns</a> > <?php 
        echo $campaign->name;
        ?>
<hr/>
<?php 
        $tabs = array('homepage' => 'Settings', 'flights' => 'Flights', 'targets' => 'Targets', 'stats' => 'Stats');
        echo '<div id="icon-themes" class="icon32"><br></div>';
        echo '<h2 class="nav-tab-wrapper">';
        foreach ($tabs as $tab => $name) {
            $class = $tab == $cur_tab ? ' nav-tab-active' : '';
            echo "<a class='nav-tab{$class}' href='?page=mt_toutrix_campaign&action=edit&campaignId=" . intval($_GET['campaignId']) . "&tab={$tab}'>{$name}</a>";
        }
        echo '</h2>';
        if ($cur_tab == 'homepage') {
            ?>

<h2>Update campaign</h2>
<?php 
            toutrix_campaign_form($campaign);
        } elseif ($cur_tab == 'flights') {
            toutrix_flights($campaign);
        } elseif ($cur_tab == 'stats') {
            toutrix_campaign_show_stats(campaign);
            //?page=mt_toutrix_campaign&action=stats&campaignId=24
        } else {
            ?>
<h2>Targeting for this campaign</h2>
It applies to all flights.<br/>
<?php 
            $fields = new stdclass();
            $fields->campaignId = intval($_GET['campaignId']);
            $targets = $toutrix_adserver->campaign_targets($fields);
            toutrix_show_targets($targets);
            echo "<h2>Add a new target</h2>";
            toutrix_show_target_form($fields);
        }
    }
}