Releases: lipemat/wordpress-libs
Single Fire Actions
New methods added to the Util/Actions class for firing an action or filter one time. Useful in situations where do_action() or apply_filters() fires more than once during a call, page-load, or user action.
use Lipe\Lib\Util\Actions;
Actions::in()->add_single_filter( $filter, $callable, $priority = 10, $accepted_args = 1 );
Actions::in()->add_single_action( $action, $callable, $priority = 10, $accepted_args = 1 );
Improving Available Services
Introducing a new Zip service for generating cached .zip files. It accepts an array of file URLS and a name for the .zip file. When complete, it serves the zip to the browser. Can also be used as an api endpoint when sending a validation key.
use Lipe\Lib\Util\Zip;
Zip::in()->build_zip( [ $url, $url ], $zip_name );
Introducing a new class for adding public query vars or the deprecated filter param to wp-json requests. Simply init the class and the rest happens automatically for all existing post types with the rest api enabled.
use Lipe\Lib\Rest_Api\Query_Vars;
Query_Vars::init();
Greatly improved the Db Schema.
Admin menu location support for Taxonomy
Using the already available "show_in_menu" Taxonomy class property, now supports specifying an admin menu location. This will add the taxonomy menu under the desired parent menu as well as highlight the correct menus when viewing or editing terms.
To simply add the taxonomy under the Tools menu:
use Lipe\Lib\Taxonomy\Taxonomy;
$tax = new Taxonomy( 'example' );
$tax->show_in_menu = 'tools.php';
To specify which order it should show up in desired menu may be achieved by passing an array:
use Lipe\Lib\Taxonomy\Taxonomy;
$tax = new Taxonomy( 'example' );
$tax->show_in_menu = [ 'tools.php' => 6 ];
Introducing a new class Comment/Comment_Trait
This class mimics the functionality already available for post types and taxonomies which gives access to the meta repo as well as exposing some basic methods for interactions.
With this being a Trait you obviously will want to extend with a child class like so.
use Lipe\Lib\Comment\Comment_Trait;
class Comment {
use Comment_Trait;
}
Then use the class via the standard factory method like so
$comment = Comment::factory( $comment_id );
echo $comment->get_comment()->comment_content;
Class_Names
Introducing a new class Util/Class_Names.
This class mimics the functionality of node classNames to allow conditional classes passed as an array then outputted as standard html classes.
Example:
$form_classes = new Class_Names( [
'entry' => 1,
'form' => 1,
'open => isset( $_GET[ 'open' ] ),
] );
<form class="<?= $form_classes; ?>"></form>
This also works with non associative arrays:
$form_classes = new Class_Names( [ 'entry', 'form' ] );
<form class="<?= $form_classes; ?>"></form>
Remove Action/Filter Always
Introducing a new class call Util/Actions with the following highlights:
- remove_action_always() method
- remove_filter_always() method
These new methods allow for removing filters or actions no matter where they are in the stack. You may call the method before, after, or during the add_action() or add_filter() call being removed. You no longer have to wait until an action or filter is registered before removing it.
Many other under the hood enhancements since version 1.2.0:
- Repeatable Term_Select_2 CMB2 fields
- Meta_Box class cleanup and enhancements
- Bug fixes
- PHP docs
- Add show_on_cb() method to CMB2\Field
Hard Tested The CMB2 Meta Classes
Everything has been refined in terms of CMB2 as well as support for:
- Tabs
- Select2 Taxonomy fields
Many other under the hood enhancements including but not limited to:
- Support to trigger callback once
- Init a singleton once
.......
Officially Out Of Beta
This is now ready for production sites. Any future changes will respect standard versioning practices and respect backward compatibility of any minor and dot version updates.
Getting Really Close To First Stable
All planned features have been accounted for. All satisfaction is acquired. Only thing left to do is give this a hard test against an actual production project.
Next non maintenance project I get, this will be used.
First Beta
Still open to structure changes, but stable enough to use in projects and/or fork.