id = $attributes['id']; $this->logic = $attributes['rule_logic']; $this->actions = $attributes['actions']; $this->execute_on = $attributes['execute_on']; $this->min_rule_engine_ver = $attributes['min_rule_engine_ver']; if (array_key_exists('max_rule_engine_ver', $attributes)) { $this->max_rule_engine_ver = $attributes['max_rule_engine_ver']; } if (array_key_exists('config', $attributes) && is_array($attributes['config'])) { $this->config = $attributes['config']; } if (array_key_exists('opts', $attributes) && is_array($attributes['opts'])) { $this->opts = $attributes['opts']; } } public static function init($attributes) { if (!is_array($attributes)) { return false; } if (!array_key_exists('min_rule_engine_ver', $attributes) || !is_float($attributes['min_rule_engine_ver']) || $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V676::VERSION) { return false; } if (array_key_exists('max_rule_engine_ver', $attributes) && (!is_float($attributes['max_rule_engine_ver']) || $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V676::VERSION)) { return false; } if (!array_key_exists('id', $attributes) || (is_int($attributes['id']) && $attributes['id'] <= 0)) { return false; } if (!array_key_exists('rule_logic', $attributes) || !is_array($attributes['rule_logic'])) { return false; } if (!array_key_exists('actions', $attributes) || !is_array($attributes['actions'])) { return false; } if (!array_key_exists('execute_on', $attributes)) { if (array_key_exists('level', $attributes) && $attributes['level'] === 1) { $attributes['execute_on'] = WPRProtectFWRule_V676::EXE_ON_BOOT; } else { return false; } } return new WPRProtectFWRule_V676($attributes); } public function isExeOnBoot() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_BOOT); } public function isExeOnPreUpdateOption() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_PRE_UPDATE_OPTION); } public function isExeOnPreDeletePost() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_PRE_DELETE_POST); } public function isExeOnWPInsertPostEmptyContent() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT); } public function isExeOnInsertUserMeta() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_INSERT_USER_META); } public function isExeOnDeleteOption() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_DELETE_OPTION); } public function isExeOnDeleteUser() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_DELETE_USER); } public function isExeOnPasswordReset() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_PASSWORD_RESET); } public function isExeOnSendAuthCookies() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_SEND_AUTH_COOKIES); } public function isExeOnSetAuthCookie() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_SET_AUTH_COOKIE); } public function isExeOnInit() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_INIT); } public function isExeOnUserRegister() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_USER_REGISTER); } public function isExeOnAddUserMeta() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_ADD_USER_META); } public function isExeOnUpdateUserMetadata() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_UPDATE_USER_METADATA); } public function isExeOnUpdateUserMeta() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_UPDATE_USER_META); } public function isExeOnAddOption() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_ADD_OPTION); } public function isExeOnWpPreInsertUserData() { return ($this->execute_on === WPRProtectFWRule_V676::EXE_ON_WP_PRE_INSERT_USER_DATA); } } endif;