Plugin Directory

Changeset 2340110


Ignore:
Timestamp:
07/14/2020 06:15:33 AM (6 years ago)
Author:
clickervolt
Message:

1.162

  • Added conversion IPN for PayKickstart affiliate network
  • Added conversion IPN for WarriorPlus affiliate network
Location:
clickervolt/trunk
Files:
4 added
15 edited

Legend:

Unmodified
Added
Removed
  • clickervolt/trunk/admin/errorsCatcher.php

    r2339223 r2340110  
    55class ErrorsCatcher
    66{
     7    static private $started = false;
     8
    79    static function start()
    810    {
    9         set_error_handler(function ($errno, $errstr, $errfile, $errline) {
    10             if (strpos($errfile, 'clickervolt') !== false) {
    11                 self::exception(new \ErrorException($errstr, $errno, 0, $errfile, $errline));
    12             }
    13         });
     11        if (!self::$started) {
     12            set_error_handler(function ($errno, $errstr, $errfile, $errline) {
     13                if (strpos($errfile, 'clickervolt') !== false) {
     14                    self::exception(new \ErrorException($errstr, $errno, 0, $errfile, $errline));
     15                }
     16            });
     17            set_exception_handler('\\ClickerVolt\\ErrorsCatcher::exception');
    1418
    15         set_exception_handler('\\ClickerVolt\\ErrorsCatcher::exception');
     19            self::$started = true;
     20        }
    1621    }
    1722
  • clickervolt/trunk/admin/js/affiliate-networks.js

    r2314546 r2340110  
    1515        this.postback_transaction = postback_transaction;
    1616        this.postback_revenue = postback_revenue;
     17        this.ipn_integration_name = null;
     18    }
     19
     20    asIPN(integration_name) {
     21        this.ipn_integration_name = integration_name;
     22        return this;
    1723    }
    1824
     
    3844
    3945    getPostbackURL() {
    40         return ClickerVoltLinkController.replaceVarsFromConvPixel(clickerVoltVars.const.ConvPostbackURLTemplate, {
     46        var basePixel = clickerVoltVars.const.ConvPostbackURLTemplate;
     47        if (this.ipn_integration_name) {
     48            basePixel = clickerVoltVars.const.ConvIPNURLTemplate.replace('-INTEGRATION_NAME-', this.ipn_integration_name);
     49        }
     50        return ClickerVoltLinkController.replaceVarsFromConvPixel(basePixel, {
    4151            'cid': this.getPostbackSubID() || "",
    4252            'type': 'conversion',
     
    5969        if (!AffiliateNetworkHelper.networks) {
    6070            AffiliateNetworkHelper.networks = {};
     71
     72            // Affiliate networks with S2S postback support
    6173            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("A4D", "aff_sub", "{aff_sub}", "{transaction_id}", "{payout}"));
    6274            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("ActionAds", "aff_sub", "{aff_sub}", "{transaction_id}", "{payout}"));
     
    92104            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("GiddyUp", "sub1", "{sub1}", "{transaction_id}", "{payout_amount}"));
    93105            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("Global Wide Media", "s2", "#s2#", "#tid#", "#price#"));
    94             // AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("JVZoo", "tid", null, null, null));
    95106            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("LeadBit", "sub2", "{sub2}", '{status}-{id}', "{cost}"));
    96107            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("LetsCPA", "sub2", "{sub2}", '{status}-{transactionid}', "{sum}"));
     
    117128            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("YTZ", "s1", "{SUB1}", null, "{REVENUE}"));
    118129            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("Zorka.Mobi", "ref_id", "{ref_id}", "{offer_id}", "{sum}"));
     130
     131            // Affiliate networks with IPN support
     132            // AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("JVZoo", "tid", null, null, null));
     133            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("PayKickstart", "tid", "tracking_id", "product_name", "affiliate_commission_amount").asIPN("paykickstart"));
     134            AffiliateNetworkHelper.registerNetwork(new AffiliateNetwork("WarriorPlus", "/[cid]", null, null, null).asIPN("warriorplus"));
     135
     136            // Sort by affiliate network name
     137            var ordered = {};
     138            Object.keys(AffiliateNetworkHelper.networks).sort().forEach(function (key) {
     139                ordered[key] = AffiliateNetworkHelper.networks[key];
     140            });
     141            AffiliateNetworkHelper.networks = ordered;
    119142        }
    120143        return AffiliateNetworkHelper.networks;
  • clickervolt/trunk/admin/js/functions.js

    r2170406 r2340110  
    737737    }
    738738
     739    static replaceAll(str, find, replace) {
     740        return str.replace(new RegExp(find, 'g'), replace);
     741    }
     742
    739743    /**
    740744     * See https://stackoverflow.com/questions/11832914/round-to-at-most-2-decimal-places-only-if-necessary
  • clickervolt/trunk/admin/setup.php

    r2339223 r2340110  
    187187                'ConvPixelHTMLTemplate' => json_encode(PixelInfo::getPixelHTML('-CID-', '-TYPE-', '-NAME-', '-REV-', '-SLUG-')),
    188188                'ConvPostbackURLTemplate' => json_encode(PixelInfo::getPostbackURL('-CID-', '-TYPE-', '-NAME-', '-REV-')),
     189                'ConvIPNURLTemplate' => json_encode(PixelInfo::getIPNURL('-INTEGRATION_NAME-', '-CID-', '-TYPE-', '-NAME-', '-REV-')),
    189190                'CVSettings' => json_encode(self::get_class_consts('ClickerVolt\\CVSettings')),
    190191            ],
  • clickervolt/trunk/admin/views/dashboardTabSettings.php

    r2339223 r2340110  
    2222            <div id="default-fraud-detection-container"></div>
    2323        </div>
     24
     25        <!--
     26        <div class="settings-section">
     27            <h2>IPN Secret Keys</h2>
     28            <p>
     29                <label>WarriorPlus:
     30                    <input type="text" name="ipn-key-warriorplus">
     31                </label>
     32            </p>
     33            <p>
     34                <label>Clickbank:
     35                    <input type="text" name="ipn-key-clickbank">
     36                </label>
     37            </p>
     38        </div>
     39        -->
    2440
    2541        <div>
  • clickervolt/trunk/admin/views/newLink.php

    r2316659 r2340110  
    22482248                var network = AffiliateNetworkHelper.getNetwork(networkName);
    22492249                if (network) {
    2250                     var $addVariableButton = $urlBlock.find('.button.add-url-variable');
    2251                     var $variableRow = ClickerVoltLinkController.addVariableToUrl($addVariableButton);
    2252                     $variableRow.find('.url-variable-value').val(cidToken).trigger('change');
    2253                     $variableRow.find('.url-variable-key').val(network.getTID()).trigger('input');
     2250                    if (network.getTID().indexOf(cidToken) == -1) {
     2251                        var $addVariableButton = $urlBlock.find('.button.add-url-variable');
     2252                        var $variableRow = ClickerVoltLinkController.addVariableToUrl($addVariableButton);
     2253                        $variableRow.find('.url-variable-value').val(cidToken).trigger('change');
     2254                        $variableRow.find('.url-variable-key').val(network.getTID()).trigger('input');
     2255                    } else {
     2256                        // The TID contains the [cid] token... it's not a query variable, but rather
     2257                        // a string to append to the URL...
     2258                        var $urlInput = $urlBlock.find('input.url');
     2259                        $urlInput.val($urlInput.val() + network.getTID());
     2260                    }
    22542261
    22552262                    $urlBlock.find('.aff-network-postback-url').val(network.getPostbackURL());
  • clickervolt/trunk/clickervolt.php

    r2339223 r2340110  
    55 * Plugin URI:  https://clickervolt.com/
    66 * Description: Advanced click tracking, link cloaking and affiliate campaigns management made easy.
    7  * Version:     1.160
     7 * Version:     1.162
    88 * Author:      ClickerVolt.com
    99 * License:     GPLv3
  • clickervolt/trunk/db/db.php

    r2339223 r2340110  
    1111class DB
    1212{
    13     const VERSION = 1.160;
     13    const VERSION = 1.162;
    1414
    1515    const OPTION_VERSION = 'clickervolt-version';
  • clickervolt/trunk/db/objects/cvSettings.php

    r2314546 r2340110  
    77class CVSettings
    88{
    9 
    109    const WP_OPTION_KEY = 'clickervolt-settings';
    1110
     
    1817    const VALUE_IP_DETECTION_TYPE_AUTO = 'auto';
    1918    const VALUE_IP_DETECTION_TYPE_REMOTE_ADDR = 'REMOTE_ADDR';
    20 
    2119
    2220    static private $settings = null;
  • clickervolt/trunk/db/tableClicks.php

    r2314546 r2340110  
    7777    function __construct($array = [])
    7878    {
    79 
    8079        $this->fromArray($array);
    8180
  • clickervolt/trunk/pixel/actionHandler.php

    r2181646 r2340110  
    88class ActionHandler
    99{
    10 
    1110    const URL_PARAM_CLICK_ID = 'cid';
    1211    const URL_PARAM_SLUG = 'slug';
     
    2524    function addAction($actionParams = [])
    2625    {
    27 
    2826        $defaultActionParams = [
    2927            'clickId' => null,
  • clickervolt/trunk/pixel/pixelInfo.php

    r2286273 r2340110  
    77class PixelInfo
    88{
    9 
    109    /**
    1110     *
     
    1312    static function getPixelHTML($defaultCID = '', $defaultType = '', $defaultName = '', $defaultRevenue = '', $defaultSlug = '')
    1413    {
    15         $url = self::getURL(null, $defaultType, $defaultName, $defaultRevenue, $defaultSlug);
     14        $url = self::getURL("/pixel/do.php", null, $defaultType, $defaultName, $defaultRevenue, $defaultSlug);
    1615        return "<iframe style='width: 1px; height: 1px;' src='{$url}'></iframe>";
    1716    }
     
    2221    static function getPostbackURL($defaultCID = '', $defaultType = '', $defaultName = '', $defaultRevenue = '')
    2322    {
    24         return self::getURL($defaultCID, $defaultType, $defaultName, $defaultRevenue);
     23        return self::getURL("/pixel/do.php", $defaultCID, $defaultType, $defaultName, $defaultRevenue);
    2524    }
    2625
     
    2827     *
    2928     */
    30     static function getURL($defaultCID = '', $defaultType = '', $defaultName = '', $defaultRevenue = '', $defaultSlug = '')
     29    static function getIPNURL($defaultIntegrationName = 'ipn', $defaultCID = '', $defaultType = '', $defaultName = '', $defaultRevenue = '')
     30    {
     31        return self::getURL("/pixel/ipn/{$defaultIntegrationName}.php", $defaultCID, $defaultType, $defaultName, $defaultRevenue);
     32    }
     33
     34    /**
     35     *
     36     */
     37    private static function getURL($scriptPath, $defaultCID = '', $defaultType = '', $defaultName = '', $defaultRevenue = '', $defaultSlug = '')
    3138    {
    3239        require_once __DIR__ . '/../utils/urlTools.php';
     
    5663        }
    5764        $queries = implode('&', $queries);
    58         return URLTools::getPluginURL() . "/pixel/do.php?{$queries}";
     65        return URLTools::getPluginURL() . "{$scriptPath}?{$queries}";
    5966    }
    6067}
  • clickervolt/trunk/readme.txt

    r2339223 r2340110  
    231231* Mobipium
    232232* MobVista
     233* PayKickstart via IPN
    233234* Shareasale
    234235* SpicyOffers
     
    239240* W4
    240241* WapEmpire
     242* WarriorPlus via IPN
    241243* Yep Ads
    242244* YTZ
     
    281283
    282284== Changelog ==
     285= 1.162 =
     286* Added conversion IPN for PayKickstart affiliate network
     287* Added conversion IPN for WarriorPlus affiliate network
     288
    283289= 1.160 =
    284290* Fixed mixed content ajax errors on some configurations
  • clickervolt/trunk/utils/arrayVars.php

    r2181646 r2340110  
    3030     *                      $array['key1']['key2']['key3'].
    3131     * @param mixed $default - default value if key not found
     32     * @param string $pathSeparator - to override the path separator
    3233     */
    33     static function getFromPath($array, $path, $default = null)
     34    static function getFromPath($array, $path, $default = null, $pathSeparator = '/')
    3435    {
    3536        $val = $default;
    3637
    3738        if (!empty($array)) {
    38             $keys = explode('/', $path);
     39            $keys = explode($pathSeparator, $path);
    3940            $nbKeys = count($keys);
    4041
     
    6061     *
    6162     */
    62     static function setFromPath(&$array, $path, $value)
     63    static function setFromPath(&$array, $path, $value, $pathSeparator = '/')
    6364    {
    64         $keys = explode('/', $path);
     65        $keys = explode($pathSeparator, $path);
    6566        $nbKeys = count($keys);
    6667
  • clickervolt/trunk/utils/uuid.php

    r2165181 r2340110  
    55class UUID
    66{
    7 
    87    static function alphaNum($maxLength = 16)
    98    {
    10 
    119        $uid = uniqid();
    1210        $uidLength = strlen($uid);
     
    1816                $suffix .= substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyz"), 0, 1);
    1917            }
    20 
    2118            $uid .= $suffix;
    2219        }
Note: See TracChangeset for help on using the changeset viewer.