function getPaywall($name = null, $showDisabled = true) { $paywalls = $this->getPaywalls($showDisabled); foreach ($paywalls as $rid => $ps) { if ($rid == $name) { return $ps; } } $ps = new TPPaySettings(array()); $ps->setResourceId($name); $ps->setEnabled(true); $ps->setMode(TPPaySettings::MODE_PPV); return $ps; }
/** * Method outputs the popup form for entering TP parameters. * Will work with both tag and post forms */ function tinypass_post_form(TPPaySettings $ps, $postID = null) { $resource_id = htmlspecialchars(stripslashes($ps->getResourceId())); if ($resource_id == '') { $ps->setResourceId('wp_post_' . $postID); } ?> <div id="poststuff"> <?php wp_nonce_field('tinypass_options', 'tinypass_nonce'); ?> <div class="tp-settings"> <div id="tp-error"></div> <div class="inside"> <input type="hidden" name="tinypass[post_ID]" value="<?php echo $postID; ?> "/> <input type="hidden" name="post_ID" value="<?php echo $postID; ?> "/> <div> <strong>Enable this Post:</strong> <input type="checkbox" autocomplete=off name="tinypass[en]" value="1" <?php echo checked($ps->isEnabled()); ?> > </div> <div class="tp-section"> <div class="postbox"> <h3><?php _e("Enter up to 3 price options"); ?> </h3> <div class="inside"> <table class="tinypass_price_options_form"> <tr> <th width="100"><?php _e('Price'); ?> </th> <th width="180"><?php _e('Length of access'); ?> </th> <th width="270"><?php _e('Caption (optional)'); ?> </th> </tr> </table> <?php echo __tinypass_price_option_display('1', $ps, false, 180); ?> <?php echo __tinypass_price_option_display('2', $ps, false, 180); ?> <?php echo __tinypass_price_option_display('3', $ps, false, 180); ?> <br> <a class="add_option_link button" href="#" onclick="tinypass.addPriceOption();return false;">Add</a> <a class="add_option_link button" href="#" onclick="tinypass.removePriceOption();return false;">Remove</a> </div> </div> </div> <?php echo __tinypass_payment_messaging_post_display($ps); ?> <?php echo __tinypass_custom_rid_display($ps); ?> <div> <center> <button class="button" type="button" onclick="tinypass.saveTinyPassPopup();">Save</button> <button class="button" type="button" onclick="tinypass.closeTinyPassPopup();">Cancel</button> </center> </div> </div> </div> </div> <?php }