wpdesk/wp-show-decision

There is no license information available for the latest version (1.0) of this package.

1.0 2020-05-24 19:10 UTC

This package is auto-updated.

Last update: 2024-04-25 18:37:52 UTC


README

pipeline status coverage report Latest Stable Version Total Downloads Latest Unstable Version License

WordPress Library for Decision whether to show something.

Idea is that you have ShouldShowStrategy interface with one bool method. Thanks to this you can create a class that delegates decision whether to show something. Your class does not have to hardcode that decision.

Requirements

PHP 5.6 or later.

Composer

You can install the bindings via Composer. Run the following command:

composer require --dev wpdesk/wp-show-decision

To use the bindings, use Composer's autoload:

require_once 'vendor/autoload.php';

Usage

    new Beacon(
        '6057086f-4b25-4e12-8735-fbc556d2dc01',
        new PostTypeStrategy('automation'),
        $this->get_plugin_assets_url()
    if ( is_admin() ) {
        ( new RateNotices(
            [ new TwoWeeksNotice( $this->plugin_url . '/assets', new PostTypeStrategy([
                [ 'page' => 'x', 'name' => 'stefan' ], // show when page = x and name = stefan
                [ 'page' => 'y' ]  // OR when page = y
            ] ) ) ]
        ) )->hooks();
    }

Project documentation

PHPDoc: https://wpdesk.gitlab.io/wp-show-decision/index.html