示例#1
0
/**
 * Displays listing package custom columns data.
 *
 * @param string $column_index
 * @param int $post_id
 *
 * @return void
 */
function cp_package_listing_add_column_data($column_index, $post_id)
{
    $package = cp_get_listing_package($post_id);
    if (!$package) {
        return;
    }
    switch ($column_index) {
        case 'description':
            echo strip_tags($package->description);
            break;
        case 'price':
            appthemes_display_price($package->price);
            break;
        case 'duration':
            printf(_n('%d day', '%d days', $package->duration, APP_TD), $package->duration);
            break;
        case 'status':
            if ($package->post_status == 'publish') {
                _e('Active', APP_TD);
            } else {
                _e('Inactive', APP_TD);
            }
            break;
    }
}
示例#2
0
/**
 * Displays coupon custom columns data.
 *
 * @param string $column_index
 * @param int $post_id
 *
 * @return void
 */
function appthemes_coupon_add_column_data($column_index, $post_id)
{
    $coupon = get_post($post_id);
    $coupon_meta = get_post_custom($post_id);
    switch ($column_index) {
        case 'discount':
            if ($coupon_meta['type'][0] == 'flat') {
                $discount = (double) $coupon_meta['amount'][0];
                appthemes_display_price($discount);
            } else {
                $discount = (int) $coupon_meta['amount'][0];
                echo $discount . '%';
            }
            break;
        case 'usage':
            $uses = isset($coupon_meta['use_count'][0]) ? $coupon_meta['use_count'][0] : 0;
            if (empty($coupon_meta['use_limit'][0])) {
                printf(__('%d / Unlimited', 'appthemes-coupons'), $uses);
            } else {
                printf(_x('%1$d / %2$d', 'Coupon usage, 1 - uses, 2 - limit', 'appthemes-coupons'), $uses, $coupon_meta['use_limit'][0]);
            }
            break;
        case 'expires':
            if (empty($coupon_meta['end_date'][0])) {
                _e('Not expiring', 'appthemes-coupons');
            } else {
                echo appthemes_display_date($coupon_meta['end_date'][0], 'date');
            }
            break;
        case 'status':
            if ($coupon->post_status == 'publish') {
                _e('Active', 'appthemes-coupons');
            } else {
                _e('Inactive', 'appthemes-coupons');
            }
            break;
    }
}
示例#3
0
/**
 * Displays preview of submitted ad listing.
 *
 * @param array $postvals
 *
 * @return void
 */
