Changeset 2882995
- Timestamp:
- 03/19/2023 08:06:19 PM (3 years ago)
- Location:
- show-hidecollapse-expand/trunk
- Files:
-
- 4 edited
-
Tab_help.php (modified) (1 diff)
-
Tab_settings.php (modified) (2 diffs)
-
bg_show_hide.php (modified) (10 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
show-hidecollapse-expand/trunk/Tab_help.php
r2843664 r2882995 22 22 $this->_html .= "<li> Inline CSS: <br><b>inline_css</b>=\"any css rule, e.g. font-size: 21px; font-weight: normal; \"</li>"; 23 23 $this->_html .= "<li> Custom class: <br><b>custom_class</b>=\"any class name you will later use for CSS styling \"</li>"; 24 $this->_html .= "<li> Onclick JS function : <br><b>onclick</b>=\"your custom JS function name or inline js, e.g. alert('Hello World!'); \"</li>";24 $this->_html .= "<li> Onclick JS function (available for roles Editor and above): <br><b>onclick</b>=\"your custom JS function name or inline js, e.g. alert('Hello World!'); \"</li>"; 25 25 $this->_html .= "</ul>"; 26 26 $this->_html .= "<h2>[bg_collapse] Button Examples</h2>"; -
show-hidecollapse-expand/trunk/Tab_settings.php
r2843664 r2882995 54 54 <input type=\"submit\" class=\"button button-primary\" id=\"save_plugin_settings\" name=\"save_plugin_settings\" value=\"Save Plugin Settings\"> 55 55 <input type=\"hidden\" name=\"action\" value=\"bg_show_hide_save_plugin_settings\"> 56 %%WP_NONCE%% 56 57 </form>"; 57 58 … … 83 84 $this->getPluginContext()->getStickToBottom() === '1' ? 'checked' : '', 84 85 $this->_html ); 85 86 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_USE_EFFECTS', array($this->getPluginContext()->getEffectsEnabledOption())); 87 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_SPEED', array($this->getPluginContext()->getAnimationSpeed())); 88 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_OPTIONS', array('none')); 89 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_EFFECT', array($this->getPluginContext()->getAnimationEffect())); 90 86 87 $this->_html = str_replace( "%%WP_NONCE%%", 88 wp_nonce_field( 'bgshce_settings'), 89 $this->_html ); 90 91 91 return $this->_html; 92 92 -
show-hidecollapse-expand/trunk/bg_show_hide.php
r2843696 r2882995 5 5 Plugin URI: http://showhide.bunte-giraffe.de 6 6 Description: Save space on your pages, posts, sidebars. Hide the content before user clicks to see it. Collapse long lists, create FAQs & more. 7 Version: 1. 2.67 Version: 1.3.0 8 8 Author: Bunte Giraffe 9 9 Author URI: http://bunte-giraffe.de … … 125 125 126 126 function bg_show_hide_save_plugin_settings() { 127 if ( isset ( $_POST["save_plugin_settings"] ) ) {127 if ( isset ( $_POST["save_plugin_settings"] ) && check_admin_referer( 'bgshce_settings' ) ) { 128 128 if ( isset( $_POST["enable_effects"] ) ) { 129 129 update_option( "bg_shce_effectsEnabled", "1" ); … … 133 133 } 134 134 if ( isset( $_POST["bg_shce_speed"] ) ) { 135 update_option( "bg_shce_animationSpeed", intval( $_POST["bg_shce_speed"]));135 update_option( "bg_shce_animationSpeed", intval(sanitize_text_field($_POST["bg_shce_speed"] ))); 136 136 } 137 137 … … 144 144 145 145 if ( isset( $_POST["bg_shce_effect"] ) ) { 146 update_option( "bg_shce_animationEffect", $_POST["bg_shce_effect"]);146 update_option( "bg_shce_animationEffect", sanitize_text_field($_POST["bg_shce_effect"]) ); 147 147 } 148 148 } … … 188 188 $bg_showmore_extra_attributes = ""; 189 189 $bg_text_color = esc_attr($a["color"]); 190 $bg_expand_text = $a["expand_text"];191 $bg_collapse_text = $a["collapse_text"];190 $bg_expand_text = esc_html($a["expand_text"]); 191 $bg_collapse_text = esc_html($a["collapse_text"]); 192 192 $bg_btn_icon_class = $a["icon"] ? "bg-" . esc_attr($a["icon"]) : ""; 193 $bg_onclick = $a["onclick"] === '' ? '' : 'onclick="'.$a["onclick"].'"'; 193 194 // check author role to allow/deny execution of js 195 global $post; 196 $aid = $post->post_author; 197 if ( user_can($aid, 'edit_others_posts') && user_can($aid, 'edit_others_pages') ) { 198 $bg_onclick = $a["onclick"] === '' ? '' : 'onclick="'.esc_js($a["onclick"]).'"'; 199 } else { 200 $bg_onclick = ''; 201 } 202 194 203 $bg_inline_css = esc_attr($a["inline_css"]); 195 204 $bg_custom_class = esc_attr($a["custom_class"]); … … 251 260 $bg_list_end . 252 261 "<" . $bg_showmore_content_tag . $bg_showmore_extra_attributes . " id='bg-showmore-hidden-$bg_uniq_id' >" . 253 $content.262 wp_kses_post($content) . 254 263 "</" . $bg_showmore_content_tag . ">" . 255 264 $bg_hidden_content_end . … … 258 267 $content = do_shortcode($content); 259 268 260 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_USE_EFFECTS', array(get_option('bg_shce_effectsEnabled','0')));261 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_SPEED', array(get_option('bg_shce_animationSpeed','400')));262 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_OPTIONS', array('none'));263 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_EFFECT', array(get_option('bg_shce_animationEffect','blind')));264 265 269 // always return 266 270 return $content; … … 287 291 plugins_url( "assets/js/bg-show-hide.js", __FILE__ ), array('jquery', 'jquery-effects-core', 'jquery-effects-slide', 'jquery-effects-highlight', 'jquery-effects-fold', 'jquery-effects-blind'), false, true 288 292 ); 293 294 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_USE_EFFECTS', get_option('bg_shce_effectsEnabled','0')); 295 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_SPEED', get_option('bg_shce_animationSpeed','400')); 296 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_OPTIONS', 'none'); 297 wp_localize_script( "bg-show-hide-script", 'BG_SHCE_TOGGLE_EFFECT', get_option('bg_shce_animationEffect','blind')); 289 298 290 299 } … … 340 349 $activeTabName = "settings"; 341 350 if( isset( $_GET["tab"] ) ) { 342 $activeTabName = $_GET["tab"];351 $activeTabName = sanitize_text_field($_GET["tab"]); 343 352 } 344 353 … … 392 401 global $typenow; 393 402 394 if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) {395 return;396 }397 398 403 if( !in_array( $typenow, array( 'post', 'page' ) ) ) { 399 404 return; 400 405 } 406 401 407 } 402 408 -
show-hidecollapse-expand/trunk/readme.txt
r2843664 r2882995 5 5 Requires at least: 4.2 6 6 Tested up to: 6.1.1 7 Stable tag: 1. 2.67 Stable tag: 1.3.0 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 89 89 90 90 == Changelog == 91 = 1.3.0 = 92 * Enhanced plugin security 93 91 94 = 1.2.6 = 92 95 * Fixed a vulnerability issue. Please update as soon as possible.
Note: See TracChangeset
for help on using the changeset viewer.