Changeset 2976975
- Timestamp:
- 10/10/2023 10:56:47 AM (2 years ago)
- Location:
- ryen-wp/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (3 diffs)
-
admin/partials/ryen-admin-display.php (modified) (1 diff)
-
public/class-ryen-public.php (modified) (1 diff)
-
ryen.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ryen-wp/trunk/README.txt
r2941402 r2976975 3 3 Tags: ryen, forms, surveys, quizzes, form builder, survey builder, quiz builder, custom forms, mobile forms, payment forms, feedback forms, zendesk 4 4 Requires at least: 5.0 5 Tested up to: 6. 25 Tested up to: 6.3 6 6 License: GPL 2.0 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.txt 8 Stable Tag: 3. 1.118 Stable Tag: 3.4.0 9 9 10 10 == Description == … … 16 16 17 17 This plugin relies on Ryen which is a tool that allows you to create conversational forms and directly integrate them on your Wordpress site and on our Ryen JS library (https://cdn.jsdelivr.net/npm/@ryen/js). 18 💁♂️ More information about Ryen: https://www.ryen.org 19 👨🏼💻 How Ryen handles collected data: https://www.ryen.org/privacy 18 19 💁♂️ More information about Ryen: https://ryen.org 20 👨🏼💻 How Ryen handles collected data: https://ryen.org/privacy 20 21 👨🏼💻 jsDelivr Terms & Policies: https://www.jsdelivr.com/terms 21 22 … … 26 27 27 28 == Changelog == 29 = 3.4.0 = 30 * Import ryen lib v0.2 to get the new variable parser 31 32 = 3.3.0 = 33 * Fix loading with Gravity Forms and add query params exclusion 34 35 = 3.2.0 = 36 * Update embed lib to 0.1 37 28 38 = 3.1.11 = 29 39 * Automatically forward UTMs for standard embed -
ryen-wp/trunk/admin/partials/ryen-admin-display.php
r2876406 r2976975 17 17 <div style="display: flex; flex-direction: column; margin-top: 1rem"> 18 18 <label>Excluded pages (optional):</label> 19 <p style="color: gray">Example: /app/*, /user/*, /admin/settings </p>19 <p style="color: gray">Example: /app/*, /user/*, /admin/settings, /app?param=*</p> 20 20 <input name="excluded_pages" value="<?php echo esc_attr(get_option('excluded_pages')); ?>" style="padding: .5rem" /> 21 21 </div> -
ryen-wp/trunk/public/class-ryen-public.php
r2941402 r2976975 1 1 <?php 2 3 2 class Ryen_Public 4 3 { 5 public function add_head_code()4 public function __construct() 6 5 { 7 function parse_wp_user() 8 { 9 $wp_user = wp_get_current_user(); 10 echo '<script> 6 add_action('wp_head', array($this, 'parse_wp_user')); 7 add_action('wp_footer', array($this, 'ryen_script')); 8 } 9 10 public function parse_wp_user() 11 { 12 $wp_user = wp_get_current_user(); 13 echo '<script> 11 14 if(typeof window.ryenWpUser === "undefined"){ 12 15 window.ryenWpUser = { 13 16 "WP ID":"' . 14 $wp_user->ID .15 '",17 $wp_user->ID . 18 '", 16 19 "WP Username":"' . 17 $wp_user->user_login .18 '",20 $wp_user->user_login . 21 '", 19 22 "WP Email":"' . 20 $wp_user->user_email .21 '",23 $wp_user->user_email . 24 '", 22 25 "WP First name":"' . 23 $wp_user->user_firstname .24 '",26 $wp_user->user_firstname . 27 '", 25 28 "WP Last name":"' . 26 $wp_user->user_lastname .27 '",29 $wp_user->user_lastname . 30 '" 28 31 } 29 32 } 30 33 </script>'; 34 } 35 36 public function add_head_code() 37 { 38 $this->parse_wp_user(); 39 } 40 41 function ryen_script() 42 { 43 echo '<script type="module">import Ryen from "https://cdn.jsdelivr.net/npm/@ryen/js@0.2/dist/web.js";'; 44 if ( 45 get_option('excluded_pages') !== null && 46 get_option('excluded_pages') !== '' 47 ) { 48 $paths = explode(',', get_option('excluded_pages')); 49 $arr_js = 'const ryenExcludePaths = ['; 50 foreach ($paths as $path) { 51 $arr_js = $arr_js . '"' . $path . '",'; 52 } 53 $arr_js = substr($arr_js, 0, -1) . '];'; 54 echo $arr_js; 55 } else { 56 echo 'const ryenExcludePaths = null;'; 31 57 } 32 58 33 function ryen_script() 34 { 35 echo '<script type="module"> 36 import Ryen from "https://cdn.jsdelivr.net/npm/@ryen/js@0.1/dist/web.js";'; 37 if ( 38 get_option('excluded_pages') !== null && 39 get_option('excluded_pages') !== '' 40 ) { 41 $paths = explode(',', get_option('excluded_pages')); 42 $arr_js = 'const ryenExcludePaths = ['; 43 foreach ($paths as $path) { 44 $arr_js = $arr_js . '"' . $path . '",'; 45 } 46 $arr_js = substr($arr_js, 0, -1) . '];'; 47 echo esc_js($arr_js); 48 } else { 49 echo 'const ryenExcludePaths = null;'; 50 } 51 if (get_option('init_snippet') && get_option('init_snippet') !== '') { 52 53 echo 'if(!ryenExcludePaths || ryenExcludePaths.every((path) => { 54 let excludePath = path.trim(); 59 if (get_option('init_snippet') && get_option('init_snippet') !== '') { 60 echo 'if(!ryenExcludePaths || ryenExcludePaths.every((path) => { 61 let [excludePath, excludeSearch] = path.trim().split("?"); 62 const excludeSearchParams = excludeSearch ? new URLSearchParams(excludeSearch) : null; 55 63 let windowPath = window.location.pathname; 64 let windowSearchParams = window.location.search.length > 0 ? new URLSearchParams(window.location.search) : null; 56 65 if (excludePath.endsWith("*")) { 66 if(excludeSearchParams){ 67 if(!windowSearchParams) return true 68 return !windowPath.startsWith(excludePath.slice(0, -1)) || !Array.from(excludeSearchParams.keys()).every((key) => excludeSearchParams.get(key) === "*" || (excludeSearchParams.get(key) === windowSearchParams.get(key))); 69 } 57 70 return !windowPath.startsWith(excludePath.slice(0, -1)); 58 71 } 59 72 if (excludePath.endsWith("/")) { 60 excludePath = path.slice(0, -1);73 excludePath = excludePath.slice(0, -1); 61 74 } 62 75 if (windowPath.endsWith("/")) { 63 76 windowPath = windowPath.slice(0, -1); 64 } 65 return windowPath !== excludePath; 77 } 78 if(excludeSearchParams){ 79 if(!windowSearchParams) return true 80 return windowPath !== excludePath || !Array.from(excludeSearchParams.keys()).every((key) => excludeSearchParams.get(key) === "*" || (excludeSearchParams.get(key) === windowSearchParams.get(key))); 81 } else { 82 return windowPath !== excludePath; 83 } 66 84 })) { 67 85 ' . get_option('init_snippet') . ' 68 86 Ryen.setPrefilledVariables({ ...ryenWpUser }); 69 70 87 }'; 71 }72 echo '</script>';73 88 } 74 add_action('wp_head', 'parse_wp_user'); 75 add_action('wp_footer', 'ryen_script'); 89 echo '</script>'; 76 90 } 77 91 78 92 public function add_ryen_container($attributes = []) 79 93 { 80 $lib_url = "https://cdn.jsdelivr.net/npm/@ryen/js@0. 1/dist/web.js";94 $lib_url = "https://cdn.jsdelivr.net/npm/@ryen/js@0.2/dist/web.js"; 81 95 $width = '100%'; 82 96 $height = '500px'; -
ryen-wp/trunk/ryen.php
r2941402 r2976975 4 4 * Plugin Name: Ryen WP 5 5 * Description: Convert more with conversational forms 6 * Version: 3. 1.116 * Version: 3.4.0 7 7 * Author: Ryen 8 * Author URI: http ://ryen.org/8 * Author URI: https://ryen.org/ 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 17 17 } 18 18 19 define('RYEN_VERSION', '3. 1.11');19 define('RYEN_VERSION', '3.4.0'); 20 20 21 21 function activate_ryen()
Note: See TracChangeset
for help on using the changeset viewer.