Exemplo n.º 1
0
function tinypass_display_card($rid, TPPaySettings $ps)
{
    $tags = $ps->getPremiumTagsArray();
    $all = array();
    $count = 0;
    foreach ($tags as $name) {
        $td = get_term_by('name', $name, 'post_tag');
        $count += $td->count;
        $td = get_term_by('name', $name, 'story_tag');
        if ($td) {
            $count += $td->count;
        }
    }
    ?>

	<div class="paywall-card">
		<div class="slider">
			<form>
				<?php 
    wp_nonce_field('enable_paywall', 'tinypass_nonce');
    ?>
				<input type="hidden" name="tinypass[rid]" value="<?php 
    echo $rid;
    ?>
">
				<?php 
    echo tinypass_slider('tinypass[en]', array('Off' => '0', 'On' => '1'), $ps->getEnabled());
    ?>
			</form>
		</div>
		<div class="type"> <?php 
    echo "{$ps->getModeName()} ({$ps->getModeNameReal()}) ";
    ?>
 </div>
		<div class="title"> <?php 
    echo $ps->getResourceName();
    ?>
 </div>

		<div class="footer">
			<div class="leftcol">
				<div class="section">
					<div class="label"><?php 
    _e("Content");
    ?>
</div>
					<div class="value"><?php 
    echo $count;
    ?>
 Items</div>
				</div>            
				<div class="section">
					<div class="label"><?php 
    _e("Tags");
    ?>
</div>
					<div class="value"><?php 
    _e($ps->getPremiumTags(','));
    ?>
</div>
				</div>            
				<div class="section">
					<div class="label"><?php 
    _e("RID");
    ?>
</div>
					<div class="value">
						<?php 
    echo $ps->getResourceId();
    ?>
						<a onclick="tinypass.showEditRIDPopup('<?php 
    echo esc_js($ps->getResourceId());
    ?>
');return false;">
							<img class="edit-bundle">
						</a>
					</div>
				</div> 
				<div class="clear"></div>
			</div>

			<div class="action">
				<a class="button" href="admin.php?page=TinyPassEditPaywall&rid=<?php 
    echo $rid;
    ?>
">Edit</a>
			</div>            
			<div class="clear"></div>
		</div>

	</div>

	<div id="tp-edit-rid-dialog" style="display:none">
		<form method="post" action="" onsubmit="return false;">
			<div class="info">
				<p>
					This is the Resource ID (RID) to your paywall and all of its content. You can refer to it on your Tinypass publisher dashboard. 
				</p>
				<p>
					<b>Warning:</b> Changing your ResourceID will result in paid users losing access to their content.
				</p>
			</div>

			<input type="hidden" id="rid" name="tinypass[rid]">
			<input type="text" id="value" name="tinypass[value]">
			<?php 
    wp_nonce_field('update_rid', 'tinypass_nonce');
    ?>
			<br>
			<br> <br>
			<div style="text-align: center">
				<a class="button" onclick="tinypass.updateRID(this);return false;">Save</a>
				<a class="button" onclick="tinypass.closeEditRIDPopup();return false;">Cancel</a>
			</div>
		</form>
	</div>

<?php 
}