AdditionalOptions.class.php
2 months ago
CampaignInfo.class.php
2 months ago
Campaigns.class.php
2 months ago
ClickTracking.class.php
2 months ago
ContactForm7.class.php
2 months ago
Debugging.class.php
4 weeks ago
EDD.class.php
4 weeks ago
General.class.php
4 weeks ago
Integrations.class.php
2 months ago
LifterLMS.class.php
2 months ago
Marketpress.class.php
4 weeks ago
MemberPress.class.php
2 months ago
Membership2.class.php
2 months ago
PMPro.class.php
2 months ago
PPBuyNowButton.class.php
2 months ago
RestrictContentPro.class.php
2 months ago
S2Member.class.php
2 months ago
Signup.class.php
2 months ago
SimplePayPro.class.php
2 months ago
StripePayments.class.php
4 weeks ago
SureCart.class.php
2 months ago
WPEasyCart.class.php
2 months ago
WPPayForms.class.php
2 months ago
WishListMember.class.php
2 months ago
WooComm.class.php
4 weeks ago
CampaignInfo.class.php
60 lines
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) exit; |
| 3 | |
| 4 | class postaffiliatepro_Form_Settings_CampaignInfo extends postaffiliatepro_Form_Base { |
| 5 | |
| 6 | const ADD_TO_CAMPAIGN = 'add-to-campaign'; |
| 7 | const SEND_NOTIFICATION_EMAIL = 'send-notification-mail'; |
| 8 | |
| 9 | /** |
| 10 | * @var postaffiliatepro_Util_CampaignHelper |
| 11 | */ |
| 12 | private $campaignHelper; |
| 13 | private $campaignId; |
| 14 | private $optionsPrefix; |
| 15 | |
| 16 | public function __construct($campaignId,postaffiliatepro_Util_CampaignHelper $campaignHelper) { |
| 17 | $this->optionsPrefix = postaffiliatepro::SIGNUP_CAMPAIGNS_SETTINGS_SETTING_NAME; |
| 18 | $this->campaignId = $campaignId; |
| 19 | $this->campaignHelper = $campaignHelper; |
| 20 | parent::__construct(); |
| 21 | } |
| 22 | |
| 23 | private function isPublic() { |
| 24 | return $this->campaignHelper->getCampaignType($this->campaignId) == postaffiliatepro_Util_CampaignHelper::CAMPAIGN_TYPE_PUBLIC; |
| 25 | } |
| 26 | |
| 27 | protected function getTemplateFile() { |
| 28 | if ($this->isPublic()) { |
| 29 | return WP_PLUGIN_DIR . '/postaffiliatepro/Template/CampaignInfo-Public.xtpl'; |
| 30 | } |
| 31 | return WP_PLUGIN_DIR . '/postaffiliatepro/Template/CampaignInfo-Private.xtpl'; |
| 32 | } |
| 33 | |
| 34 | protected function getOption($name, $type = 'none') { |
| 35 | $value = get_option($this->optionsPrefix); |
| 36 | if (!is_array($value)) { |
| 37 | return ''; |
| 38 | } |
| 39 | $name = str_replace(array('[',']', $this->optionsPrefix), '', $name); |
| 40 | if (!array_key_exists($name, $value)) { |
| 41 | return ''; |
| 42 | } |
| 43 | return $value[$name]; |
| 44 | } |
| 45 | |
| 46 | protected function initForm() { |
| 47 | $this->addHtml('campaign-name', $this->campaignHelper->getCampaignName($this->campaignId)); |
| 48 | $this->addHtml('campaign-type', $this->campaignHelper->getTypeAsText($this->campaignHelper->getCampaignType($this->campaignId))); |
| 49 | $this->addHtml('campaign-id', $this->campaignId); |
| 50 | |
| 51 | if (!$this->isPublic()) { |
| 52 | $this->addCheckbox($this->optionsPrefix.'['.self::ADD_TO_CAMPAIGN.'-'.$this->campaignId.']', self::ADD_TO_CAMPAIGN); |
| 53 | $this->addCheckbox($this->optionsPrefix.'['.self::SEND_NOTIFICATION_EMAIL.'-'.$this->campaignId.']', self::SEND_NOTIFICATION_EMAIL); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | public function render($toVar = false, $template = '') { |
| 58 | return parent::render(true); |
| 59 | } |
| 60 | } |