Plugin Directory

Changeset 1703025


Ignore:
Timestamp:
07/26/2017 11:25:32 AM (9 years ago)
Author:
adtechmedia
Message:

preparing release 0.11.0

Location:
adtechmedia/trunk
Files:
300 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • adtechmedia/trunk/adtechmedia-config.php

    r1684514 r1703025  
    2020    private static $conf = [
    2121        'debug'                          => false,
     22        'ab_default_percentage'                  => 0,
    2223        'api_end_point'                  => 'https://api.adtechmedia.io/v1/',
    2324        'plugin_table_name'              => 'adtechmedia',
    2425        'plugin_cache_table_name'        => 'adtechmedia_cache',
     26        'plugin_ab_cookie_name'          => 'adtechmedia_ab',
     27        'plugin_ab_test_name'                => 'adtechmedia_ab',
    2528        'maxTries'                       => 7,
    2629        'minDelay'                       => 150000,
     
    2831        'atm_js_cache_time'              => 86400,
    2932        'template_overall_styles_patch'  => '@media (max-width: 991px) { .atm-targeted-container { width: 90% !important; left: 5% !important; transform: none !important; } } @media (max-width: 600px) { .atm-targeted-container { top: 0 !important; } }',
    30         'sw_js_url'                      => 'https://www.adtechmedia.io/atm-admin/atm-build/sw.min.js',
    31         'tpl_js_url'                     => 'https://www.adtechmedia.io/atm-core/atm-build/atmTpl.js',
    32         'tpl_mgmt_js_url'                => 'https://www.adtechmedia.io/atm-core/atm-build/atmTplManager.js',
     33        'sw_js_url'                      => 'https://manage.adtechmedia.io/atm-admin/atm-build/sw.min.js',
     34        'tpl_js_url'                     => 'https://manage.adtechmedia.io/atm-admin/atm-build/atmTpl.js',
     35        'tpl_mgmt_js_url'                => 'https://manage.adtechmedia.io/atm-admin/atm-build/atmTplManager.js',
    3336        'terms_url'                      => 'https://www.adtechmedia.io/terms/dialog.html',
    34         'register_url_tpl'               => 'https://www.adtechmedia.io/admin/accounts/signup/%s',
     37        'register_url_tpl'               => 'https://manage.adtechmedia.io/accounts/signup/%s',
    3538        'price'                          => 5,
    3639        'content_offset'                 => 2,
    3740        'payment_pledged'                => 2,
    38         'ads_video'                      => 'https://www.adtechmedia.io/adtechmedia-website/demo-vast.xml',
     41        'ads_video'                      => 'https://manage.adtechmedia.io/atm-admin/atm-build/demo-vast.xml',
    3942        'content_lock'                   => 'blur+scramble',
    4043        'revenue_method'                 => 'advertising+micropayments',
     
    4346        'content_offset_type'            => 'paragraphs',
    4447        'country'                        => 'United States',
    45         'platform_id'                                        => 'Wordpress',
     48        'platform_id'                    => 'Wordpress',
     49        'updated_appearance'             => '0',
    4650        'appearance_settings'                        => '{"model":{"main":{"sticky":true,"width":"600px","offset":{"top":"20px","fromCenter":"-60px","scrollTop":"100"}},"body":{"backgroundColor":"#ffffff","border":"1px solid #d3d3d3","fontFamily":"\'Merriweather\', sans-serif","boxShadow":"0 1px 2px 0 rgba(0, 0, 0, 0.1)"},"footer":{"backgroundColor":"#fafafa","border":"1px solid #e3e3e3"}}}',
    4751    ];
     
    6367    public static function setup_endpoints() {
    6468        if ( self::is_localhost() ) {
    65             self::$conf['api_end_point']        = 'https://api-dev.adtechmedia.io/v1/';
    66             self::$conf['sw_js_url']            = 'https://www-dev.adtechmedia.io/atm-admin/atm-build/sw.min.js';
    67             self::$conf['register_url_tpl'] = 'https://www-dev.adtechmedia.io/admin/accounts/signup/%s';
    68             self::$conf['tpl_js_url']       = 'https://www-dev.adtechmedia.io/atm-core/atm-build/atmTpl.js';
    69             self::$conf['tpl_mgmt_js_url']  = 'https://www-dev.adtechmedia.io/atm-core/atm-build/atmTplManager.js';
    70             self::$conf['terms_url']        = 'https://www-dev.adtechmedia.io/terms/dialog.html';
     69            self::$conf['api_end_point']        = 'https://api-test.adtechmedia.io/v1/';
     70            self::$conf['ads_video']            = 'https://manage-test.adtechmedia.io/atm-admin/atm-build/demo-vast.xml';
     71            self::$conf['sw_js_url']            = 'https://manage-test.adtechmedia.io/atm-admin/atm-build/sw.min.js';
     72            self::$conf['tpl_js_url']       = 'https://manage-test.adtechmedia.io/atm-admin/atm-build/atmTpl.js';
     73            self::$conf['tpl_mgmt_js_url']  = 'https://manage-test.adtechmedia.io/atm-admin/atm-build/atmTplManager.js';
     74            self::$conf['register_url_tpl'] = 'https://manage-test.adtechmedia.io/accounts/signup/%s';
     75            self::$conf['terms_url']        = 'https://www-test.adtechmedia.io/terms/dialog.html';
    7176        }
    7277    }
    7378
    7479    /**
    75      * Returns true if server IP is 127.0.0.1
     80     * Is local installation
    7681     *
    7782     * @return bool
  • adtechmedia/trunk/adtechmedia-lifecycle.php

    r1684514 r1703025  
    100100        $this->add_plugin_option( 'template_overall_styles_patch', Adtechmedia_Config::get( 'template_overall_styles_patch' ) );
    101101        $this->add_plugin_option( 'appearance_settings', Adtechmedia_Config::get( 'appearance_settings' ) );
     102        $this->add_plugin_option( 'ab_percentage', Adtechmedia_Config::get( 'ab_default_percentage' ) );
     103        $this->add_plugin_option( 'updated_appearance', Adtechmedia_Config::get( 'updated_appearance' ) );
    102104        try {
    103105            $this->check_api_key_exists();
    104             $this->check_prop();
    105 
    106             if ( ! empty( $this->get_plugin_option( 'key' ) ) ) {
    107                 $this->update_prop();
    108                 $this->update_appearance();
    109             }
    110106        } catch ( Error $error ) {
    111107            $this->activation_error = $error->getMessage();
     
    179175        $key = $this->get_plugin_option( 'key' );
    180176        if ( empty( $key ) ) {
     177            if ( $this->get_plugin_option( 'api-token-sent' ) === '1' ) {
     178                return false;
     179            }
     180
    181181            $key_response = Adtechmedia_Request::api_key_create(
    182182                $this->get_plugin_option( 'support_email' )
     
    209209                    $this->get_plugin_option( 'website_url' ),
    210210                    $this->get_plugin_option( 'support_email' ),
    211                     $this->get_plugin_option( 'country' ),
     211                    $this->country_full_to_UN( $this->get_plugin_option( 'country' ) ),
    212212                    $key
    213213                );
  • adtechmedia/trunk/adtechmedia-optionsmanager.php

    r1684514 r1703025  
    158158        $prefixed_option_name = $this->prefix( $option_name ); // how it is stored in DB.
    159159        $ret_val = get_option( $prefixed_option_name );
    160         if ( ! $ret_val && $default ) {
     160        if ( ! isset( $ret_val ) && $default ) {
    161161            $ret_val = $default;
    162162        }
     
    187187        }
    188188
    189         if ( ! $ret_val && $default ) {
     189        if ( ! isset( $ret_val ) && $default ) {
    190190            $ret_val = $default;
    191191        }
     
    558558        }
    559559
     560        Adtechmedia_Plugin::api_to_plugin_options();
    560561        require_once 'views/admin.php';
    561562    }
  • adtechmedia/trunk/adtechmedia-plugin.php

    r1695151 r1703025  
    1212 */
    1313include_once( 'adtechmedia-lifecycle.php' );
     14include_once( 'adtechmedia-ab.php' );
    1415
    1516/**
     
    2627        // http://plugin.michael-simpson.com/?page_id=31.
    2728        return array();
     29    }
     30
     31    /**
     32     * Checking if value is ok and update the option based on API one
     33     *
     34     * @param string $api_name field name.
     35     * @param string $api_value filed value.
     36     */
     37    private function update_from_api_option( $api_name, $api_value ) {
     38        if ( ! ctype_space( $api_name ) ) {
     39            $this->update_plugin_option( $api_name, $api_value );
     40        }
     41    }
     42    /**
     43     * Transform UN into Country Name
     44     *
     45     * @param string $un UN name of country.
     46     * @return string
     47     */
     48    function country_UN_to_full( $un ) {
     49        $list = Adtechmedia_Request::get_countries_list( $this->get_plugin_option( 'key' ) );
     50        foreach ( $list as $country ) {
     51            if ( $country['UN'] === $un ) {
     52                return $country['Name'];
     53            }
     54        }
     55    }
     56    /**
     57     * Transform Full into Country UN
     58     *
     59     * @param string $name  name of country.
     60     * @return string
     61     */
     62    function country_full_to_UN( $name ) {
     63        $list = Adtechmedia_Request::get_countries_list( $this->get_plugin_option( 'key' ) );
     64        foreach ( $list as $country ) {
     65            if ( $country['Name'] === $name ) {
     66                return $country['UN'];
     67            }
     68        }
     69    }
     70    /**
     71     * Gethering data from API and put it into mysql
     72     */
     73    public function api_to_plugin_options() {
     74        $api_result = Adtechmedia_Request::property_retrieve();
     75        $pleded_types = [
     76            'count' => 'transactions',
     77            'amount' => 'pledged currency',
     78        ];
     79        if ( $api_result ) {
     80            $this->update_from_api_option( 'selector', $api_result['Config']['defaults']['content']['selector'] );
     81            $this->update_from_api_option( 'price', $api_result['Config']['defaults']['payment']['price'] );
     82            $this->update_from_api_option( 'support_email', $api_result['SupportEmail'] );
     83            $this->update_from_api_option( 'country', $this->country_UN_to_full( $api_result['Country'] ) );
     84            $this->update_from_api_option( 'content_offset', $api_result['Config']['defaults']['content']['offset'] );
     85            $this->update_from_api_option( 'content_lock', $api_result['Config']['defaults']['content']['lock'] );
     86            $this->update_from_api_option( 'revenue_method', $api_result['Config']['defaults']['revenueMethod'] );
     87            $this->update_from_api_option( 'payment_pledged', $api_result['Config']['defaults']['payment']['pledged'] );
     88            $this->update_from_api_option( 'price_currency', $api_result['Config']['defaults']['payment']['currency'] );
     89            $this->update_from_api_option( 'content_paywall', $pleded_types[ $api_result['Config']['defaults']['payment']['pledgedType'] ] );
     90            $this->update_from_api_option( 'content_offset_type', $api_result['Config']['defaults']['content']['offsetType'] );
     91        }
    2892    }
    2993
     
    223287            );
    224288        }
     289        add_filter( 'after_setup_theme',
     290            array(
     291                &$this,
     292                'init_adtechmedia_AB',
     293            )
     294        );
    225295        add_filter( 'the_content',
    226296            array(
     
    263333            )
    264334        );
    265     }
    266 
     335        add_action( 'wp_ajax_update_appearance',
     336            array(
     337                &$this,
     338                'one_update_appearance',
     339            )
     340        );
     341    }
     342
     343    /**
     344     * Call function update_appearance after activation
     345     */
     346    public function one_update_appearance() {
     347        if ( ! empty( $this->get_plugin_option( 'key' ) ) ) {
     348            $this->update_appearance();
     349            $this->add_plugin_option( 'updated_appearance', 1 );
     350        }
     351        wp_die();
     352    }
     353
     354    /**
     355     * The first init function Adtechmedia_AB
     356     */
     357    public function init_adtechmedia_AB() {
     358        $this->is_enabled();
     359    }
    267360    /**
    268361     * Get key from token with API
     
    288381                $this->update_prop();
    289382                $this->update_appearance();
    290                 // @codingStandardsIgnoreStart
     383        // @codingStandardsIgnoreStart
    291384                echo $key;
    292                 // @codingStandardsIgnoreEnd
     385        // @codingStandardsIgnoreEnd
    293386            }
    294387            wp_die();
     
    368461        if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'adtechmedia-nonce' ) ) {
    369462            // @codingStandardsIgnoreStart
    370             if ( isset( $_POST['revenueMethod'] ) ) {
     463            if ( isset( $_POST['revenueMethod'], $_POST['country'] ) ) {
    371464                $plugin_dir = plugin_dir_path( __FILE__ );
    372465                $file       = $plugin_dir . '/js/atm.min.js';
    373466                @unlink( $file );
    374467
    375                 $revenue_method = $_POST['revenueMethod'];
     468                $revenue_method = sanitize_text_field( wp_unslash( $_POST['revenueMethod'] ) );
    376469                $this->update_plugin_option( 'revenue_method', $revenue_method );
     470
     471                $ab_percentage = (int) sanitize_text_field( wp_unslash( $_POST['abPercentage'] ) );
     472                $this->update_plugin_option( 'ab_percentage', $ab_percentage );
     473
     474                $country = sanitize_text_field( wp_unslash( $_POST['country'] ) );
     475                $this->update_plugin_option( 'country', $country );
     476
    377477                Adtechmedia_Request::property_update_config_by_array(
    378478                    $this->get_plugin_option( 'id' ),
     
    381481                        'revenueMethod' => $revenue_method,
    382482                    ]
     483                );
     484                Adtechmedia_Request::property_update(
     485                    $this->get_plugin_option( 'id' ),
     486                    $this->get_plugin_option( 'support_email' ),
     487                    $this->country_full_to_UN( $country ),
     488                    $this->get_plugin_option( 'key' )
    383489                );
    384490                Adtechmedia_ContentManager::clear_all_content();
     
    396502            }
    397503            // @codingStandardsIgnoreEnd
    398 
    399504            echo 'ok';
    400505        }
     
    470575     */
    471576    public function add_adtechmedia_scripts() {
    472         if ( ! is_single() || empty( $this->get_plugin_option( 'key' ) ) ) {
    473             return;
    474         }
    475         if ( $script = $this->get_plugin_option( 'BuildPath' ) ) {
     577        $script = $this->get_plugin_option( 'BuildPath' );
     578
     579        if ( $this->is_enabled() && isset( $script ) ) {
    476580            $is_old = $this->get_plugin_option( 'atm-js-is-old' );
    477581            // @codingStandardsIgnoreStart
     
    489593                // @codingStandardsIgnoreStart
    490594                $data = wp_remote_get( $script . "?_v=" . time() );
    491                 $data = gzdecode( $data['body'] ) ? gzdecode( $data['body'] ) : $data['body'];
    492                 $this->add_plugin_option( 'atm-js-hash', time() );
    493                 $this->add_plugin_option( 'atm-js-is-old', '0' );
    494                 file_put_contents( $file, $data );
     595                if ( is_array($data) ) {
     596                    $decodedData = @gzdecode( $data['body'] );
     597                    $this->add_plugin_option( 'atm-js-hash', time() );
     598                    $this->add_plugin_option( 'atm-js-is-old', '0' );
     599                    file_put_contents( $file, $decodedData ? $decodedData : $data['body'] );
     600                }
    495601                // @codingStandardsIgnoreEnd
    496602            }
     
    501607                // @codingStandardsIgnoreStart
    502608                $data = wp_remote_get( Adtechmedia_Config::get( 'sw_js_url' ) );
    503                 $data = gzdecode( $data['body'] ) ? gzdecode( $data['body'] ) : $data['body'];
    504                 file_put_contents( $sw_file, $data );
     609                if ( is_array($data) ) {
     610                    $decodedData = @gzdecode( $data['body'] );
     611                    file_put_contents( $sw_file, $decodedData ? $decodedData : $data['body'] );
     612                }
    505613                // @codingStandardsIgnoreEnd
    506614            }
    507             wp_enqueue_script( 'Adtechmedia', $path . '?v=' . $this->get_plugin_option( 'atm-js-hash' ), null, null, true );
     615
     616            if ( file_exists( $file ) ) {
     617                wp_enqueue_script( 'Adtechmedia', $path . '?v=' . $this->get_plugin_option( 'atm-js-hash' ), null, null, true );
     618            }
    508619        }
    509620    }
     
    522633
    523634    /**
     635     * Check if widget should be enabled.
     636     *
     637     * @return bool
     638     */
     639    public function is_enabled() {
     640        if ( ! isset( $this->ab ) ) {
     641            $percentage = (int) $this->get_plugin_option( 'ab_percentage', Adtechmedia_AB::DEFAULT_PERCENTAGE );
     642
     643            if ( $percentage <= 0 ) {
     644                return false;
     645            }
     646
     647            $this->ab = Adtechmedia_AB::instance()->set_percentage( $percentage )->start();
     648        }
     649
     650        $is_enabled = Adtechmedia_AB::SHOW === $this->ab->variant
     651            && is_single() && ! empty( $this->get_plugin_option( 'key' ) );
     652
     653        if ( ! $is_enabled ) {
     654            return false;
     655        }
     656        // @codingStandardsIgnoreStart
     657        $data = array(
     658            'time'              => get_post_time( 'U', true ),
     659            'url'                   => get_permalink(),
     660            'categories'    => join( ',', array_map( function ( $category ) {
     661                    return $category->name;
     662                }, get_the_category() ? get_the_category() : array()  ) ),
     663            'tags'              => join( ',', array_map( function( $tag ) {
     664                    return $tag->name;
     665                }, get_the_tags() ? get_the_tags() : array() ) )
     666        );
     667        // @codingStandardsIgnoreEnd
     668        return Adtechmedia_Request::br_decide_show(
     669            $this->get_plugin_option( 'Id' ),
     670            'load',
     671            $data,
     672            $this->get_plugin_option( 'key' )
     673        );
     674    }
     675
     676    /**
    524677     * Hide post content
    525678     *
     
    529682     */
    530683    public function hide_content( $content ) {
    531 
    532         if ( is_single() && ! empty( $this->get_plugin_option( 'key' ) ) ) {
     684        if ( $this->is_enabled() ) {
    533685            $id            = (string) get_the_ID();
    534686            $saved_content = Adtechmedia_ContentManager::get_content( $id );
  • adtechmedia/trunk/adtechmedia-request.php

    r1693783 r1703025  
    1212 */
    1313class Adtechmedia_Request {
     14    /**
     15     * Create content API request
     16     *
     17     * @param string $property_id id of property.
     18     * @param string $type type of decision.
     19     * @param array $data decision content.
     20     * @param string $key API key.
     21     * @return mixed
     22     *
     23     * @todo return false by default?
     24     */
     25    public static function br_decide_show( $property_id, $type, $data, $key ) {
     26        if ( empty( $key ) ) {
     27            return null;
     28        }
     29        $data = [
     30            'Id' => $property_id,
     31            'Type' => $type,
     32            'Data' => $data,
     33        ];
     34        $result = self::make(
     35            Adtechmedia_Config::get( 'api_end_point' ) . 'atm-admin/business-rules/decide',
     36            'GET',
     37            [ 'X-Api-Key' => $key ],
     38            $data
     39        );
     40        return $result['matched'] ? $result['result'] : true;
     41    }
    1442
    1543    /**
     
    91119            return false;
    92120        }
     121    }
     122
     123    /**
     124     * Get property API request
     125     *
     126     * @return bool|mixed
     127     */
     128    public static function property_retrieve() {
     129        $key = Adtechmedia_OptionsManager::get_plugin_option( 'key' );
     130        $id = Adtechmedia_OptionsManager::get_plugin_option( 'Id' );
     131        if ( empty( $key ) ) {
     132            return false;
     133        }
     134        return self::make(
     135            Adtechmedia_Config::get( 'api_end_point' ) . 'atm-admin/property/retrieve',
     136            'GET',
     137            [
     138                'X-Api-Key' => $key,
     139            ],
     140            [
     141                'Id' => $id,
     142            ]
     143        );
    93144    }
    94145
     
    371422        }
    372423        $data = [
    373             'Name' => $id,
     424            'Id' => $id,
    374425            'SupportEmail' => $support_email,
    375426            'Country' => $country,
  • adtechmedia/trunk/adtechmedia.php

    r1695151 r1703025  
    33 * Plugin Name: AdTechMedia
    44 * Plugin URI: https://wordpress.org/plugins/adtechmedia/
    5  * Version: 0.10.8
     5 * Version: 0.11.0
    66 * Author: AdTechMedia.io
    77 * Description: AdTechMedia is an advertising platform with micropayments capabilities for media content monetization. We help publishers and content providers to generate complimentary revenue streams that are immune to ad blocking software (e.g. native advertising or native micropayments). Our solutions are white labeled, data driven and realtime. To learn more, contact hello@adtechmedia.io or visit www.adtechmedia.io.
     
    6969// If it is successful, continue with initialization for this plugin.
    7070if ( adtechmedia_php_version_check() ) {
    71 
     71    include_once( 'vendor/autoload.php' );
    7272    include_once( 'adtechmedia-init.php' );
    7373    include_once( 'adtechmedia-request.php' );
    7474    include_once( 'adtechmedia-config.php' );
    7575    include_once( 'adtechmedia-contentmanager.php' );
    76     include_once( 'lib/autoload.php' );
    7776    adtechmedia_init( __FILE__ );
    7877}
  • adtechmedia/trunk/css/main.css

    r1693783 r1703025  
    17421742    box-shadow: none;
    17431743}
     1744
     1745input#support_email{
     1746    pointer-events: none;
     1747    font-weight: bold;
     1748}
  • adtechmedia/trunk/js/main.js

    r1693889 r1703025  
    215215          action: 'save_template',
    216216          nonce: save_template.nonce,
    217           revenueMethod: jQuery('select[name="revenue_method"]').val()
     217          revenueMethod: jQuery('select[name="revenue_method"]').val(),
     218          abPercentage: jQuery('input[name="ab_percentage"]').val(),
     219          country: jQuery('select[name="country"]').val()
    218220        },
    219221        success: function(response) {
     
    232234    var method = jQuery('#revenue_method');
    233235    method.empty();
     236    var currency = jQuery('#price_currency');
     237    currency.empty();
    234238    jQuery.each(country.find(':selected').data('methods'), function(key, value) {
    235239      method.append(jQuery('<option></option>')
     240        .attr('value', value).text(value));
     241    });
     242    jQuery.each(country.find(':selected').data('currency'), function(key, value) {
     243      currency.append(jQuery('<option></option>')
    236244        .attr('value', value).text(value));
    237245    });
     
    318326 
    319327  const saveTemplatesBtn = jQuery('#save-templates-config');
    320   const tplManager = atmTplManager(isLocalhost ? 'dev' : 'prod');
     328  const tplManager = atmTplManager(isLocalhost ? 'test' : 'prod');
    321329  const runtime = tplManager.rendition().render('#template-editor');
    322330  let firstSaveTemplates = false;
     
    409417    });
    410418  }
     419  if (updatedAppearance === 0) {
     420    jQuery.ajax({
     421      url: ajaxurl,
     422      type: 'post',
     423      data: {
     424        action: 'update_appearance'
     425      }
     426    });
     427  }
    411428});
  • adtechmedia/trunk/readme.txt

    r1695151 r1703025  
    1010Requires at least: 3.6
    1111Tested up to: 4.8
    12 Stable tag: 0.10.8
     12Stable tag: 0.11.0
    1313
    1414
     
    3838
    3939== Changelog ==
     40
     41= 0.11 =
     42- Integrated business rules support
     43- Added multiple countries and currencies
     44- Fixed bugs related to cookies and registration
    4045
    4146= 0.10 =
  • adtechmedia/trunk/views/admin.php

    r1693783 r1703025  
    1717    foreach ( $countries_list as $countries_element ) {
    1818        $countries[ $countries_element['Name'] ] = $countries_element['RevenueModel'];
    19         foreach ( $countries_element['Currency'] as $currency ) {
    20             if ( ! in_array( $currency, $currencies, true ) ) {
    21                 $currencies[] = $currency;
    22             }
    23         }
     19        $currencies [ $countries_element['Name'] ] = $countries_element['Currency'];
    2420    }
    2521}
     
    4642echo 'var termsUrl = \'' . addslashes( Adtechmedia_Config::get ( 'terms_url' ) ) . '\';' . PHP_EOL;
    4743echo 'var forceSaveTemplates = ' . ( empty( $this->get_plugin_option( 'force-save-templates' ) ) ? 'false' : 'true' )  . ';' . PHP_EOL;
     44echo 'var updatedAppearance = ' . $this->get_plugin_option( 'updated_appearance' ) . ';' . PHP_EOL;
    4845echo '</script>' . PHP_EOL;
    4946// @codingStandardsIgnoreEnd
     
    167164                                        $selected = ($this->get_plugin_option( 'country' ) === $name) ? 'selected' : '';
    168165                                        echo "<option value='" . esc_html( $name ) . "' data-methods='"
    169                                             . wp_json_encode( $methods ) . "' " . esc_html( $selected ) . '>' . esc_html( $name ) . '</option>';
     166                                            . wp_json_encode( $methods ) . "' data-currency='"
     167                                            . wp_json_encode( $currencies[ $name ] ) . "' " . esc_html( $selected ) . '>' . esc_html( $name ) . '</option>';
    170168                                    }
    171169                                    ?>
     
    190188                                Choose the revenue model that will be used on this blog
    191189                            </div>
     190                            <br/><!-- ToDo: Remove <br/> and add spacer through CSS -->
     191                            <div class="custom-label">
     192                                <label>
     193                                    <i class="mdi mdi-target"></i> A/B target
     194                                </label>
     195                                <input style="width: 100%;" min="0" max="100" step="1" type="number" id="ab_percentage" name="ab_percentage"
     196                                    value="<?php echo esc_html( $this->get_plugin_option( 'ab_percentage' ) ) ?>"/>
     197                            </div>
     198                            <div class="block-info">
     199                                Choose the percentage of users having the plugin enabled
     200                            </div>
    192201                            <div class="custom-input">
    193202                                <button type="button" id="save-revenue-model" class="btn"><i class="mdi mdi-check"></i> Save</button>
     
    205214                            <div class="custom-input">
    206215                                <input type="text" id="support_email" name="support_email" value="<?php echo esc_html( $this->get_plugin_option( 'support_email' ) ) ?>" size="100"/>
    207                                 <span class="bar"></span>
    208216                                <label><i class="mdi mdi-email"></i> Email address</label>
    209217                            </div>
    210218                            <div class="block-info">
    211                                 Provide your email address that will be used to register, connect and interact
    212                                 with AdTechMedia.io platform
     219                                This email address will be used to register, connect and interact
     220                                with AdTechMedia.io platform.
    213221                            </div>
    214222                            <br/><!-- ToDo: Remove <br/> and add spacer through CSS -->
     
    258266                                            <?php
    259267                                            $price_currency_value = $this->get_plugin_option( 'price_currency' );
    260                                             foreach ( $currencies as $currency ) {
    261                                                 echo "<option value='";
    262                                                 echo esc_html( $currency );
    263                                                 echo "' " .
    264                                                     (($currency === $price_currency_value) ? 'selected' : '')
    265                                                     . ' >' .
    266                                                     esc_html( strtoupper( $currency ) ) . '</option>';
     268                                            $coutry = $this->get_plugin_option( 'country' );
     269                                            if ( isset( $currencies[ $coutry ] ) ) {
     270                                                foreach ( $currencies[ $coutry ] as $currency ) {
     271                                                    echo "<option value='";
     272                                                    echo esc_html( $currency );
     273                                                    echo "' " .
     274                                                        (($currency === $price_currency_value) ? 'selected' : '')
     275                                                        . ' >' .
     276                                                        esc_html( strtoupper( $currency ) ) . '</option>';
     277                                                }
    267278                                            }
    268279                                            ?>
Note: See TracChangeset for help on using the changeset viewer.