event-tickets-with-ticket-scanner
Last commit date
3rd
5 months ago
css
5 months ago
img
5 months ago
includes
5 months ago
js
5 months ago
languages
5 months ago
ticket
5 months ago
vendors
5 months ago
.gitignore
5 months ago
SASO_EVENTTICKETS.php
5 months ago
backend.js
5 months ago
changelog.txt
5 months ago
db.php
5 months ago
index.php
5 months ago
init_file.php
5 months ago
order_details.js
5 months ago
readme.txt
5 months ago
saso-eventtickets-validator.js
5 months ago
sasoEventtickets_AdminSettings.php
5 months ago
sasoEventtickets_Authtoken.php
5 months ago
sasoEventtickets_Base.php
5 months ago
sasoEventtickets_Core.php
5 months ago
sasoEventtickets_Frontend.php
5 months ago
sasoEventtickets_Messenger.php
5 months ago
sasoEventtickets_Options.php
5 months ago
sasoEventtickets_PDF.php
5 months ago
sasoEventtickets_Seating.php
5 months ago
sasoEventtickets_Ticket.php
5 months ago
sasoEventtickets_TicketBadge.php
5 months ago
sasoEventtickets_TicketDesigner.php
5 months ago
sasoEventtickets_TicketQR.php
5 months ago
ticket_events.js
5 months ago
ticket_scanner.js
5 months ago
validator.js
5 months ago
wc_backend.js
5 months ago
wc_frontend.js
5 months ago
woocommerce-hooks.php
5 months ago
sasoEventtickets_Base.php
61 lines
| 1 | <?php |
| 2 | include_once(plugin_dir_path(__FILE__)."init_file.php"); |
| 3 | class sasoEventtickets_Base { |
| 4 | private $_isPremInitialized = false; |
| 5 | private $_maxValues = []; |
| 6 | |
| 7 | private $MAIN = null; |
| 8 | |
| 9 | public function __construct($MAIN) { |
| 10 | $this->MAIN = $MAIN; |
| 11 | } |
| 12 | private function initPrem() { |
| 13 | if (count($this->_maxValues) == 0) { |
| 14 | $this->_maxValues = $this->MAIN->getMV(); |
| 15 | } |
| 16 | if ($this->_isPremInitialized == false) { |
| 17 | $prem = $this->MAIN->getPremiumFunctions(); |
| 18 | if ($prem != null) { |
| 19 | if ($this->MAIN->isPremium() && method_exists($this->MAIN->getPremiumFunctions(), 'maxValues')) { |
| 20 | $this->_maxValues = $prem->maxValues(); |
| 21 | } |
| 22 | } |
| 23 | $this->_isPremInitialized = true; |
| 24 | } |
| 25 | } |
| 26 | public function increaseGlobalTicketCounter($a=1) { |
| 27 | $mvct = $this->getOverallTicketCounterValue() + $a; |
| 28 | update_option($this->MAIN->getPrefix()."mvct", $mvct); |
| 29 | do_action( $this->MAIN->_do_action_prefix.'base_increaseGlobalTicketCounter', $mvct ); |
| 30 | } |
| 31 | public function getOverallTicketCounterValue() { |
| 32 | return intval(get_option( $this->MAIN->getPrefix()."mvct" )); |
| 33 | } |
| 34 | public function getMaxValues() { |
| 35 | $this->initPrem(); |
| 36 | return $this->_maxValues; |
| 37 | } |
| 38 | public function getMaxValue($key, $def = 1) { |
| 39 | $maxValues = $this->getMaxValues(); |
| 40 | if (isset($maxValues[$key])) return $maxValues[$key]; |
| 41 | return $def; |
| 42 | } |
| 43 | public function _isMaxReachedForList($total) { |
| 44 | if ($this->getMaxValue('lists') == 0) return true; |
| 45 | if ($total > $this->getMaxValue('lists')) return false; |
| 46 | return true; |
| 47 | } |
| 48 | public function _isMaxReachedForTickets($total) { |
| 49 | if ($this->getMaxValue('codes_total') == 0) return true; |
| 50 | if ($total > $this->getMaxValue('codes_total')) return false; |
| 51 | //$mvct = $this->getOverallTicketCounterValue(); |
| 52 | //if ( $mvct > 0 && $mvct > ($total+150)) return false; |
| 53 | return true; |
| 54 | } |
| 55 | public function _isMaxReachedForAuthtokens($total) { |
| 56 | if ($this->getMaxValue('authtokens_total', 0) == 0) return true; |
| 57 | if ($total > $this->getMaxValue('authtokens_total')) return false; |
| 58 | return true; |
| 59 | } |
| 60 | } |
| 61 | ?> |