Save 40% this spring!

Documentation

Core components


TotalPoll uses multiple components to get the job done, this article will give you a quick look at different components and their respective role in poll lifecycle as well as an overview of the global architecture and how are these components related to each other.

Poll Component#

This component is the main constructing block of poll functionality starting from how it's registered to how votes are counted including the usage and integration of WordPress APIs like post type.

This component consists of following units:

PostType: This unit is responsible for poll custom post type registration.

Model: The poll data model, which cover its state and possible mutations.

Repository: Polls data are queried and mutations saved through this unit.

Controller: Received requests are processed in this unit.

Form: This unit constructs the vote form including the validation.

Renderer: This unit renders poll using a specific template.

Log Component#

The log component records every vote request whether is denied or accepted, and it's used to restrict voters from voting again using the stored entries.

Model: The log entry data model.

Repository: This unit is used to query and access log registry.

Form Entry Component#

Form entries are stored and retrieved by this component. Also, it's used to restrict voters from voting again using the stored entries.

Model: The log entry data model.

Repository: This unit is used to query and access log registry.

Limitation Component#

The main purpose of this component is handling different limitations applied to a poll by its creator, like a start date and end date, quota and membership. The limitation term refers to conditions the poll or the voter must met in order to open poll for voting.

Membership: This unit is responsible for enabling vote for certain memberships only (in WordPress terms, roles).

Period: Date limited polls are handled by this unit.

Quota: Quote limited polls are handled by this unit.

Region: Region limited (based on IP) polls are handled by this unit.

Restriction Component#

This component take the responsibility of restricting voters from exceeding their quota of votes allowed per specific period.

Cookies: This unit handles restriction by cookies.

IP: This unit handles restriction by IP.

LoggedInUser: This unit handles restriction by logged in user.

 

Note: This article is being improved based on developers feedback.