当前位置: 首页>>代码示例>>PHP>>正文


PHP get_pack函数代码示例

本文整理汇总了PHP中get_pack函数的典型用法代码示例。如果您正苦于以下问题:PHP get_pack函数的具体用法?PHP get_pack怎么用?PHP get_pack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_pack函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show_notice

 function show_notice()
 {
     global $current_user;
     $membership_active = false;
     $membership = get_pack($current_user->active_membership_pack);
     if ($membership) {
         $membership_active = appthemes_days_between_dates($current_user->membership_expires) > 0;
     }
     if ($membership_active && !isset($_POST['step2'])) {
         appthemes_display_notice('success', sprintf(__('You have active membership pack "%s". Membership benefit will apply on the review page before publishing an ad.', APP_TD), $membership->pack_name));
     }
 }
开发者ID:kalushta,项目名称:darom,代码行数:12,代码来源:views.php

示例2: cp_ad_listing_fee

         $postvals['featured_ad'] = $_POST['featured_ad'];
         // get the featured ad price into the array
         $postvals['cp_sys_feat_price'] = $cp_options->sys_feat_price;
     }
     // calculate the ad listing fee and put into a variable
     $postvals['cp_sys_ad_listing_fee'] = cp_ad_listing_fee($_POST['cat'], $ad_pack_id, $postvals['cp_price'], $price_curr);
     // calculate the total cost of the ad
     if (isset($postvals['cp_sys_feat_price'])) {
         $postvals['cp_sys_total_ad_cost'] = cp_calc_ad_cost($_POST['cat'], $ad_pack_id, $postvals['cp_sys_feat_price'], $postvals['cp_price'], $coupon, $price_curr);
     } else {
         $postvals['cp_sys_total_ad_cost'] = cp_calc_ad_cost($_POST['cat'], $ad_pack_id, 0, $postvals['cp_price'], $coupon, $price_curr);
     }
     //UPDATE TOTAL BASED ON MEMBERSHIP
     //check for current users active membership pack and that its not expired
     if (!empty($current_user->active_membership_pack) && appthemes_days_between_dates($current_user->membership_expires) > 0) {
         $postvals['membership_pack'] = get_pack($current_user->active_membership_pack);
         //update the total cost based on the membership pack ID and current total cost
         $postvals['cp_sys_total_ad_cost'] = get_pack_benefit($postvals['membership_pack'], $postvals['cp_sys_total_ad_cost']);
         //add featured cost to static pack type
         if (isset($postvals['cp_sys_feat_price']) && in_array($postvals['membership_pack']->pack_type, array('required_static', 'static'))) {
             $postvals['cp_sys_total_ad_cost'] += $postvals['cp_sys_feat_price'];
         }
     }
 }
 // prevent from minus prices if bigger discount applied
 if (!isset($postvals['cp_sys_total_ad_cost']) || $postvals['cp_sys_total_ad_cost'] < 0) {
     $postvals['cp_sys_total_ad_cost'] = 0;
 }
 // now put the array containing all the post values into the database
 // instead of passing hidden values which are easy to hack and so we
 // can also retrieve it on the next step
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:31,代码来源:step2.php

示例3: appthemes_process_membership_order

function appthemes_process_membership_order($current_user, $order)
{
    //if order ID matches pending membership id suffix, then process the order by extendning the date and setting the ID
    if (isset($current_user->active_membership_pack)) {
        $user_active_pack_id = get_pack_id($current_user->active_membership_pack);
    } else {
        $user_active_pack_id = false;
    }
    if (isset($current_user->membership_expires)) {
        $user_active_pack_expiration = $current_user->membership_expires;
    } else {
        $user_active_pack_expiration = strtotime(current_time('mysql'));
    }
    if ($order['total_cost'] == 0 || $order['order_id'] == $_REQUEST['oid'] || $order['order_id'] == $_REQUEST['custom'] || $order['order_id'] == $_REQUEST['invoice']) {
        //update the user profile to current order pack_id taking it off "pending" status and setup the membership object
        update_user_meta($current_user->ID, 'active_membership_pack', $order['pack_id']);
        $membership = get_pack($order['pack_id']);
        //extend membership if its still active, so long as its not free (otherwise free extentions could be infinite)
        $expires_in_days = appthemes_seconds_to_days(strtotime($user_active_pack_expiration) - strtotime(current_time('mysql')));
        $purchase = $order['pack_duration'] . ' ' . __('days', 'appthemes');
        if ($expires_in_days > 0 && $order['total_cost'] > 0 && $order['pack_id'] == $user_active_pack_id) {
            $updated_expires_date = appthemes_mysql_date($user_active_pack_expiration, $order['pack_duration']);
        } else {
            $updated_expires_date = appthemes_mysql_date(current_time('mysql'), $order['pack_duration']);
        }
        update_user_meta($current_user->ID, 'membership_expires', $updated_expires_date);
        $order['updated_expires_date'] = $updated_expires_date;
        delete_option($order['option_order_id']);
        //return the order information in case its needed
        return $order;
    } else {
        //get orders of the user
        $the_order = get_user_orders($current_user->ID, $order['order_id']);
        return false;
    }
}
开发者ID:ugurbastan,项目名称:swe-574-group4,代码行数:36,代码来源:step-functions.php

