Class: \Conifer\Authorization\ShortcodePolicy (abstract)
Abstract class providing a basis for defining shortcodes that filter their content according to custom authorization logic
Visibility | Function |
---|---|
public | __construct(\string $tag='protected' )</strong> : voidSets the shortcode tag for the new shortcode policy |
public | adopt() : PolicyInterface fluent interface Filter the shortcode content based on the implementation of the decide method. |
public | abstract decide(array $atts, \string $content, \Timber\User $user)</strong> : bool whether $user meets the criteria described in $atts Determine whether the user has access to content based on shortcode attributes, user data, and possibly the content itself. |
public | enforce(array $atts, \string $content, \Timber\User $user)</strong> : void Filter the shortcode content based on the current user's data |
protected | filter_authorized(\string $content)</strong> : string the content to display Get the filtered shortcode content to display to authorized users. Override this method to display something other thatn the original content. |
protected | filter_unauthorized(\string $content)</strong> : string the content to display Get the filtered shortcode content to display to unauthorized users. Override this method to display something other than the empty string. |
protected | get_user() : \Timber\User Get the user to check against shortcode attributes. Override this method to perform authorization against someone other than the current user. |
protected | tag() : string the shortcode tag to declare Get the shortcode tag to be declared |
This class extends \Conifer\Authorization\AbstractPolicy
This class implements \Conifer\Authorization\PolicyInterface