Plugin Directory

Changeset 2601020


Ignore:
Timestamp:
09/18/2021 09:45:26 AM (5 years ago)
Author:
bcripts
Message:

Price is further extended to currency (supporting all countries), price and price suffix

Location:
ya-pricing-table
Files:
57 added
17 edited

Legend:

Unmodified
Added
Removed
  • ya-pricing-table/trunk/README.txt

    r2587959 r2601020  
    55Requires at least: 5.0
    66Tested up to: 5.8
    7 Stable tag: 1.1.0
     7Requires PHP: 7.4
     8Stable tag: 2.0.0
    89License: GPLv2 or later
    910License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1011
    11 Simple WordPress plugin to create pricing tables in post or pages easily with no programming knowledge.
     12Easily create and publish beautiful pricing tables with no programming knowledge using Yet Another Pricing Table Plugin by bCripts.
    1213
    1314== Description ==
    1415
    15 Simple WordPress plugin to create pricing tables in post or pages easily with no programming knowledge. With this plugin you can also create or update templates located inside **templates** folder of the plugin directory (if you know how to edit html and css). We are continuously planning to improve our plugin and make it one of the best pricing table plugins.
     16Simple WordPress plugin to create pricing tables in post or pages easily with no programming knowledge. Easily create and publish beautiful pricing tables with no programming knowledge using Yet Another Pricing Table Plugin by bCripts. Alter content, select a desired template, and publish on the website.
     17
     18= Features =
     19
     20* Build beautiful WordPress pricing tables in minutes.
     21* Clean Codes and fast loading.
     22* Works with any WordPress theme.
     23* Responsive pricing tables - responds to fit any device.
     24* Gutenberg / WordPress 5.8 compatible. Not just compatible.
     25* Intuitive User Interface.
     26* Unlimited pricing tables, columns and rows
     27* Preset Templates
     28* Featured Column – draw people to your most popular products by highlighting a featured column.
     29* Shortcode support for use with classic editor and page builders.
    1630
    1731== Installation ==
     
    4963== Changelog ==
    5064
     65= 2.0.0 =
     66* Price is further extended to currency (supporting all countries), price and price suffix.
     67
    5168= 1.1.0 =
    5269* Added new template named Aanya
     
    5471= 1.0.0 =
    5572* First version of YA Pricing Tables
     73
     74== Upgrade Notice ==
     75
     76= 2.0.0 =
     77Price is further extended to currency (supporting all countries), price and price suffix.
  • ya-pricing-table/trunk/Type/Column.php

    r2586259 r2601020  
    77    public string $highlighted;
    88    public string $description;
     9    public string $column_price_currency;
    910    public string $column_price;
     11    public string $column_price_suffix;
    1012    public string $column_button_url;
    1113    public string $column_button_face_text;
     
    2224     * @param array $features
    2325     */
    24     public function __construct(int $column_id, string $column_title, string $highlighted, string $description, string $column_price, string $column_button_url, string $column_button_face_text, array $features)
     26    public function __construct(int $column_id, string $column_title, string $highlighted, string $description, string $column_price_currency, string $column_price, string $column_price_suffix, string $column_button_url, string $column_button_face_text, array $features)
    2527    {
    2628        $this->column_id = $column_id;
     
    2830        $this->highlighted = $highlighted;
    2931        $this->description = $description;
     32        $this->column_price_currency = $column_price_currency;
    3033        $this->column_price = $column_price;
     34        $this->column_price_suffix = $column_price_suffix;
    3135        $this->column_button_url = $column_button_url;
    3236        $this->column_button_face_text = $column_button_face_text;
     
    4448        $column_id = (int)sanitize_text_field($column_data_array['column_id'] ?? 0);
    4549        $description = sanitize_text_field($column_data_array['description']);
     50        $column_price_currency = sanitize_text_field($column_data_array['column_price_currency']);
    4651        $column_price = sanitize_text_field($column_data_array['column_price']);
     52        $column_price_suffix = sanitize_text_field($column_data_array['column_price_suffix']);
    4753        $column_button_url = sanitize_text_field($column_data_array['column_button_url']);
    4854        $column_button_face_text = sanitize_text_field($column_data_array['column_button_face_text']);
     
    6672        }
    6773
    68         return new Column($column_id, $column_title, $highlighted, $description, $column_price, $column_button_url, $column_button_face_text, $feature_array);
     74        return new Column($column_id, $column_title, $highlighted, $description, $column_price_currency, $column_price, $column_price_suffix, $column_button_url, $column_button_face_text, $feature_array);
    6975    }
    7076}
  • ya-pricing-table/trunk/Type/PriceTable.php

    r2586259 r2601020  
    3636        $price_table_id = (int)sanitize_text_field($price_table_data['price_table_id'] ?? 0);
    3737        $custom_styles = str_replace("/* styles here */", '', sanitize_textarea_field($price_table_data['custom_styles']));
    38         $highlighted_key = sanitize_text_field($price_table_data['highlighted']);
     38        $highlighted_key = sanitize_text_field($price_table_data['highlighted'] ?? '');
    3939
    4040        if (empty($pricing_table_title) || empty($template_id)) {
  • ya-pricing-table/trunk/admin/class-yapt-admin.php

    r2586259 r2601020  
    209209            if (empty($column->column_id)) {
    210210                // insert into yapt_columns
    211                 $wpdb->insert($wpdb->prefix . 'yapt_columns', ['column_title' => $column->column_title, 'description' => $column->description, 'highlighted' => $column->highlighted, 'table_id' => $price_table_obj->price_table_id, 'price_text' => $column->column_price, 'ctoa_btn_text' => $column->column_button_face_text, 'ctoa_btn_link' => $column->column_button_url, 'created_at' => $now, 'updated_at' => $now]);
     211                $wpdb->insert($wpdb->prefix . 'yapt_columns', ['column_title' => $column->column_title, 'description' => $column->description, 'highlighted' => $column->highlighted, 'table_id' => $price_table_obj->price_table_id, 'price_currency' => $column->column_price_currency, 'price' => $column->column_price, 'price_suffix' => $column->column_price_suffix, 'ctoa_btn_text' => $column->column_button_face_text, 'ctoa_btn_link' => $column->column_button_url, 'created_at' => $now, 'updated_at' => $now]);
    212212                $column->column_id = $wpdb->insert_id;
    213213            } else {
    214214                // update yapt_columns
    215                 $wpdb->update($wpdb->prefix . 'yapt_columns', ['column_title' => $column->column_title, 'description' => $column->description, 'highlighted' => $column->highlighted, 'table_id' => $price_table_obj->price_table_id, 'price_text' => $column->column_price, 'ctoa_btn_text' => $column->column_button_face_text, 'ctoa_btn_link' => $column->column_button_url, 'created_at' => $now, 'updated_at' => $now], ['id' => $column->column_id]);
     215                $wpdb->update($wpdb->prefix . 'yapt_columns', ['column_title' => $column->column_title, 'description' => $column->description, 'highlighted' => $column->highlighted, 'table_id' => $price_table_obj->price_table_id, 'price_currency' => $column->column_price_currency, 'price' => $column->column_price, 'price_suffix' => $column->column_price_suffix, 'ctoa_btn_text' => $column->column_button_face_text, 'ctoa_btn_link' => $column->column_button_url, 'created_at' => $now, 'updated_at' => $now], ['id' => $column->column_id]);
    216216            }
    217217
  • ya-pricing-table/trunk/admin/css/yapt-admin.css

    r2586259 r2601020  
    163163
    164164.yapt_table_row input[type="text"] {
     165    width: 100%;
     166    padding: 3px 8px;
     167    border: 1px solid #ddd;
     168    margin-top: 3px;
     169    border-radius: 0;
     170}
     171
     172.yapt_table_row select {
    165173    width: 100%;
    166174    padding: 3px 8px;
  • ya-pricing-table/trunk/admin/partials/yapt-admin-add-page.php

    r2586259 r2601020  
    1515global $wpdb;
    1616$results_templates = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}yapt_templates", ARRAY_A);
     17
     18$currencies = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}yapt_currency", ARRAY_A);
    1719?>
    1820<div class="wrap">
     
    106108<script type="text/javascript">
    107109    let computed_feature_id;
     110    let computed_column_id;
     111    let price_suffixs = ['Per hour', 'Per day', 'Per month', 'Per year', 'Per night'];
     112    let option = '';
     113    price_suffixs.forEach(function(price_suffix) {
     114        option += "<option value='" + price_suffix + "'>" + price_suffix + "</option>";
     115    });
     116
     117    <?php
     118        $currency_options = '';
     119        $selected_currency = 'United States of America';
     120        foreach($currencies as $currency) {
     121            $select = '';
     122            if($selected_currency === $currency['country']) {
     123                $select = "selected = 'selected'";
     124            }
     125            $currency_options .= "<option value='" . $currency['country'] . "' ".$select.">" . $currency['country'].' ('.$currency['code'] . ")</option>";
     126        }
     127    ?>
    108128
    109129    function add_feature(column_id) {
     
    135155    function add_column() {
    136156        //console.log('add column called');
    137         let computed_column_id = parseInt(jQuery("#column_count").val());
     157        computed_column_id = parseInt(jQuery("#column_count").val());
    138158        //console.log('new column id: ' + computed_column_id);
     159
     160        let price_suffix = "<select name='fields[" + computed_column_id + "][column_price_suffix]'>" + option + "</select>";
     161
     162        let currency_select = "<select name='fields[" + computed_column_id + "][column_price_currency]'><?php echo $currency_options;?></select>";
    139163
    140164        let new_column_value = "<div class='yapt_table_column' id='tbl_column" + computed_column_id +
    141165            "'><div class='yapt_table_row'><label>Name</label><input type='text' required='required' name='fields[" + computed_column_id +
    142166            "][column_title]'/></div><div class='yapt_table_row'><label>Short description</label><textarea class='short_description' name='fields[" + computed_column_id +
    143             "][description]'></textarea></div><div class='yapt_table_row'><label>Pricing</label><input type='text' name='fields[" +
    144             computed_column_id +
    145             "][column_price]'/></div><div class='yapt_table_row'><label>Button face text</label><input type='text' name='fields[" +
     167            "][description]'></textarea></div>" +
     168            "<div class='yapt_table_row'><label>Currency</label>" + currency_select + "</div>" +
     169            "<div class='yapt_table_row'><label>Price</label><input type='text' name='fields[" + computed_column_id + "][column_price]'/></div>" +
     170            "<div class='yapt_table_row'><label>Price suffix</label>"+price_suffix+"</div>" +
     171            "<div class='yapt_table_row'><label>Button face text</label><input type='text' name='fields[" +
    146172            computed_column_id +
    147173            "][column_button_face_text]'/></div><div class='yapt_table_row'><label>Button url</label><input type='text' name='fields[" +
     
    165191    // add first column
    166192    add_column();
     193
     194    jQuery(document).on('change', 'select[name*="[column_price_currency]"]', function() {
     195        jQuery('select[name*="[column_price_currency]"]').val(this.value);
     196    });
    167197</script>
  • ya-pricing-table/trunk/admin/partials/yapt-admin-edit.php

    r2586259 r2601020  
    1515global $wpdb;
    1616$results_templates = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}yapt_templates", ARRAY_A);
     17
     18$currencies = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}yapt_currency", ARRAY_A);
    1719?>
    1820<div class="wrap">
     
    115117    let computed_feature_id;
    116118    let computed_column_id;
     119    let price_suffixs = ['Per hour', 'Per day', 'Per month', 'Per year', 'Per night'];
     120    let option = '';
     121    price_suffixs.forEach(function(price_suffix) {
     122        option += "<option value='" + price_suffix + "'>" + price_suffix + "</option>";
     123    });
     124
     125    <?php
     126    $currency_options = '';
     127    $selected_currency = 'United States of America';
     128    foreach($currencies as $currency) {
     129        $select = '';
     130        if($selected_currency === $currency['country']) {
     131            $select = "selected = 'selected'";
     132        }
     133        $currency_options .= "<option value='" . $currency['country'] . "' ".$select.">" . $currency['country'].' ('.$currency['code'] . ")</option>";
     134    }
     135    ?>
    117136
    118137    function add_feature(column_id) {
     
    148167        //console.log('new column id: ' + computed_column_id);
    149168
     169        let price_suffix = "<select name='fields[" + computed_column_id + "][column_price_suffix]'>" + option + "</select>";
     170
     171        let currency_select = "<select name='fields[" + computed_column_id + "][column_price_currency]'><?php echo $currency_options;?></select>";
     172
    150173        let new_column_value = "<div class='yapt_table_column' id='tbl_column" + computed_column_id +
    151174            "'><div class='yapt_table_row'><label>Name</label><input type='hidden' name='fields[" + computed_column_id +
    152175            "][column_id]' /><input type='text' required='required' name='fields[" + computed_column_id +
    153176            "][column_title]'/></div><div class='yapt_table_row'><label>Short description</label><textarea class='short_description' name='fields[" + computed_column_id +
    154             "][description]'></textarea></div><div class='yapt_table_row'><label>Pricing</label><input type='text' name='fields[" +
    155             computed_column_id +
    156             "][column_price]'/></div><div class='yapt_table_row'><label>Button face text</label><input type='text' name='fields[" +
    157             computed_column_id +
    158             "][column_button_face_text]'/></div><div class='yapt_table_row'><label>Button url</label><input type='text' name='fields[" +
    159             computed_column_id +
    160             "][column_button_url]'/></div><div class='yapt_table_row yapt_table_row_features_head'><span class='features_title'>Features</span><a href='javascript:;' class='add_feature' onclick='add_feature(" +
     177            "][description]'></textarea></div>" +
     178            "<div class='yapt_table_row'><label>Currency</label>"+currency_select+"</div>" +
     179            "<div class='yapt_table_row'><label>Price</label><input type='text' name='fields[" + computed_column_id +"][column_price]'/></div>" +
     180            "<div class='yapt_table_row'><label>Price suffix</label>" + price_suffix + "</div>" +
     181            "<div class='yapt_table_row'><label>Button face text</label><input type='text' name='fields[" + computed_column_id + "][column_button_face_text]'/></div>" +
     182            "<div class='yapt_table_row'><label>Button url</label><input type='text' name='fields[" + computed_column_id + "][column_button_url]'/></div>" +
     183            "<div class='yapt_table_row yapt_table_row_features_head'><span class='features_title'>Features</span><a href='javascript:;' class='add_feature' onclick='add_feature(" +
    161184            computed_column_id +
    162185            ")'><span class='dashicons dashicons-plus-alt'></span>add feature</a></div><input type='hidden' name='column" +
     
    184207    jQuery("input[name='fields[" + column_id_value + "][column_title]']").val('<?php echo esc_html($col['column_title']);?>');
    185208    jQuery("textarea[name='fields[" + column_id_value + "][description]']").val('<?php echo esc_html($col['description']);?>');
    186     jQuery("input[name='fields[" + column_id_value + "][column_price]']").val('<?php echo esc_html($col['price_text']);?>');
     209    jQuery("select[name='fields[" + column_id_value + "][column_price_currency]']").val('<?php echo esc_html($col['price_currency']);?>').change();
     210    jQuery("input[name='fields[" + column_id_value + "][column_price]']").val('<?php echo esc_html($col['price']);?>');
     211    jQuery("select[name='fields[" + column_id_value + "][column_price_suffix]']").val('<?php echo esc_html($col['price_suffix']);?>').change();
    187212    jQuery("input[name='fields[" + column_id_value + "][column_button_face_text]']").val('<?php echo esc_html($col['ctoa_btn_text']);?>');
    188213    jQuery("input[name='fields[" + column_id_value + "][column_button_url]']").val('<?php echo esc_url($col['ctoa_btn_link']);?>');
     
    211236    }
    212237    ?>
     238    jQuery(document).on('change', 'select[name*="[column_price_currency]"]', function() {
     239        jQuery('select[name*="[column_price_currency]"]').val(this.value);
     240    });
    213241</script>
  • ya-pricing-table/trunk/includes/class-yapt-activator.php

    r2587868 r2601020  
    7373             `updated_at` DATETIME NOT NULL,
    7474              PRIMARY KEY id (id)
    75         )$charset_collate;";
    76             dbDelta($sql);
     75            )$charset_collate;";
     76                dbDelta($sql);
    7777
    7878            // insert_query
     
    9999              FOREIGN KEY(template_id)
    100100                REFERENCES " . $wpdb->prefix . "yapt_templates (id)
    101         )$charset_collate;";
    102             dbDelta($sql);
     101            )$charset_collate;";
     102                dbDelta($sql);
    103103        }
    104104
     
    113113             `description` TEXT NULL,
    114114             `table_id` INT(11) NOT NULL,
    115              `price_text` VARCHAR(255) NOT NULL,
     115             `price_currency` VARCHAR(255) NOT NULL,
     116             `price` VARCHAR(255) NOT NULL,
     117             `price_suffix` VARCHAR(255) NOT NULL,
    116118             `ctoa_btn_text` VARCHAR(255) NOT NULL,/** ctoa => call to action */
    117119             `ctoa_btn_link` VARCHAR(255) NOT NULL,
     
    122124                REFERENCES " . $wpdb->prefix . "yapt_pricing_tables (id)
    123125                ON DELETE CASCADE
    124         )$charset_collate;";
     126            )$charset_collate;";
    125127            dbDelta($sql);
    126128        }
     
    141143                REFERENCES " . $wpdb->prefix . "yapt_columns (id)
    142144                ON DELETE CASCADE
    143         )$charset_collate;";
     145            )$charset_collate;";
     146                dbDelta($sql);
     147        }
     148
     149        // yapt_features
     150        $table_name = $wpdb->prefix . 'yapt_currency';
     151        $charset_collate = $wpdb->get_charset_collate();
     152        if ($wpdb->get_var("show tables like '{$table_name}'") != $table_name) {
     153            $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " (
     154                    `country`  VARCHAR(100) NOT NULL,
     155                    `currency` VARCHAR(100),
     156                    `code`     VARCHAR(100),
     157                    `symbol`   VARCHAR(100),
     158                    PRIMARY KEY (`country`),
     159                    UNIQUE INDEX `country_UNIQUE` (`country` ASC)
     160                )$charset_collate;";
    144161            dbDelta($sql);
     162
     163            $sql_insert = <<<CUR
     164INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Albania', 'Leke', 'ALL', 'Lek');
     165INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Afghanistan', 'Afghanis', 'AFN', '؋');
     166INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Argentina', 'Pesos', 'ARS', '$');
     167INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Aruba', 'Guilders', 'AWG', 'ƒ');
     168INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Australia', 'Dollars', 'AUD', '$');
     169INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Azerbaijan', 'New Manats', 'AZN', 'ман');
     170INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Bahamas', 'Dollars', 'BSD', '$');
     171INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Barbados', 'Dollars', 'BBD', '$');
     172INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Belarus', 'Rubles', 'BYR', 'p.');
     173INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Belgium', 'Euro', 'EUR', '€');
     174INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Beliz', 'Dollars', 'BZD', 'BZ$');
     175INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Bermuda', 'Dollars', 'BMD', '$');
     176INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Bolivia', 'Bolivianos', 'BOB', '\$b');
     177INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Bosnia and Herzegovina', 'Convertible Marka', 'BAM', 'KM');
     178INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Botswana', 'Pula', 'BWP', 'P');
     179INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Bulgaria', 'Leva', 'BGN', 'лв');
     180INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Brazil', 'Reais', 'BRL', 'R$');
     181INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Britain (United Kingdom)', 'Pounds', 'GBP', '£');
     182INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Brunei Darussalam', 'Dollars', 'BND', '$');
     183INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Cambodia', 'Riels', 'KHR', '៛');
     184INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Canada', 'Dollars', 'CAD', '$');
     185INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Cayman Islands', 'Dollars', 'KYD', '$');
     186INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Chile', 'Pesos', 'CLP', '$');
     187INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('China', 'Yuan Renminbi', 'CNY', '¥');
     188INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Colombia', 'Pesos', 'COP', '$');
     189INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Costa Rica', 'Colón', 'CRC', '₡');
     190INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Croatia', 'Kuna', 'HRK', 'kn');
     191INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Cuba', 'Pesos', 'CUP', '₱');
     192INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Cyprus', 'Euro', 'EUR', '€');
     193INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Czech Republic', 'Koruny', 'CZK', 'Kč');
     194INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Denmark', 'Kroner', 'DKK', 'kr');
     195INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Dominican Republic', 'Pesos', 'DOP ', 'RD$');
     196INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('East Caribbean', 'Dollars', 'XCD', '$');
     197INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Egypt', 'Pounds', 'EGP', '£');
     198INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('El Salvador', 'Colones', 'SVC', '$');
     199INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('England (United Kingdom)', 'Pounds', 'GBP', '£');
     200INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Euro', 'Euro', 'EUR', '€');
     201INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Falkland Islands', 'Pounds', 'FKP', '£');
     202INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Fiji', 'Dollars', 'FJD', '$');
     203INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('France', 'Euro', 'EUR', '€');
     204INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Ghana', 'Cedis', 'GHC', '¢');
     205INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Gibraltar', 'Pounds', 'GIP', '£');
     206INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Greece', 'Euro', 'EUR', '€');
     207INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Guatemala', 'Quetzales', 'GTQ', 'Q');
     208INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Guernsey', 'Pounds', 'GGP', '£');
     209INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Guyana', 'Dollars', 'GYD', '$');
     210INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Holland (Netherlands)', 'Euro', 'EUR', '€');
     211INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Honduras', 'Lempiras', 'HNL', 'L');
     212INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Hong Kong', 'Dollars', 'HKD', '$');
     213INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Hungary', 'Forint', 'HUF', 'Ft');
     214INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Iceland', 'Kronur', 'ISK', 'kr');
     215INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('India', 'Rupees', 'INR', '₹');
     216INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Indonesia', 'Rupiahs', 'IDR', 'Rp');
     217INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Iran', 'Rials', 'IRR', '﷼');
     218INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Ireland', 'Euro', 'EUR', '€');
     219INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Isle of Man', 'Pounds', 'IMP', '£');
     220INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Israel', 'New Shekels', 'ILS', '₪');
     221INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Italy', 'Euro', 'EUR', '€');
     222INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Jamaica', 'Dollars', 'JMD', 'J$');
     223INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Japan', 'Yen', 'JPY', '¥');
     224INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Jersey', 'Pounds', 'JEP', '£');
     225INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Kazakhstan', 'Tenge', 'KZT', 'лв');
     226INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Korea (North)', 'Won', 'KPW', '₩');
     227INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Korea (South)', 'Won', 'KRW', '₩');
     228INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Kyrgyzstan', 'Soms', 'KGS', 'лв');
     229INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Laos', 'Kips', 'LAK', '₭');
     230INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Latvia', 'Lati', 'LVL', 'Ls');
     231INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Lebanon', 'Pounds', 'LBP', '£');
     232INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Liberia', 'Dollars', 'LRD', '$');
     233INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Liechtenstein', 'Switzerland Francs', 'CHF', 'CHF');
     234INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Lithuania', 'Litai', 'LTL', 'Lt');
     235INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Luxembourg', 'Euro', 'EUR', '€');
     236INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Macedonia', 'Denars', 'MKD', 'ден');
     237INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Malaysia', 'Ringgits', 'MYR', 'RM');
     238INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Malta', 'Euro', 'EUR', '€');
     239INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Mauritius', 'Rupees', 'MUR', '₨');
     240INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Mexico', 'Pesos', 'MXN', '$');
     241INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Mongolia', 'Tugriks', 'MNT', '₮');
     242INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Mozambique', 'Meticais', 'MZN', 'MT');
     243INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Namibia', 'Dollars', 'NAD', '$');
     244INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Nepal', 'Rupees', 'NPR', '₨');
     245INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Netherlands Antilles', 'Guilders', 'ANG', 'ƒ');
     246INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Netherlands', 'Euro', 'EUR', '€');
     247INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('New Zealand', 'Dollars', 'NZD', '$');
     248INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Nicaragua', 'Cordobas', 'NIO', 'C$');
     249INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Nigeria', 'Nairas', 'NGN', '₦');
     250INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('North Korea', 'Won', 'KPW', '₩');
     251INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Norway', 'Krone', 'NOK', 'kr');
     252INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Oman', 'Rials', 'OMR', '﷼');
     253INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Pakistan', 'Rupees', 'PKR', '₨');
     254INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Panama', 'Balboa', 'PAB', 'B/.');
     255INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Paraguay', 'Guarani', 'PYG', 'Gs');
     256INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Peru', 'Nuevos Soles', 'PEN', 'S/.');
     257INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Philippines', 'Pesos', 'PHP', 'Php');
     258INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Poland', 'Zlotych', 'PLN', 'zł');
     259INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Qatar', 'Rials', 'QAR', '﷼');
     260INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Romania', 'New Lei', 'RON', 'lei');
     261INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Russia', 'Rubles', 'RUB', 'руб');
     262INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Saint Helena', 'Pounds', 'SHP', '£');
     263INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Saudi Arabia', 'Riyals', 'SAR', '﷼');
     264INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Serbia', 'Dinars', 'RSD', 'Дин.');
     265INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Seychelles', 'Rupees', 'SCR', '₨');
     266INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Singapore', 'Dollars', 'SGD', '$');
     267INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Slovenia', 'Euro', 'EUR', '€');
     268INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Solomon Islands', 'Dollars', 'SBD', '$');
     269INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Somalia', 'Shillings', 'SOS', 'S');
     270INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('South Africa', 'Rand', 'ZAR', 'R');
     271INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('South Korea', 'Won', 'KRW', '₩');
     272INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Spain', 'Euro', 'EUR', '€');
     273INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Sri Lanka', 'Rupees', 'LKR', '₨');
     274INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Sweden', 'Kronor', 'SEK', 'kr');
     275INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Switzerland', 'Francs', 'CHF', 'CHF');
     276INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Suriname', 'Dollars', 'SRD', '$');
     277INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Syria', 'Pounds', 'SYP', '£');
     278INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Taiwan', 'New Dollars', 'TWD', 'NT$');
     279INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Thailand', 'Baht', 'THB', '฿');
     280INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Trinidad and Tobago', 'Dollars', 'TTD', 'TT$');
     281INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Turkey', 'Liras', 'TRL', '£');
     282INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Tuvalu', 'Dollars', 'TVD', '$');
     283INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Ukraine', 'Hryvnia', 'UAH', '₴');
     284INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('United Kingdom', 'Pounds', 'GBP', '£');
     285INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('United States of America', 'Dollars', 'USD', '$');
     286INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Uruguay', 'Pesos', 'UYU', '\$U');
     287INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Uzbekistan', 'Sums', 'UZS', 'лв');
     288INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Vatican City', 'Euro', 'EUR', '€');
     289INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Venezuela', 'Bolivares Fuertes', 'VEF', 'Bs');
     290INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Vietnam', 'Dong', 'VND', '₫');
     291INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Yemen', 'Rials', 'YER', '﷼');
     292INSERT INTO {$table_name} (country, currency, code, symbol) VALUES ('Zimbabwe', 'Zimbabwe Dollars', 'ZWD', 'Z$')
     293CUR;
     294            dbDelta($sql_insert);
    145295        }
    146296    }
  • ya-pricing-table/trunk/includes/db_data.php

    r2586259 r2601020  
    2323        foreach ($columns as $col) {
    2424            $features = $wpdb->get_results("SELECT * FROM  {$wpdb->prefix}yapt_features WHERE `column_id` = '" . $col['id'] . "'", ARRAY_A);
     25
    2526            $col_temp = $col;
     27            $col_temp['currency_symbol'] = '$';
     28            if (!empty($col['price_currency'])) {
     29                $currency = $wpdb->get_row("SELECT `symbol` FROM  {$wpdb->prefix}yapt_currency WHERE `country` = '" . $col['price_currency'] . "'", ARRAY_A);
     30                $col_temp['currency_symbol'] = $currency['symbol'];
     31            }
    2632            $col_temp['features'] = $features;
    2733            $formatted_column[] = $col_temp;
  • ya-pricing-table/trunk/public/class-yapt-public.php

    r2586259 r2601020  
    156156            }
    157157
     158            $price_suffix = $this->getPriceSuffix(esc_html($col['price_suffix']));
     159
    158160            $temp_col = str_replace('##is_highlighted##', $highlighted, $pt_column_content);
    159161            $temp_col = str_replace('##description##', esc_html($col['description']), $temp_col);
    160162            $temp_col = str_replace('##col_title##', esc_html($col['column_title']), $temp_col);
    161             $temp_col = str_replace('##col_price##', esc_html($col['price_text']), $temp_col);
     163            $temp_col = str_replace('##col_price_currency##', esc_html($col['currency_symbol']), $temp_col);
     164            $temp_col = str_replace('##col_price##', esc_html($col['price']), $temp_col);
     165            $temp_col = str_replace('##col_price_suffix##', $price_suffix, $temp_col);
    162166            $temp_col = str_replace('##col_cta_btn_lnk##', esc_url($col['ctoa_btn_link']), $temp_col);
    163167            $temp_col = str_replace('##col_cta_btn_text##', esc_html($col['ctoa_btn_text']), $temp_col);
     
    173177
    174178        return $pt_html;
     179    }
     180
     181    /**
     182     * getPriceSuffix returns 'Per day' to '/day'
     183     * @param string $price_suffix
     184     * @return string
     185     */
     186    private function getPriceSuffix(string $price_suffix): string
     187    {
     188        // ['Per hour', 'Per day', 'Per month', 'Per year', 'Per night'];
     189        switch(strtolower($price_suffix)) {
     190            case 'per hour':
     191                $code = '/hr';
     192                break;
     193            case 'per day':
     194                $code = '/d';
     195                break;
     196            case 'per month':
     197                $code = '/mo';
     198                break;
     199            case 'per night':
     200                $code = '/nt';
     201                break;
     202            case 'per year':
     203            default:
     204                $code = '/yr';
     205        }
     206        return $code;
    175207    }
    176208
  • ya-pricing-table/trunk/templates/aanya/default.css

    r2587868 r2601020  
    9292    height: 70px;
    9393}
    94 
    95 .yapt_table_col .col_price sup {
    96     font-size: 0.4em;
    97     position: relative;
    98     left: 5px;
    99 }
    100 .aanya_price{
     94.aanya_price_frame{
    10195    width: 100px;
    10296    height: 100px;
     
    108102    position: relative;
    109103    top: -47px;
    110 }
    111 .highlighted .aanya_price{
     104    overflow: hidden;
     105}
     106.highlighted .aanya_price_frame{
    112107    top: -52px;
    113108    border-color: #b63ac3;
    114109}
    115 
     110.yapt_table_col .col_price .yapt-price-currency{
     111    font-size: 0.7em;
     112    opacity: 0.7;
     113}
     114.yapt-price-suffix{
     115    font-size: 0.7em;
     116}
    116117/* ========================
    117118* Features
  • ya-pricing-table/trunk/templates/aanya/default.html

    r2587868 r2601020  
    22    <div class="aanya_heading">
    33        <div class="yapt_table_row col_price">
    4             <div class="aanya_price">
    5                 ##col_price##
     4            <div class="aanya_price_frame">
     5                <sup class="yapt-price-currency">##col_price_currency##</sup><span class="yapt-price-value">##col_price##</span><span class="yapt-price-suffix"> ##col_price_suffix##</span>
    66            </div>
    7            
     7
    88        </div>
    99        <div class="yapt_table_row col_title">
  • ya-pricing-table/trunk/templates/default/default.css

    r2586259 r2601020  
    2727    padding: 12px;
    2828}
    29 
     29.yapt_table_col .col_price .yapt-price-currency{
     30    font-size: 0.7em;
     31    opacity: 0.7;
     32    font-weight: normal;
     33}
     34.yapt-price-suffix{
     35    font-size: 0.7em;
     36    opacity: 0.7;
     37    font-weight: normal;
     38
     39}
    3040/** ========================
    3141* Contenedor
     
    7888}
    7989
    80 .yapt_table_col .col_price sup {
    81     font-size: 0.4em;
    82     position: relative;
    83     left: 5px;
    84 }
    8590
    8691.col_features ul {
  • ya-pricing-table/trunk/templates/default/default.html

    r2586259 r2601020  
    44    </div>
    55    <div class="yapt_table_row col_price">
    6         ##col_price##
     6        <sup class="yapt-price-currency">##col_price_currency##</sup><span class="yapt-price-value">##col_price##</span><span class="yapt-price-suffix"> ##col_price_suffix##</span>
    77    </div>
    88    <div class="yapt_table_row col_features">
  • ya-pricing-table/trunk/templates/yapt2021/yapt2021.css

    r2586259 r2601020  
    2727    padding: 12px;
    2828}
    29 
     29.yapt_table_col .col_price .yapt-price-currency{
     30    font-size: 0.7em;
     31    opacity: 0.7;
     32}
     33.yapt-price-suffix{
     34    font-size: 0.7em;
     35    opacity: 0.7;
     36}
    3037/** ========================
    3138* Contenedor
     
    8693    font-weight: normal;
    8794    padding: 20px 0;
    88 }
    89 
    90 .yapt_table_col .col_price sup {
    91     font-size: 0.4em;
    92     position: relative;
    93     left: 5px;
    9495}
    9596
  • ya-pricing-table/trunk/templates/yapt2021/yapt2021.html

    r2586259 r2601020  
    44    </div>
    55    <div class="yapt_table_row col_price">
    6         ##col_price##
     6        <sup class="yapt-price-currency">##col_price_currency##</sup><span class="yapt-price-value">##col_price##</span><span class="yapt-price-suffix"> ##col_price_suffix##</span>
    77    </div>
    88    <div class="yapt_table_row col_subtitle">
  • ya-pricing-table/trunk/yapt.php

    r2587878 r2601020  
    1010 *
    1111 * @link              https://github.com/8ivek/yapt
    12  * @since             1.1.0
     12 * @since             2.0.0
    1313 * @package           Yapt
    1414 *
     
    1616 * Plugin Name:       YA Pricing Table
    1717 * Plugin URI:        https://github.com/8ivek/yapt
    18  * Description:       This is a short description of what the plugin does. It's displayed in the WordPress admin area.
    19  * Version:           1.1.0
     18 * Description:       Easily create and publish beautiful pricing tables with no programming knowledge.
     19 * Version:           2.0.0
    2020 * Author:            bCripts
    2121 * Author URI:        https://github.com/8ivek/ya-pricing-table
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define('YAPT_VERSION', '1.1.0');
     38define('YAPT_VERSION', '2.0.0');
    3939
    4040$url = plugin_dir_url(__FILE__);
Note: See TracChangeset for help on using the changeset viewer.