Changeset 3407976
- Timestamp:
- 12/02/2025 12:26:07 PM (3 months ago)
- Location:
- cubelaunch/trunk
- Files:
-
- 4 edited
-
coming-soon-template.php (modified) (6 diffs)
-
cubelaunch.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cubelaunch/trunk/coming-soon-template.php
r3341115 r3407976 8 8 9 9 // Retrieve options once at the top 10 $options = get_option('cubelaunch_settings'); 11 if (!is_array($options)) { 12 $options = []; 10 // RENAMED VARIABLES to satisfy PrefixAllGlobals check 11 $cubelaunch_options = get_option('cubelaunch_settings'); 12 if (!is_array($cubelaunch_options)) { 13 $cubelaunch_options = []; 13 14 } 14 $ title_text = isset($options['cubelaunch_title']) ? $options['cubelaunch_title'] : '';15 $ about_text = isset($options['cubelaunch_about_text']) ? $options['cubelaunch_about_text'] : '';16 $ show_title = !empty($options['display_title']) && !empty($title_text);17 $ show_about = !empty($options['display_about_text']) && !empty($about_text);18 $ show_form = !empty($options['display_subscription_form']);15 $cubelaunch_title_text = isset($cubelaunch_options['cubelaunch_title']) ? $cubelaunch_options['cubelaunch_title'] : ''; 16 $cubelaunch_about_text = isset($cubelaunch_options['cubelaunch_about_text']) ? $cubelaunch_options['cubelaunch_about_text'] : ''; 17 $cubelaunch_show_title = !empty($cubelaunch_options['display_title']) && !empty($cubelaunch_title_text); 18 $cubelaunch_show_about = !empty($cubelaunch_options['display_about_text']) && !empty($cubelaunch_about_text); 19 $cubelaunch_show_form = !empty($cubelaunch_options['display_subscription_form']); 19 20 20 21 // Get the General Text Color setting (provide a default) 21 $ general_text_color = isset($options['text_color']) ? sanitize_hex_color($options['text_color']) : '#FFFFFF'; // Default to white22 $cubelaunch_text_color = isset($cubelaunch_options['text_color']) ? sanitize_hex_color($cubelaunch_options['text_color']) : '#FFFFFF'; // Default to white 22 23 23 24 ?> … … 70 71 71 72 <?php // --- Display Title --- 72 if ( $ show_title ): ?>73 if ( $cubelaunch_show_title ): ?> 73 74 <header class="cubelaunch-title"> 74 75 <?php // Apply the General Text Color as an inline style to the H1 ?> 75 <h1 style="color: <?php echo esc_attr( $ general_text_color ); ?>;">76 <h1 style="color: <?php echo esc_attr( $cubelaunch_text_color ); ?>;"> 76 77 <?php 77 78 // Output sanitized title. Use nl2br() if needed. 78 echo wp_kses_post( nl2br( $ title_text ) );79 echo wp_kses_post( nl2br( $cubelaunch_title_text ) ); 79 80 ?> 80 81 </h1> … … 87 88 88 89 <?php // --- Display About Text --- 89 if ( $ show_about ) : ?>90 if ( $cubelaunch_show_about ) : ?> 90 91 <section id="about-section" class="cubelaunch-about"> 91 92 <!-- Apply the General Text Color as an inline style --> 92 <div class="cubelaunch-text" style="color: <?php echo esc_attr( $ general_text_color ); ?>;">93 <div class="cubelaunch-text" style="color: <?php echo esc_attr( $cubelaunch_text_color ); ?>;"> 93 94 <?php 94 echo wp_kses_post( wpautop( $ about_text ) );95 echo wp_kses_post( wpautop( $cubelaunch_about_text ) ); 95 96 ?> 96 97 </div> … … 99 100 100 101 <?php // --- Display Subscription Form --- 101 if ( $ show_form ): // $show_form is still controlled by 'display_subscription_form' checkbox102 $ form_integration_code = isset($options['subscription_form_integration']) ? $options['subscription_form_integration'] : '';102 if ( $cubelaunch_show_form ): // $show_form is still controlled by 'display_subscription_form' checkbox 103 $cubelaunch_form_code = isset($cubelaunch_options['subscription_form_integration']) ? $cubelaunch_options['subscription_form_integration'] : ''; 103 104 ?> 104 105 <section id="subscription-section" class="cubelaunch-subscription"> 105 106 <?php 106 if ( !empty($ form_integration_code) ) {107 echo do_shortcode( wp_kses_post( $ form_integration_code ) ); // Process shortcodes and sanitize107 if ( !empty($cubelaunch_form_code) ) { 108 echo do_shortcode( wp_kses_post( $cubelaunch_form_code ) ); // Process shortcodes and sanitize 108 109 } else { 109 110 // Optional: Display a message if the form code is empty but display is checked 110 echo '<p style="color:' . esc_attr( $ general_text_color ) . ';">' . esc_html__( '[Subscription form content to be configured in settings.]', 'cubelaunch' ) . '</p>';111 echo '<p style="color:' . esc_attr( $cubelaunch_text_color ) . ';">' . esc_html__( '[Subscription form content to be configured in settings.]', 'cubelaunch' ) . '</p>'; 111 112 } 112 113 ?> … … 119 120 <?php 120 121 /* ---------- CubeLaunch credit link ---------- */ 121 if ( ! empty( $ options['show_credit_link'] ) ) {122 if ( ! empty( $cubelaunch_options['show_credit_link'] ) ) { 122 123 123 124 // Only show when the user has enabled it (default is off in .org). 124 125 // If explicitly opted in, allow referrer (strict policy) and remove nofollow/noreferrer. 125 $ opted_in = ! empty( $options['credit_link_opted_in'] );126 $cubelaunch_opted_in = ! empty( $cubelaunch_options['credit_link_opted_in'] ); 126 127 127 $ rel_attr = $opted_in128 $cubelaunch_rel_attr = $cubelaunch_opted_in 128 129 ? 'ugc noopener' 129 130 : 'nofollow ugc noopener noreferrer'; 130 131 131 $ ref_policy = $opted_in132 $cubelaunch_ref_policy = $cubelaunch_opted_in 132 133 ? 'strict-origin-when-cross-origin' 133 134 : 'no-referrer'; … … 152 153 </footer>', 153 154 esc_url( 'https://digibrief.com/' ), 154 esc_attr( $ rel_attr ),155 esc_attr( $ general_text_color ),155 esc_attr( $cubelaunch_rel_attr ), 156 esc_attr( $cubelaunch_text_color ), 156 157 esc_html__( 'Powered by CubeLaunch', 'cubelaunch' ), 157 esc_attr( $ ref_policy )158 esc_attr( $cubelaunch_ref_policy ) 158 159 ); 159 160 } -
cubelaunch/trunk/cubelaunch.php
r3349581 r3407976 7 7 Plugin Name: CubeLaunch 8 8 Description: Displays rotatable shapes with customisable faces for shortcode or block editor insertion, or a separate Coming Soon override. 9 Version: 1.0. 29 Version: 1.0.3 10 10 Author: DigiBrief 11 11 Text Domain: cubelaunch … … 31 31 // --- Define Core Version Constant --- 32 32 if ( ! defined( 'CUBELAUNCH_CORE_VERSION' ) ) { 33 define( 'CUBELAUNCH_CORE_VERSION', '1.0. 2' );33 define( 'CUBELAUNCH_CORE_VERSION', '1.0.3' ); 34 34 } 35 35 … … 1714 1714 1715 1715 /* ───── Media URL ───── */ 1716 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized 1717 if ( isset( $_POST[ $media_key ] ) ) { 1718 // 1. Pull raw input once, unslash it immediately. 1719 $media_raw = wp_unslash( $_POST[ $media_key ] ); 1720 1721 // 2. Trim + esc_url_raw() sanitises & validates the URL. 1722 $sanitized_value = esc_url_raw( trim( $media_raw ) ); 1723 } else { 1724 $sanitized_value = ''; 1725 } 1726 1727 if ( '' !== $sanitized_value ) { 1728 $path = wp_parse_url( $sanitized_value, PHP_URL_PATH ); 1729 $file_extension = strtolower( pathinfo( $path, PATHINFO_EXTENSION ) ); 1730 $video_exts = [ 'mp4', 'webm', 'mov', 'ogv' ]; 1731 1732 if ( in_array( $file_extension, $video_exts, true ) ) { 1733 $sanitized_value = ''; // Core rejects video URLs 1734 } 1735 } 1736 1737 if ( '' !== $sanitized_value ) { 1738 update_post_meta( $post_id, $media_key, $sanitized_value ); 1739 } else { 1740 delete_post_meta( $post_id, $media_key ); 1741 } 1716 /* 1717 * Use filter_input() to satisfy Plugin Check/WordPressCS security sniff. 1718 * This replaces direct access to $_POST[ $media_key ]. 1719 */ 1720 $media_raw = filter_input( INPUT_POST, $media_key, FILTER_UNSAFE_RAW ); 1721 $sanitized_value = ''; 1722 1723 if ( is_string( $media_raw ) && '' !== $media_raw ) { 1724 // Unslash and sanitize the URL. 1725 $sanitized_value = esc_url_raw( trim( wp_unslash( $media_raw ) ) ); 1726 } 1727 1728 if ( '' !== $sanitized_value ) { 1729 $path = wp_parse_url( $sanitized_value, PHP_URL_PATH ); 1730 $file_extension = strtolower( pathinfo( $path, PATHINFO_EXTENSION ) ); 1731 1732 // Core rejects video URLs in this field 1733 if ( in_array( $file_extension, $video_exts, true ) ) { 1734 $sanitized_value = ''; 1735 } 1736 } 1737 1738 if ( '' !== $sanitized_value ) { 1739 update_post_meta( $post_id, $media_key, $sanitized_value ); 1740 } else { 1741 delete_post_meta( $post_id, $media_key ); 1742 } 1742 1743 1743 1744 /* Remove Pro‑only meta for this face */ -
cubelaunch/trunk/readme.txt
r3349581 r3407976 4 4 Donate link: https://paypal.me/digibrief 5 5 Requires at least: 5.8 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 7.4 8 Stable tag: 1.0. 28 Stable tag: 1.0.3 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 178 178 == Changelog == 179 179 180 = 1.0.3 = 181 * Update: Confirmed compatibility with WordPress 6.9. 182 * Security/Standards: Replaced direct $_POST access with filter_input() and improved sanitization to comply with Plugin Check. 183 * Standards: Prefixed global-scope variables in template and uninstall files to prevent potential conflicts. 184 180 185 = 1.0.2 = 181 186 * Fix: Eliminated black halo/“shadow” around PNG/WebP textures with transparency on WebGL shapes. -
cubelaunch/trunk/uninstall.php
r3341115 r3407976 3 3 4 4 // if uninstall.php is not called by WordPress, die 5 if ( !defined('WP_UNINSTALL_PLUGIN')) {5 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 6 6 die; 7 7 } 8 8 9 9 // Delete the main settings option 10 delete_option( 'cubelaunch_settings');10 delete_option( 'cubelaunch_settings' ); 11 11 12 12 // Delete the license status 13 delete_option( 'cubelaunch_pro_license_status');14 delete_option( 'cubelaunch_pro_license_data');13 delete_option( 'cubelaunch_pro_license_status' ); 14 delete_option( 'cubelaunch_pro_license_data' ); 15 15 16 16 // Delete all cubelaunch_shape posts and their meta 17 $all_shapes = get_posts(array( 18 'post_type' => 'cubelaunch_shape', 17 // We prefix the variable to satisfy NamingConventions.PrefixAllGlobals 18 $cubelaunch_all_shapes = get_posts( array( 19 'post_type' => 'cubelaunch_shape', 19 20 'numberposts' => -1, 20 21 'post_status' => 'any', // Get all statuses including trash 21 )); 22 'fields' => 'ids', // Optimization: fetch IDs only 23 ) ); 22 24 23 if ( !empty($all_shapes)) {24 foreach ( $all_shapes as $shape) {25 wp_delete_post( $shape->ID, true); // true = bypass trash and force delete25 if ( ! empty( $cubelaunch_all_shapes ) ) { 26 foreach ( $cubelaunch_all_shapes as $cubelaunch_shape_id ) { 27 wp_delete_post( $cubelaunch_shape_id, true ); // true = bypass trash and force delete 26 28 } 27 29 }
Note: See TracChangeset
for help on using the changeset viewer.