示例4: get_author_posts_url

/*?><div class="avatar"><?php appthemes_get_profile_pic($current_user->ID, $current_user->user_email, 60); ?></div><?php */
?>

				<?php 
/*?><ul class="user-info">
			<li><h3 class="single"><a href="<?php echo get_author_posts_url($current_user->ID); ?>"><?php echo $display_user_name; ?></a></h3></li>
			<li><strong><?php _e( 'Member Since:', APP_TD ); ?></strong> <?php echo appthemes_display_date( $current_user->user_registered, 'datetime', true ); ?></li>
			<li><strong><?php _e( 'Last Login:', APP_TD ); ?></strong> <?php echo appthemes_get_last_login($current_user->ID); ?></li>
		</ul><?php */
?>

				<?php 
if ($cp_options->enable_membership_packs) {
    ?>
				<?php 
    $membership = get_pack($current_user->active_membership_pack);
    ?>
				<ul class="membership-pack">
					<?php 
    if ($membership && appthemes_days_between_dates($current_user->membership_expires) < 0) {
        ?>
						<li><?php 
        printf(__('Your membership pack "%1$s" expired on %2$s.', APP_TD), $membership->pack_name, appthemes_display_date($current_user->membership_expires));
        ?>
</li>
						<li><a href="<?php 
        echo CP_MEMBERSHIP_PURCHASE_URL;
        ?>
"><?php 
        _e('Renew Your Membership Pack', APP_TD);
        ?>
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:31,代码来源:tpl-billinginfo.php

示例5: elseif

        <div class="shadowblock_out">

          <div class="shadowblock">
			
            <?php 
if (get_option('cp_enable_membership_packs') == 'yes') {
    ?>

				<?php 
    // check and make sure the form was submitted from step1 and the session value exists
    if (isset($_POST['step1'])) {
        include_once TEMPLATEPATH . '/includes/forms/step2-membership.php';
    } elseif (isset($_POST['step2'])) {
        //now put the array containing all the post values into the database
        //DO NOTE USE POST VARS execpt as the relate to options selected. All POST vars are insecure.
        $membership = get_pack($_POST['pack']);
        $order = array();
        $order['user_id'] = $current_user->ID;
        $order['order_id'] = $_POST['oid'];
        $order['option_order_id'] = 'cp_order_' . $current_user->ID . '_' . $_POST['oid'];
        $order['pack_type'] = 'membership';
        $order['total_cost'] = $total_cost;
        //Check for coupon and use to to reduce total price and total number of coupon uses left
        if (isset($_POST['cp_coupon_code'])) {
            $order['cp_coupon_code'] = $_POST['cp_coupon_code'];
            //incriment coupon code count only if total ad price was not zero
            if (cp_check_coupon_discount($order['cp_coupon_code'])) {
                cp_use_coupon($order['cp_coupon_code']);
                //TODO - handle discounting of total cost
            }
        }
开发者ID:joaosigno,项目名称:dazake-job,代码行数:31,代码来源:tpl-membership-purchase.php

示例6: cp_redirect_membership

function cp_redirect_membership()
{
    global $current_user, $cp_options;
    $current_requirement = false;
    $redirect_user = false;
    $current_user = wp_get_current_user();
    //code added by rj starts(user login redirect to membership form)
    if (!is_user_logged_in()) {
        wp_redirect(CP_LOGIN);
    }
    //code added by rj ends
    if (!$cp_options->enable_membership_packs) {
        return;
    }
    if (isset($_POST['cat'])) {
        $current_requirement = get_membership_requirement($_POST['cat']);
    }
    if ($cp_options->required_membership_type == 'all') {
        $current_requirement = 'all';
    }
    if (!$current_requirement) {
        return;
    }
    $current_membership = !empty($current_user->active_membership_pack) ? get_pack($current_user->active_membership_pack) : false;
    if (!$current_membership || empty($current_user->membership_expires)) {
        $redirect_user = true;
    } else {
        if (!stristr($current_membership->pack_type, 'required') || appthemes_days_between_dates($current_user->membership_expires) < 0) {
            $redirect_user = true;
        }
    }
    if ($redirect_user) {
        $redirect_url = add_query_arg(array('membership' => 'required', 'cat' => $current_requirement), CP_MEMBERSHIP_PURCHASE_URL);
        wp_redirect($redirect_url);
        exit;
    }
}
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:37,代码来源:functions_rj_beforemenuchange-18-10-15.php

示例7: cp_redirect_membership

function cp_redirect_membership()
{
    global $current_user, $app_abbr;
    $current_user = wp_get_current_user();
    //if membership required to post, and no membership is active on logged in user, redirect to membership page
    $current_membership = isset($current_user->active_membership_pack) ? get_pack($current_user->active_membership_pack) : false;
    if (isset($_POST['cat'])) {
        $current_requirement = get_membership_requirement($_POST['cat']);
    }
    if (get_option($app_abbr . '_required_membership_type') == 'all') {
        $current_requirement = 'all';
    }
    //if requirement is found, but required is not in the users pack type, fail and redirect to membership page.
    if (isset($current_requirement) && $current_requirement && get_option($app_abbr . '_enable_membership_packs') == 'yes') {
        //if no membership, or if membership but not a membership that satisfies required memberships, or if membership expired
        if (!isset($current_membership->pack_type) || !isset($current_user->membership_expires) || isset($current_membership->pack_type) && !stristr($current_membership->pack_type, 'required') || appthemes_days_between_dates($current_user->membership_expires) < 0) {
            $redirect_url = add_query_arg(array('membership' => 'required', 'cat' => $current_requirement), CP_MEMBERSHIP_PURCHASE_URL);
            wp_redirect($redirect_url);
            exit;
        }
    }
}
开发者ID:kalushta,项目名称:darom,代码行数:22,代码来源:theme-functions.php

示例8: cp_profile_fields

    function cp_profile_fields($user)
    {
        global $appthemes_extended_profile_fields;
        ?>
		<h3><?php 
        _e('Extended Profile', APP_TD);
        ?>
</h3>
		<table class="form-table">

		<?php 
        foreach ($appthemes_extended_profile_fields as $field_id => $field_values) {
            if (isset($field_values['protected']) && $field_values['protected'] == 'yes' && !is_admin()) {
                $protected = 'disabled="disabled"';
            } else {
                $protected = '';
            }
            //TODO - use this value for display purposes while protecting stored value
            //prepare, modify, or filter the field value based on the field ID
            switch ($field_id) {
                case 'active_membership_pack':
                    $the_display_value = get_pack(get_the_author_meta($field_id, $user->ID), '', 'pack_name');
                    break;
                default:
                    $the_display_value = false;
                    break;
            }
            $the_value = get_the_author_meta($field_id, $user->ID);
            //begin writing the row and heading
            ?>
					<tr id="<?php 
            echo $field_id;
            ?>
_row">
						<th><label for="<?php 
            echo $field_id;
            ?>
"><?php 
            echo esc_html($field_values['title']);
            ?>
</label></th>
							<td>
			<?php 
            //print the appropriate profile field based on the type of field
            switch ($field_values['type']) {
                case 'date':
                    ?>
								<input type="text" name="<?php 
                    echo $field_id;
                    ?>
" id="<?php 
                    echo $field_id;
                    ?>
" value="<?php 
                    echo esc_attr($the_value);
                    ?>
" class="regular-text" size="35" <?php 
                    if (!empty($protected)) {
                        echo 'style="display: none;"';
                    }
                    ?>
 /><br />
								<span class="description" <?php 
                    if (!empty($protected)) {
                        echo 'style="display: none;"';
                    }
                    ?>
 ><?php 
                    echo $field_values['admin_description'];
                    ?>
<br /></span>
								<input type="text" name="<?php 
                    echo $field_id;
                    ?>
_display" id="<?php 
                    echo $field_id;
                    ?>
" value="<?php 
                    echo esc_attr(appthemes_display_date($the_value));
                    ?>
" class="regular-text" size="35" disabled="disabled" /><br />
								<span class="description"><?php 
                    echo $field_values['description'];
                    ?>
</span>
				<?php 
                    break;
                case 'active_membership_pack':
                    ?>
								<input type="text" name="<?php 
                    echo $field_id;
                    ?>
" id="<?php 
                    echo $field_id;
                    ?>
" value="<?php 
                    echo esc_attr($the_value);
                    ?>
" class="regular-text" size="35" <?php 
                    if (!empty($protected)) {
//.........这里部分代码省略.........
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:101,代码来源:profile.php

示例9: cp_get_order_pack_vals

/**
* return all the order pack values we plan on using as hidden payment fields
*
* @since 3.1
*
*/
function cp_get_order_pack_vals($order_vals)
{
    // lookup the pack info
    $pack = get_pack($order_vals['pack']);
    // figure out the number of days this ad was listed for
    // not needed? keeping for safety
    $order_vals['prune_period'] = get_option('cp_prun_period');
    //setup variables depending on the purchase type
    if (isset($pack->pack_name) && stristr($pack->pack_status, 'membership')) {
        $order_vals['item_name'] = sprintf(__('Membership on %s for %s days', 'appthemes'), get_bloginfo('name'), $pack->pack_duration);
        $order_vals['item_number'] = stripslashes($pack->pack_name);
        $order_vals['item_amount'] = $pack->pack_membership_price;
        $order_vals['notify_url'] = get_bloginfo('url') . '/index.php?invoice=' . $order_vals['oid'];
        $order_vals['return_url'] = CP_MEMBERSHIP_PURCHASE_CONFIRM_URL . '?oid=' . $order_vals['oid'];
        $order_vals['return_text'] = __('Click here to complete your purchase on', 'appthemes') . ' ' . get_bloginfo('name');
    } else {
        _e("Sorry, but there's been an error.", 'appthemes');
        die;
    }
    return $order_vals;
}
开发者ID:joaosigno,项目名称:dazake-job,代码行数:27,代码来源:theme-functions.php

示例10: cp_dashboard_paypal_button

function cp_dashboard_paypal_button($the_id)
{
    global $wpdb;
    $pack = get_pack($the_id);
    // figure out the number of days this ad was listed for
    if (get_post_meta($the_id, 'cp_sys_ad_duration', true)) {
        $prun_period = get_post_meta($the_id, 'cp_sys_ad_duration', true);
    } else {
        $prun_period = get_option('cp_prun_period');
    }
    //setup variables depending on the purchase type
    if (isset($pack->pack_name) && stristr($pack->pack_status, 'membership')) {
        $item_name = sprintf(__('Membership on %s for %s days', 'appthemes'), get_bloginfo('name'), $pack->pack_duration);
        $item_number = stripslashes($pack->pack_name);
        $amount = $pack->pack_membership_price;
        $notify_url = get_bloginfo('url') . '/index.php?invoice=' . $_POST['oid'];
        $return = CP_MEMBERSHIP_PURCHASE_CONFIRM_URL . '?oid=' . $_POST['oid'];
        $cbt = __('Click here to complete your purchase on', 'appthemes') . ' ' . get_bloginfo('name');
    } else {
        //by default we assume its an ad posting
        $item_name = sprintf(__('Classified ad listing on %s for %s days', 'appthemes'), get_bloginfo('name'), $prun_period);
        $item_number = get_post_meta($the_id, 'cp_sys_ad_conf_id', true);
        $amount = get_post_meta($the_id, 'cp_sys_total_ad_cost', true);
        $notify_url = get_bloginfo('url') . '/index.php?invoice=' . get_post_meta($the_id, 'cp_sys_ad_conf_id', true) . '&amp;aid=' . $the_id;
        $return = CP_ADD_NEW_CONFIRM_URL . '?pid=' . get_post_meta($the_id, 'cp_sys_ad_conf_id', true) . '&amp;aid=' . $the_id;
        $cbt = __('Click here to publish your ad on', 'appthemes') . ' ' . get_bloginfo('name');
    }
    ?>

   <form name="paymentform" action="<?php 
    if (get_option('cp_paypal_sandbox') == 'true') {
        echo 'https://www.sandbox.paypal.com/cgi-bin/webscr';
    } else {
        echo 'https://www.paypal.com/cgi-bin/webscr';
    }
    ?>
" method="post">

       <input type="hidden" name="cmd" value="_xclick" />
       <input type="hidden" name="business" value="<?php 
    echo get_option('cp_paypal_email');
    ?>
" />
       <input type="hidden" name="item_name" value="<?php 
    echo esc_attr($item_name);
    ?>
" />
       <input type="hidden" name="item_number" value="<?php 
    echo esc_attr($item_number);
    ?>
" />
       <input type="hidden" name="amount" value="<?php 
    echo esc_attr($amount);
    ?>
" />
       <input type="hidden" name="no_shipping" value="1" />
       <input type="hidden" name="no_note" value="1" />
       <input type="hidden" name="custom" value="<?php 
    echo esc_attr($_POST['oid']);
    ?>
" />
       <input type="hidden" name="cancel_return" value="<?php 
    echo home_url();
    ?>
" />
       <input type="hidden" name="return" value="<?php 
    echo esc_attr($return);
    ?>
" />
       <input type="hidden" name="rm" value="2" />
       <input type="hidden" name="cbt" value="<?php 
    echo esc_attr($cbt);
    ?>
" />
       <input type="hidden" name="currency_code" value="<?php 
    echo esc_attr(get_option('cp_curr_pay_type'));
    ?>
" />

       <?php 
    if (get_option('cp_enable_paypal_ipn') == 'yes') {
        ?>
           <input type="hidden" name="notify_url" value="<?php 
        echo esc_attr($notify_url);
        ?>
" />
           <?php 
        if (get_option('cp_paypal_sandbox') == 'true') {
            ?>
               <input type="hidden" name="test_ipn" value="1" />
           <?php 
        }
        ?>
	   <?php 
    }
    ?>

       <?php 
    if (get_option('cp_paypal_logo_url')) {
        ?>
//.........这里部分代码省略.........
开发者ID:joaosigno,项目名称:dazake-job,代码行数:101,代码来源:paypal.php

示例11: cp_profile_fields

    function cp_profile_fields($user)
    {
        global $appthemes_extended_profile_fields;
        ?>
		<h3><?php 
        _e('Extended Profile', 'appthemes');
        ?>
</h3>
        <table class="form-table">

			<?php 
        foreach ($appthemes_extended_profile_fields as $field_id => $field_values) {
            if (isset($field_values['protected']) && $field_values['protected'] == 'yes' && !is_admin()) {
                $protected = 'disabled="disabled"';
            } else {
                $protected = '';
            }
            //TODO - use this value for display purposes while protecting stored value
            //prepare, modify, or filter the field value based on the field ID
            switch ($field_id) {
                case 'active_membership_pack':
                    $the_display_value = get_pack(get_the_author_meta($field_id, $user->ID), '', 'pack_name');
                    break;
                default:
                    $the_display_value = false;
                    break;
            }
            $the_value = get_the_author_meta($field_id, $user->ID);
            //begin writing the row and heading
            ?>
						<tr id="<?php 
            echo $field_id;
            ?>
_row">
							<th><label for="<?php 
            echo $field_id;
            ?>
"><?php 
            echo esc_html($field_values['title']);
            ?>
</label></th>
                            <td>
				<?php 
            //print the appropriate profile field based on the type of field
            switch ($field_values['type']) {
                case 'date':
                    ?>
								<input type="text" name="<?php 
                    echo $field_id;
                    ?>
" id="<?php 
                    echo $field_id;
                    ?>
" value="<?php 
                    esc_attr_e($the_value);
                    ?>
" class="regular-text" size="35" <?php 
                    if (!empty($protected)) {
                        echo 'style="display: none;"';
                    }
                    ?>
 /><br />
								<span class="description" <?php 
                    if (!empty($protected)) {
                        echo 'style="display: none;"';
                    }
                    ?>
 ><?php 
                    echo $field_values['admin_description'];
                    ?>
<br /></span>
                <input type="text" name="<?php 
                    echo $field_id;
                    ?>
_display" id="<?php 
                    echo $field_id;
                    ?>
" value="<?php 
                    esc_attr_e(appthemes_display_date($the_value));
                    ?>
" class="regular-text" size="35" disabled="disabled" /><br />
								<span class="description"><?php 
                    echo $field_values['description'];
                    ?>
</span>
				<?php 
                    break;
                case 'active_membership_pack':
                    ?>
								<input type="text" name="<?php 
                    echo $field_id;
                    ?>
" id="<?php 
                    echo $field_id;
                    ?>
" value="<?php 
                    esc_attr_e($the_value);
                    ?>
" class="regular-text" size="35" <?php 
                    if (!empty($protected)) {
//.........这里部分代码省略.........
开发者ID:joaosigno,项目名称:dazake-job,代码行数:101,代码来源:theme-profile.php

示例12: cp_membership_reminder_cron

function cp_membership_reminder_cron()
{
    global $wpdb, $cp_options;
    if (!$cp_options->membership_ending_reminder_email) {
        return;
    }
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $subject = sprintf(__('Membership Subscription Ending on %s', APP_TD), $blogname);
    $siteurl = home_url('/');
    $days_before = $cp_options->membership_ending_reminder_days;
    $days_before = is_numeric($days_before) ? $days_before : 7;
    $timestamp = wp_next_scheduled('cp_send_membership_reminder');
    $timestamp = $timestamp - 1 * 24 * 60 * 60 + get_option('gmt_offset') * 3600;
    // minus 1 day to get current schedule time, plus GMT offset
    $date_max = date('Y-m-d H:i:s', $timestamp + $days_before * 24 * 60 * 60);
    $date_min = date('Y-m-d H:i:s', $timestamp + ($days_before - 1) * 24 * 60 * 60);
    $query_users = $wpdb->prepare("SELECT {$wpdb->users}.ID FROM {$wpdb->users}\n\t\tLEFT JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id\n\t\tWHERE {$wpdb->usermeta}.meta_key = 'membership_expires'\n\t\tAND {$wpdb->usermeta}.meta_value < %s\n\t\tAND {$wpdb->usermeta}.meta_value > %s\n\t\t", $date_max, $date_min);
    $userids = $wpdb->get_col($query_users);
    if (!$userids) {
        return;
    }
    foreach ($userids as $user_id) {
        $user = get_userdata($user_id);
        $mailto = $user->user_email;
        $user_login = appthemes_clean($user->user_login);
        $membership = get_pack($user->active_membership_pack);
        $membership_pack_name = appthemes_clean($membership->pack_name);
        $membership_expires = appthemes_display_date($user->membership_expires);
        $message = html('p', sprintf(__('Hi %s,', APP_TD), $user_login)) . PHP_EOL;
        $message .= html('p', sprintf(__('Your membership pack will expire in %d days! Please renew your membership to continue posting classified ads.', APP_TD), $days_before)) . PHP_EOL;
        $message_details = __('Membership Details', APP_TD) . '<br />';
        $message_details .= __('-----------------', APP_TD) . '<br />';
        $message_details .= sprintf(__('Membership Pack: %s', APP_TD), $membership_pack_name) . '<br />';
        $message_details .= sprintf(__('Membership Expires: %s', APP_TD), $membership_expires) . '<br />';
        $message_details .= sprintf(__('Renew Your Membership Pack: %s', APP_TD), CP_MEMBERSHIP_PURCHASE_URL) . '<br />';
        $message .= html('p', $message_details) . PHP_EOL;
        $message .= html('p', sprintf(__('For questions or problems, please contact us directly at %s', APP_TD), get_option('admin_email')));
        $message .= html('p', __('Regards,', APP_TD) . '<br />' . sprintf(__('Your %s Team', APP_TD), $blogname));
        $message .= html('p', $siteurl);
        $email = array('to' => $mailto, 'subject' => $subject, 'message' => $message);
        $email = apply_filters('cp_email_user_membership_reminder', $email, $order);
        appthemes_send_email($email['to'], $email['subject'], $email['message']);
    }
}
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:44,代码来源:cron.php

示例13: wp_get_current_user

Template Name: Membership Pack Purchases
*/
global $current_user;
$current_user = wp_get_current_user();
if (!isset($errors)) {
    $errors = new WP_Error();
}
// get information about current membership
$active_membership = isset($current_user->active_membership_pack) ? get_pack($current_user->active_membership_pack) : false;
//get any existing orders
$cp_user_orders = get_user_orders($current_user->ID);
$cp_user_recent_order = $cp_user_orders ? $cp_user_orders[0] : false;
if (isset($_POST['step1']) || isset($_POST['step2'])) {
    if (isset($_POST['pack'])) {
        $pack_id = appthemes_numbers_only($_POST['pack']);
        $membership = get_pack($pack_id);
        if (!$membership) {
            $errors->add('invalid-pack-id', __('Choosen membership package does not exist.', APP_TD));
        }
    } else {
        $errors->add('missed-pack', __('You need to choose membership package.', APP_TD));
    }
    if (!isset($_POST['oid']) || $_POST['oid'] != appthemes_numbers_letters_only($_POST['oid'])) {
        $errors->add('invalid-order-id', __('Membership order ID is invalid.', APP_TD));
    }
}
?>


<div class="content">
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:30,代码来源:tpl-membership-purchase.php

示例14: cp_dashboard_paypal_button

/**
 * payment processing for ad dashboard so ad owners can pay for unpaid ads
 *
 * @since 3.0.4
 */
function cp_dashboard_paypal_button($the_id)
{
    global $wpdb, $app_abbr, $current_user;
    $current_user = wp_get_current_user();
    if (get_option('cp_enable_paypal') != 'yes') {
        return;
    }
    // is this a test transaction?
    if (get_option($app_abbr . '_paypal_sandbox') == true) {
        $post_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
    } else {
        $post_url = 'https://www.paypal.com/cgi-bin/webscr';
    }
    $pack = get_pack($the_id);
    // figure out the number of days this ad was listed for
    if (get_post_meta($the_id, 'cp_sys_ad_duration', true)) {
        $prun_period = get_post_meta($the_id, 'cp_sys_ad_duration', true);
    } else {
        $prun_period = get_option('cp_prun_period');
    }
    //setup variables depending on the purchase type
    if (isset($pack->pack_name) && stristr($pack->pack_status, 'membership')) {
        //get any existing orders
        $cp_user_orders = get_user_orders($current_user->ID);
        if (isset($cp_user_orders) && $cp_user_orders) {
            $cp_user_recent_order = $cp_user_orders[0];
        } else {
            $oid = uniqid(rand(10, 1000), false);
            $order = array();
            $order['user_id'] = $current_user->ID;
            $order['order_id'] = $oid;
            $order['option_order_id'] = 'cp_order_' . $current_user->ID . '_' . $oid;
            $order['pack_type'] = 'membership';
            $order['total_cost'] = $pack->pack_membership_price;
            $order = array_merge($order, (array) $pack);
            if (add_option($order['option_order_id'], $order)) {
                $cp_user_orders = get_user_orders($current_user->ID);
                if (isset($cp_user_orders) && $cp_user_orders) {
                    $cp_user_recent_order = $cp_user_orders[0];
                }
            }
        }
        $item_name = sprintf(__('Membership on %s for %s days', APP_TD), get_bloginfo('name'), $pack->pack_duration);
        $item_number = stripslashes($pack->pack_name);
        $custom = get_order_id($cp_user_recent_order);
        $amount = $pack->pack_membership_price;
        $notify_url = add_query_arg(array('invoice' => $custom, 'uid' => $current_user->ID), site_url('/'));
        $return = add_query_arg(array('oid' => $custom, 'uid' => $current_user->ID), CP_MEMBERSHIP_PURCHASE_CONFIRM_URL);
        $cbt = sprintf(__('Click here to complete your purchase on %s', APP_TD), get_bloginfo('name'));
    } else {
        //by default we assume its an ad posting
        $item_name = sprintf(__('Classified ad listing on %s for %s days', APP_TD), get_bloginfo('name'), $prun_period);
        $item_number = get_post_meta($the_id, 'cp_sys_ad_conf_id', true);
        $custom = get_post_meta($the_id, 'cp_sys_ad_conf_id', true);
        $amount = get_post_meta($the_id, 'cp_sys_total_ad_cost', true);
        $notify_url = add_query_arg(array('invoice' => $custom, 'aid' => $the_id), site_url('/'));
        $return = add_query_arg(array('pid' => $custom, 'aid' => $the_id), CP_ADD_NEW_CONFIRM_URL);
        $cbt = sprintf(__('Click here to publish your ad on %s', APP_TD), get_bloginfo('name'));
    }
    // if ipn enabled we don't need post data from user
    $rm = get_option('cp_enable_paypal_ipn') == 'yes' ? 0 : 2;
    ?>

	<form name="paymentform" action="<?php 
    echo esc_url($post_url);
    ?>
" method="post">

		<input type="hidden" name="cmd" value="_xclick" />
		<input type="hidden" name="charset" value="utf-8" />
		<input type="hidden" name="business" value="<?php 
    echo get_option('cp_paypal_email');
    ?>
" />
		<input type="hidden" name="item_name" value="<?php 
    echo esc_attr($item_name);
    ?>
" />
		<input type="hidden" name="item_number" value="<?php 
    echo esc_attr($item_number);
    ?>
" />
		<input type="hidden" name="amount" value="<?php 
    echo esc_attr($amount);
    ?>
" />
		<input type="hidden" name="no_shipping" value="1" />
		<input type="hidden" name="no_note" value="1" />
		<input type="hidden" name="custom" value="<?php 
    echo esc_attr($custom);
    ?>
" />
		<input type="hidden" name="cancel_return" value="<?php 
    echo home_url();
    ?>
//.........这里部分代码省略.........
开发者ID:kalushta,项目名称:darom,代码行数:101,代码来源:paypal.php

示例15: cp_membership_reminder_cron

function cp_membership_reminder_cron()
{
    if (get_option('cp_membership_ending_reminder_email') == 'yes') {
        global $wpdb;
        $days_before = get_option('cp_membership_ending_reminder_days');
        $days_before = is_numeric($days_before) ? $days_before : 7;
        $timestamp = wp_next_scheduled('cp_send_membership_reminder');
        $timestamp -= 1 * 24 * 60 * 60;
        // minus 1 day to get current schedule time on which in theory function should to execute
        $date_max = date('Y-m-d H:i:s', $timestamp + $days_before * 24 * 60 * 60);
        $date_min = date('Y-m-d H:i:s', $timestamp + ($days_before - 1) * 24 * 60 * 60);
        $qryToString = $wpdb->prepare("SELECT {$wpdb->users}.ID FROM {$wpdb->users}\n        LEFT JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id\n        WHERE {$wpdb->usermeta}.meta_key = 'membership_expires'\n        AND {$wpdb->usermeta}.meta_value < %s\n        AND {$wpdb->usermeta}.meta_value > %s\n        ", $date_max, $date_min);
        $userids = $wpdb->get_col($qryToString);
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        $siteurl = trailingslashit(get_option('home'));
        if ($userids) {
            foreach ($userids as $user_id) {
                $the_user = get_userdata($user_id);
                $mailto = $the_user->user_email;
                $user_login = stripslashes($the_user->user_login);
                $membership = get_pack($the_user->active_membership_pack);
                $membership_pack_name = stripslashes($membership->pack_name);
                $subject = sprintf(__('Membership Subscription Ending on %s', APP_TD), $blogname);
                $headers = 'From: ' . sprintf(__('%s Admin', APP_TD), $blogname) . ' <' . get_option('admin_email') . '>' . "\r\n";
                $message = sprintf(__('Hi %s,', APP_TD), $user_login) . "\r\n\r\n";
                $message .= sprintf(__('Your membership pack will expire in %d days! Please renew your membership to continue posting classified ads.', APP_TD), $days_before) . "\r\n\r\n";
                $message .= __('Membership Details', APP_TD) . "\r\n";
                $message .= __('-----------------', APP_TD) . "\r\n";
                $message .= __('Membership Pack: ', APP_TD) . $membership_pack_name . "\r\n";
                $message .= __('Membership Expires: ', APP_TD) . $the_user->membership_expires . "\r\n";
                $message .= __('Renew Your Membership Pack: ', APP_TD) . CP_MEMBERSHIP_PURCHASE_URL . "\r\n\r\n";
                $message .= __('For questions or problems, please contact us directly at', APP_TD) . " " . get_option('admin_email') . "\r\n\r\n\r\n\r\n";
                $message .= __('Regards,', APP_TD) . "\r\n\r\n";
                $message .= sprintf(__('Your %s Team', APP_TD), $blogname) . "\r\n";
                $message .= $siteurl . "\r\n\r\n\r\n\r\n";
                wp_mail($mailto, $subject, $message, $headers);
            }
        }
    }
}
开发者ID:kalushta,项目名称:darom,代码行数:40,代码来源:theme-cron.php


注:本文中的get_pack函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。