We're excited to announce the release of Advanced Scripts version 2.4.0! This update introduces several new features, enhancements, and important bug fixes to further enhance your scripting capabilities within WordPress. Let's dive into the details of this release.
Custom Shortcode Attributes
Now, custom shortcodes in Advanced Scripts have access to the
$tag variables, providing you with more options for customization and flexibility. Unlock the full potential of the shortcodes API and make them even more powerful.
Let's demonstrate the use case by creating a dynamic Greeting shortcode.
First, open the Advanced Scripts interface and create a new script using the following settings:
- Title: Dynamic Greeting Shortcode
- Type: PHP
- Location: Shortcode
- Shortcode: greeting
In the code editor area, paste the following PHP code
$atts = shortcode_atts([
'name' => 'World',
], $atts, $tag);
printf('Hello %s!', $atts['name']);
Code language: PHP (php)
That's it, now you have a dynamic shortcode that can accept a name and display a greeting message. You can use it as any other shortcode and supply a value for the name attribute, for example
[greeting name="Advanced Scripts"].
Enhanced safe mode activation security and accessibility
Up to this release, anyone could activate the safe mode by adding
?safemode=1 to the website URL. Enabling safe mode using this method is a helpful option for website admins to quickly recover from a website crash caused by Advanced Scripts PHP code, despite it being a bad choice for website security.
With this update, you can now enforce the safe mode by defining the
AS_SAFE_MODE constant in wp-config.php, Doing so, you can no longer enable or disable the safe mode by the URL method.
Enhanced PHP Errors Handler
To ensure you have a smooth and error-free scripting journey, we have refactored our PHP error handler. Advanced Scripts 2.4.0 introduces safety checks and comprehensive error reporting. When an issue arises, you'll receive clear and detailed information, making debugging a breeze.
These error details are shown only to website administrators to protect sensitive details.
Fixing Permissions Issues for Temporary Files
Previously, Advanced Scripts was using the system temporary folder to store PHP script files for execution. This approach didn't work well in some systems where the temporary files get deleted too early before they get included.
To fix this, we are now saving these files to a custom folder named 'advanced-scripts' located in the uploads' directory.
Preparing for the Future with Streamlined Migration
To ensure a smooth transition to the next major release, we have incorporated additional functions into Advanced Scripts. These functions are designed to streamline the migration process.
We've upgraded the bundled ScssPhp library and Freemius SDK to their latest versions. This ensures better performance, and enhances compatibility with PHP 8.1.
We always welcome your valuable feedback. If you have any questions, suggestions, or encounter any issues, please don't hesitate to reach out to our dedicated support team. We're here to assist you at every step of your journey.
Stay tuned for more exciting updates in the pipeline. Happy coding with Advanced Scripts!