paywallID: <?php echo json_encode($this->paywallId()); ?> , trackPageview: true, onMeterExpired: function ( meter ) { <?php if (WPTinypass::canDebug()) { ?> tinypassDebugMeter( meter ); <?php } ?> }, <?php if (WPTinypass::canDebug()) { ?> onMeterActive: function ( meter ) { tinypassDebugMeter( meter ); }, onAccessGranted: function ( meter ) { tinypassDebugMeter( meter ); } <?php } ?> } ); } ] ); } tinypassMeterTick();
/** * Fetch all required options from database */ protected function initOptions() { $isAdmin = is_admin(); if ($isAdmin) { $this->getOption(self::OPTION_NAME_PLUGIN_VERSION); } // These options are always available $coreOptions = array(self::OPTION_NAME_MODE, self::OPTION_NAME_BUSINESS_MODEL, self::OPTION_NAME_USER_PROVIDER, self::OPTION_NAME_FEATURES, self::OPTION_NAME_APP_ID, self::OPTION_NAME_API_TOKEN, self::OPTION_NAME_PRIVATE_KEY, self::OPTION_NAME_DISABLED_FOR_PRIVILEGED, self::OPTION_NAME_TRUNCATION_MODE, self::OPTION_NAME_FIRST_CLICK_MODE, self::OPTION_NAME_DEBUG, self::OPTION_NAME_ENABLE_PREMIUM_TAG, self::OPTION_NAME_DISPLAY_MODE); // Load these options foreach ($coreOptions as $option) { $this->getOption($option); } $businessModelOptions = array(); if (TinypassConfig::BUSINESS_MODEL_METERED === self::$business_model) { // Load options for metered paywall $businessModelOptions = array(self::OPTION_NAME_PAYWALL_ID, self::OPTION_NAME_PAYWALL_OFFER_ID, self::OPTION_NAME_PAYWALL_TEMPLATE_ID, self::OPTION_NAME_METER_HOME_PAGE); } elseif (TinypassConfig::BUSINESS_MODEL_SUBSCRIPTION === self::$business_model) { // Load options for hard paywall $businessModelOptions = array(self::OPTION_NAME_OFFER_ID, self::OPTION_NAME_OFFER_SET, self::OPTION_NAME_RESOURCES, self::OPTION_NAME_ENABLE_PPP); } // Load options for the selected business model foreach ($businessModelOptions as $option) { $this->getOption($option); } if ($isAdmin) { // Default access settings are only used in backend $this->getOption(self::OPTION_NAME_DEFAULT_ACCESS_SETTINGS); } if ($isAdmin || TinypassConfig::MODE_CUSTOM === $this::$mode) { // Dedicated environment url in frontend is only required when the mode is set to "dedicated" $this->getOption(self::OPTION_NAME_DEDICATED_ENVIRONMENT); } if ($isAdmin || self::TRUNCATION_MODE_PARAGRAPHED === self::$truncation_mode) { // Paragraphs count value in frontend is only required when truncation mode is set to "paragraphed" $this->getOption(self::OPTION_NAME_PARAGRAPHS_COUNT); } if ($isAdmin || in_array(self::$first_click_mode, array(TinypassConfig::FIRST_CLICK_OPTION_EXCLUDE, TinypassConfig::FIRST_CLICK_OPTION_EXCLUDE))) { // Referrers for first click in frontend are only required when first click mode is set to "include" or "exclude $this->getOption(self::OPTION_NAME_FIRST_CLICK_REFERRERS); } if (is_array(self::$offer_set)) { self::$offer_id = isset(self::$offer_set[self::$mode]) ? self::$offer_set[self::$mode] : null; } else { self::$offer_set = array(); } }