Plugin Directory

Changeset 3830656


Ignore:
Timestamp:
11/28/2026 12:28:37 AM (66 minutes ago)
Author:
madjarov
Message:

Release 2.9.0

Location:
icdsoft-reseller-store/trunk
Files:
2 deleted
26 edited

Legend:

Unmodified
Added
Removed
  • icdsoft-reseller-store/trunk/assets/js/widget.js

    r3819731 r3830656  
    162162                        var domain_parts = DomainSearchForm.domainParts();
    163163                        var tld = domain_parts && domain_parts[2] ? domain_parts[2] : '';
    164                         var domain_group = (plandata['product_type'] != 'undefined' && plandata['product_type'] == 'server') ? 'extra:domain' : 'bonus:domain';
     164                        var domain_qty = HostingOrderForm.domainPeriod(plandata, qty);
    165165
    166166                        if (plandata['bonus:domain'] || plandata['extra:domain']) {
    … …  
    168168                                $('#hosting-order-form .hosting-new-domain[value=' + new_domain + ']').prop('checked', true);
    169169                                $('#hosting-order-form .domain-search-controls').css('display', new_domain == '1' ? '' : 'none');
    170                                 if (new_domain == '1' && $('#domain-search-tlds input[value="' + tld + '"]').data('icann') == '1' && validPath(plandata, domain_group + '.' + tld + '.order.' + qty + '.price')) {
     170                                if (new_domain == '1' && $('#domain-search-tlds input[value="' + tld + '"]').data('icann') == '1' && HostingOrderForm.domainItem(plandata, tld, domain_qty)) {
    171171                                        $('#order-domain-icann').show().find(':input').prop('required', true);
    172172                                } else {
    … …  
    189189                        if (new_domain == 1 && domain_parts && domain_parts[1]) {
    190190                                domain_total = Widget.tr('domain_search.not_offered');
    191                                 if (validPath(plandata, domain_group + '.' + tld.replace(/\./, '\\.') + '.order.' + qty + '.price')) {
    192                                         domain_price = parseFloat(plandata[domain_group][tld].order[qty].price);
     191                                var domain_item = HostingOrderForm.domainItem(plandata, tld, domain_qty);
     192                                if (domain_item) {
     193                                        domain_price = parseFloat(domain_item.order[domain_qty].price);
    193194                                        domain_total = HostingOrderForm.priceFormat(domain_price);
    194195                                }
    195196                                $('#hosting-price-domain').html(domain_total).show();
    196197                                $('#domain-search-tlds :input:checked').each(function () {
    197                                         var domain_total = '-', tld = $(this).val();
    198 
    199                                         if (validPath(plandata, domain_group + '.' + tld.replace(/\./, '\\.') + '.order.' + qty + '.price'))
    200                                                 domain_total = HostingOrderForm.priceFormat(parseFloat(plandata[domain_group][tld].order[qty].price));
     198                                        var domain_total = '-', tld = $(this).val(), item = HostingOrderForm.domainItem(plandata, tld, domain_qty);
     199
     200                                        if (item)
     201                                                domain_total = HostingOrderForm.priceFormat(parseFloat(item.order[domain_qty].price));
    201202
    202203                                        $('#domain-search-result .domain-price-' + tld.replace(/\./, '\\.')).html(domain_total);
    … …  
    215216
    216217                        $('#hosting-order-form #payment-information').css('display', plan_price + domain_price > 0 ? '' : 'none');
     218                },
     219                // Years of a domain ordered with the plan: monthly plans count in months, domains in years (as the API does)
     220                domainPeriod: function (plandata, period) {
     221                        period = parseInt(period, 10) || 1;
     222                        if (plandata && plandata.periodicity == 'MO')
     223                                return period <= 12 ? 1 : Math.ceil(period / 12);
     224
     225                        return period;
     226                },
     227                // The plan's bonus:domain item when it has a price for those years, otherwise extra:domain, as the API and RCP choose
     228                domainItem: function (plandata, tld, years) {
     229                        var groups = ['bonus:domain', 'extra:domain'];
     230                        for (var i = 0; i < groups.length; i++) {
     231                                var item = plandata && plandata[groups[i]] ? plandata[groups[i]][tld] : null;
     232                                if (item && item.order && item.order[years] && typeof item.order[years].price !== 'undefined')
     233                                        return item;
     234                        }
     235
     236                        return null;
    217237                },
    218238                rebuildPeriods: function (e) {
    … …  
    425445                        }
    426446
     447                        var not_offered_tld = '';
    427448                        if (DomainSearchForm.parts[2]) {
    428                                 $('input[value="' + DomainSearchForm.parts[2] + '"]', '#domain-search-tlds').prop('checked', 1);
     449                                var typed_tld = $('input[value="' + DomainSearchForm.parts[2] + '"]', '#domain-search-tlds');
     450                                if (typed_tld.length)
     451                                        typed_tld.prop('checked', 1);
     452                                else // not offered: the ticked extensions are searched for the same name, with a notice
     453                                        not_offered_tld = DomainSearchForm.parts[2];
    429454                        }
    430455
    … …  
    489514                        });
    490515
     516                        // after the requests: each one clears the messages when it starts
     517                        DomainSearchForm.tldNotOffered(not_offered_tld);
     518
    491519                        // Widget.spi('button');
    492520                        $.when.apply(null, DomainSearchForm.search_requests)
    … …  
    501529                                        else if (selected[0])
    502530                                                DomainSearchForm.showExtraAttributes(selected[0].attributes['data-tld'].value);
     531
     532                                        // selecting a domain above clears the messages too
     533                                        DomainSearchForm.tldNotOffered(not_offered_tld);
    503534                                })
    504535                                //.always(function () {
    … …  
    508539
    509540                        return false;
     541                },
     542                tldNotOffered: function (tld) {
     543                        if (tld)
     544                                Widget.msg('warning', String(Widget.tr('domain_search.tld_not_offered')).replace('%tld%', tld));
    510545                },
    511546                abortSearch: function () {
    … …  
    569604                                return
    570605                        }
     606                        // PayPal's script didn't load (blocked or offline): say so and leave the form as it is
     607                        if (typeof window.paypal === 'undefined' || !window.paypal || typeof window.paypal.Buttons !== 'function') {
     608                                Widget.msg('error', Widget.tr('error.paypal_unavailable'));
     609                                return;
     610                        }
    571611                        $('#complete-order').hide();
    572612                        $(element_id).empty();
    573                         paypal.Buttons({
     613                        var rendering = window.paypal.Buttons({
    574614                                async createOrder(data, actions) {
    575615                                        Widget.spi();
    … …  
    626666                                }
    627667                        }).render(element_id);
     668                        if (rendering && typeof rendering.catch === 'function') {
     669                                rendering.catch(function () {
     670                                        Widget.msg('error', Widget.tr('error.paypal_unavailable'));
     671                                });
     672                        }
    628673                        container.show();
    629674                },
  • icdsoft-reseller-store/trunk/icd-hosting.php

    r3819731 r3830656  
    44 * Plugin URI: https://www.icdsoft.com/reseller
    55 * Description: This plugin allows you to add hosting order forms on your website, accept hosting service orders and payments from your customers, and then  have these orders opened on servers hosted by ICDSoft.
    6  * Version: 2.8.2
     6 * Version: 2.9.0
    77 * Author: ICDSoft Hosting
    88 * Author URI: https://icdsoft.com
    … …  
    3737         * @var string
    3838         */
    39         public $version = '2.8.2';
     39        public $version = '2.9.0';
    4040
    4141        /**
    … …  
    124124                define( 'ICD_HOSTING_PLUGIN_NAME', 'icd_hosting' );
    125125
    126                 define( 'WIDGET_VERSION', '4.61' );
     126                define( 'WIDGET_VERSION', '4.68' );
    127127        }
    128128
  • icdsoft-reseller-store/trunk/includes/admin/class-icd-hosting-admin-settings.php

    r3697050 r3830656  
    7777                        // Clear cache when settings are updated
    7878                        add_action( 'update_option_' . self::OPTION_NAME, array( $this, 'clear_storage_cache' ), 10, 2 );
     79                        add_action( 'admin_post_icd_hosting_clear_cache', array( $this, 'clear_cache_request' ) );
    7980
    8081                        self::$options['registration_form_send'] = get_transient( ICD_Hosting_Admin_Settings::REGISTER_FORM_SEND );
    … …  
    252253                        <div class="wrap">
    253254                                <h2><?php esc_html__( 'WP Hosting Settings', 'icd-hosting') ?></h2>
     255                                <?php if ( ! empty( $_GET['cache-cleared'] ) ) : ?>
     256                                        <div class="notice notice-success is-dismissible"><p><?php esc_html_e( 'The cache has been cleared.', 'icd-hosting' ); ?></p></div>
     257                                <?php endif; ?>
    254258                                <form method="post" action="options.php">
    255259                                        <?php
    … …  
    259263                                        ?>
    260264                                </form>
     265                                <h2><?php esc_html_e( 'Cache', 'icd-hosting' ); ?></h2>
     266                                <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
     267                                        <input type="hidden" name="action" value="icd_hosting_clear_cache">
     268                                        <?php wp_nonce_field( 'icd_hosting_clear_cache' ); ?>
     269                                        <p><?php esc_html_e( 'Plans, prices and other store data are kept for a while to make the pages faster. Clear the cache to show changes made in the Reseller Control Panel right away.', 'icd-hosting' ); ?></p>
     270                                        <?php submit_button( __( 'Clear cache', 'icd-hosting' ), 'secondary', 'icd-hosting-clear-cache', false ); ?>
     271                                </form>
    261272                        </div>
    262273                        <?php
    … …  
    582593
    583594                /**
     595                 * The settings page's "Clear cache" button
     596                 */
     597                public function clear_cache_request() {
     598                        if ( ! current_user_can( 'manage_options' ) ) {
     599                                wp_die( esc_html__( 'Sorry, you are not allowed to do that.', 'icd-hosting' ), '', array( 'response' => 403 ) );
     600                        }
     601                        check_admin_referer( 'icd_hosting_clear_cache' );
     602
     603                        icd_hosting_clear_storage_cache();
     604
     605                        wp_safe_redirect( admin_url( 'admin.php?page=icd-hosting-settings&cache-cleared=1' ) );
     606                        exit;
     607                }
     608
     609                /**
    584610                 * Clear storage cache when settings are updated
    585611                 *
  • icdsoft-reseller-store/trunk/includes/class-icd-hosting-ajax.php

    r3781665 r3830656  
    163163                                                ), true );
    164164                                        }
     165                                } else if ( $total > 0 ) {
     166                                        // no payment method to choose from: the payment page says so, instead of a thank-you as if paid
     167                                        $create_order_result['redirect_to'] = icd_hosting_url( 'payment', array( 'order_id' => $order_id ), true );
    165168                                } else {
    166169                                        $create_order_result['redirect_to'] = icd_hosting_url( 'thankyou', array( 'order_id' => $order_id ), true );
    … …  
    317320                                                ), true );
    318321                                        }
     322                                } else if ( $total > 0 ) {
     323                                        // no payment method to choose from: the payment page says so, instead of a thank-you as if paid
     324                                        $create_order_result['redirect_to'] = icd_hosting_url( 'payment', array( 'order_id' => $order_id ), true );
    319325                                } else {
    320326                                        $create_order_result['redirect_to'] = icd_hosting_url( 'thankyou', array( 'order_id' => $order_id ), true );
  • icdsoft-reseller-store/trunk/includes/class-icd-hosting-config.php

    r3697050 r3830656  
    3939                                'key' => ! empty( self::$options['api_key'] ) ? self::$options['api_key'] : self::DEMO_STORE_KEY,
    4040                                'sec' => ! empty( self::$options['api_sec'] ) ? self::$options['api_sec'] : self::DEMO_STORE_SEC,
     41                                'demo' => empty( self::$options['api_key'] ),
    4142                                'cache' => true
    4243                        ),
  • icdsoft-reseller-store/trunk/includes/class-icd-hosting-install.php

    r3754341 r3830656  
    1818                if ( ! defined( 'IFRAME_REQUEST' ) && get_option( 'icd_hosting_version' ) !== ICD_Hosting()->version ) {
    1919                        self::install();
     20                }
     21
     22                self::purge_api_cache_once();
     23        }
     24
     25        /**
     26         * Empty the API cache the first time this release runs: cache files are named differently now, so
     27         * the earlier ones would never be read or expire.
     28         */
     29        public static function purge_api_cache_once() {
     30                if ( ! get_option( 'icd_hosting_api_cache_purged' ) ) {
     31                        self::purge_api_cache();
     32                        update_option( 'icd_hosting_api_cache_purged', time() );
     33                }
     34        }
     35
     36        /**
     37         * Empty storage/cache, keeping the files that close it to web requests
     38         */
     39        public static function purge_api_cache() {
     40                $dir = ICD_HOSTING_PLUGIN_PATH . 'storage/cache';
     41                if ( ! is_dir( $dir ) ) {
     42                        return;
     43                }
     44
     45                foreach ( scandir( $dir ) as $file ) {
     46                        if ( strpos( $file, '.' ) !== 0 && $file !== 'index.php' && is_file( $dir . '/' . $file ) ) {
     47                                @unlink( $dir . '/' . $file );
     48                        }
    2049                }
    2150        }
  • icdsoft-reseller-store/trunk/includes/icd-hosting-core-functions.php

    r3697050 r3830656  
    439439        $cleared_count = 0;
    440440        foreach ( $cache_files as $cache_file ) {
    441                 if ( is_file( $cache_file ) ) {
     441                // index.php keeps the folder from being listed, see icd_hosting_deny_web_access()
     442                if ( is_file( $cache_file ) && basename( $cache_file ) !== 'index.php' ) {
    442443                        if ( @unlink( $cache_file ) ) {
    443444                                $cleared_count++;
  • icdsoft-reseller-store/trunk/includes/services/ApiClient.php

    r3721474 r3830656  
    1111
    1212        /**
     13         * The only commands written to the disk cache: their answers hold public store and catalog data.
     14         * Every other answer stays in memory for the request, whatever ttl the API gives.
     15         */
     16        const CACHEABLE_COMMANDS = array( 'store', 'catalog', 'order-data', 'tlds', 'countries', 'signupCountries' );
     17
     18        /**
     19         * Commands that place orders or record payments. While the plugin runs on the public demo key they
     20         * would reach the demo store, so they are answered with an error instead.
     21         */
     22        const DEMO_BLOCKED_COMMANDS = array( 'order-create', 'order-update', 'payment-request-create', 'payment-add', 'payment-process-webhook' );
     23
     24        /**
    1325         * API Authentication Key
    1426         *
    … …  
    3042         */
    3143        protected $extra_params = array();
     44
     45        /**
     46         * Whether the store key is the public demo key, used before the plugin is set up
     47         *
     48         * @var bool
     49         */
     50        protected $demo = false;
    3251
    3352        /**
    … …  
    4463
    4564                $this->apiKey = $settings['key'];
     65                $this->demo   = ! empty( $settings['demo'] );
    4666
    4767                if ( ! empty( $settings['sec'] ) ) {
    … …  
    5878                        if (!is_dir($cache_path) or !is_writable($cache_path)) {
    5979                                $cache_path = '';
     80                        } else {
     81                                icd_hosting_deny_web_access( ICD_HOSTING_PLUGIN_PATH . 'storage' );
    6082                        }
    6183                        $this->cacheDir = $cache_path;
    … …  
    86108         */
    87109        public function isCachable( $cmd, $params = array() ) {
     110                if ( ! in_array( $cmd, self::CACHEABLE_COMMANDS, true ) ) {
     111                        return false;
     112                }
     113
    88114                if ( $this->hasValidResponse( $cmd, $params ) and $this->responses[ $this->cmdHash( $cmd, $params ) ]['ttl'] > 0 and $this->cacheDir ) {
    89115                        return true;
    … …  
    106132
    107133                return $cmd . '_' . md5( http_build_query( $params ) );
     134        }
     135
     136        /**
     137         * Cache file path: one file per store key and command parameters, the same for every visitor.
     138         * The fields that change with each request or visitor are left out of the name.
     139         *
     140         * @param string $cmd
     141         * @param array $params
     142         *
     143         * @return string
     144         */
     145        protected function getCacheFilePath( $cmd, $params ) {
     146                $params = array_diff_key( $params, array_flip( array( 'auth_token', 'wp_widget_version', 'widget_version', 'user_ip', 'nonce', 'ts', 'signature' ) ) );
     147
     148                return $this->cacheDir . '/' . ( empty( $cmd ) ? 'UNKNOWN' : $cmd ) . '_' . md5( $this->apiKey . '?' . http_build_query( $params ) );
    108149        }
    109150
    … …  
    137178         */
    138179        public function commands( $commands, $method = 'POST' ) {
    139                 if ( in_array( $method, $this->supportedHttpMethods ) ) {
    140                         $this->httpMethod = $method;
    141                 }
    142 
    143                 $result = parent::executeMulti( $commands );
     180                // always POST, for the reason get() gives
     181                $this->httpMethod = 'POST';
     182                foreach ( $commands as $k => $details ) {
     183                        unset( $commands[ $k ]['method'] );
     184                }
     185
     186                $blocked = array();
     187                foreach ( $commands as $k => $details ) {
     188                        if ( $this->blockedOnDemo( $details['command'] ) ) {
     189                                $blocked[ $k ] = $this->notConfigured();
     190                                unset( $commands[ $k ] );
     191                        }
     192                }
     193
     194                $result = $blocked + ( $commands ? parent::executeMulti( $commands ) : array() );
    144195                foreach ( $result as $k => $v ) {
    145196                        $result[ $k ] = $v = $this->normalizeResponse( $v );
    … …  
    205256         */
    206257        protected function execute( $cmd = '', $params = array() ) {
     258                if ( $this->blockedOnDemo( $cmd ) ) {
     259                        return $this->notConfigured();
     260                }
     261
    207262                $result = $this->normalizeResponse( parent::execute( $cmd, $params ) );
    208263                if ( ! empty( $result['messages'] ) ) {
    … …  
    211266
    212267                return $result;
     268        }
     269
     270        /**
     271         * Whether the command must not be sent because the plugin runs on the demo key
     272         *
     273         * @param string $cmd
     274         *
     275         * @return bool
     276         */
     277        protected function blockedOnDemo( $cmd ) {
     278                return $this->demo && in_array( $cmd, self::DEMO_BLOCKED_COMMANDS, true );
     279        }
     280
     281        /**
     282         * The answer to a command blocked on the demo key
     283         *
     284         * @return array
     285         */
     286        protected function notConfigured() {
     287                return array(
     288                        'status'   => false,
     289                        'messages' => $this->mapMessages( array( array( 'type' => 'error', 'code' => 'store_not_configured' ) ) ),
     290                );
    213291        }
    214292
  • icdsoft-reseller-store/trunk/includes/services/CurlClient.php

    r3697050 r3830656  
    228228
    229229                if ( $this->logFile ) {
    230                         $log = 'curl -X GET ' . escapeshellarg( $url ) . ' -k -g';
     230                        $log_params = icd_hosting_mask_secrets( $params );
     231                        $log        = 'curl -X GET ' . escapeshellarg( $this->httpMethod === 'POST' ? $url : $url . ( strpos( $url, '?' ) !== false ? '&' : '?' ) . http_build_query( $log_params ) ) . ' -k -g';
    231232                        if ( $this->httpMethod == 'POST' ) {
    232                                 $json = defined( 'JSON_PRETTY_PRINT' ) ? json_encode( $params, JSON_PRETTY_PRINT ) : json_encode( $params );
     233                                $json = defined( 'JSON_PRETTY_PRINT' ) ? json_encode( $log_params, JSON_PRETTY_PRINT ) : json_encode( $log_params );
    233234                                $log  = 'curl -X POST ' . escapeshellarg( $url ) . " -H 'Content-Type: application/json' -k -g -d \\\n" . escapeshellarg( $json );
    234235                        }
    … …  
    396397         */
    397398        protected function saveToCache( $cmd, $params, $response, $TTL = 3600 ) {
     399                if ( isset( $response['ttl'] ) && is_numeric( $response['ttl'] ) ) {
     400                        $TTL = (int) $response['ttl'];
     401                }
     402
     403                if ( (int) $TTL <= 0 ) {
     404                        return;
     405                }
     406
    398407                $cache = $this->getCacheFilePath( $cmd, $params );
    399408                file_put_contents( $cache, json_encode( $response ) );
    400                 if ( (int) $TTL > 0 ) {
    401                         touch( $cache, time() + $TTL );
     409                touch( $cache, time() + $TTL );
     410
     411                // one visit in five tidies up, so expired files don't pile up
     412                if ( wp_rand( 1, 5 ) == 1 ) {
     413                        $this->clearExpiredCache();
     414                }
     415        }
     416
     417        /**
     418         * Delete expired cache files. Dot files and index.php keep the folder closed to web requests.
     419         */
     420        protected function clearExpiredCache() {
     421                if ( ! $this->cacheDir || ! is_dir( $this->cacheDir ) ) {
     422                        return;
     423                }
     424
     425                foreach ( scandir( $this->cacheDir ) as $file ) {
     426                        $path = $this->cacheDir . '/' . $file;
     427                        if ( strpos( $file, '.' ) !== 0 && $file !== 'index.php' && is_file( $path ) && filemtime( $path ) < time() ) {
     428                                @unlink( $path );
     429                        }
    402430                }
    403431        }
  • icdsoft-reseller-store/trunk/includes/services/OrderHelper.php

    r3754341 r3830656  
    389389
    390390                $hosting_dto = OrderDTO::getHostingItem();
     391                $plan_item   = $catalog_by_location[ $input['location'] ][ $input['plan'] ];
    391392
    392393                if ( ! empty( $input['new_domain'] ) ) {
    393                         $domain_dto = OrderDTO::getDomainItem();
    394                         $sld_tld    = icd_hosting_sld_tld( $input['domain'] );
    395 
    396                         if ( strpos( $input['plan'], 'multivps' ) !== false ) {
    397                                 if ( ! $sld_tld or empty( $catalog_by_location[ $input['location'] ][ $input['plan'] ]['extra:domain'][ $sld_tld['tld'] ]['order'][ $input['period'] ] ) ) {
    398                                         icd_hosting_error( 'error.tld_not_supported' );
    399                                 }
    400                         } else if ( ! $sld_tld or empty( $catalog_by_location[ $input['location'] ][ $input['plan'] ]['bonus:domain'][ $sld_tld['tld'] ]['order'][ $input['period'] ] ) ) {
     394                        $domain_dto    = OrderDTO::getDomainItem();
     395                        $sld_tld       = icd_hosting_sld_tld( $input['domain'] );
     396                        $domain_period = self::domainPeriod( $plan_item, $input['period'] );
     397                        $domain_item   = $sld_tld ? self::domainItem( $plan_item, $sld_tld['tld'], $domain_period ) : null;
     398
     399                        if ( ! $domain_item ) {
    401400                                icd_hosting_error( 'error.tld_not_supported' );
    402401                        }
    … …  
    442441
    443442                // Fill hosting product props
    444                 $plan_item                       = $catalog_by_location[ $input['location'] ][ $input['plan'] ];
    445443                $hosting_dto['hosting.hostname'] = icd_hosting_valid_domain( $input['domain'] );
    446444                $hosting_dto['action']           = 'order';
    … …  
    462460
    463461                if ( isset( $domain_dto ) ) {
    464                         if ( strpos( $input['plan'], 'multivps' ) !== false ) {
    465                                 $domain_item = $catalog_by_location[ $input['location'] ][ $input['plan'] ]['extra:domain'][ $sld_tld['tld'] ];
    466                         } else {
    467                                 $domain_item = $catalog_by_location[ $input['location'] ][ $input['plan'] ]['bonus:domain'][ $sld_tld['tld'] ];
    468                         }
    469462                        $domain_dto['domain.tld'] = $sld_tld['tld'];
    470463                        $domain_dto['domain.sld'] = $sld_tld['sld'];
    471464                        $domain_dto['action']     = 'order';
    472                         $domain_dto['period']     = $input['period'];
    473                         if ( $plan_item['periodicity'] == 'MO' ) {
    474                                 $domain_dto['period'] = $domain_dto['period'] <= 12 ? 1 : intdiv( $domain_dto['period'], 12 );
    475                         }
     465                        $domain_dto['period']     = $domain_period;
    476466                        $domain_dto['catalog_id'] = $domain_item['catalog_id'];
    477467                        $domain_dto['type']       = $domain_dto['product_type'] = $domain_item['product_type'];
    … …  
    480470                                                    ': ' . $sld_tld['sld'] . '.' . $sld_tld['tld'];
    481471
    482                         $domain_dto['price'] = $domain_item['order'][ $input['period'] ]['price'];
     472                        $domain_dto['price'] = $domain_item['order'][ $domain_period ]['price'];
    483473
    484474                        if ( ! empty( $input['domain_extra_attributes'] ) ) {
    … …  
    500490
    501491        /**
     492         * Years of a domain ordered with a plan. Monthly plans count their period in months, domains count in years: the
     493         * same rule as the API and the RCP billing form.
     494         *
     495         * @param array $plan_item
     496         * @param int $period the plan's period
     497         *
     498         * @return int
     499         */
     500        public static function domainPeriod( $plan_item, $period ) {
     501                $period = (int) $period;
     502                if ( isset( $plan_item['periodicity'] ) && $plan_item['periodicity'] == 'MO' ) {
     503                        return $period <= 12 ? 1 : (int) ceil( $period / 12 );
     504                }
     505
     506                return $period;
     507        }
     508
     509        /**
     510         * The catalog item of a domain ordered with a plan: the plan's bonus:domain when it has a price for that period,
     511         * otherwise extra:domain, as the RCP order forms choose. Whether it's free is up to the catalog price.
     512         *
     513         * @param array $plan_item
     514         * @param string $tld
     515         * @param int $years
     516         *
     517         * @return array|null
     518         */
     519        public static function domainItem( $plan_item, $tld, $years ) {
     520                foreach ( array( 'bonus:domain', 'extra:domain' ) as $group ) {
     521                        if ( isset( $plan_item[ $group ][ $tld ]['order'][ $years ]['price'] ) ) {
     522                                return $plan_item[ $group ][ $tld ];
     523                        }
     524                }
     525
     526                return null;
     527        }
     528
     529        /**
    502530         * Get order details
    503531         *
    … …  
    538566
    539567        /**
     568         * Whether a value is an order request's OR- identity, the one request emails carry
     569         *
     570         * @param mixed $request_id
     571         *
     572         * @return bool
     573         */
     574        public static function validRequestId( $request_id ) {
     575                return is_string( $request_id ) && preg_match( '/^OR-[A-Z0-9]+$/i', $request_id ) === 1;
     576        }
     577
     578        /**
    540579         * Get order request details
    541580         *
    … …  
    546585         */
    547586        public static function getRequestDetails( $request_id ) {
    548                 if ( ! preg_match( '/^(OR-[A-Z0-9]+|[0-9]{1,16})$/i', $request_id ) ) {
     587                if ( ! self::validRequestId( $request_id ) ) {
    549588                        icd_hosting_error( 'invalid.request_id:' . $request_id );
    550589                }
  • icdsoft-reseller-store/trunk/includes/services/Payment.php

    r2595510 r3830656  
    5555                $processor = reset( $this->processors );
    5656
    57                 return $processor['processor_id'];
     57                return $processor ? $processor['processor_id'] : null;
    5858        }
    5959
  • icdsoft-reseller-store/trunk/includes/services/Translate.php

    r2502442 r3830656  
    5353
    5454        /**
     55         * Language files already read, by path
     56         *
     57         * @var array
     58         */
     59        private static $files = array();
     60
     61        /**
    5562         * Default language
    5663         */
    … …  
    275282                        }
    276283
    277                         self::$custom_labels[ $language ] = array_merge( self::$custom_labels[ $language ], require_once( self::$custom_lang_path . "/{$language}.php" ) );
     284                        self::$custom_labels[ $language ] = array_merge( self::$custom_labels[ $language ], self::loadFile( self::$custom_lang_path . "/{$language}.php" ) );
    278285
    279286                        return;
    280287                }
     288        }
     289
     290        /**
     291         * A language file's texts. Not require_once: a second call in the same request, as when a shortcode is rendered
     292         * twice, would get true instead of the texts.
     293         *
     294         * @param string $file
     295         *
     296         * @return array
     297         */
     298        private static function loadFile( $file ) {
     299                if ( ! isset( self::$files[ $file ] ) ) {
     300                        self::$files[ $file ] = require $file;
     301                }
     302
     303                return self::$files[ $file ];
    281304        }
    282305
    … …  
    294317
    295318                if ( is_file( self::$lang_path . "/{$language}.php" ) ) {
    296                         self::$labels[ $language ] = array_merge( self::$labels[ $language ], require_once( self::$lang_path . "/{$language}.php" ) );
     319                        self::$labels[ $language ] = array_merge( self::$labels[ $language ], self::loadFile( self::$lang_path . "/{$language}.php" ) );
    297320
    298321                        return;
    299322                }
    300323                if ( is_file( self::$lang_path . '/' . self::DEFAULT_LANG . '.php' ) ) {
    301                         self::$labels[ $language ] = array_merge( self::$labels[ $language ], require_once( self::$lang_path . '/' . self::DEFAULT_LANG . '.php' ) );
     324                        self::$labels[ $language ] = array_merge( self::$labels[ $language ], self::loadFile( self::$lang_path . '/' . self::DEFAULT_LANG . '.php' ) );
    302325
    303326                        return;
  • icdsoft-reseller-store/trunk/includes/services/helpers.php

    r3697050 r3830656  
    442442
    443443/**
     444 * Replace credentials with "_masked_" before data is logged or mailed. The same key list as the
     445 * widget's mask_secrets(). auth_token keeps its first 16 characters, the hint the API stores for the
     446 * key, so a log line still tells which key was used without holding a usable one.
     447 *
     448 * @param mixed $data
     449 *
     450 * @return mixed
     451 */
     452function icd_hosting_mask_secrets( $data ) {
     453        if ( ! is_array( $data ) ) {
     454                return $data;
     455        }
     456
     457        $keys = array(
     458                'auth_token', 'password', 'pass', 'secret', 'secret_key', 'client_secret', 'private_key',
     459                'api_key', 'apikey', 'token', 'access_token', 'refresh_token', 'client_token', 'authorization',
     460                // domain transfer authorization code
     461                'epp',
     462                // WorldPay's callback password, sent back in its payment response
     463                'callbackpw',
     464        );
     465
     466        foreach ( $data as $key => $value ) {
     467                $name = strtolower( (string) $key );
     468
     469                if ( in_array( $name, $keys, true ) ) {
     470                        $data[ $key ] = $name == 'auth_token' && is_string( $value ) && strlen( $value ) >= 32 ? substr( $value, 0, 16 ) : '_masked_';
     471                } elseif ( is_array( $value ) ) {
     472                        $data[ $key ] = icd_hosting_mask_secrets( $value );
     473                }
     474        }
     475
     476        return $data;
     477}
     478
     479/**
     480 * Close a folder to web requests: an Apache deny rule, and an empty index.php in it and its
     481 * subfolders against directory listings. nginx ignores .htaccess, so nothing secret may be kept there.
     482 *
     483 * @param string $dir
     484 */
     485function icd_hosting_deny_web_access( $dir ) {
     486        if ( ! is_dir( $dir ) ) {
     487                return;
     488        }
     489
     490        if ( ! file_exists( $dir . '/.htaccess' ) ) {
     491                // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents
     492                file_put_contents( $dir . '/.htaccess', "<IfModule mod_authz_core.c>\n\tRequire all denied\n</IfModule>\n<IfModule !mod_authz_core.c>\n\tOrder deny,allow\n\tDeny from all\n</IfModule>\n" );
     493        }
     494
     495        icd_hosting_protect_directory_listing( $dir );
     496}
     497
     498/**
    444499 * @param $array
    445500 * @param $key
  • icdsoft-reseller-store/trunk/includes/services/processors/Payment2CheckOut.php

    r2986374 r3830656  
    243243                        $hash = strtoupper( md5( $this->secret . $this->merchantId . $input['order_number'] . $input['total'] ) );
    244244
    245                         if ( $hash == $input['key'] ) {
     245                        if ( is_string( $input['key'] ) && hash_equals( $hash, $input['key'] ) ) {
    246246                                return array(
    247247                                        'payment_processor_id' => $this->config['processor_id'],
    … …  
    262262                        $hash = strtoupper( md5( $input['sale_id'] . $this->merchantId . $input['invoice_id'] . $this->secret ) );
    263263
    264                         if ( $hash == $input['md5_hash'] ) {
     264                        if ( is_string( $input['md5_hash'] ) && hash_equals( $hash, $input['md5_hash'] ) ) {
    265265                                return array(
    266266                                        'payment_processor_id' => $this->config['processor_id'],
  • icdsoft-reseller-store/trunk/includes/services/processors/PaymentAuthorizeNet.php

    r3525448 r3830656  
    128128                        $sig = hash_hmac('sha512', $textToHash, hex2bin($this->secret));
    129129
    130                         if ($input['x_SHA2_Hash'] == strtoupper($sig)) {
     130                        if (isset($input['x_SHA2_Hash']) and is_string($input['x_SHA2_Hash']) and hash_equals(strtoupper($sig), $input['x_SHA2_Hash'])) {
    131131                                return array(
    132132                                        'payment_processor_id' => $this->config['processor_id'],
  • icdsoft-reseller-store/trunk/includes/services/processors/PaymentEpay.php

    r2502442 r3830656  
    157157                        $CHECKSUM      = $input['checksum'];
    158158                        $CHECKSUM_CALC = $this->hmac( 'sha1', $ENCODED, $this->secret );
    159                         if ( $CHECKSUM_CALC == $CHECKSUM ) {
     159                        if ( is_string( $CHECKSUM ) && hash_equals( $CHECKSUM_CALC, $CHECKSUM ) ) {
    160160                                $data      = base64_decode( $ENCODED );
    161161                                $lines_arr = explode( "\n", $data );
  • icdsoft-reseller-store/trunk/includes/services/processors/PaymentPayDollar.php

    r2110032 r3830656  
    5656                }
    5757
    58                 return array(
     58                $data = array(
    5959                        'url'    => $this->url,
    6060                        'type'   => 'online',
    … …  
    7777                        )
    7878                );
     79
     80                // once AsiaPay turns Secure Hash on for the merchant, it refuses a form without one
     81                if ( $this->secureHashSecret() !== '' ) {
     82                        $params               = &$data['params'];
     83                        $params['amount']     = number_format( $params['amount'], 2, '.', '' );
     84                        $params['secureHash'] = sha1( implode( '|', array(
     85                                $params['merchantId'], $params['orderRef'], $params['currCode'], $params['amount'], $params['payType'], $this->secureHashSecret()
     86                        ) ) );
     87                }
     88
     89                return $data;
     90        }
     91
     92        /**
     93         * The store's Secure Hash Secret, or '' when it has none
     94         *
     95         * @return string
     96         */
     97        protected function secureHashSecret() {
     98                return isset( $this->config['options']['secure_hash_secret'] ) && is_string( $this->config['options']['secure_hash_secret'] ) ? trim( $this->config['options']['secure_hash_secret'] ) : '';
     99        }
     100
     101        /**
     102         * Whether a datafeed carries a Secure Hash made with the store's secret. While a secret is being
     103         * replaced, PayDollar sends one hash per secret, comma separated.
     104         *
     105         * @param array $input
     106         *
     107         * @return bool
     108         */
     109        protected function validSecureHash( $input ) {
     110                if ( empty( $input['secureHash'] ) || ! is_string( $input['secureHash'] ) ) {
     111                        return false;
     112                }
     113
     114                $signed = array();
     115                foreach ( array( 'src', 'prc', 'successcode', 'Ref', 'PayRef', 'Cur', 'Amt', 'payerAuth' ) as $field ) {
     116                        $signed[] = isset( $input[ $field ] ) && is_scalar( $input[ $field ] ) ? $input[ $field ] : '';
     117                }
     118                $expected = sha1( implode( '|', $signed ) . '|' . $this->secureHashSecret() );
     119
     120                foreach ( explode( ',', $input['secureHash'] ) as $hash ) {
     121                        if ( hash_equals( $expected, strtolower( trim( $hash ) ) ) ) {
     122                                return true;
     123                        }
     124                }
     125
     126                return false;
    79127        }
    80128
    … …  
    88136        public function validPayment( $input ) {
    89137                if ( isset( $input['successcode'] ) and isset( $input['PayRef'] ) and isset( $input['Ref'] ) ) {
     138                        $verified = $this->secureHashSecret() !== '';
     139                        if ( $verified && ! $this->validSecureHash( $input ) ) {
     140                                return;
     141                        }
     142
    90143                        $this->postback_response = 'OK';
    91144
    92                         return array(
     145                        $payment = array(
    93146                                'payment_processor_id' => $this->config['processor_id'],
    94147                                'order_id'             => null,
    … …  
    102155                                'ipn'                  => $input,
    103156                        );
     157
     158                        // without a Secure Hash Secret the reseller confirms the payment in the PayDollar account,
     159                        // see ICD_Hosting_Shortcode_Postback::report_unverified_payment()
     160                        if ( ! $verified && $payment['payment_type'] == 'incoming' ) {
     161                                $payment['hold'] = 'unverified';
     162                        }
     163
     164                        return $payment;
    104165                }
    105166        }
  • icdsoft-reseller-store/trunk/includes/services/processors/PaymentPayPal.php

    r2986374 r3830656  
    44
    55use ICD\Hosting\ICD_Hosting;
     6use ICD\Hosting\Services\OrderHelper;
    67
    78/**
    … …  
    211212                }
    212213
     214                // only payments to this store's PayPal account
     215                $receivers = array();
     216                foreach (array('business', 'receiver_email', 'receiver_id') as $field) {
     217                        if (!empty($input[$field]) and is_string($input[$field]))
     218                                $receivers[] = strtolower(trim($input[$field]));
     219                }
     220
     221                if (!in_array(strtolower(trim($this->merchantId)), $receivers, true))
     222                        return;
     223
    213224                if ($this->validPayment($input)) {
    214225                        if (preg_match('/^\d{1,14}$/', $input['invoice'])) {
    … …  
    218229                                $payment_request_id = '';
    219230                                $order_id = $input['invoice'];
     231                        }
     232
     233                        // a payment request is paid in its own currency and in full; the tolerance covers
     234                        // paymentData()'s item rounding
     235                        if ($payment_request_id and $this->paymentType($input) == 'incoming') {
     236                                $request = $this->paymentRequestDetails($payment_request_id);
     237                                if (
     238                                        !isset($input['mc_currency']) or strcasecmp($input['mc_currency'], $request['currency']) != 0 or
     239                                        $input['mc_gross'] < $request['amount'] - max(0.1, $request['amount'] * 0.01)
     240                                ) {
     241                                        return;
     242                                }
    220243                        }
    221244
    … …  
    424447
    425448        /**
     449         * The payment request an IPN pays
     450         *
     451         * @param string $payment_request_id
     452         *
     453         * @return array
     454         * @throws \ICD\Hosting\Services\AppException
     455         */
     456        protected function paymentRequestDetails($payment_request_id) {
     457                return OrderHelper::getPaymentRequestDetails($payment_request_id);
     458        }
     459
     460        /**
    426461         * Get payment type based on IPN payment status
    427462         *
    … …  
    432467        public function paymentType($ipn) {
    433468                if (in_array($ipn['payment_status'], ['Denied', 'Expired', 'Failed', 'Refunded', 'Reversed', 'Voided']))
    434                         return in_array($ipn['reason_code'], ['chargeback', 'guarantee', 'buyer-complaint']) ? 'chargeback' : 'refund';
     469                        return in_array(icd_hosting_array_get($ipn, 'reason_code'), ['chargeback', 'guarantee', 'buyer-complaint']) ? 'chargeback' : 'refund';
    435470
    436471                if ($ipn['payment_status'] == 'Completed' and isset($ipn['txn_type']) and $ipn['txn_type'] == 'adjustment' and $ipn['mc_gross'] < 0)
    … …  
    469504                        $shell = "curl -X $method " . escapeshellarg("{$this->api['url']}$cmd") . " \
    470505-H 'Content-Type: application/json' \
    471 -H 'Authorization: Basic {$this->api['auth']}' \
     506-H 'Authorization: Basic _masked_' \
    472507-d " . escapeshellarg(json_encode($data));
    473508                } else {
    474509                        $shell = "curl -X $method " . escapeshellarg("{$this->api['url']}$cmd") . " \
    475510-H 'Content-Type: application/json' \
    476 -H 'Authorization: Basic {$this->api['auth']}'";
     511-H 'Authorization: Basic _masked_'";
    477512                }
    478513
  • icdsoft-reseller-store/trunk/includes/services/processors/PaymentPayU.php

    r2110032 r3830656  
    115115                $transaction_state = $input['state_pol'];
    116116
    117                 if ( strtoupper( $input['sign'] ) == strtoupper( $signature ) && ! empty( $input['reference_pol'] ) && ! empty( $input['value'] ) ) {
     117                if ( is_string( $input['sign'] ) && hash_equals( strtoupper( $signature ), strtoupper( $input['sign'] ) ) && ! empty( $input['reference_pol'] ) && ! empty( $input['value'] ) ) {
    118118
    119119                        return array_merge(
  • icdsoft-reseller-store/trunk/includes/services/processors/PaymentSkrill.php

    r2110032 r3830656  
    117117                        $md5 = strtoupper( md5( $input['merchant_id'] . $input['transaction_id'] . $secretMD5 . $input['mb_amount'] . $input['mb_currency'] . $input['status'] ) );
    118118
    119                         if ( $input['md5sig'] == $md5 ) {
     119                        if ( isset( $input['md5sig'] ) && is_string( $input['md5sig'] ) && hash_equals( $md5, $input['md5sig'] ) ) {
    120120                                echo "OK";
    121121
  • icdsoft-reseller-store/trunk/includes/shortcodes/class-icd-hosting-shortcode-plan-info.php

    r2676950 r3830656  
    2323
    2424                        if ( empty( $plan ) ) {
     25                                self::not_offered( isset( $atts['plan'] ) ? $atts['plan'] : '', $location, $order_data, $atts );
     26
    2527                                return false;
    2628                        }
    … …  
    4143
    4244                        if ( empty( $viewdata['price'] ) ) {
     45                                self::not_offered( $plan, $location, $order_data, $atts );
     46
    4347                                return false;
    4448                        }
    … …  
    5155                }
    5256        }
     57
     58        /**
     59         * A plan the store doesn't sell at that location shows nothing to visitors. The page's editors get a note, so a
     60         * wrong or retired plan name doesn't go unnoticed.
     61         *
     62         * @param string $plan       plan from the shortcode, '' when it names none
     63         * @param string $location   data center key
     64         * @param array  $order_data order form data, for the data center's name
     65         * @param array  $atts       shortcode attributes, for the location as typed
     66         */
     67        protected static function not_offered( $plan, $location, $order_data, $atts ) {
     68                if ( ! current_user_can( 'edit_post', get_the_ID() ) ) {
     69                        return;
     70                }
     71
     72                if ( isset( $order_data['datacenters'][ $location ]['name'] ) ) {
     73                        $location = $order_data['datacenters'][ $location ]['name'];
     74                } elseif ( isset( $atts['location'] ) ) {
     75                        $location = $atts['location'];
     76                }
     77
     78                if ( $plan === '' ) {
     79                        /* translators: %s: data center */
     80                        $note = sprintf( __( '[plan_info]: no plans are offered at the location "%s". Only the editors of this page see this note.', 'icd-hosting' ), $location );
     81                } else {
     82                        /* translators: 1: plan name from the shortcode, 2: data center */
     83                        $note = sprintf( __( '[plan_info]: the plan "%1$s" is not offered at the location "%2$s". Only the editors of this page see this note.', 'icd-hosting' ), $plan, $location );
     84                }
     85                echo '<p class="icd-hosting-not-offered">' . esc_html( $note ) . '</p>';
     86        }
    5387}
  • icdsoft-reseller-store/trunk/includes/shortcodes/class-icd-hosting-shortcode-postback.php

    r3187671 r3830656  
    1414                try {
    1515                        $input    = $_POST;
    16                         $debug    = wp_json_encode( $input, JSON_PRETTY_PRINT );
     16                        $debug    = wp_json_encode( icd_hosting_mask_secrets( $input ), JSON_PRETTY_PRINT );
    1717                        $settings = ICD_Hosting::instance()->getApp()->settings;
    1818
    … …  
    3030                        $redirect_params = [];
    3131
    32                         if ( $payment['payment_type'] != 'error' ) {
     32                        if ( ! empty( $payment['hold'] ) ) {
     33                                self::report_unverified_payment( $payment, $settings );
     34                        } else if ( $payment['payment_type'] != 'error' ) {
    3335                                $result = ICD_Hosting::instance()->order_service->addPayment( $payment );
    34                                 $debug  .= "\n" . wp_json_encode( $payment, JSON_PRETTY_PRINT ) . "\n" . wp_json_encode( $result, JSON_PRETTY_PRINT );
     36                                $debug  .= "\n" . wp_json_encode( icd_hosting_mask_secrets( $payment ), JSON_PRETTY_PRINT ) . "\n" . wp_json_encode( $result, JSON_PRETTY_PRINT );
    3537                                if ( empty( $result['status'] ) ) {
    3638                                        icd_hosting_error( 'error.adding_payment' );
    … …  
    7779                }
    7880        }
     81
     82        /**
     83         * A payment to confirm by hand (PayDollar without a Secure Hash Secret) is not recorded: the
     84         * reseller gets its details to find in the processor's account. At most 20 mails go out a day.
     85         *
     86         * @param array $payment detectPayment()'s result
     87         * @param array $settings
     88         */
     89        public static function report_unverified_payment( $payment, $settings ) {
     90                if ( ! empty( $settings['ipn_log'] ) ) {
     91                        icd_hosting_custom_log( $settings['ipn_log'], 'not recorded, to check by hand: ' . wp_json_encode( icd_hosting_mask_secrets( $payment ) ) );
     92                }
     93
     94                $day  = 'icd_hosting_unverified_mails_' . gmdate( 'Ymd' );
     95                $sent = (int) get_transient( $day );
     96                if ( $sent >= 20 ) {
     97                        return;
     98                }
     99                set_transient( $day, $sent + 1, DAY_IN_SECONDS );
     100
     101                $to = ! empty( $settings['notification_email'] ) ? $settings['notification_email'] : get_option( 'admin_email' );
     102                $ipn = isset( $payment['ipn'] ) && is_array( $payment['ipn'] ) ? $payment['ipn'] : array();
     103
     104                wp_mail(
     105                        $to,
     106                        sprintf( '[WORDPRESS_PAYMENT] %s payment to check', $payment['payment_method'] ),
     107                        implode( "\n", array(
     108                                sprintf( '%s reported a payment that this site cannot verify, so it was not recorded.', $payment['payment_method'] ),
     109                                'Find it in your ' . $payment['payment_method'] . ' account. If it is there, record it for the order in the Reseller Control Panel.',
     110                                '',
     111                                'Payment request: ' . $payment['payment_request_id'],
     112                                'Payment reference: ' . $payment['transaction_id'],
     113                                'Amount: ' . $payment['total'] . ( isset( $ipn['Cur'] ) && is_scalar( $ipn['Cur'] ) ? ' (currency code ' . $ipn['Cur'] . ')' : '' ),
     114                                '',
     115                                'To have PayDollar payments recorded automatically, ask PayDollar to turn on Secure Hash for your account and enter the Secure Hash Secret in your store\'s PayDollar settings in the Reseller Control Panel.',
     116                        ) )
     117                );
     118        }
    79119}
  • icdsoft-reseller-store/trunk/includes/shortcodes/class-icd-hosting-shortcode-request.php

    r3721474 r3830656  
    2020                        $options    = get_option( ICD_Hosting_Config::OPTION_NAME );
    2121
    22                         if ( ! preg_match( '/^(OR-[A-Z0-9]+|[0-9]{1,16})$/i', $id ) ) {
     22                        if ( ! OrderHelper::validRequestId( $id ) ) {
    2323                                icd_hosting_error( 'invalid.request_id' );
    2424                        }
  • icdsoft-reseller-store/trunk/lang/language/en.php

    r3781665 r3830656  
    77                'hostname_is_already_hosted'           => 'The selected domain is already hosted with us',
    88                'system_error'                         => 'An unexpected error has occurred',
     9                'store_not_configured'                 => 'This store is not set up yet, so orders cannot be placed.',
    910                'domain_not_available'                 => 'Domain name not available',
    1011                'invalid_signature'                    => 'Invalid API Security Key',
    … …  
    128129                'invalid'            => 'Invalid domain',
    129130                'not_offered'        => 'Registration not offered',
     131                'tld_not_offered'    => 'Domains ending in .%tld% are not offered. Here are the results for the other extensions.',
    130132                'choose_search_tlds' => 'Please select search TLDs',
    131133                'check_all'          => 'Check all'
    … …  
    229231        'payment_details'     => 'Enter payment details',
    230232        'payment_info_text'   => 'There is an outstanding amount of <b>%outstanding%</b> required for the completion of your order.',
     233        'no_payment_methods'  => 'No payment methods are available at the moment. Please contact us to complete your order.',
    231234        'thankyou_info_text'  => 'Our team will process it as soon as possible. You will be contacted if needed.',
    232235
    … …  
    492495                'generic'                           => 'Application error',
    493496                'payment_failed'                    => 'We were unable to process your payment. Please try again.',
     497                'paypal_unavailable'                => 'PayPal could not be loaded. Please reload the page or choose another payment method.',
     498                'paypal_order_create_failed'        => 'The PayPal payment could not be started. Please try again or choose another payment method.',
    494499                'product_not_found'                 => 'The selected product cannot be found.',
    495500                'failed_to_retrieve_order_data'     => 'Failed to retrieve order data.',
  • icdsoft-reseller-store/trunk/readme.txt

    r3825488 r3830656  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 2.8.2
     7Stable tag: 2.9.0
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
    … …  
    8080[plan_info plan=&#34;Product Name&#34; location=&#34;Data Center&#34;]
    8181
    82 The plan_info shortcode can be used to display the main features of a given hosting product. **plan** can take one of the following values - economy, business, business-plus, economy-sureapp, business-sureapp, firstclass, firstclass-startup, firstclass-ultimate, multivps, multivps-pro. **location** can take one of the following values - eu, us, hk.
    83 
    84 ***Example:*** The following shortcode will display a table with the characteristics of the Economy plan at the Europe data center
    85 
    86 [plan_info plan=&#34;economy&#34; location=&#34;eu&#34;]
     82The plan_info shortcode can be used to display the main features of a given hosting product. **plan** can take one of the following values:
     83
     84* Shared hosting - launch, core, advanced, professional
     85* VPS - firstclass-startup, firstclass, firstclass-x2, firstclass-ultimate, firstclass-ultimate-x2, firstclass-ultimate-x3
     86* SmartVPS - multivps-40, multivps-100, multivps-150, multivps-200
     87
     88**location** can take one of the following values - eu, us, hk.
     89
     90A plan is shown only at the locations where your online store sells it. Online stores created earlier may still sell older plans (for example economy, business or multivps), which can be used the same way. If the plan or location is not sold, visitors see nothing, and the editors of the page see a note about it.
     91
     92***Example:*** The following shortcode will display a table with the characteristics of the Core plan at the Europe data center
     93
     94[plan_info plan=&#34;core&#34; location=&#34;eu&#34;]
    8795
    8896**Plan compare block**
    … …  
    118126
    119127== Changelog ==
     128= 2.9.0 =
     129* Security hardening of the API cache and the storage folder
     130* Payment methods added to the online store show on the Payment page right away
     131* New "Clear cache" button on the Settings page, to show plan and price changes right away
     132* A new domain ordered with a monthly plan is registered for 1 year for up to 12 months, and for whole years above that, as in the Reseller Control Panel
     133* The price of a new domain ordered with a plan comes from the plan's domain prices in the catalog, so the order form shows the amount charged (VPS and SmartVPS plans)
     134* An order with an amount due and no payment method to choose from opens the Payment page, which says that no payment methods are available
     135* Show a message when PayPal cannot be loaded on the Payment page
     136* Domain Check says when the typed extension is not offered, and shows the results for the other extensions
     137* plan_info: the page's editors see a note when the plan or location is not sold by the store; the readme lists the current plans
     138* PayDollar: payment notifications are confirmed with the Secure Hash when the online store has a Secure Hash secret; otherwise the payment details are emailed to the site to be recorded in the Reseller Control Panel
     139* Orders and payments are not sent while the plugin uses the demo store key
     140* Fix the "Terms of Use" page error in the block editor
     141* Fix the demo store's details staying after a new store key is saved
     142* Do not fail when no payment processors are configured
     143
    120144= 2.8.2 =
    121145* "Use my already registered domain name" keeps domains with extensions outside the built-in list (e.g. .top) instead of searching the extension as a name
  • icdsoft-reseller-store/trunk/templates/payment.php

    r3339755 r3830656  
    6565                </div>
    6666        </form>
     67<?php else: ?>
     68        <div class="alert alert-warning" role="alert"><?php echo esc_html( icd_hosting_tr( 'no_payment_methods' ) ); ?></div>
    6769<?php endif; ?>
    6870<?php if (!empty($payment_assets['js'])): ?>
Note: See TracChangeset for help on using the changeset viewer.