function mp_content_placement_exemptions($content, $CheckEditPermission = true) { global $post; $excluded_posts = get_option(MediaPass_Plugin::OPT_EXCLUDED_POSTS); $included_posts = get_option(MediaPass_Plugin::OPT_INCLUDED_POSTS); $enable = false; if (current_user_can('edit_posts') && !CheckEditPermission) { // when the user is editing the content, we want to show the short codes $enable = false; // has premium meta } else { if (MediaPass_Plugin::has_premium_meta($post) && (count($excluded_posts) == 0 || !isset($excluded_posts[$post->ID]))) { $enable = true; } else { if (MediaPass_Plugin::has_premium_meta($post) && isset($excluded_posts[$post->ID])) { $enable = false; // following doesn't have premium meta } else { if (isset($included_posts[$post->ID])) { $enable = $included_posts[$post->ID]; // will take the form of true or false } else { if (MediaPass_ContentHelper::has_existing_protection($content)) { $enable = true; } } } } } // either enable or disable the short codes / overlay if ($enable) { $content = MediaPass_ContentHelper::enable_overlay($content, "", !$CheckEditPermission); } else { $content = MediaPass_ContentHelper::strip_all_shortcodes($content); } /* if (current_user_can('edit_posts') || (!MediaPass_Plugin::has_premium_meta($post) && (isset($excluded_posts[$post->ID]) || !$included_posts[$post->ID]))){ $content = MediaPass_ContentHelper::strip_all_shortcodes($content); } else if (MediaPass_ContentHelper::has_existing_protection($content)){ $content = MediaPass_ContentHelper::enable_overlay($content); } else { $content = MediaPass_ContentHelper::enable_overlay($content); } */ return $content; }
public function add_save_shortcodes($content) { global $post; $excluded_posts = get_option(MediaPass_Plugin::OPT_EXCLUDED_POSTS); $included_posts = get_option(MediaPass_Plugin::OPT_INCLUDED_POSTS); $PremiumMeta = MediaPass_Plugin::has_premium_meta($post); $Protection = MediaPass_ContentHelper::has_existing_protection($content); if ($PremiumMeta && $Protection) { if (isset($included_posts[$post->ID])) { unset($included_posts[$post->ID]); } // Remove any exclusions if (isset($excluded_posts[$post->ID])) { unset($excluded_posts[$post->ID]); } } else { if (!$PremiumMeta && $Protection) { $included_posts[$post->ID] = true; // Remove any exclusions if (isset($excluded_posts[$post->ID])) { unset($excluded_posts[$post->ID]); } } else { if ($PremiumMeta && !$Protection) { if (isset($included_posts[$post->ID])) { unset($included_posts[$post->ID]); } $excluded_posts[$post->ID] = true; } else { if (!$PremiumMeta && !$Protection) { if (isset($included_posts[$post->ID])) { unset($included_posts[$post->ID]); } // Remove any exclusions if (isset($excluded_posts[$post->ID])) { unset($excluded_posts[$post->ID]); } } } } } update_option(MediaPass_Plugin::OPT_EXCLUDED_POSTS, $excluded_posts); update_option(MediaPass_Plugin::OPT_INCLUDED_POSTS, $included_posts); return $content; }
<?php $data = $data['Msg']; ?> <div class="wrap"> <h2 class="header"><img src="<?php echo plugins_url('/images/logo-icon.png', dirname(__FILE__)); ?> " class="mp-icon" /><span>Manage account information</span></h2> <p class="subtitle" style="padding-left:0">Update your MediaPass Publisher Account information here. Accurate account and address information ensures proper payment of your Premium subscription revenue to WordPress site administrators, processed and issued by MediaPass.</p> <br/> <form action="" method="post" accept-charset="utf-8"> <?php MediaPass_Plugin::nonce_for(MediaPass_Plugin::NONCE_ACCOUNT); ?> <table border="0" cellspacing="0" cellpadding="0" class="form-table"> <tbody> <tr> <th><label for="Title">Web Site Subject/Title</label></th> <td><input type="text" name="Title" value="<?php echo !empty($data['Title']) ? esc_attr($data['Title']) : null; ?> " id="title" class="regular-text"></td> </tr> <tr> <th><label for="CompanyName">Company Name</label></th> <td><input type="text" name="CompanyName" value="<?php echo !empty($data['CompanyName']) ? esc_attr($data['CompanyName']) : null; ?> " id="company-name" class="regular-text"></td> </tr>
<div class="wrap"> <h2 class="header"><img src="<?php echo plugins_url('/images/logo-icon.png', dirname(__FILE__)); ?> " class="mp-icon" /><span>Pricing Configuration</span></h2> <p class="subtitle" style="padding-left:0">Set up Premium Subscription Prices.</p> <br/> <p class="subtitle" style="padding-left:0">First, choose your Premium Subscription model. Most websites will use Membership Access, to allow multiple pages or sections of content to be included in your premium subscription membership. The Single Article Access is for websites that wish to only charge for specific pieces of content. This option is similar to a pay-per-view model, and does not support ongoing premium subscriptions.</p> <br/> <form action="#" method="post" accept-charset="utf-8" id="membership-form"> <?php MediaPass_Plugin::nonce_for(MediaPass_Plugin::NONCE_PRICING); ?> <div id="subscription-model"> <label for="subscription-model">My Premium Subscription Model:</label> <select name="subscription_model" id="subscription-model" style="width:165px;"> <option value="membership"<?php echo $data['subscription_model'] == 'membership' ? ' selected="selected"' : null; ?> >Membership Access</option> <option value="single"<?php echo $data['subscription_model'] == 'single' ? ' selected="selected"' : null; ?> >Single Article Access</option> </select> </div> <br/> <div id="membership-wrapper"<?php echo $data['subscription_model'] == 'single' ? ' style="display:none"' : null; ?>
public function action_update_post_protection() { check_ajax_referer(self::TARGET_POST, 'nonce'); if (!$this->can_protect_posts()) { die; } $data = json_decode(stripslashes($_POST['data']), true); $posts = $data['selectedPosts']; $action = $data['actionRequested']; $processed = array(); foreach ($posts as $p) { $the_post = get_post($p); //if( $action == 'remove' && MediaPass_ContentHelper::has_existing_protection($the_post->post_content) ) { // $the_post->post_content = MediaPass_ContentHelper::strip_all_shortcodes($the_post->post_content); //} wp_update_post($the_post); // If the post belongs to a Premium Category, Tag, or Author but the user marks it as Free then we should exclude it // If the post has been previously excluded and the user wants to add it back to be Premium then remove the post from the Exclusion // Alter the exclusion options $excluded_posts = get_option(MediaPass_Plugin::OPT_EXCLUDED_POSTS); $included_posts = get_option(MediaPass_Plugin::OPT_INCLUDED_POSTS); if (MediaPass_Plugin::has_premium_meta($the_post)) { if ($action == 'remove') { // Remove inclusion, this post is now free $included_posts[$the_post->ID] = false; unset($included_posts[$the_post->ID]); // Add an exclusion, so the post is free even if it has premium meta data $excluded_posts[$the_post->ID] = true; } else { // Add this inclusion, this post is now premium $included_posts[$the_post->ID] = true; // Remove any exclusions if (isset($excluded_posts[$the_post->ID])) { unset($excluded_posts[$the_post->ID]); } } } else { // This will include or not include posts without premium meta data if ($action == 'remove') { $included_posts[$the_post->ID] = false; unset($included_posts[$the_post->ID]); } else { $included_posts[$the_post->ID] = true; // Remove any exclusions if (isset($excluded_posts[$the_post->ID])) { unset($excluded_posts[$the_post->ID]); } } } update_option(MediaPass_Plugin::OPT_EXCLUDED_POSTS, $excluded_posts); update_option(MediaPass_Plugin::OPT_INCLUDED_POSTS, $included_posts); array_push($processed, $p); } $resp = array(); $resp['result'] = "success"; $resp['updatedStatus'] = $action == 'remove' ? 'unprotected' : 'protected'; $resp['updatedPosts'] = $processed; echo json_encode($resp); die; }
<?php if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN')) { exit; } require_once dirname(__FILE__) . "/mediapass_plugin.php"; MediaPass_Plugin::delete_all_options();
<div class="wrap"> <h2 class="header"><img src="<?php echo plugins_url('/images/logo-icon.png', dirname(__FILE__)); ?> " class="mp-icon" /><span>Customize Logo and Benefits</span></h2> <h3>Logo</h3> <p>Upload a logo to customize the look and feel of your Page Overlay and Video Overlay subscription options. Your logo must be a jpg. See examples below.</p> <form name="benefits" action="" method="post" accept-charset="utf-8" id="benefits-form" enctype="multipart/form-data"> <?php MediaPass_Plugin::nonce_for(MediaPass_Plugin::NONCE_BENEFITS); ?> <br/><br/> <table width="100%" border="0" cellpadding="0" cellspacing="0" id="logo_benefits_options"> <colgroup> <col class="first_column" /> </colgroup> <tr valign="top"> <th valign="top" scope="row">Upload Image</th> <td valign="top"><label for="upload_image"> <input id="upload_image" type="text" size="36" name="upload_image" value="" /> <input id="upload_image_button" type="button" value="Upload Image" /> <!--<input id="upload_image" type="file" name="upload_image" value="" />--> <p>Enter URL or upload an image for the logo.</p> </label><input type="submit" value="Update"> </td> </tr> <tr> <th valign="top">Current Logo</th> <td valign="top">
<div class="wrap"> <h2 class="header"><img src="<?php echo plugins_url('/images/logo-icon.png', dirname(__FILE__)); ?> " class="mp-icon" /><span>Manage eCPM Floor</span></h2> <form action="" method="post" accept-charset="utf-8"> <?php MediaPass_Plugin::nonce_for(MediaPass_Plugin::NONCE_ECPM_FLOOR); ?> <table border="0" class="form-table"> <tr> <th><label for="ecpm_floor">eCPM Floor</label></th> <td> <input type="text" name="ecpm_floor" value="<?php echo esc_attr($data['Msg']); ?> " id="ecpm_floor"> </td> </tr> <tr> <td colspan="2"><input type="submit" value="Update"></td> </tr> </table> </form> </div>
</tr> </table> </form> <br/> </div> <h3 id="a-pricing">Set Pricing</h3> <div id="membership-wrapper"> <p class="subtitle" style="padding-left:0">Setting up a "Network Pass" allows site visitors to pay to access Premium content on multiple website, all managed by one WordPress administrator. Pricing specified here will be made available to people who wish to subscribe to all sites in your Network.</p> <br/> <p class="subtitle" style="padding-left:0">Your site visitors will see three options when asked to sign-up for a Premium subscription. Select the 3 subscription membership periods to choose from, and the corresponding unit price for each period. For example, if you want to charge $60 for a 6 month subscription, enter $10 for the unit price.</p> <br/> <form method="POST"> <?php MediaPass_Plugin::nonce_for(MediaPass_Plugin::NONCE_NETWORK); ?> <input type="hidden" name="mp-network-update-active-network-pricing" value="1" /> <table border="0" cellspacing="0" cellpadding="0" id="price-points"> <tr> <th>Period Length</th> <th>Unit Price</th> </tr> <?php $i = 0; while ($i <= 2) { ?> <tr> <td>
<div class="wrap"> <h2 class="header"><img src="<?php echo plugins_url('/images/logo-icon.png', dirname(__FILE__)); ?> " class="mp-icon" /><span>Plugin Settings</span></h2> <form action="" method="post" accept-charset="utf-8"> <?php MediaPass_Plugin::nonce_for(MediaPass_Plugin::NONCE_METERED); ?> <h3>Paywall Settings</h3> <table border="0" class="form-table"> <tr> <th><label for="DefaultPlacementMode">Paywall Style</label></th> <td> <select name="DefaultPlacementMode" id="DefaultPlacementMode" onchange="if (this.value == 'inpage'){ document.getElementById('numparagraphs').style.display='table-row'; } else { document.getElementById('numparagraphs').style.display='none'; }"> <option value="overlay"<?php echo get_option(MediaPass_Plugin::OPT_DEFAULT_PLACEMENT_MODE) == 'overlay' ? ' selected="selected"' : null; ?> >Page Overlay</option> <option value="inpage"<?php echo get_option(MediaPass_Plugin::OPT_DEFAULT_PLACEMENT_MODE) == 'inpage' ? ' selected="selected"' : null; ?> >In-Page</option> </select> </td> </tr> <tr id="numparagraphs" style="display:<?php echo get_option(MediaPass_Plugin::OPT_DEFAULT_PLACEMENT_MODE) == 'inpage' ? 'table-row' : 'none'; ?> ;">