function cp_show_review($postvals)
{
    if (empty($postvals['fid'])) {
        // get default form fields
        $form_fields = cp_get_custom_form_fields();
    } else {
        $form_fields = cp_get_custom_form_fields($postvals['fid']);
    }
    if ($form_fields) {
        // loop through the custom form fields and display them
        cp_formbuilder_review($form_fields, $postvals);
    } else {
        printf(__('ERROR: The form template for form ID %s does not exist or the session variable is empty.', APP_TD), $postvals['fid']);
    }
    ?>

	<hr class="bevel" />
	<div class="clr"></div>


	<li>
		<div class="labelwrapper">
			<label><?php 
    _e('Ad Listing Fee:', APP_TD);
    ?>
</label>
		</div>
		<div id="review"><?php 
    if (cp_payments_is_enabled()) {
        appthemes_display_price($postvals['cp_sys_ad_listing_fee']);
    } else {
        _e('FREE', APP_TD);
    }
    ?>
</div>
		<div class="clr"></div>
	</li>

	<?php 
    if (!empty($postvals['featured_ad'])) {
        ?>
		<li>
			<div class="labelwrapper">
				<label><?php 
        _e('Featured Listing Fee:', APP_TD);
        ?>
</label>
			</div>
			<div id="review"><?php 
        appthemes_display_price($postvals['cp_sys_feat_price']);
        ?>
</div>
			<div class="clr"></div>
		</li>
	<?php 
    }
    ?>

	<?php 
    if (isset($postvals['membership_pack'])) {
        ?>
		<li>
			<div class="labelwrapper">
				<label><?php 
        _e('Membership:', APP_TD);
        ?>
</label>
			</div>
			<div id="review"><?php 
        echo cp_get_membership_package_benefit_text($postvals['membership_pack']);
        ?>
</div>
			<div class="clr"></div>
		</li>
	<?php 
    }
    ?>

	<hr class="bevel-double" />
	<div class="clr"></div>

	<li>
		<div class="labelwrapper">
			<label><?php 
    _e('Total Amount Due:', APP_TD);
    ?>
</label>
		</div>
		<div id="review"><strong>
		<?php 
    if (cp_payments_is_enabled()) {
        appthemes_display_price($postvals['cp_sys_total_ad_cost']);
    } else {
        _e('--', APP_TD);
    }
    ?>
		</strong></div>
		<div class="clr"></div>
	</li>

	<?php 
    if (cp_payments_is_enabled()) {
        do_action('appthemes_purchase_fields');
    }
    ?>

<?php 
}
function cp_show_review($postvals)
{
    //var_dump($postvals);
    global $wpdb;
    // if there's no form id it must mean the default form is being used so let's go grab those fields
    if (empty($postvals['fid'])) {
        // use this if there's no custom form being used and give us the default form
        $sql = "SELECT field_label, field_name, field_type, field_values, field_req FROM {$wpdb->cp_ad_fields} WHERE field_core = '1' ORDER BY field_id asc";
    } else {
        // now we should have the formid so show the form layout based on the category selected
        $sql = $wpdb->prepare("SELECT f.field_label,f.field_name,f.field_type,f.field_values,f.field_perm,m.meta_id,m.field_pos,m.field_req,m.form_id " . "FROM {$wpdb->cp_ad_fields} f " . "INNER JOIN {$wpdb->cp_ad_meta} m " . "ON f.field_id = m.field_id " . "WHERE m.form_id = %s " . "ORDER BY m.field_pos asc", $postvals['fid']);
    }
    $results = $wpdb->get_results($sql);
    if ($results) {
        // loop through the custom form fields and display them
        echo cp_formbuilder_review($results);
    } else {
        printf(__('ERROR: The form template for form ID %s does not exist or the session variable is empty.', APP_TD), $postvals['fid']);
    }
    ?>

	<hr class="bevel" />
	<div class="clr"></div>


	<li>
		<div class="labelwrapper">
			<label><?php 
    _e('Ad Listing Fee:', APP_TD);
    ?>
</label>
		</div>
		<div id="review"><?php 
    if (cp_payments_is_enabled()) {
        appthemes_display_price($postvals['cp_sys_ad_listing_fee']);
    } else {
        _e('FREE', APP_TD);
    }
    ?>
</div>
		<div class="clr"></div>
	</li>

	<?php 
    if (isset($postvals['featured_ad'])) {
        ?>
		<li>
			<div class="labelwrapper">
				<label><?php 
        _e('Featured Listing Fee:', APP_TD);
        ?>
</label>
			</div>
			<div id="review"><?php 
        appthemes_display_price($postvals['cp_sys_feat_price']);
        ?>
</div>
			<div class="clr"></div>
		</li>
	<?php 
    }
    ?>
	
	<?php 
    if (isset($postvals['membership_pack'])) {
        ?>
		<li>
			<div class="labelwrapper">
				<label><?php 
        _e('Membership:', APP_TD);
        ?>
</label>
			</div>
			<div id="review"><?php 
        echo get_pack_benefit($postvals['membership_pack']);
        ?>
</div>
			<div class="clr"></div>
		</li>
	<?php 
    }
    ?>

	<hr class="bevel-double" />
	<div class="clr"></div>

	<li>
		<div class="labelwrapper">
			<label><?php 
    _e('Total Amount Due:', APP_TD);
    ?>
</label>
		</div>
		<div id="review"><strong>
		<?php 
    if (cp_payments_is_enabled()) {
        appthemes_display_price($postvals['cp_sys_total_ad_cost']);
    } else {
        _e('--', APP_TD);
    }
    ?>
		</strong></div>
		<div class="clr"></div>
	</li>

	<?php 
    if (cp_payments_is_enabled() && $postvals['cp_sys_total_ad_cost'] > 0) {
        do_action('appthemes_purchase_fields');
    }
    ?>

<?php 
}
示例#5
0
function cp_ad_packs()
{
    global $wpdb, $current_user, $options_new_ad_pack, $options_new_membership_pack, $cp_options;
    $current_user = wp_get_current_user();
    $theswitch = isset($_GET['action']) ? $_GET['action'] : '';
    ?>

	<script type="text/javascript">
	/* <![CDATA[ */
		/* initialize the form validation */
		jQuery(document).ready(function($) {
			$("#mainform").validate({errorClass: "invalid"});
		});
	/* ]]> */
	</script>

	<?php 
    $options_new_pack = isset($_GET['type']) && $_GET['type'] == 'membership' ? $options_new_membership_pack : $options_new_ad_pack;
    switch ($theswitch) {
        case 'addpack':
            ?>

			<div class="wrap">
				<div class="icon32" id="icon-themes"><br /></div>
				<h2><?php 
            if ($_GET['type'] == 'membership') {
                _e('New Membership Pack', APP_TD);
            } else {
                _e('New Ad Pack', APP_TD);
            }
            ?>
</h2>

				<?php 
            // check and make sure the form was submitted
            if (isset($_POST['submitted'])) {
                //setup optional variables for the package
                $post_pack_satisfies_required = isset($_POST['pack_satisfies_required']) ? $_POST['pack_satisfies_required'] : '';
                $post_pack_type = isset($_POST['pack_type']) ? $post_pack_satisfies_required . $_POST['pack_type'] : '';
                $post_pack_membership_price = isset($_POST['pack_membership_price']) ? $_POST['pack_membership_price'] : 0;
                $data = array('pack_name' => appthemes_clean($_POST['pack_name']), 'pack_desc' => appthemes_clean($_POST['pack_desc']), 'pack_price' => appthemes_clean_price($_POST['pack_price'], 'float'), 'pack_duration' => appthemes_clean($_POST['pack_duration']), 'pack_status' => appthemes_clean($_POST['pack_status']), 'pack_type' => appthemes_clean($post_pack_type), 'pack_membership_price' => appthemes_clean_price($post_pack_membership_price, 'float'), 'pack_owner' => appthemes_clean($_POST['pack_owner']), 'pack_modified' => current_time('mysql'), 'pack_horse_limit' => appthemes_clean($_POST['pack_horse_limit']), 'pack_video_limit' => appthemes_clean($_POST['pack_video_limit']), 'pack_imagelimit' => appthemes_clean($_POST['pack_imagelimit']), 'pack_secure_mail' => appthemes_clean($_POST['pack_secure_mail']), 'pack_social_media' => appthemes_clean($_POST['pack_social_media']), 'pack_cancel' => appthemes_clean($_POST['pack_cancel']), 'pack_ad_views' => appthemes_clean($_POST['pack_ad_views']), 'pack_link_to_site' => appthemes_clean($_POST['pack_link_to_site']), 'pack_iso_ad' => appthemes_clean($_POST['pack_iso_ad']));
                $insert = $wpdb->insert($wpdb->cp_ad_packs, $data);
                if ($insert) {
                    ?>

						<p style="text-align:center;padding-top:50px;font-size:22px;"><?php 
                    _e('Creating your ad package.....', APP_TD);
                    ?>
<br /><br /><img src="<?php 
                    echo get_template_directory_uri();
                    ?>
/images/loader.gif" alt="" /></p>
						<meta http-equiv="refresh" content="0; URL=?page=packages">

					<?php 
                }
            } else {
                ?>

					<form method="post" id="mainform" action="">

						<?php 
                cp_admin_fields($options_new_pack);
                ?>

						<p class="submit">
							<input class="btn button-primary" name="save" type="submit" value="<?php 
                _e('Create New Ad Package', APP_TD);
                ?>
" />&nbsp;&nbsp;&nbsp;
							<input class="btn button-secondary" name="cancel" type="button" onClick="location.href='?page=packages'" value="<?php 
                _e('Cancel', APP_TD);
                ?>
" />
							<input name="submitted" type="hidden" value="yes" />
							<input name="pack_owner" type="hidden" value="<?php 
                echo $current_user->user_login;
                ?>
" />
						</p>

					</form>

				<?php 
            }
            ?>

			</div><!-- end wrap -->

		<?php 
            break;
        case 'editpack':
            ?>

			<div class="wrap">
				<div class="icon32" id="icon-themes"><br /></div>
				<h2><?php 
            _e('Edit Ad Package', APP_TD);
            ?>
</h2>

				<?php 
            if (isset($_POST['submitted']) && $_POST['submitted'] == 'yes') {
                //setup optional variables for the package
                $post_pack_satisfies_required = isset($_POST['pack_satisfies_required']) ? $_POST['pack_satisfies_required'] : '';
                $post_pack_type = isset($_POST['pack_type']) ? $post_pack_satisfies_required . $_POST['pack_type'] : '';
                $post_pack_membership_price = isset($_POST['pack_membership_price']) ? $_POST['pack_membership_price'] : 0;
                $data = array('pack_name' => appthemes_clean($_POST['pack_name']), 'pack_desc' => appthemes_clean($_POST['pack_desc']), 'pack_price' => appthemes_clean_price($_POST['pack_price'], 'float'), 'pack_duration' => appthemes_clean($_POST['pack_duration']), 'pack_status' => appthemes_clean($_POST['pack_status']), 'pack_type' => appthemes_clean($post_pack_type), 'pack_membership_price' => appthemes_clean_price($post_pack_membership_price, 'float'), 'pack_owner' => appthemes_clean($_POST['pack_owner']), 'pack_modified' => current_time('mysql'), 'pack_horse_limit' => appthemes_clean($_POST['pack_horse_limit']), 'pack_video_limit' => appthemes_clean($_POST['pack_video_limit']), 'pack_imagelimit' => appthemes_clean($_POST['pack_imagelimit']), 'pack_secure_mail' => appthemes_clean($_POST['pack_secure_mail']), 'pack_social_media' => appthemes_clean($_POST['pack_social_media']), 'pack_cancel' => appthemes_clean($_POST['pack_cancel']), 'pack_ad_views' => appthemes_clean($_POST['pack_ad_views']), 'pack_link_to_site' => appthemes_clean($_POST['pack_link_to_site']), 'pack_iso_ad' => appthemes_clean($_POST['pack_iso_ad']));
                $update = $wpdb->update($wpdb->cp_ad_packs, $data, array('pack_id' => $_GET['id']));
                ?>

						<p style="text-align:center;padding-top:50px;font-size:22px;"><?php 
                _e('Saving your changes.....', APP_TD);
                ?>
<br /><br /><img src="<?php 
                echo get_template_directory_uri();
                ?>
/images/loader.gif" alt="" /></p>
						<meta http-equiv="refresh" content="0; URL=?page=packages">

				<?php 
            } else {
                ?>

					<form method="post" id="mainform" action="">

						<?php 
                cp_admin_db_fields($options_new_pack, 'cp_ad_packs', 'pack_id');
                ?>

						<p class="submit">
							<input class="btn button-primary" name="save" type="submit" value="<?php 
                _e('Save changes', APP_TD);
                ?>
" />&nbsp;&nbsp;&nbsp;
							<input class="btn button-secondary" name="cancel" type="button" onClick="location.href='?page=packages'" value="<?php 
                _e('Cancel', APP_TD);
                ?>
" />
							<input name="submitted" type="hidden" value="yes" />
							<input name="pack_owner" type="hidden" value="<?php 
                echo $current_user->user_login;
                ?>
" />
						</p>

					</form>

				<?php 
            }
            ?>

			</div><!-- end wrap -->

		<?php 
            break;
        case 'delete':
            $delete = $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->cp_ad_packs} WHERE pack_id = %d", $_GET['id']));
            ?>

				<p style="text-align:center;padding-top:50px;font-size:22px;"><?php 
            _e('Deleting ad package.....', APP_TD);
            ?>
<br /><br /><img src="<?php 
            echo get_template_directory_uri();
            ?>
/images/loader.gif" alt="" /></p>
				<meta http-equiv="refresh" content="0; URL=?page=packages">

		<?php 
            break;
        default:
            $results = $wpdb->get_results("SELECT * FROM {$wpdb->cp_ad_packs} ORDER BY pack_id desc");
            ?>

			<div class="wrap">
				<div class="icon32" id="icon-themes"><br /></div>
				<h2><?php 
            _e('Ad Packs', APP_TD);
            ?>
&nbsp;<a class="add-new-h2" href="?page=packages&amp;action=addpack&amp;type=ad"><?php 
            _e('Add New', APP_TD);
            ?>
</a></h2>

				<?php 
            if ($cp_options->price_scheme != 'single') {
                ?>
					<div class="error"><p><?php 
                printf(__('Ad Packs are disabled. Change the <a href="%1$s">pricing model</a> to enable Ad Packs.', APP_TD), 'admin.php?page=app-pricing&tab=general');
                ?>
</p></div>
				<?php 
            }
            ?>

				<p class="admin-msg"><?php 
            _e('Ad Packs allow you to create bundled listing options for your customers to choose from. For example, instead of only offering a set price for xx days (30 days for $5), you could also offer discounts for longer terms (60 days for $7). These only work if you are selling ads and using the "Fixed Price Per Ad" price model.', APP_TD);
            ?>
</p>

				<table id="tblspacer" class="widefat fixed">

					<thead>
						<tr>
							<th scope="col" style="width:35px;">&nbsp;</th>
							<th scope="col"><?php 
            _e('Name', APP_TD);
            ?>
</th>
							<th scope="col"><?php 
            _e('Description', APP_TD);
            ?>
</th>
							<th scope="col"><?php 
            _e('Price Per Ad', APP_TD);
            ?>
</th>
							<th scope="col"><?php 
            _e('Duration', APP_TD);
            ?>
</th>
							<th scope="col" style="width:150px;"><?php 
            _e('Modified', APP_TD);
            ?>
</th>
							<th scope="col" style="width:75px;"><?php 
            _e('Status', APP_TD);
            ?>
</th>
							<th scope="col" style="text-align:center;width:100px;"><?php 
            _e('Actions', APP_TD);
            ?>
</th>
							</tr>
						</thead>

						<?php 
            if ($results) {
                $rowclass = '';
                $i = 1;
                ?>

							<tbody id="list">

								<?php 
                foreach ($results as $result) {
                    if ($result->pack_status == 'active' || $result->pack_status == 'inactive') {
                        $rowclass = 'even' == $rowclass ? 'alt' : 'even';
                        ?>

										<tr class="<?php 
                        echo $rowclass;
                        ?>
">
											<td style="padding-left:10px;"><?php 
                        echo $i++;
                        ?>
.</td>
											<td><a href="?page=packages&amp;action=editpack&amp;type=ad&amp;id=<?php 
                        echo $result->pack_id;
                        ?>
"><strong><?php 
                        echo stripslashes($result->pack_name);
                        ?>
</strong></a></td>
											<td><?php 
                        echo $result->pack_desc;
                        ?>
</td>
											<td><?php 
                        appthemes_display_price($result->pack_price);
                        ?>
</td>
											<td><?php 
                        echo $result->pack_duration;
                        ?>
&nbsp;<?php 
                        _e('days', APP_TD);
                        ?>
</td>
											<td><?php 
                        echo appthemes_display_date($result->pack_modified);
                        ?>
 <?php 
                        _e('by', APP_TD);
                        ?>
 <?php 
                        echo $result->pack_owner;
                        ?>
</td>
											<td><?php 
                        echo cp_get_status_i18n($result->pack_status);
                        ?>
</td>
											<td style="text-align:center">
												<a href="?page=packages&amp;action=editpack&amp;type=ad&amp;id=<?php 
                        echo $result->pack_id;
                        ?>
"><img src="<?php 
                        echo get_template_directory_uri();
                        ?>
/images/edit.png" alt="<?php 
                        _e('Edit ad package', APP_TD);
                        ?>
" title="<?php 
                        _e('Edit ad package', APP_TD);
                        ?>
" /></a>&nbsp;&nbsp;&nbsp;
												<a onclick="return confirmBeforeDelete();" href="?page=packages&amp;action=delete&amp;id=<?php 
                        echo $result->pack_id;
                        ?>
"><img src="<?php 
                        echo get_template_directory_uri();
                        ?>
/images/cross.png" alt="<?php 
                        _e('Delete ad package', APP_TD);
                        ?>
" title="<?php 
                        _e('Delete ad package', APP_TD);
                        ?>
" /></a>
											</td>
										</tr>

								<?php 
                    }
                    //end if('active' || 'inactive')
                }
                // end foreach
                unset($i);
                ?>

							</tbody>

						<?php 
            } else {
                ?>

							<tr>
								<td colspan="7"><?php 
                _e('No ad packs found.', APP_TD);
                ?>
</td>
							</tr>

						<?php 
            }
            // end $results
            ?>

				</table>


			</div><!-- end wrap for ad packs -->

			<div id="membership-packs" class="wrap">
				<div class="icon32" id="icon-themes"><br /></div>
				<h2><?php 
            _e('Membership Packs', APP_TD);
            ?>
&nbsp;<a class="add-new-h2" href="?page=packages&amp;action=addpack&amp;type=membership"><?php 
            _e('Add New', APP_TD);
            ?>
</a></h2>

				<p class="admin-msg"><?php 
            printf(__('Membership Packs allow you to setup subscription-based pricing packages. This enables your customers to post unlimited ads for a set period of time or until the membership becomes inactive. These memberships affect pricing regardless of the ad packs or pricing model you have set as long as you have enabled the <a href="%1$s">membership packs</a> option.', APP_TD), 'admin.php?page=app-pricing&tab=membership');
            ?>
</p>

				<table id="tblspacer" class="widefat fixed">

					<thead>
						<tr>
							<th scope="col" style="width:35px;">&nbsp;</th>
							<th scope="col"><?php 
            _e('Name', APP_TD);
            ?>
</th>
							<th scope="col"><?php 
            _e('Description', APP_TD);
            ?>
</th>
							<th scope="col"><?php 
            _e('Price Modifier', APP_TD);
            ?>
</th>
							<th scope="col"><?php 
            _e('Terms', APP_TD);
            ?>
</th>
							<th scope="col" style="width:150px;"><?php 
            _e('Modified', APP_TD);
            ?>
</th>
							<th scope="col" style="width:75px;"><?php 
            _e('Status', APP_TD);
            ?>
</th>
							<th scope="col" style="text-align:center;width:100px;"><?php 
            _e('Actions', APP_TD);
            ?>
</th>
						</tr>
					</thead>

					<?php 
            if ($results) {
                $rowclass = '';
                $i = 1;
                ?>

						<tbody id="list">

							<?php 
                foreach ($results as $result) {
                    if ($result->pack_status == 'active_membership' || $result->pack_status == 'inactive_membership') {
                        $rowclass = 'even' == $rowclass ? 'alt' : 'even';
                        ?>

									<tr class="<?php 
                        echo $rowclass;
                        ?>
">
										<td style="padding-left:10px;"><?php 
                        echo $i++;
                        ?>
.</td>
										<td><a href="?page=packages&amp;action=editpack&amp;type=membership&amp;id=<?php 
                        echo $result->pack_id;
                        ?>
"><strong><?php 
                        echo stripslashes($result->pack_name);
                        ?>
</strong></a></td>
										<td><?php 
                        echo $result->pack_desc;
                        ?>
</td>
										<td>
						<?php 
                        switch ($result->pack_type) {
                            case 'percentage':
                                echo preg_replace('/.00$/', '', $result->pack_price) . '% ' . __('of price', APP_TD);
                                //remove decimal when decimal is .00
                                break;
                            case 'discount':
                                printf(__('%s\'s less per ad', APP_TD), appthemes_get_price($result->pack_price));
                                break;
                            case 'required_static':
                                if ((double) $result->pack_price == 0) {
                                    _e('Free', APP_TD);
                                } else {
                                    printf(__('%s per ad', APP_TD), appthemes_get_price($result->pack_price));
                                }
                                echo ' (' . __('required to post', APP_TD) . ')';
                                break;
                            case 'required_discount':
                                printf(__('%s\'s less per ad', APP_TD), appthemes_get_price($result->pack_price));
                                echo ' (' . __('required to post', APP_TD) . ')';
                                break;
                            case 'required_percentage':
                                echo preg_replace('/.00$/', '', $result->pack_price) . '% ' . __('of price', APP_TD);
                                //remove decimal when decimal is .00
                                echo ' (' . __('required to post', APP_TD) . ')';
                                break;
                            default:
                                //likely 'static'
                                if ((double) $result->pack_price == 0) {
                                    _e('Free', APP_TD);
                                } else {
                                    printf(__('%s per ad', APP_TD), appthemes_get_price($result->pack_price));
                                }
                        }
                        ?>
										</td>
										<td><?php 
                        printf(__('%1$s / %2$s days', APP_TD), appthemes_get_price($result->pack_membership_price), $result->pack_duration);
                        ?>
</td>
										<td><?php 
                        echo appthemes_display_date($result->pack_modified);
                        ?>
 <?php 
                        _e('by', APP_TD);
                        ?>
 <?php 
                        echo $result->pack_owner;
                        ?>
</td>
										<td><?php 
                        echo cp_get_status_i18n($result->pack_status);
                        ?>
</td>
										<td style="text-align:center">
											<a href="?page=packages&amp;action=editpack&amp;type=membership&amp;id=<?php 
                        echo $result->pack_id;
                        ?>
"><img src="<?php 
                        echo get_template_directory_uri();
                        ?>
/images/edit.png" alt="<?php 
                        _e('Edit ad package', APP_TD);
                        ?>
" title="<?php 
                        _e('Edit ad package', APP_TD);
                        ?>
" /></a>&nbsp;&nbsp;&nbsp;
											<a onclick="return confirmBeforeDelete();" href="?page=packages&amp;action=delete&amp;id=<?php 
                        echo $result->pack_id;
                        ?>
"><img src="<?php 
                        echo get_template_directory_uri();
                        ?>
/images/cross.png" alt="<?php 
                        _e('Delete ad package', APP_TD);
                        ?>
" title="<?php 
                        _e('Delete ad package', APP_TD);
                        ?>
" /></a>
										</td>
									</tr>

								<?php 
                    }
                    //end if('active_membership' || 'inactive_membership')
                }
                // end foreach
                unset($i);
                ?>

						</tbody>

					<?php 
            } else {
                ?>

						<tr>
							<td colspan="7"><?php 
                _e('No ad packs found.', APP_TD);
                ?>
</td>
						</tr>

					<?php 
            }
            // end $results
            ?>

				</table>


			</div><!-- end wrap for membership packs-->

	<?php 
    }
    // end switch
    ?>
	<script type="text/javascript">
	/* <![CDATA[ */
		function confirmBeforeDelete() { return confirm("<?php 
    _e('Are you sure you want to delete this ad package?', APP_TD);
    ?>
"); }
	/* ]]> */
	</script>

<?php 
}
?>
</div>
				<div class="clr"></div>
			</li>

			<hr class="bevel-double" />
			<div class="clr"></div>

			<li>
				<div class="labelwrapper"><label><?php 
_e('Total Amount Due:', APP_TD);
?>
</label></div>
				<div id="review"><strong><?php 
if ($membership->pack_membership_price > 0) {
    appthemes_display_price($membership->pack_membership_price);
} else {
    _e('--', APP_TD);
}
?>
</strong></div>
				<div class="clr"></div>
			</li>

			<?php 
if (cp_payments_is_enabled() && $membership->pack_membership_price > 0) {
    do_action('appthemes_purchase_fields');
}
?>

		</ol>
 public function test_output()
 {
     $string = appthemes_get_price(1);
     $this->expectOutputString($string);
     appthemes_display_price(1);
 }
示例#8
0
    /**
     * Displays specific details for PayPal Adaptive escrow orders
     *
     * @param object $post WordPress Post object
     */
    function display($post)
    {
        $order = appthemes_get_order($post->ID);
        $details = appthemes_get_escrow_details($order);
        ?>
		<style type="text/css">
			#admin-escrow-order-details td.paypal-email {
				font-size: 11px;
			}
		</style>
		<?php 
        if (!empty($details['paymentInfoList']['paymentInfo'])) {
            ?>
			<table id="admin-escrow-order-details">

				<?php 
            $retained = 0;
            ?>
				<tbody>
						<?php 
            foreach ($details['paymentInfoList']['paymentInfo'] as $key => $payment_info) {
                ?>
							<?php 
                if (0 == $key) {
                    continue;
                }
                ?>
							<?php 
                $retained += $payment_info['receiver']['amount'];
                ?>
							<tr>
								<th><?php 
                _e('Funds', APP_TD);
                ?>
: </th>
								<td><?php 
                echo appthemes_display_price($order->get_total(), $order->get_currency());
                ?>
</td>
							</tr>
							<tr>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<th><?php 
                _e('Receiver', APP_TD);
                ?>
: </th>
								<td class="paypal-email"><?php 
                echo $payment_info['receiver']['email'];
                ?>
</td>
							</tr>
							<tr>
								<th><?php 
                _e('Amount', APP_TD);
                ?>
: </th>
								<td><?php 
                echo appthemes_display_price($payment_info['receiver']['amount'], $order->get_currency());
                ?>
</td>
							</tr>
						<?php 
            }
            ?>
						<tr>
							<th><?php 
            _e('Retained', APP_TD);
            ?>
: </th>
							<td><?php 
            echo appthemes_display_price($order->get_total() - $retained, $order->get_currency());
            ?>
 <?php 
            echo __('(when completed)', APP_TD);
            ?>
 </td>
						</tr>
					</tr>
				</tbody>
			</table>

		<?php 
        } else {
            ?>

			<?php 
            echo __('N/A', APP_TD);
            ?>

		<?php 
        }
        ?>

		<div class="clear"></div>
<?php 
    }