=== CWP Snippets === Contributors: rcates00, agseidler Tags: filemaker, code snippets, php, css, javascript Requires at least: 5.2 Tested up to: 6.8 Requires PHP: 7.2 Stable tag: 1.8.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html A plugin designed to enhance WordPress by providing seamless connectivity and integration with FileMaker databases. == Description == CWP Snippets extends WordPress functionality by providing robust connectivity and integration with FileMaker databases. It allows developers and administrators to manage and execute custom code snippets that can retrieve, display, and manipulate data from FileMaker, enriching WordPress sites with dynamic data-driven content. **Key Features Include:** - **FileMaker Integration**: Connect and interact directly with FileMaker databases. - **Snippet Management**: Easily add, edit, and manage custom PHP, HTML, CSS, and JavaScript snippets. - **Dynamic Shortcode Execution**: Utilize shortcodes to embed custom logic within posts and pages. - **Secure Preview Capability**: Preview how snippets will run, restricted to admin users for safety. - **Advanced Code Editing**: Integrated CodeMirror editor provides syntax highlighting and error detection. - **Code Validation**: Ensures uniqueness and correct syntax to prevent issues during execution. This plugin is ideal for developers needing to integrate FileMaker data into WordPress, providing tools necessary for robust data manipulation and presentation. == Installation == 1. Upload the `cwp-snippets` folder to the `/wp-content/plugins/` directory. 2. Activate the plugin through the 'Plugins' menu in WordPress. 3. Go to the newly available 'CWP Snippets' section to begin adding and managing your custom code snippets. == Documentation == For detailed instructions, tutorials, and references, please see the built-in documentation. 1. **In-Plugin Help:** The full documentation is available in the "Help" tab within the plugin itself. Navigate to "CWP Snippets" -> "Help" in your WordPress admin dashboard. 2. **Online Documentation:** For public access, the same documentation is available on our website at https://cwpsnippets.com/docs == Frequently Asked Questions == = Can I use this plugin without FileMaker? = While the plugin is designed for use with FileMaker, it can also be used to manage general code snippets in your WordPress site. = Is there any limit to the number of snippets I can create? = No, you can create an unlimited number of snippets depending on your needs. == Screenshots == 1. The main interface for managing snippets. 2. Code editor with syntax highlighting. 3. Settings for connecting to a FileMaker database. == Changelog == = 1.8.4 = * Enhancement: Added to the Demo Database for new Account Login Snippet. * Fix: Created a GET fallback if POST fails when activating license. = 1.8.3 = * Enhancement: Add-on submenu items now appear alphabetically sorted under the "Add-ons" menu for better organization. * Change: Removed Pro license restriction on shortcode attributes. All users can now pass attributes to snippets regardless of license status. = 1.8.2 = * Fix: Resolved an issue with cwpSafe Redirect. * Fix: Resolved an issue with cwpLog not creating the log table. * Enhancement: Added wildcard cache clearing by prefix. Sending a cache key that ends with `*` (for example `alex_*`) via the REST endpoint will now delete matching transients automatically. * Change: Removed the `dry_run` option for remote wildcard clears — wildcard requests now perform deletions immediately. Use caution and protect the endpoint (see notes below). * Enhancement: `cwp_cache_endpoint` now accepts a single key, an array of keys, or a delimiter-separated string (CR/LF, comma, semicolon). Sending `cache_key: "clear_all"` triggers a full clear-all operation. * New Helper: Added `cwpClearCacheWildcard($prefix, $limit = 25)` to search and delete transients that share a logical prefix under the `CWP_TRANSIENT_PREFIX` namespace. The helper enforces a safety limit to avoid accidental mass-deletes. * New Utility: Added `handle_filemaker_download()` — an AJAX handler to securely fetch and stream files from a FileMaker server (registered handlers: `fm_download` / `fm_download` for unauthenticated requests). See the documentation for usage and security notes. * Improvement: `cwpIsURLValid()` was enhanced to allow checking multiple Streaming_SSL URLs (sampling/count options) when validating FileMaker image URLs. We also added the option to pull a random image (rather then the first one) from a FileMaker result. Security note: Because wildcard deletes now execute immediately, it's strongly recommended to protect the REST endpoint with a `permission_callback` (token, capability or similar). See the developer docs for an example permission callback using Bearer tokens. = 1.8.1 = * Feature: Added `cwp_toolbar()` function to provide a vertical drag-and-drop floating toolbar (Top, Bottom, Save, Preview, Undo, Redo) with keyboard shortcuts for quick snippet editing. * New Feature: Added Versioning to every snippet, function, script, and style for easy tracking. (defaults to 1.0.0) * Enhancement: Introduced universal helper utilities in `/includes/functions.php` (Admin Debug Display, Logging, Caching & Transient Management, FileMaker helper functions, WordPress helper functions, CSS utilities, and JavaScript helper functions). * Enhancement: Reworked `fmcwpShowResponse()` to accept additional parameters and render collapsible debug blocks with a Copy-to-Clipboard button and toast feedback. * Enhancement: Updated plugin documentation and individual library documentation to reflect new features and improvements. * Enhancement: Added additional utility functions for admin and AJAX operations. * Enhancement: Added JavaScript create/show/hide Spinner universal functions with optional arguements = 1.7.2 = * Feature: Added `cwp_do_shortcode()` function to execute shortcodes with accompanying CSS injection. Allows snippets to include other snippets while preserving all CSS styling. * Helper Function: Added `cwp_get_snippet_css()` to retrieve CSS for a specific shortcode tag, supporting both snippet-specific and global Style snippet CSS. * Fix: Resolved an issue where detecting updates to the demo database was always finding true. * Enhancement: Optimized license verification system by removing scheduled cron jobs and using on-demand 12-hour transient caching instead. * Enhancement: Simplified error logging to only capture and log errors (not success messages) for cleaner production logs. * Enhancement: License errors are now logged through the custom logging system for better visibility in Pro Debug Log. * Enhancement: Standardized and improved error logging for viewing in the debug log viewer and or the Pro logging feature. = 1.7.1 = * Fix: Resolved an issue where importing snippets with the same name but different casing would fail to recognize them as updates, treating them as new snippets instead. * Fix: Corrected a flaw in the conflict detection logic that incorrectly flagged functions and classes as duplicates during an update, by removing the unreliable `function_exists` and `class_exists` checks. * Enhancement: Increased the undo limit in the snippet editor to 50 changes. * Enhancement: Inactive snippets with function name conflicts can now be saved with a warning. They cannot be activated until the conflict is resolved. * Enhancement: Improved duplicate snippet naming to prevent duplicate names by appending a numbered copy suffix. = 1.7.0 = * Fix: Fixed a bug that prevented snippets from being imported. * Enhancement: Added instructions to the documentstaion for running FileMaker scripts. = 1.6.9 = * Fix: Made code changes to prepare for submission to WordPress Repository = 1.6.8 = * Enhancement: Updated template and sample snippets. * Enhancement: Updated Demo Database. * NOTE: The demo database has been updated. If you use it, please replace your hosted file with the new version from the plugin's 'assets/demo' directory. * Enhancement: Added syntax highlighting (CodeMirror) to code examples in the plugin's internal documentation for improved readability. * Enhancement: Expanded and updated internal documentation content. = 1.6.7 = * Feature - Added a 'No Cache' option for snippets to prevent page caching on a per-snippet basis. * Fix - Text erorrs fixed in Demo instructions. * Fix - Inmproved the display of Demo instructions. * Fix - Set the critical error notice to dismiss when the offending snippet is resaved. = 1.6.6 = * Fix - Addressed a fatal error on new installations related to a missing PHP Parser library. * Fix - Improved robustness of the editor's undo/redo history by capping its size to prevent browser storage from becoming full. * Feature - Added Ctrl+S (Cmd+S on Mac) keyboard shortcut to save snippets directly from the editor. = 1.6.5 = * **Enhancement:** Added Documentation. = 1.6.4 = * **Major Feature: Runtime Error Protection.** Implemented a robust "Runtime Catch & Deactivate" system. If an active function snippet causes a fatal error, the plugin will now automatically deactivate it to prevent further crashes and display a clear notification in the admin area for review. * **Major Feature: Interactive Import Dialog.** The import process has been completely overhauled. It now features an interactive dialog that shows all snippets in the file, identifies conflicts, and allows you to select exactly which snippets to add or update. * **Major Feature: Bundled Snippet Update System.** Replaced the "Generate" buttons with a new "Reload" and "Update" system for bundled snippets. You will now be notified when new versions of the bundled Samples, Templates, etc., are available. All updates and reloads use the new interactive import dialog, giving you full control. * **Enhancement:** Changed the default location for new snippets from 'frontend' to 'everywhere' for better out-of-the-box usability. * **Enhancement:** The import process now correctly uses the snippet's type from the import file, rather than the type of the page you are currently viewing. * **Fix:** Corrected various UI inconsistencies, including button styling and success message formatting. = 1.6.3 = * Added support for add-ons and an add-on coming soon page. = 1.6.2 = * Added robust PHP error and syntax handling by bundling Nikic's PHP-Parser Library. * Added custom CWP Debug Log functionality. = 1.6.1 = * Fixed an Ajax handler bug. = 1.5.9 = * Improved error handling. Added Debug Log Viewer. Fixed importing where backslashes were being lost. = 1.5.8 = * Added the ability to run front-end snippets in edit mode in admin and added improved error handling for critical errors. = 1.5.7 = * Added support for add-on snippets to extend the functionality of the core plugin. = 1.5.6 = * Added License management, activation, and Transients Token Management. = 1.5.4 = * Added Pro Feature Lock. = 1.5.3 = * Fixed a bug with undo/redo functionality. = 1.5.2 = * Fixed a bug preventing updating functions. = 1.5.1 = * Added Functions, and Styles. = 1.3.0 = * Added attributes to shortcodes. = 1.0.0 = * Initial release.