Changeset 3267326
- Timestamp:
- 04/05/2025 10:21:04 PM (10 months ago)
- Location:
- hippoo-popup/trunk
- Files:
-
- 5 edited
-
app/admin-page.php (modified) (1 diff)
-
app/popup-template.php (modified) (1 diff)
-
app/web-api-auth.php (modified) (1 diff)
-
hippoo-popup.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hippoo-popup/trunk/app/admin-page.php
r3203303 r3267326 33 33 <th scope="row"><label for="agents"><?php echo esc_html( __( 'Agents', 'hippoo-popup' ) ); ?></label></th> 34 34 <td> 35 <input type="checkbox" name="agents[windowsPhone]" <?php checked( isset( $opt['agents'] ['windowsPhone'] ) && $opt['agents']['windowsPhone'] == 'true'); ?> value="true" /> Windows Phone <br>36 <input type="checkbox" name="agents[android]" <?php checked( isset( $opt['agents'] ['android'] ) && $opt['agents']['android'] == 'true'); ?> value="true" /> Android <br>37 <input type="checkbox" name="agents[ios]" <?php checked( isset( $opt['agents'] ['ios'] ) && $opt['agents']['ios'] == 'true'); ?> value="true" /> IOS <br>38 <input type="checkbox" name="agents[unknown]" <?php checked( isset( $opt['agents'] ['unknown'] ) && $opt['agents']['unknown'] == 'true'); ?> value="true" /> Unknown <br>35 <input type="checkbox" name="agents[windowsPhone]" <?php checked( isset( $opt['agents'] ) && in_array( 'windowsPhone', $opt['agents'] ) ); ?> value="true" /> Windows Phone <br> 36 <input type="checkbox" name="agents[android]" <?php checked( isset( $opt['agents'] ) && in_array( 'android', $opt['agents'] ) ); ?> value="true" /> Android <br> 37 <input type="checkbox" name="agents[ios]" <?php checked( isset( $opt['agents'] ) && in_array( 'ios', $opt['agents'] ) ); ?> value="true" /> IOS <br> 38 <input type="checkbox" name="agents[unknown]" <?php checked( isset( $opt['agents'] ) && in_array( 'unknown', $opt['agents'] ) ); ?> value="true" /> Unknown <br> 39 39 </td> 40 40 </tr> -
hippoo-popup/trunk/app/popup-template.php
r3203303 r3267326 2 2 if ( ! defined( 'ABSPATH' ) ) exit; 3 3 ?> 4 5 4 <div id="gift-sheet" class="gift-sheet"> 6 5 <?php if ( isset( $opt['image'] ) ) : ?> -
hippoo-popup/trunk/app/web-api-auth.php
r3267218 r3267326 37 37 $current = get_option( 'hippoo_popup_settings', array() ); 38 38 $sanitized = hippoo_popup_recursive_sanitize( $datas ); 39 $merged = hippoo_popup_recursive_merge( $current, $sanitized );39 $merged = array_merge( $current, $sanitized ); 40 40 update_option( 'hippoo_popup_settings', $merged ); 41 41 return rest_ensure_response( $merged ); -
hippoo-popup/trunk/hippoo-popup.php
r3267220 r3267326 2 2 /** 3 3 * Plugin Name: Hippoo Popup 4 * Version: 1.0. 24 * Version: 1.0.3 5 5 * Plugin URI: https://Hippoo.app 6 6 * Description: The ultimate extension to elevate your store's engagement! With Hippoo Popup, seamlessly integrate captivating popups directly within the Hippoo app, boosting interaction and driving results like never before. … … 15 15 define( 'HIPPOO_POPUP_URL', plugins_url( 'hippoo-popup' ) . '/assets' ); 16 16 include_once( plugin_dir_path( __FILE__ ) . 'app' . DIRECTORY_SEPARATOR . 'web-api-auth.php' ); 17 17 18 18 19 // Load translation files … … 81 82 82 83 foreach ( $valid_agents as $agent ) { 83 $settings['agents'][ $agent ] = in_array( $agent, $agents, true ); 84 } 85 } else { 86 // Default values if no agents are selected 87 foreach ( $valid_agents as $agent ) { 88 $settings['agents'][ $agent ] = false; 84 if ( isset( $agents[$agent] ) && $agents[$agent] === 'true' ) { 85 $settings['agents'][] = $agent; 86 } 89 87 } 90 88 } … … 105 103 // Enqueue JS 106 104 function hippoo_popup_enqueue_inline_external_js() { 107 if ( !is_admin() ) {108 return;109 }105 // if ( is_admin() ) { 106 // return; 107 // } 110 108 111 109 // Get the plugin options and sanitize them … … 122 120 $ags = array(); 123 121 foreach ( $agents as $k => $v ) { 124 if ( $v === 'true') {125 $ags[] = sanitize_text_field( $k );122 if ( true === filter_var( $v, FILTER_VALIDATE_BOOLEAN ) ) { 123 $ags[] = "'" . esc_js( sanitize_text_field( $k ) ) . "'"; 126 124 } 127 125 } 128 $ags = implode( ',', array_map( 'esc_js', $ags ) );126 $ags_string = ! empty( $ags ) ? "agents: [" . implode( ',', $ags ) . "]," : ''; 129 127 130 128 // Sanitize and validate timeout … … 134 132 $inline_code = " 135 133 (function($) { 136 setTimeout(() => { 137 $('#gift-sheet').bottomSheet({ 138 openOnInit: " . ( isset( $opt['openOnInit'] ) && $opt['openOnInit'] === 'true' ? 'true' : 'false' ) . ", 139 persistent: " . ( isset( $opt['persist'] ) && $opt['persist'] === 'true' ? 'true' : 'false' ) . ", 140 dialogMode: " . ( isset( $opt['dialogMode'] ) && $opt['dialogMode'] === 'true' ? 'true' : 'false' ) . ", 141 hashTracker: '" . esc_js( isset( $opt['secondaryButtonLabel'] ) ? sanitize_text_field( $opt['secondaryButtonLabel'] ) : '' ) . "', 142 once: " . ( isset( $opt['once'] ) && $opt['once'] === 'true' ? 'true' : 'false' ) . ", 143 agents: [" . $ags . "], 144 cookiePrefix: null, 145 appendTo: 'body', 146 onInit: $.noop(), 147 }); 148 }, " . esc_js( $timeout ) . "); 134 $(document).ready(function() { 135 setTimeout(() => { 136 const \$el = $('#gift-sheet'); 137 if (!\$el.length) { 138 console.warn('#gift-sheet not found'); 139 return; 140 } 141 142 \$el.bottomSheet({ 143 openOnInit: " . ( isset( $opt['openOnInit'] ) && $opt['openOnInit'] === 'true' ? 'true' : 'false' ) . ", 144 persistent: " . ( isset( $opt['persist'] ) && $opt['persist'] === 'true' ? 'true' : 'false' ) . ", 145 dialogMode: " . ( isset( $opt['dialogMode'] ) && $opt['dialogMode'] === 'true' ? 'true' : 'false' ) . ", 146 hashTracker: '" . esc_js( isset( $opt['secondaryButtonLabel'] ) ? sanitize_text_field( $opt['secondaryButtonLabel'] ) : '' ) . "', 147 once: " . ( isset( $opt['once'] ) && $opt['once'] === 'true' ? 'true' : 'false' ) . ", 148 " . $ags_string . " 149 cookiePrefix: null, 150 appendTo: 'body', 151 onInit: $.noop(), 152 }); 153 }, " . esc_js( $timeout ) . "); 154 }); 149 155 })(jQuery);"; 156 150 157 wp_add_inline_script( 'hp-bottomSheet', $inline_code ); 151 158 } 152 159 } 153 add_action( 'admin_enqueue_scripts', 'hippoo_popup_enqueue_inline_external_js', 10 ); 160 add_action( 'wp_enqueue_scripts', 'hippoo_popup_enqueue_inline_external_js', 10 ); 161 154 162 155 163 // Hook popup to footer … … 158 166 159 167 if ( isset( $opt['active'] ) && $opt['active'] == 'true' ) { 160 include( plugin_dir_path( __FILE__ ) . 'app' . DIRECTORY_SEPARATOR . 'popup-template.php' ); 168 $template_file_path = plugin_dir_path( __FILE__ ) . 'app' . DIRECTORY_SEPARATOR . 'popup-template.php'; 169 require_once $template_file_path; 161 170 } 162 171 } -
hippoo-popup/trunk/readme.txt
r3267220 r3267326 5 5 Requires at least: 5.3 6 6 Tested up to: 6.7 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 Text Domain: hippoo-popup 9 9 License: GPL3 … … 35 35 == Changelog == 36 36 37 = 1.0.2 = 38 * Cleanup 39 40 = 1.0.1 = 41 * Minor updates 42 43 = 1.0.0 = 44 * Initial release. 45 46 == Upgrade Notice == 47 48 = 1.0.0 = 49 This is the initial release of the plugin. 37 * 1.0.3 - Fix modal display on home page 38 * 1.0.2 - Cleanup 39 * 1.0.1 - Minor updates 40 * 1.0.0 - Initial release.
Note: See TracChangeset
for help on using the changeset viewer.