Changeset 3340531
- Timestamp:
- 08/06/2025 05:49:02 PM (8 months ago)
- Location:
- page-post-converter-for-wpbakery-to-elementor
- Files:
-
- 16 added
- 3 edited
-
tags/1.6 (added)
-
tags/1.6/assets (added)
-
tags/1.6/assets/admin.css (added)
-
tags/1.6/assets/admin.js (added)
-
tags/1.6/includes (added)
-
tags/1.6/includes/class-wpb2e-btn-parser.php (added)
-
tags/1.6/includes/class-wpb2e-column-parser.php (added)
-
tags/1.6/includes/class-wpb2e-column-text-parser.php (added)
-
tags/1.6/includes/class-wpb2e-custom-heading-parser.php (added)
-
tags/1.6/includes/class-wpb2e-rev-slider-parser.php (added)
-
tags/1.6/includes/class-wpb2e-shortcode-parser.php (added)
-
tags/1.6/includes/class-wpb2e-single-image-parser.php (added)
-
tags/1.6/includes/class-wpb2e-tabs-parser.php (added)
-
tags/1.6/page-post-converter-for-wpbakery-to-elementor.php (added)
-
tags/1.6/readme.txt (added)
-
tags/1.6/sflwa-notice-handler.php (added)
-
trunk/page-post-converter-for-wpbakery-to-elementor.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/sflwa-notice-handler.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
page-post-converter-for-wpbakery-to-elementor/trunk/page-post-converter-for-wpbakery-to-elementor.php
r3340514 r3340531 3 3 * Plugin Name: Page/Post Converter for WPBakery to Elementor 4 4 * Description: Clones a WordPress page or post and prepares its content for Elementor editing. 5 * Version: 1. 55 * Version: 1.6 6 6 * Requires Plugin: elementor 7 7 * Author: South Florida Web Advisors … … 11 11 * Requires PHP: 8.0 12 12 * Tested up to: 6.8 13 * Stable tag: 1. 513 * Stable tag: 1.6 14 14 * Text Domain: page-post-converter-for-wpbakery-to-elementor 15 15 */ -
page-post-converter-for-wpbakery-to-elementor/trunk/readme.txt
r3340514 r3340531 4 4 Requires at least: 6.7 5 5 Tested up to: 6.8 6 Stable tag: 1. 56 Stable tag: 1.6 7 7 Requires PHP: 8.0 8 8 License: GPLv2 or later … … 41 41 ## Change Log 42 42 43 2025-08-06 v1.6 44 * Fixed function name 45 43 46 2025-08-06 v1.5 44 47 * Fixed function name -
page-post-converter-for-wpbakery-to-elementor/trunk/sflwa-notice-handler.php
r3340514 r3340531 19 19 // IMPORTANT: This line should ideally be in your main plugin file, 20 20 // but included here for a self-contained example. 21 if ( ! defined( ' SFLWA_PLUGIN_NAME' ) ) {22 define( ' SFLWA_PLUGIN_NAME', 'Page/Post Converter for WPBakery to Elementor' ); // <--- IMPORTANT: Change this for each plugin!21 if ( ! defined( 'WPB2E_SFLWA_PLUGIN_NAME' ) ) { 22 define( 'WPB2E_SFLWA_PLUGIN_NAME', 'Page/Post Converter for WPBakery to Elementor' ); // <--- IMPORTANT: Change this for each plugin! 23 23 } 24 24 25 25 // Register the custom admin notice to be displayed. 26 26 // This hook ensures the notice is checked and potentially displayed on every admin page load. 27 add_action( 'admin_init', ' sflwa_register_admin_notice_wpb2e' );27 add_action( 'admin_init', 'wpb2e_sflwa_register_admin_notice' ); 28 28 29 29 /** … … 33 33 * If the transient doesn't exist, it means the notice should be displayed. 34 34 */ 35 function sflwa_register_admin_notice_wpb2e() {35 function wpb2e_sflwa_register_admin_notice() { 36 36 // Construct a unique transient name based on the plugin name. 37 37 // sanitize_title() ensures the name is safe for a transient key. 38 $transient_name = ' sflwa_notice_dismissed_' . sanitize_title(SFLWA_PLUGIN_NAME );38 $transient_name = 'wpb2e_sflwa_notice_dismissed_' . sanitize_title( WPB2E_SFLWA_PLUGIN_NAME ); 39 39 40 40 // Check if the transient exists. If not, add the action to display the notice. 41 41 if ( ! get_transient( $transient_name ) ) { 42 add_action( 'admin_notices', ' sflwa_display_admin_notice' );42 add_action( 'admin_notices', 'wpb2e_sflwa_display_admin_notice' ); 43 43 } 44 44 } … … 48 48 * 49 49 * This function is hooked into 'admin_notices' and calls the reusable 50 * ` sflwa_display_notice_handler` function, passing in the current plugin's name50 * `wpb2e_sflwa_display_notice_handler` function, passing in the current plugin's name 51 51 * and the AJAX URL needed for the JavaScript. 52 52 */ 53 function sflwa_display_admin_notice() {53 function wpb2e_sflwa_display_admin_notice() { 54 54 // Ensure the current user has permission to see admin notices (e.g., administrator). 55 55 if ( ! current_user_can( 'manage_options' ) ) { … … 58 58 59 59 // Call the shared handler function, passing the plugin name and WordPress AJAX URL. 60 sflwa_display_notice_handler(SFLWA_PLUGIN_NAME, admin_url( 'admin-ajax.php' ) );60 wpb2e_sflwa_display_notice_handler( WPB2E_SFLWA_PLUGIN_NAME, admin_url( 'admin-ajax.php' ) ); 61 61 } 62 62 … … 67 67 * @param string $ajax_url The URL for the WordPress AJAX endpoint. 68 68 */ 69 function sflwa_display_notice_handler( $plugin_name, $ajax_url ) {69 function wpb2e_sflwa_display_notice_handler( $plugin_name, $ajax_url ) { 70 70 // Enqueue jQuery if it's not already enqueued (WordPress usually does this in admin). 71 71 // This ensures our inline script can use jQuery. … … 107 107 // Perform AJAX request to submit plugin info. 108 108 $.post('<?php echo esc_url( $ajax_url ); ?>', { 109 action: ' sflwa_submit_plugin_info', // WordPress AJAX action hook.109 action: 'wpb2e_sflwa_submit_plugin_info', // WordPress AJAX action hook. 110 110 plugin_name: notice.data('plugin-name'), // Get plugin name from data attribute. 111 111 website_url: '<?php echo esc_url( get_home_url() ); ?>', // Get current website URL. 112 _ajax_nonce: '<?php echo esc_attr( wp_create_nonce( ' sflwa_submit_nonce' ) ); ?>' // Security nonce.112 _ajax_nonce: '<?php echo esc_attr( wp_create_nonce( 'wpb2e_sflwa_submit_nonce' ) ); ?>' // Security nonce. 113 113 }, function(response) { 114 114 // Hide spinner after response. … … 148 148 // Perform AJAX request to dismiss the notice permanently. 149 149 $.post('<?php echo esc_url( $ajax_url ); ?>', { 150 action: ' sflwa_dismiss_admin_notice', // WordPress AJAX action hook.150 action: 'wpb2e_sflwa_dismiss_admin_notice', // WordPress AJAX action hook. 151 151 plugin_name: notice.data('plugin-name'), // Get plugin name from data attribute. 152 _ajax_nonce: '<?php echo esc_attr( wp_create_nonce( ' sflwa_dismiss_nonce' ) ); ?>' // Security nonce.152 _ajax_nonce: '<?php echo esc_attr( wp_create_nonce( 'wpb2e_sflwa_dismiss_nonce' ) ); ?>' // Security nonce. 153 153 }, function(response) { 154 154 if (response.success) { … … 175 175 var notice = $(this).closest('.sflwa-admin-notice'); 176 176 $.post('<?php echo esc_url( $ajax_url ); ?>', { 177 action: ' sflwa_dismiss_admin_notice', // WordPress AJAX action hook.177 action: 'wpb2e_sflwa_dismiss_admin_notice', // WordPress AJAX action hook. 178 178 plugin_name: notice.data('plugin-name'), // Get plugin name from data attribute. 179 _ajax_nonce: '<?php echo esc_attr( wp_create_nonce( ' sflwa_dismiss_nonce' ) ); ?>' // Security nonce.179 _ajax_nonce: '<?php echo esc_attr( wp_create_nonce( 'wpb2e_sflwa_dismiss_nonce' ) ); ?>' // Security nonce. 180 180 }, function(response) { 181 181 // No specific UI update needed here as the notice is already hidden by WordPress. … … 193 193 * AJAX callback to handle the Gravity Forms submission via a custom proxy endpoint. 194 194 * 195 * This function is hooked to 'wp_ajax_ sflwa_submit_plugin_info'.195 * This function is hooked to 'wp_ajax_wpb2e_sflwa_submit_plugin_info'. 196 196 * It receives the plugin name and website URL, and submits them to a custom 197 197 * REST API endpoint on southfloridawebadvisors.com. 198 198 */ 199 add_action( 'wp_ajax_ sflwa_submit_plugin_info', 'sflwa_submit_plugin_info_callback' );200 function sflwa_submit_plugin_info_callback() {199 add_action( 'wp_ajax_wpb2e_sflwa_submit_plugin_info', 'wpb2e_sflwa_submit_plugin_info_callback' ); 200 function wpb2e_sflwa_submit_plugin_info_callback() { 201 201 // Verify nonce for security. 202 check_ajax_referer( ' sflwa_submit_nonce', '_ajax_nonce' );202 check_ajax_referer( 'wpb2e_sflwa_submit_nonce', '_ajax_nonce' ); 203 203 204 204 // Sanitize and retrieve data from the AJAX request. … … 272 272 * AJAX callback to permanently dismiss the admin notice. 273 273 * 274 * This function is hooked to 'wp_ajax_ sflwa_dismiss_admin_notice'.274 * This function is hooked to 'wp_ajax_wpb2e_sflwa_dismiss_admin_notice'. 275 275 * It sets a transient to prevent the notice from showing again for this plugin. 276 276 */ 277 add_action( 'wp_ajax_ sflwa_dismiss_admin_notice', 'sflwa_dismiss_admin_notice_callback' );278 function sflwa_dismiss_admin_notice_callback() {277 add_action( 'wp_ajax_wpb2e_sflwa_dismiss_admin_notice', 'wpb2e_sflwa_dismiss_admin_notice_callback' ); 278 function wpb2e_sflwa_dismiss_admin_notice_callback() { 279 279 // Verify nonce for security. 280 check_ajax_referer( ' sflwa_dismiss_nonce', '_ajax_nonce' );280 check_ajax_referer( 'wpb2e_sflwa_dismiss_nonce', '_ajax_nonce' ); 281 281 282 282 // Sanitize and retrieve the plugin name from the AJAX request. … … 284 284 285 285 // Construct the unique transient name. 286 $transient_name = ' sflwa_notice_dismissed_' . sanitize_title( $plugin_name );286 $transient_name = 'wpb2e_sflwa_notice_dismissed_' . sanitize_title( $plugin_name ); 287 287 288 288 // Set a transient that never expires (0 seconds lifetime) to permanently hide the notice.
Note: See TracChangeset
for help on using the changeset viewer.