/** * Create and Display IssueM settings page * * @since 1.0.0 */ function settings_page() { // Get the user options $settings = $this->get_settings(); $settings_saved = false; if (isset($_REQUEST['update_leaky_paywall_settings'])) { if (!empty($_REQUEST['page_for_login'])) { $settings['page_for_login'] = $_REQUEST['page_for_login']; } if (!empty($_REQUEST['page_for_subscription'])) { $settings['page_for_subscription'] = $_REQUEST['page_for_subscription']; } if (!empty($_REQUEST['page_for_register'])) { $settings['page_for_register'] = $_REQUEST['page_for_register']; } if (!empty($_REQUEST['page_for_after_subscribe'])) { $settings['page_for_after_subscribe'] = $_REQUEST['page_for_after_subscribe']; } if (!empty($_REQUEST['page_for_profile'])) { $settings['page_for_profile'] = $_REQUEST['page_for_profile']; } if (!empty($_REQUEST['login_method'])) { $settings['login_method'] = $_REQUEST['login_method']; } if (!empty($_REQUEST['post_types'])) { $settings['post_types'] = $_REQUEST['post_types']; } if (isset($_REQUEST['free_articles'])) { $settings['free_articles'] = trim($_REQUEST['free_articles']); } if (!empty($_REQUEST['site_name'])) { $settings['site_name'] = trim($_REQUEST['site_name']); } if (!empty($_REQUEST['from_name'])) { $settings['from_name'] = trim($_REQUEST['from_name']); } if (!empty($_REQUEST['from_email'])) { $settings['from_email'] = trim($_REQUEST['from_email']); } if (!empty($_REQUEST['new_email_subject'])) { $settings['new_email_subject'] = trim($_REQUEST['new_email_subject']); } if (!empty($_REQUEST['new_email_body'])) { $settings['new_email_body'] = trim($_REQUEST['new_email_body']); } if (!empty($_REQUEST['cookie_expiration'])) { $settings['cookie_expiration'] = trim($_REQUEST['cookie_expiration']); } if (!empty($_REQUEST['cookie_expiration_interval'])) { $settings['cookie_expiration_interval'] = trim($_REQUEST['cookie_expiration_interval']); } if (!empty($_REQUEST['leaky_paywall_currency'])) { $settings['leaky_paywall_currency'] = trim($_REQUEST['leaky_paywall_currency']); } if (!empty($_REQUEST['restrict_pdf_downloads'])) { $settings['restrict_pdf_downloads'] = $_REQUEST['restrict_pdf_downloads']; } else { $settings['restrict_pdf_downloads'] = 'off'; } if (!empty($_REQUEST['subscribe_login_message'])) { $settings['subscribe_login_message'] = trim($_REQUEST['subscribe_login_message']); } if (!empty($_REQUEST['subscribe_upgrade_message'])) { $settings['subscribe_upgrade_message'] = trim($_REQUEST['subscribe_upgrade_message']); } if (!empty($_REQUEST['css_style'])) { $settings['css_style'] = $_REQUEST['css_style']; } if (!empty($_REQUEST['test_mode'])) { $settings['test_mode'] = $_REQUEST['test_mode']; } else { $settings['test_mode'] = apply_filters('zeen101_demo_test_mode', 'off'); } if (!empty($_REQUEST['payment_gateway'])) { $settings['payment_gateway'] = $_REQUEST['payment_gateway']; } else { $settings['payment_gateway'] = array('stripe'); } if (!empty($_REQUEST['live_secret_key'])) { $settings['live_secret_key'] = apply_filters('zeen101_demo_stripe_live_secret_key', trim($_REQUEST['live_secret_key'])); } if (!empty($_REQUEST['live_publishable_key'])) { $settings['live_publishable_key'] = apply_filters('zeen101_demo_stripe_live_publishable_key', trim($_REQUEST['live_publishable_key'])); } if (!empty($_REQUEST['test_secret_key'])) { $settings['test_secret_key'] = apply_filters('zeen101_demo_stripe_test_secret_key', trim($_REQUEST['test_secret_key'])); } if (!empty($_REQUEST['test_publishable_key'])) { $settings['test_publishable_key'] = apply_filters('zeen101_demo_stripe_test_publishable_key', trim($_REQUEST['test_publishable_key'])); } if (!empty($_REQUEST['paypal_live_email'])) { $settings['paypal_live_email'] = apply_filters('zeen101_demo_paypal_live_email', trim($_REQUEST['paypal_live_email'])); } if (!empty($_REQUEST['paypal_live_api_username'])) { $settings['paypal_live_api_username'] = apply_filters('zeen101_demo_paypal_live_api_username', trim($_REQUEST['paypal_live_api_username'])); } if (!empty($_REQUEST['paypal_live_api_password'])) { $settings['paypal_live_api_password'] = apply_filters('zeen101_demo_paypal_live_api_password', trim($_REQUEST['paypal_live_api_password'])); } if (!empty($_REQUEST['paypal_live_api_secret'])) { $settings['paypal_live_api_secret'] = apply_filters('zeen101_demo_paypal_live_api_secret', trim($_REQUEST['paypal_live_api_secret'])); } if (!empty($_REQUEST['paypal_sand_email'])) { $settings['paypal_sand_email'] = apply_filters('zeen101_demo_paypal_sand_email', trim($_REQUEST['paypal_sand_email'])); } if (!empty($_REQUEST['paypal_sand_api_username'])) { $settings['paypal_sand_api_username'] = apply_filters('zeen101_demo_paypal_sand_api_username', trim($_REQUEST['paypal_sand_api_username'])); } if (!empty($_REQUEST['paypal_sand_api_password'])) { $settings['paypal_sand_api_password'] = apply_filters('zeen101_demo_paypal_sand_api_password', trim($_REQUEST['paypal_sand_api_password'])); } if (!empty($_REQUEST['paypal_sand_api_secret'])) { $settings['paypal_sand_api_secret'] = apply_filters('zeen101_demo_paypal_sand_api_secret', trim($_REQUEST['paypal_sand_api_secret'])); } if (!empty($_REQUEST['restrictions'])) { $settings['restrictions'] = $_REQUEST['restrictions']; } else { $settings['restrictions'] = array(); } if (!empty($_REQUEST['levels'])) { $settings['levels'] = $_REQUEST['levels']; } else { $settings['levels'] = array(); } if (!empty($_REQUEST['site_wide_enabled'])) { update_site_option('issuem-leaky-paywall-site-wide', true); } else { update_site_option('issuem-leaky-paywall-site-wide', false); } $settings = apply_filters('leaky_paywall_update_settings_settings', $settings); $this->update_settings($settings); $settings_saved = true; do_action('leaky_paywall_update_settings', $settings); } if ($settings_saved) { // update settings notification ?> <div class="updated"><p><strong><?php _e("zeen101's Leaky Paywall Settings Updated.", 'issuem-leaky-paywall'); ?> </strong></p></div> <?php } // Display HTML form for the options below ?> <div class=wrap> <div style="width:70%;" class="postbox-container"> <div class="metabox-holder"> <div class="meta-box-sortables ui-sortable"> <form id="issuem" method="post" action=""> <h2 style='margin-bottom: 10px;' ><?php _e("zeen101's Leaky Paywall Settings", 'issuem-leaky-paywall'); ?> </h2> <?php if (is_multisite_premium() && is_super_admin()) { ?> <div id="site-wide-option" class="postbox"> <div class="handlediv" title="Click to toggle"><br /></div> <h3 class="hndle"><span><?php _e('Site Wide Options', 'issuem-leaky-paywall'); ?> </span></h3> <div class="inside"> <table id="issuem_multisite_settings" class="leaky-paywall-table"> <tr> <th rowspan="1"> <?php _e('Enable Settings Site Wide?', 'issuem-leaky-paywall'); ?> </th> <td> <td><input type="checkbox" id="site_wide_enabled" name="site_wide_enabled" <?php checked($this->is_site_wide_enabled()); ?> /></td> </td> </tr> </table> <p class="submit"> <input class="button-primary" type="submit" name="update_leaky_paywall_settings" value="<?php _e('Save Settings', 'issuem-leaky-paywall'); ?> " /> </p> </div> </div> <?php } ?> <?php wp_nonce_field('issuem_leaky_general_options', 'issuem_leaky_general_options_nonce'); ?> <div id="modules" class="postbox"> <div class="handlediv" title="Click to toggle"><br /></div> <h3 class="hndle"><span><?php _e('General Settings', 'issuem-leaky-paywall'); ?> </span></h3> <div class="inside"> <table id="leaky_paywall_administrator_options" class="form-table"> <tr> <th><?php _e('Page for Log In', 'issuem-leaky-paywall'); ?> </th> <td> <?php echo wp_dropdown_pages(array('name' => 'page_for_login', 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => $settings['page_for_login'])); ?> <p class="description"><?php printf(__('Add this shortcode to your Log In page: %s', 'issuem-leaky-paywall'), '[leaky_paywall_login]'); ?> </p> </td> </tr> <tr> <th><?php _e('Page for Subscribe Cards', 'issuem-leaky-paywall'); ?> </th> <td> <?php echo wp_dropdown_pages(array('name' => 'page_for_subscription', 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => $settings['page_for_subscription'])); ?> <p class="description"><?php printf(__('Add this shortcode to your Subscription page: %s', 'issuem-leaky-paywall'), '[leaky_paywall_subscription]'); ?> </p> </td> </tr> <tr> <th><?php _e('Page for Register Form', 'issuem-leaky-paywall'); ?> </th> <td> <?php echo wp_dropdown_pages(array('name' => 'page_for_register', 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => $settings['page_for_register'])); ?> <p class="description"><?php printf(__('Add this shortcode to your register page: %s', 'issuem-leaky-paywall'), '[leaky_paywall_register_form]'); ?> </p> </td> </tr> <tr> <th><?php _e('Page for Profile', 'issuem-leaky-paywall'); ?> </th> <td> <?php echo wp_dropdown_pages(array('name' => 'page_for_profile', 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => $settings['page_for_profile'])); ?> <p class="description"><?php printf(__('Add this shortcode to your Profile page: %s. This page displays the account information for subscribers.', 'issuem-leaky-paywall'), '[leaky_paywall_profile]'); ?> </p> </td> </tr> <tr> <th><?php _e('Subscribe or Login Message', 'issuem-leaky-paywall'); ?> </th> <td> <textarea id="subscribe_login_message" class="large-text" name="subscribe_login_message" cols="50" rows="3"><?php echo stripslashes($settings['subscribe_login_message']); ?> </textarea> <p class="description"> <?php _e("Available replacement variables: {{SUBSCRIBE_LOGIN_URL}} {{SUBSCRIBE_URL}} {{LOGIN_URL}}", 'issuem-leaky-paywall'); ?> </p> </td> </tr> <tr> <th><?php _e('Upgrade Message', 'issuem-leaky-paywall'); ?> </th> <td> <textarea id="subscribe_upgrade_message" class="large-text" name="subscribe_upgrade_message" cols="50" rows="3"><?php echo stripslashes($settings['subscribe_upgrade_message']); ?> </textarea> <p class="description"> <?php _e("Available replacement variables: {{SUBSCRIBE_LOGIN_URL}} {{SUBSCRIBE_URL}}", 'issuem-leaky-paywall'); ?> </p> </td> </tr> <tr> <th><?php _e('CSS Style', 'issuem-leaky-paywall'); ?> </th> <td> <select id='css_style' name='css_style'> <option value='default' <?php selected('default', $settings['css_style']); ?> ><?php _e('Default', 'issuem-leaky-paywall'); ?> </option> <option value='none' <?php selected('none', $settings['css_style']); ?> ><?php _e('None', 'issuem-leaky-paywall'); ?> </option> </select> </td> </tr> <tr> <th><?php _e('After Subscribe Page', 'issuem-leaky-paywall'); ?> </th> <td> <?php echo wp_dropdown_pages(array('name' => 'page_for_after_subscribe', 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => $settings['page_for_after_subscribe'])); ?> <p class="description"><?php _e('Page to redirect to after a user subscribes', 'issuem-leaky-paywall'); ?> </p> </td> </tr> </table> <p class="submit"> <input class="button-primary" type="submit" name="update_leaky_paywall_settings" value="<?php _e('Save Settings', 'issuem-leaky-paywall'); ?> " /> </p> </div> </div> <div id="modules" class="postbox"> <div class="handlediv" title="Click to toggle"><br /></div> <h3 class="hndle"><span><?php _e('Email Settings', 'issuem-leaky-paywall'); ?> </span></h3> <div class="inside"> <table id="leaky_paywall_administrator_options" class="form-table"> <tr> <th><?php _e('Site Name', 'issuem-leaky-paywall'); ?> </th> <td><input type="text" id="site_name" class="regular-text" name="site_name" value="<?php echo htmlspecialchars(stripcslashes($settings['site_name'])); ?> " /></td> </tr> <tr> <th><?php _e('From Name', 'issuem-leaky-paywall'); ?> </th> <td><input type="text" id="from_name" class="regular-text" name="from_name" value="<?php echo htmlspecialchars(stripcslashes($settings['from_name'])); ?> " /></td> </tr> <tr> <th><?php _e('From Email', 'issuem-leaky-paywall'); ?> </th> <td><input type="text" id="from_email" class="regular-text" name="from_email" value="<?php echo htmlspecialchars(stripcslashes($settings['from_email'])); ?> " /></td> </tr> <tr><td colspan="2"><h3><?php _e('New Subscriber Email', 'issuem-leaky-paywall'); ?> </h3></td></tr> <tr> <th><?php _e('Subject', 'issuem-leaky-paywall'); ?> </th> <td><input type="text" id="new_email_subject" class="regular-text" name="new_email_subject" value="<?php echo htmlspecialchars(stripcslashes($settings['new_email_subject'])); ?> " /> <p class="description"><?php _e('The subject line for the email sent to new subscribers.', 'issuem-leaky-paywall'); ?> </p> </td> </tr> <tr> <th><?php _e('Body', 'issuem-leaky-paywall'); ?> </th> <td><textarea id="new_email_body" class="large-text" name="new_email_body" rows="10" cols="20"><?php echo htmlspecialchars(stripcslashes($settings['new_email_body'])); ?> </textarea> <p class="description"><?php _e('The email message that is sent to new subscribers.', 'issuem-leaky-paywall'); ?> </p> <p class="description"><?php _e('Available template tags:', 'issuem-leaky-paywall'); ?> <br> %blogname%, %sitename%, %username%, %password%, %firstname%, %lastname%, %displayname%</p> </td> </tr> </table> <p class="submit"> <input class="button-primary" type="submit" name="update_leaky_paywall_settings" value="<?php _e('Save Settings', 'issuem-leaky-paywall'); ?> " /> </p> </div> </div> <div id="modules" class="postbox leaky-paywall-gateway-settings"> <div class="handlediv" title="Click to toggle"><br /></div> <h3 class="hndle"><span><?php _e('Payment Gateway Settings', 'issuem-leaky-paywall'); ?> </span></h3> <div class="inside"> <table id="leaky_paywall_test_option" class="form-table"> <tr class="gateway-options"> <th><?php _e("Test Mode?", 'issuem-leaky-paywall'); ?> </th> <td><input type="checkbox" id="test_mode" name="test_mode" <?php checked('on', $settings['test_mode']); ?> /></td> </tr> </table> <?php ob_start(); //Level 1 ?> <table id="leaky_paywall_gateway_options" class="form-table"> <tr class="gateway-options"> <th><?php _e('Enabled Gateways', 'issuem-leaky-paywall'); ?> </th> <td> <?php $gateways = leaky_paywall_get_payment_gateways(); foreach ($gateways as $key => $value) { ?> <p> <input id="enable-<?php echo $key; ?> " type="checkbox" name="payment_gateway[]" value="<?php echo $key; ?> " <?php checked(in_array($key, $settings['payment_gateway'])); ?> /> <label for="enable-<?php echo $key; ?> "><?php _e($value['admin_label'], 'issuem-leaky-paywall'); ?> </label> </p> <?php } ?> </td> </tr> </table> <?php if (in_array('stripe', $settings['payment_gateway']) || in_array('stripe_checkout', $settings['payment_gateway'])) { ob_start(); //Level 2 ?> <table id="leaky_paywall_stripe_options" class="form-table"> <tr><th><?php _e('Stripe Settings', 'issuem-leaky-paywall'); ?> </th><td></td></tr> <tr> <th><?php _e('Live Secret Key', 'issuem-leaky-paywall'); ?> </th> <td><input type="text" id="live_secret_key" class="regular-text" name="live_secret_key" value="<?php echo htmlspecialchars(stripcslashes($settings['live_secret_key'])); ?> " /></td> </tr> <tr> <th><?php _e('Live Publishable Key', 'issuem-leaky-paywall'); ?> </th> <td><input type="text" id="live_publishable_key" class="regular-text" name="live_publishable_key" value="<?php echo htmlspecialchars(stripcslashes($settings['live_publishable_key'])); ?> " /></td> </tr> <tr> <th><?php _e('Live Webhooks', 'issuem-leaky-paywall'); ?> </th> <td><p class="description"><?php echo esc_url(add_query_arg('listener', 'stripe', get_site_url() . '/')); ?> </p></td> </tr> <tr> <th><?php _e('Test Secret Key', 'issuem-leaky-paywall'); ?> </th> <td><input type="text" id="test_secret_key" class="regular-text" name="test_secret_key" value="<?php echo htmlspecialchars(stripcslashes($settings['test_secret_key'])); ?> " /></td> </tr> <tr> <th><?php _e('Test Publishable Key', 'issuem-leaky-paywall'); ?> </th> <td><input type="text" id="test_publishable_key" class="regular-text" name="test_publishable_key" value="<?php echo htmlspecialchars(stripcslashes($settings['test_publishable_key'])); ?> " /></td> </tr> <tr> <th><?php _e('Test Webhooks', 'issuem-leaky-paywall'); ?> </th> <td><p class="description"><?php echo esc_url(add_query_arg('listener', 'stripe', get_site_url() . '/')); ?> </p></td> </tr> </table> <?php echo apply_filters('leaky_paywall_settings_page_stripe_payment_gateway_options', ob_get_clean()); ?> <?php } ?> <?php if (in_array('paypal_standard', $settings['payment_gateway']) || in_array('paypal-standard', $settings['payment_gateway'])) { ?> <table id="leaky_paywall_paypal_options" class="gateway-options form-table"> <tr><th><?php _e('PayPal Standard Settings', 'issuem-leaky-paywall'); ?> </th><td></td></tr> <tr> <th><?php _e('Merchant ID', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="paypal_live_email" class="regular-text" name="paypal_live_email" value="<?php echo htmlspecialchars(stripcslashes($settings['paypal_live_email'])); ?> " /> <p class="description"><?php _e('Use PayPal Email Address in lieu of Merchant ID', 'issuem-leaky-paywall'); ?> </p> </td> </tr> <tr> <th><?php _e('API Username', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="paypal_live_api_username" class="regular-text" name="paypal_live_api_username" value="<?php echo htmlspecialchars(stripcslashes($settings['paypal_live_api_username'])); ?> " /> <p class="description"><?php _e('At PayPal, see: Profile → My Selling Tools → API Access → Update → View API Signature (or Request API Credentials).', 'issuem-leaky-paywall'); ?> </p> </td> </tr> <tr> <th><?php _e('API Password', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="paypal_live_api_password" class="regular-text" name="paypal_live_api_password" value="<?php echo htmlspecialchars(stripcslashes($settings['paypal_live_api_password'])); ?> " /> </td> </tr> <tr> <th><?php _e('API Signature', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="paypal_live_api_secret" class="regular-text" name="paypal_live_api_secret" value="<?php echo htmlspecialchars(stripcslashes($settings['paypal_live_api_secret'])); ?> " /> </td> </tr> <tr> <th><?php _e('Live IPN', 'issuem-leaky-paywall'); ?> </th> <td><p class="description"><?php echo esc_url(add_query_arg('listener', 'IPN', get_site_url() . '/')); ?> </p></td> </tr> <tr> <th><?php _e('Sandbox Merchant ID', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="paypal_sand_email" class="regular-text" name="paypal_sand_email" value="<?php echo htmlspecialchars(stripcslashes($settings['paypal_sand_email'])); ?> " /> <p class="description"><?php _e('Use PayPal Sandbox Email Address in lieu of Merchant ID', 'issuem-leaky-paywall'); ?> </p> </td> </tr> <tr> <th><?php _e('Sandbox API Username', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="paypal_sand_api_username" class="regular-text" name="paypal_sand_api_username" value="<?php echo htmlspecialchars(stripcslashes($settings['paypal_sand_api_username'])); ?> " /> <p class="description"><?php _e('At PayPal, see: Profile → My Selling Tools → API Access → Update → View API Signature (or Request API Credentials).', 'issuem-leaky-paywall'); ?> </p> </td> </tr> <tr> <th><?php _e('Sandbox API Password', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="paypal_sand_api_password" class="regular-text" name="paypal_sand_api_password" value="<?php echo htmlspecialchars(stripcslashes($settings['paypal_sand_api_password'])); ?> " /> </td> </tr> <tr> <th><?php _e('Sandbox API Signature', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="paypal_sand_api_secret" class="regular-text" name="paypal_sand_api_secret" value="<?php echo htmlspecialchars(stripcslashes($settings['paypal_sand_api_secret'])); ?> " /> </td> </tr> <tr> <th><?php _e('Sandbox IPN', 'issuem-leaky-paywall'); ?> </th> <td><p class="description"><?php echo esc_url(add_query_arg('listener', 'IPN', get_site_url() . '/')); ?> </p></td> </tr> </table> <?php } ?> <?php wp_nonce_field('issuem_leaky_general_options', 'issuem_leaky_general_options_nonce'); ?> <?php $leaky_paywall_gateway_options = ob_get_clean(); ?> <?php echo apply_filters('leaky_paywall_settings_page_gateway_options', $leaky_paywall_gateway_options); ?> <?php do_action('leaky_paywall_payments_settings', $settings); ?> <p class="submit"> <input class="button-primary" type="submit" name="update_leaky_paywall_settings" value="<?php _e('Save Settings', 'issuem-leaky-paywall'); ?> " /> </p> </div> </div> <?php // currency options ?> <div id="modules" class="postbox"> <div class="handlediv" title="Click to toggle"><br /></div> <h3 class="hndle"><span><?php _e('Currency Options', 'issuem-leaky-paywall'); ?> </span></h3> <div class="inside"> <table id="leaky_paywall_currency_options" class="form-table"> <tr> <th><?php _e('Currency', 'issuem-leaky-paywall'); ?> </th> <td> <select id="leaky_paywall_currency" name="leaky_paywall_currency"> <?php $currencies = leaky_paywall_supported_currencies(); foreach ($currencies as $key => $currency) { echo '<option value="' . $key . '" ' . selected($key, $settings['leaky_paywall_currency'], true) . '>' . $currency['label'] . ' - ' . $currency['symbol'] . '</option>'; } ?> </select> <p class="description"><?php _e('This controls which currency payment gateways will take payments in.', 'issuem-leaky-paywall'); ?> </p> </td> </tr> </table> <p class="submit"> <input class="button-primary" type="submit" name="update_leaky_paywall_settings" value="<?php _e('Save Settings', 'issuem-leaky-paywall'); ?> " /> </p> </div> </div> <?php // end currency options ?> <div id="modules" class="postbox leaky-paywall-restriction-settings"> <div class="handlediv" title="Click to toggle"><br /></div> <h3 class="hndle"><span><?php _e('Content Restriction', 'issuem-leaky-paywall'); ?> </span></h3> <div class="inside"> <table id="leaky_paywall_default_restriction_options" class="form-table"> <tr class="restriction-options"> <th><?php _e('Limited Article Cookie Expiration', 'issuem-leaky-paywall'); ?> </th> <td> <input type="text" id="cookie_expiration" class="small-text" name="cookie_expiration" value="<?php echo stripcslashes($settings['cookie_expiration']); ?> " /> <select id="cookie_expiration_interval" name="cookie_expiration_interval"> <option value="hour" <?php selected('hour', $settings['cookie_expiration_interval']); ?> ><?php _e('Hour(s)', 'issuem-leaky-paywall'); ?> </option> <option value="day" <?php selected('day', $settings['cookie_expiration_interval']); ?> ><?php _e('Day(s)', 'issuem-leaky-paywall'); ?> </option> <option value="week" <?php selected('week', $settings['cookie_expiration_interval']); ?> ><?php _e('Week(s)', 'issuem-leaky-paywall'); ?> </option> <option value="month" <?php selected('month', $settings['cookie_expiration_interval']); ?> ><?php _e('Month(s)', 'issuem-leaky-paywall'); ?> </option> <option value="year" <?php selected('year', $settings['cookie_expiration_interval']); ?> ><?php _e('Year(s)', 'issuem-leaky-paywall'); ?> </option> </select> <p class="description"><?php _e('Choose length of time when a visitor can once again read your articles/posts (up to the # of articles allowed).', 'issuem-leaky-paywall'); ?> </p> </td> </tr> <tr class="restriction-options "> <th><?php _e('Restrict PDF Downloads?', 'issuem-leaky-paywall'); ?> </th> <td><input type="checkbox" id="restrict_pdf_downloads" name="restrict_pdf_downloads" <?php checked('on', $settings['restrict_pdf_downloads']); ?> /></td> </tr> <tr class="restriction-options"> <th> <label for="restriction-post-type-' . $row_key . '"><?php _e('Restrictions', 'issuem-leaky-paywall'); ?> </label> </th> <td id="issuem-leaky-paywall-restriction-rows"> <?php $last_key = -1; if (!empty($settings['restrictions']['post_types'])) { foreach ($settings['restrictions']['post_types'] as $key => $restriction) { if (!is_numeric($key)) { continue; } echo build_leaky_paywall_default_restriction_row($restriction, $key); $last_key = $key; } } ?> </td> </tr> <tr class="restriction-options"> <th> </th> <td> <script type="text/javascript" charset="utf-8"> var leaky_paywall_restriction_row_key = <?php echo $last_key; ?> ; </script> <p class="description"><?php _e('By default all content is allowed.', 'issuem-leaky-paywall'); ?> </p> <p> <input class="button-secondary" id="add-restriction-row" class="add-new-issuem-leaky-paywall-restriction-row" type="submit" name="add_leaky_paywall_restriction_row" value="<?php _e('Add New Restricted Content', 'issuem-leaky-paywall-multilevel'); ?> " /> </p> </td> </tr> </table> <p class="submit"> <input class="button-primary" type="submit" name="update_leaky_paywall_settings" value="<?php _e('Save Settings', 'issuem-leaky-paywall'); ?> " /> </p> </div> </div> <div id="modules" class="postbox leaky-paywall-subscription-settings"> <div class="handlediv" title="Click to toggle"><br /></div> <h3 class="hndle"><span><?php _e('Subscription Levels', 'issuem-leaky-paywall'); ?> </span></h3> <div id="leaky_paywall_subscription_level_options" class="inside"> <table id="leaky_paywall_subscription_level_options_table" class="leaky-paywall-table subscription-options form-table"> <tr><td id="issuem-leaky-paywall-subscription-level-rows" colspan="2"> <?php $last_key = -1; if (!empty($settings['levels'])) { $deleted = array(); foreach ($settings['levels'] as $key => $level) { if (!is_numeric($key)) { continue; } echo build_leaky_paywall_subscription_levels_row($level, $key); $last_key = $key; if ($level['deleted'] == 1) { $deleted[] = true; } } // if we have levels but they have all been deleted, add one level if (count($deleted) == count($settings['levels'])) { // set the default key to one more than they last key value $default_key = count($settings['levels']); echo build_leaky_paywall_subscription_levels_row('', $default_key); } } ?> </td></tr> </table> <?php do_action('leaky_paywall_after_subscription_levels', $last_key); ?> <?php if (!is_plugin_active('leaky-paywall-multiple-levels/leaky-paywall-multiple-levels.php')) { echo '<p class="description">Want more levels? Buy our <a target="_blank" href="https://zeen101.com/downloads/leaky-paywall-multiple-levels/">multiple subscription levels</a> add-on.</p>'; } ?> <p class="submit"> <input class="button-primary" type="submit" name="update_leaky_paywall_settings" value="<?php _e('Save Settings', 'issuem-leaky-paywall'); ?> " /> </p> </div> </div> <?php do_action('leaky_paywall_settings_form', $settings); ?> </form> </div> </div> </div> </div> <?php }
/** * AJAX Wrapper * * @since 1.0.0 */ function build_leaky_paywall_subscription_row_ajax() { if (isset($_REQUEST['row-key'])) { die(build_leaky_paywall_subscription_levels_row(array(), $_REQUEST['row-key'])); } else { die; } }