Plugin Directory

Changeset 2231607


Ignore:
Timestamp:
01/22/2020 02:09:02 PM (6 years ago)
Author:
yotiwordpress
Message:

Release 1.5.0

Location:
yoti/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • yoti/trunk/YotiButton.php

    r2135092 r2231607  
    2222     * @return string|null
    2323     */
    24     public static function render($redirect = NULL, $from_widget = FALSE, $echo = FALSE)
     24    public static function render($redirect = NULL, $from_widget = FALSE, $echo = FALSE, $instance_config = [])
    2525    {
    2626        // Increment button ID
     
    2828        $button_id = 'yoti-button-' . ++$button_id_suffix;
    2929
    30         // No config? no button
     30        // Do not show the button if the plugin has not been configured.
    3131        $config = YotiHelper::getConfig();
    3232        if (!$config) {
     
    3434        }
    3535
     36        // Merge instance config with global config.
     37        $config = array_merge($config, array_filter($instance_config));
     38
     39        // Default button text and linked status.
    3640        $button_text = YotiButton::YOTI_LINK_BUTTON_TEXT;
    3741        $is_linked = FALSE;
    3842
     43        // Button text and linked status for logged in users.
    3944        if (is_user_logged_in()) {
    4045            $button_text = 'Link to Yoti';
    4146            $currentUser = wp_get_current_user();
    4247            $is_linked = !empty(get_user_meta($currentUser->ID, 'yoti_user.identifier'));
     48        }
     49
     50        // Override button text if set for widget instance.
     51        if (!empty($config['yoti_button_text'])) {
     52            $button_text = $config['yoti_button_text'];
    4353        }
    4454
  • yoti/trunk/YotiHelper.php

    r2154130 r2231607  
    5656     * Yoti WordPress SDK version.
    5757     */
    58     const SDK_VERSION = '1.4.2';
     58    const SDK_VERSION = '1.5.0';
    5959
    6060    /**
  • yoti/trunk/YotiWidget.php

    r2117048 r2231607  
    3535
    3636        wp_enqueue_style('yoti-asset-css', plugin_dir_url(__FILE__) . 'assets/styles.css');
     37
    3738        $config = YotiHelper::getConfig();
    3839
    39         $view = function () use ($args, $config, $title)
     40        $view = function () use ($args, $config, $title, $instance)
    4041        {
    4142            require __DIR__ . '/views/widget.php';
     
    5455    {
    5556        $title = isset( $instance['title'] ) ? $instance['title'] : '';
     57        $scenario_id = isset( $instance['yoti_scenario_id'] ) ? $instance['yoti_scenario_id'] : '';
     58        $button_text = isset( $instance['yoti_button_text'] ) ? $instance['yoti_button_text'] : '';
    5659        ?>
    5760        <p>
     
    6265          name="<?php esc_attr_e($this->get_field_name('title')); ?>"
    6366          type="text" value="<?php esc_attr_e($title); ?>">
     67        <label for="<?php esc_attr_e($this->get_field_id('yoti_button_text')); ?>">Button Text <em>(optional)</em>:</label>
     68        <input
     69          class="widefat"
     70          id="<?php esc_attr_e($this->get_field_id('yoti_button_text')); ?>"
     71          name="<?php esc_attr_e($this->get_field_name('yoti_button_text')); ?>"
     72          type="text" value="<?php esc_attr_e($button_text); ?>">
     73        <label for="<?php esc_attr_e($this->get_field_id('yoti_scenario_id')); ?>">Scenario ID <em>(optional)</em>:</label>
     74        <input
     75          class="widefat"
     76          id="<?php esc_attr_e($this->get_field_id('yoti_scenario_id')); ?>"
     77          name="<?php esc_attr_e($this->get_field_name('yoti_scenario_id')); ?>"
     78          type="text" value="<?php esc_attr_e($scenario_id); ?>">
    6479        </p>
    6580        <?php
     
    8095        $instance = [];
    8196        $instance['title'] = sanitize_text_field($new_instance['title']);
     97        $instance['yoti_scenario_id'] = sanitize_text_field($new_instance['yoti_scenario_id']);
     98        $instance['yoti_button_text'] = sanitize_text_field($new_instance['yoti_button_text']);
    8299
    83100        return $instance;
  • yoti/trunk/readme.txt

    r2195784 r2231607  
    66Tested up to: 5.3
    77Requires PHP: 5.6
    8 Stable tag: 1.4.2
     8Stable tag: 1.5.0
    99License: GNU v3
    1010License URI: https://www.gnu.org/licenses/gpl.txt
     
    8181Here you can find the changes for each version:
    8282
     831.5.0
     84
     85Release Date - 22 January 2020
     86
     87* Scenario ID and button text can now be configured per widget
     88
    83891.4.2
    8490
  • yoti/trunk/views/widget.php

    r2135092 r2231607  
    55 * @var string $title
    66 * @var array $config
     7 * @var array $instance
    78 */
    89?>
     
    1819<ul><li>
    1920    <?php if (!empty($config['yoti_sdk_id']) && !empty($config['yoti_pem']['contents'])) { ?>
    20         <?php YotiButton::render(NULL, TRUE, TRUE); ?>
     21        <?php YotiButton::render(NULL, TRUE, TRUE, $instance); ?>
    2122    <?php } else { ?>
    2223        <strong>Yoti not configured.</strong>
  • yoti/trunk/yoti.php

    r2154130 r2231607  
    55Plugin URI: https://wordpress.org/plugins/yoti/
    66Description: Let Yoti users quickly register on your site.
    7 Version: 1.4.2
     7Version: 1.5.0
    88Author: Yoti SDK.
    99Author URI: https://yoti.com
Note: See TracChangeset for help on using the changeset viewer.