Files
branddefense.pl/wp-content/plugins/brizy/admin/rules/template-rule-validator.php
Roman Pyrih c2e100a763 first commit
2023-07-24 08:30:51 +02:00

35 lines
848 B
PHP

<?php
class Brizy_Admin_Rules_TemplateRuleValidator extends Brizy_Admin_Rules_AbstractValidator {
/**
* @param Brizy_Admin_Rule $rule
* @param int $postId
*
* @return mixed
* @throws Brizy_Admin_Rules_ValidationException
*/
public function validateRuleForPostId( Brizy_Admin_Rule $rule, $postId ) {
$ruleSets = $this->getRulesSetByWPQuery( [ 'post_type' => get_post_type( $postId ) ] );
return $this->validateRule( $rule, $ruleSets );
}
/**
* @param Brizy_Admin_Rule[] $rules
* @param int $postId
*
* @return mixed
* @throws Brizy_Admin_Rules_ValidationException
*/
public function validateRulesForPostId( $rules, $postId ) {
$ruleSets = $this->getRulesSetByWPQuery( [
'post_type' => get_post_type( $postId ),
'exclude' => [ $postId ]
] );
return $this->validateRules( $rules, $ruleSets );
}
}