Changeset 3218190
- Timestamp:
- 01/07/2025 08:49:37 AM (14 months ago)
- Location:
- boot-modal
- Files:
-
- 2 edited
- 1 copied
-
tags/1.9.1 (copied) (copied from boot-modal/trunk)
-
trunk/boot_modal.php (modified) (11 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
boot-modal/trunk/boot_modal.php
r2366537 r3218190 4 4 Plugin URI: https://wordpress.org/plugins/boot-modal/ 5 5 Description: A simple plugin to open any page in a Bootstrap modal window. 6 Version: 1. 9.16 Version: 1.10 7 7 Author: Julien Crego 8 8 Author URI: https://dev.juliencrego.com/boot-modal/ … … 63 63 $this->options = get_option('bootmodal_plugin_options'); 64 64 65 // Check the Bootstrap version and define the 5 by default 66 if (!isset($this->options['bootstrap_version']) || intval($this->options['bootstrap_version']) < 4) { 67 $this->options['bootstrap_version'] = 5; 68 } else { 69 $this->options['bootstrap_version'] = intval($this->options['bootstrap_version']); 70 } 71 65 72 add_filter('widget_text', 'do_shortcode'); 66 73 add_shortcode('bootmodal', array($this,'shortcodeLauncher') ); … … 99 106 ), $atts); 100 107 extract($params); 101 $this->animation = $params['animation'] ; 102 $this->postname = $params['post'] ; 103 $this->buttonclass = $params['buttonclass']; 104 $this->buttontype = $params['buttontype']; 105 $this->buttontext = $params['buttontext']; 106 $this->buttoncloseclass = $params['buttoncloseclass']; 107 $this->buttonclosetext = $params['buttonclosetext']; 108 $this->size = $params['size']; 109 $this->urlkey = $params['urlkey']; 110 $this->urlvalue = $params['urlvalue']; 111 $this->dismiss = $params['dismiss']; 108 109 $this->animation = esc_attr($params['animation']) ; 110 $this->postname = esc_attr($params['post']); 111 $this->buttonclass = esc_attr($params['buttonclass']); 112 $this->buttontype = esc_attr($params['buttontype']); 113 $this->buttontext = esc_html($params['buttontext']); 114 $this->buttoncloseclass = esc_attr($params['buttoncloseclass']); 115 $this->buttonclosetext = esc_html($params['buttonclosetext']); 116 $this->size = esc_attr($params['size']); 117 $this->urlkey = esc_attr($params['urlkey']); 118 $this->urlvalue = esc_attr($params['urlvalue']); 119 $this->dismiss = esc_attr($params['dismiss']); 112 120 113 121 ob_start(); … … 123 131 124 132 // Construct link or button 125 if($this->buttontype=="button" or ($this->buttontype=="" && $this->options['open_button_type']=="button")): 126 $this->html_button(); 127 else: 128 $this->html_link(); 129 endif; 133 $this->html_button_or_link(); 134 130 135 } else { 131 136 _e( "Permalink unknow (Boot-modal)", 'bootmodal'); … … 138 143 139 144 public function addBootstrap() { 140 if( !isset($this->options['bootstrap_version']) or $this->options['bootstrap_version'] == '3') { 141 wp_enqueue_style('bootstrap-css', 'https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css'); 142 wp_enqueue_script('bootstrap-js', 'https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js', array('jquery')); 143 } elseif($this->options['bootstrap_version'] == '4') { 144 wp_enqueue_style('bootstrap-css', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.1/css/bootstrap.min.css'); 145 wp_enqueue_script('bootstrap-js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.1/js/bootstrap.bundle.min.js', array('jquery')); 145 if($this->options['bootstrap_version'] <= 4) { 146 // Bootstrap 4.6.2 147 wp_enqueue_style('bootstrap-css', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css', array(), '4.6.2'); 148 wp_enqueue_script('bootstrap-js', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js', array('jquery'), '4.6.2', true); 149 } elseif($this->options['bootstrap_version'] == 5) { 150 // Bootstrap 5.3.3 151 wp_enqueue_style('bootstrap-css', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css', array(), '5.3.3'); 152 wp_enqueue_script('bootstrap-js', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js', array('jquery'), '5.3.3', true); 146 153 } 147 154 } … … 153 160 } 154 161 155 public function html_button() { 156 ?> 157 <button type="button" 158 class="<?php echo($this->buttonclass=="")?$this->options['open_button_class']:$this->buttonclass; ?>" 159 data-toggle="modal" 160 <?php if($this->dismiss == 'yes') : ?> 161 data-dismiss="modal" 162 public function html_button_or_link() { 163 // Check the Bootstrap version 164 if ($this->options['bootstrap_version'] == 5) { 165 $dataDismiss = "data-bs-dismiss"; 166 $dataTarget = "data-bs-target"; 167 $dataToggle = "data-bs-toggle"; 168 } else { 169 $dataDismiss = "data-dismiss"; 170 $dataTarget = "data-target"; 171 $dataToggle = "data-toggle"; 172 } 173 174 // Button or link ? 175 $is_button = ($this->buttontype == "button" || ($this->buttontype == "" && $this->options['open_button_type'] == "button")); 176 177 if ($is_button) { 178 ?> 179 <button type="button" 180 class="<?php echo ($this->buttonclass == "") ? $this->options['open_button_class'] : $this->buttonclass; ?>" 181 <?= $dataToggle ?>="modal" 182 <?php if ($this->dismiss == 'yes') : ?> 183 <?= $dataDismiss ?>="modal" 184 <?php endif; ?> 185 <?= $dataTarget ?>="#<?php echo $this->post->post_name; ?>"> 186 <?php echo $this->buttontext; ?> 187 </button> 188 <?php 189 } else { 190 $url = site_url(); 191 $url_param = ($this->urlkey && $this->urlvalue) ? '?' . esc_attr($this->urlkey) . '=' . esc_attr($this->urlvalue) . '/#' : '/#'; 192 ?> 193 <a href="<?php echo esc_url($url . '/index.php/' . $this->postname . $url_param); ?>" 194 class="<?php echo esc_attr(($this->buttonclass == "") ? $this->options['open_button_class'] : $this->buttonclass); ?>" 195 <?= $dataToggle ?>="modal" 196 <?php if ($this->dismiss == 'yes') : ?> 197 <?= $dataDismiss ?>="modal" 162 198 <?php endif; ?> 163 data-target="#<?php echo $this->post->post_name; ?>"> 164 <?php echo $this->buttontext ; ?> 165 </button> 166 <?php 167 } 168 169 public function html_link() { 170 $url = site_url(); 171 $url_param = ($this->urlkey && $this->urlvalue) ? '?'.$this->urlkey.'='.$this->urlvalue.'/#' : '/#'; 172 ?> 173 <a href="<?php echo $url.'/index.php/'.$this->postname.$url_param; ?>" 174 class="<?php echo($this->buttonclass=="")?$this->options['open_button_class']:$this->buttonclass; ?>" 175 data-toggle="modal" 176 <?php if($this->dismiss == 'yes') : ?> 177 data-dismiss="modal" 178 <?php endif; ?> 179 data-target="#<?php echo $this->post->post_name; ?>"> 180 <?php echo $this->buttontext ; ?> 181 </a> 182 <?php 183 } 184 199 <?= $dataTarget ?>="#<?php echo esc_attr($this->post->post_name); ?>"> 200 <?php echo $this->buttontext; ?> 201 </a> 202 <?php 203 } 204 } 205 206 /** 207 * DEPRECATED : Insert HTML code for Modal with Bootstrap 3 208 */ 185 209 public function html_modal_bootstrap3() { 186 210 ?> … … 206 230 <?php 207 231 } 232 208 233 public function html_modal_bootstrap4() { 209 234 ?> … … 224 249 <button type="button" class="<?php echo ($this->buttoncloseclass) ? $this->buttoncloseclass : $this->options['button_class']; ?>" data-dismiss="modal"> 225 250 <?php if($this->buttonclosetext){echo $this->buttonclosetext ;}elseif($this->options['button_text']!=""){ echo $this->options['button_text'];} else { _e( "Close", 'bootmodal'); } ?> 251 </button> 252 </div> 253 </div> 254 </div> 255 </div> 256 <?php 257 } 258 259 public function html_modal_bootstrap5() { 260 ?> 261 <div class="modal <?php echo $this->anim_value; ?>" 262 id="<?php echo $this->post->post_name; ?>" tabindex="-1" aria-labelledby="modalLabel_<?php echo $this->post->post_name; ?>" aria-hidden="true"> 263 <div class="modal-dialog <?php echo $this->size; ?>"> 264 <div class="modal-content"> 265 <div class="modal-header"> 266 <h5 class="modal-title" id="modalLabel_<?php echo $this->post->post_name; ?>"> 267 <?php echo apply_filters('translate_text', $this->post->post_title, $this->locale); ?> 268 </h5> 269 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="<?php echo ($this->options['button_text'] != "") ? $this->options['button_text'] : _e( "Close", 'bootmodal'); ?>"></button> 270 </div> 271 <div class="modal-body"> 272 <?php echo apply_filters('the_content', apply_filters('translate_text', $this->post->post_content, $this->locale)); ?> 273 </div> 274 <div class="modal-footer"> 275 <button type="button" class="<?php echo ($this->buttoncloseclass) ? $this->buttoncloseclass : $this->options['button_class']; ?>" data-bs-dismiss="modal"> 276 <?php echo ($this->buttonclosetext) ? $this->buttonclosetext : (($this->options['button_text'] != "") ? $this->options['button_text'] : _e( "Close", 'bootmodal')); ?> 226 277 </button> 227 278 </div> … … 245 296 } 246 297 247 if( !isset($this->options['bootstrap_version']) or $this->options['bootstrap_version'] == '3') { 248 $this->html_modal_bootstrap3(); 249 } elseif($this->options['bootstrap_version'] == '4') { 298 if( $this->options['bootstrap_version'] <= 4) { 250 299 $this->html_modal_bootstrap4(); 300 } elseif($this->options['bootstrap_version'] == 5) { 301 $this->html_modal_bootstrap5(); 251 302 } 252 303 … … 562 613 */ 563 614 function load_admin_css() { 564 wp_enqueue_style( 'bootmodal_admin', plugins_url( $this->plugin_folder.'/css/boot_modal_admin.css'));615 wp_enqueue_style( 'bootmodal_admin', plugins_url( $this->plugin_folder.'/css/boot_modal_admin.css')); 565 616 } 566 617 … … 588 639 array('name'=>'bootstrap_version', 589 640 'description' => __( "Version of bootstrap to use.", 'bootmodal'), 590 'options'=>array( ' 3' => '3',591 ' 4' => '4')));641 'options'=>array( '4' => '4', 642 '5' => '5'))); 592 643 593 644 // Links params -
boot-modal/trunk/readme.txt
r2366537 r3218190 4 4 Tags: modal, bootstrap, shortcode 5 5 Requires at least: 3.0.1 6 Tested up to: 5.56 Tested up to: 6.7 7 7 Stable tag: trunk 8 8 License: GPLv2 or later … … 46 46 47 47 == Changelog == 48 = 1.10 = 49 * Corrected Shortcode XSS vulnerability. 50 * Added support for Bootstrap 5. 51 * Removed support for Bootstrap 3. 52 48 53 = 1.9 = 49 * Add the possibility to choose the version of Bootstrap (3 or 4)50 * Use CDN to deliver Bootstrap51 * Add Custom CSS54 * Added the ability to choose the Bootstrap version (3 or 4). 55 * Used CDN to deliver Bootstrap. 56 * Added support for custom CSS. 52 57 53 58 = 1.8 = 54 * Correct issue of position for the button59 * Fixed button position issue. 55 60 56 61 = 1.7 = 57 * Add the dismiss shortcode option58 * Translation corrections 62 * Added the "dismiss" shortcode option. 63 * Translation corrections. 59 64 60 65 = 1.6 = 61 * Add a button in editor to generate the shortcode62 * New shortcode option : animation, buttoncloseclass and buttonclosetext66 * Added a button in the editor to generate the shortcode. 67 * New shortcode options: animation, buttoncloseclass, and buttonclosetext. 63 68 64 69 = 1.5 = 65 * Changes by Christer to : 66 - take into account multi-lingual pages 67 - process shortcodes in the page appearing in the modal 68 - make it possible to send a parameter in the URL for the page being opened in the modal 69 This makes it possible to customize the content of the page 70 The parameter consists of a url_key (parameter name) and url_value 71 Thanks to him !! 72 * New shortcode option : buttontext 70 * Changes by Christer: 71 - Added support for multilingual pages. 72 - Shortcodes are now processed in the page displayed in the modal. 73 - Added the ability to send parameters in the URL for the page being opened in the modal, enabling content customization. The parameter consists of a url_key (parameter name) and url_value. 74 Thanks to him! 75 * New shortcode option: buttontext. 73 76 74 77 = 1.4.1 = 75 * Add modification from "Christer_f" published in forum76 * Minor corrections 78 * Added changes from "Christer_f" published in the forum. 79 * Minor corrections. 77 80 78 81 = 1.4 = 79 * Correct Warning: substr() expects parameter 1 to be string, array given in wp-includes/functions.php on line 167982 * Fixed Warning: substr() expects parameter 1 to be string, array given in wp-includes/functions.php on line 1679. 80 83 81 84 = 1.3 = 82 * Correct issue of position85 * Fixed position issue. 83 86 84 87 85
Note: See TracChangeset
for help on using the changeset viewer.