Changeset 2231607
- Timestamp:
- 01/22/2020 02:09:02 PM (6 years ago)
- Location:
- yoti/trunk
- Files:
-
- 6 edited
-
YotiButton.php (modified) (3 diffs)
-
YotiHelper.php (modified) (1 diff)
-
YotiWidget.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
-
views/widget.php (modified) (2 diffs)
-
yoti.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
yoti/trunk/YotiButton.php
r2135092 r2231607 22 22 * @return string|null 23 23 */ 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 = []) 25 25 { 26 26 // Increment button ID … … 28 28 $button_id = 'yoti-button-' . ++$button_id_suffix; 29 29 30 // No config? no button30 // Do not show the button if the plugin has not been configured. 31 31 $config = YotiHelper::getConfig(); 32 32 if (!$config) { … … 34 34 } 35 35 36 // Merge instance config with global config. 37 $config = array_merge($config, array_filter($instance_config)); 38 39 // Default button text and linked status. 36 40 $button_text = YotiButton::YOTI_LINK_BUTTON_TEXT; 37 41 $is_linked = FALSE; 38 42 43 // Button text and linked status for logged in users. 39 44 if (is_user_logged_in()) { 40 45 $button_text = 'Link to Yoti'; 41 46 $currentUser = wp_get_current_user(); 42 47 $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']; 43 53 } 44 54 -
yoti/trunk/YotiHelper.php
r2154130 r2231607 56 56 * Yoti WordPress SDK version. 57 57 */ 58 const SDK_VERSION = '1. 4.2';58 const SDK_VERSION = '1.5.0'; 59 59 60 60 /** -
yoti/trunk/YotiWidget.php
r2117048 r2231607 35 35 36 36 wp_enqueue_style('yoti-asset-css', plugin_dir_url(__FILE__) . 'assets/styles.css'); 37 37 38 $config = YotiHelper::getConfig(); 38 39 39 $view = function () use ($args, $config, $title )40 $view = function () use ($args, $config, $title, $instance) 40 41 { 41 42 require __DIR__ . '/views/widget.php'; … … 54 55 { 55 56 $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'] : ''; 56 59 ?> 57 60 <p> … … 62 65 name="<?php esc_attr_e($this->get_field_name('title')); ?>" 63 66 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); ?>"> 64 79 </p> 65 80 <?php … … 80 95 $instance = []; 81 96 $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']); 82 99 83 100 return $instance; -
yoti/trunk/readme.txt
r2195784 r2231607 6 6 Tested up to: 5.3 7 7 Requires PHP: 5.6 8 Stable tag: 1. 4.28 Stable tag: 1.5.0 9 9 License: GNU v3 10 10 License URI: https://www.gnu.org/licenses/gpl.txt … … 81 81 Here you can find the changes for each version: 82 82 83 1.5.0 84 85 Release Date - 22 January 2020 86 87 * Scenario ID and button text can now be configured per widget 88 83 89 1.4.2 84 90 -
yoti/trunk/views/widget.php
r2135092 r2231607 5 5 * @var string $title 6 6 * @var array $config 7 * @var array $instance 7 8 */ 8 9 ?> … … 18 19 <ul><li> 19 20 <?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); ?> 21 22 <?php } else { ?> 22 23 <strong>Yoti not configured.</strong> -
yoti/trunk/yoti.php
r2154130 r2231607 5 5 Plugin URI: https://wordpress.org/plugins/yoti/ 6 6 Description: Let Yoti users quickly register on your site. 7 Version: 1. 4.27 Version: 1.5.0 8 8 Author: Yoti SDK. 9 9 Author URI: https://yoti.com
Note: See TracChangeset
for help on using the changeset viewer.