本文整理汇总了PHP中wpuf_get_option函数 的典型用法代码示例。如果您正苦于以下问题:PHP wpuf_get_option函数的具体用法?PHP wpuf_get_option怎么用?PHP wpuf_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpuf_get_option函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: set_mode
/**
* Set the payment mode to sandbox or live
*
* @since 0.8
*/
function set_mode()
{
if (wpuf_get_option('sandbox_mode') == 'on') {
$this->gateway_url = 'https://www.sandbox.paypal.com/webscr/';
$this->test_mode = true;
}
}
开发者ID:dewavi, 项目名称:occupysandy.net, 代码行数:12, 代码来源:paypal.php
示例2: attach_html
public static function attach_html($attach_id, $type = NULL)
{
if (!$type) {
$type = isset($_GET['type']) ? $_GET['type'] : 'image';
}
$attachment = get_post($attach_id);
if (!$attachment) {
return;
}
if (wp_attachment_is_image($attach_id)) {
$image = wp_get_attachment_image_src($attach_id, 'thumbnail');
$image = $image[0];
} else {
$image = wp_mime_type_icon($attach_id);
}
$html = '<li class="wpuf-image-wrap thumbnail">';
$html .= sprintf('<div class="attachment-name"><img src="%s" alt="%s" /></div>', $image, esc_attr($attachment->post_title));
if (wpuf_get_option('image_caption', 'wpuf_general', 'off') == 'on') {
$html .= '<div class="wpuf-file-input-wrap">';
$html .= sprintf('<input type="text" name="wpuf_files_data[%d][title]" value="%s" placeholder="%s">', $attach_id, esc_attr($attachment->post_title), __('Title', 'wpuf'));
$html .= sprintf('<textarea name="wpuf_files_data[%d][caption]" placeholder="%s">%s</textarea>', $attach_id, __('Caption', 'wpuf'), esc_textarea($attachment->post_excerpt));
$html .= sprintf('<textarea name="wpuf_files_data[%d][desc]" placeholder="%s">%s</textarea>', $attach_id, __('Description', 'wpuf'), esc_textarea($attachment->post_content));
$html .= '</div>';
}
$html .= sprintf('<input type="hidden" name="wpuf_files[%s][]" value="%d">', $type, $attach_id);
$html .= sprintf('<div class="caption"><a href="#" class="btn btn-danger btn-small attachment-delete" data-attach_id="%d">%s</a></div>', $attach_id, __('Delete', 'wpuf'));
$html .= '</li>';
return $html;
}
开发者ID:trdvelho, 项目名称:estoque_wp, 代码行数:29, 代码来源:upload.php
示例3: coupon_columns_content
/**
* Coupon list table column values
*
* @param string $column_name
* @param int $post_ID
* @return void
*/
function coupon_columns_content($column_name, $post_ID)
{
switch ($column_name) {
case 'coupon_type':
$price = get_post_meta($post_ID, '_type', true);
if ($price == 'amount') {
_e('Fixed Price', 'wpuf');
} else {
_e('Percentage', 'wpuf');
}
break;
case 'amount':
$type = get_post_meta($post_ID, '_type', true);
$currency = $type != 'percent' ? wpuf_get_option('currency_symbol', 'wpuf_payment') : '';
$symbol = $type == 'percent' ? '%' : '';
echo $currency . get_post_meta($post_ID, '_amount', true) . $symbol;
break;
case 'usage_limit':
$usage_limit = get_post_meta($post_ID, '_usage_limit', true);
if (intval($usage_limit) == 0) {
$usage_limit = __('∞', 'wpuf');
}
$use = intval(get_post_meta($post_ID, '_coupon_used', true));
echo $use . '/' . $usage_limit;
break;
case 'expire_date':
$start_date = get_post_meta($post_ID, '_start_date', true);
$end_date = get_post_meta($post_ID, '_end_date', true);
$start_date = !empty($start_date) ? date_i18n('M j, Y', strtotime($start_date)) : '';
$end_date = !empty($end_date) ? date_i18n('M j, Y', strtotime($end_date)) : '';
echo $start_date . ' to ' . $end_date;
break;
}
}
开发者ID:jimmyshen007, 项目名称:webproject, 代码行数:41, 代码来源:coupon.php
示例4: add_form_button_style
function add_form_button_style()
{
global $pagenow, $post_type;
if (!in_array($post_type, array('wpuf_forms', 'wpuf_profile'))) {
return;
}
$fixed_sidebar = wpuf_get_option('fixed_form_element', 'wpuf_general');
?>
<style type="text/css">
.wrap .add-new-h2, .wrap .add-new-h2:active {
background: #21759b;
color: #fff;
text-shadow: 0 1px 1px #446E81;
}
<?php
if ($fixed_sidebar == 'on') {
?>
#wpuf-metabox-fields{
position: fixed;
bottom: 10px;
}
<?php
}
?>
</style>
<?php
}
开发者ID:brunolampada, 项目名称:foss4g2014-wordpress, 代码行数:28, 代码来源:admin-form.php
示例5: user_info
/**
* Show user info on dashboard
*/
function user_info()
{
global $userdata;
if (wpuf_get_option('show_user_bio', 'wpuf_dashboard', 'on') == 'on') {
?>
<div class="wpuf-author">
<h3><?php
_e('Author Info', 'wpuf');
?>
</h3>
<div class="wpuf-author-inside odd">
<div class="wpuf-user-image"><?php
echo get_avatar($userdata->user_email, 80);
?>
</div>
<div class="wpuf-author-body">
<p class="wpuf-user-name"><a href="<?php
echo get_author_posts_url($userdata->ID);
?>
"><?php
printf(esc_attr__('%s', 'wpuf'), $userdata->display_name);
?>
</a></p>
<p class="wpuf-author-info"><?php
echo $userdata->description;
?>
</p>
</div>
</div>
</div><!-- .author -->
<?php
}
}
开发者ID:kajidipes, 项目名称:saedi-works, 代码行数:36, 代码来源:frontend-dashboard.php
示例6: validate_re_captcha
/**
* reCaptcha Validation
*
* @return void
*/
function validate_re_captcha()
{
$recap_challenge = isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : '';
$recap_response = isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : '';
$private_key = wpuf_get_option('recaptcha_private', 'wpuf_general');
$resp = recaptcha_check_answer($private_key, $_SERVER["REMOTE_ADDR"], $recap_challenge, $recap_response);
if (!$resp->is_valid) {
$this->send_error(__('reCAPTCHA validation failed', 'wpuf'));
}
}
开发者ID:BurlesonBrad, 项目名称:WP-User-Frontend, 代码行数:15, 代码来源:render-form.php
示例7: prepare_to_send
/**
* Prepare the payment form and send to paypal
*
* @since 0.8
* @param array $data payment info
*/
function prepare_to_send($data)
{
$order_id = wp_insert_post(array('post_type' => 'wpuf_order', 'post_status' => 'publish', 'post_title' => 'WPUF Bank Order'));
if ($order_id) {
update_post_meta($order_id, '_data', $data);
}
do_action('wpuf_gateway_bank_order_submit', $data, $order_id);
$success = get_permalink(wpuf_get_option('bank_success', 'wpuf_payment'));
wp_redirect($success);
exit;
}
开发者ID:brunolampada, 项目名称:foss4g2014-wordpress, 代码行数:17, 代码来源:bank.php
示例8: shortcode_handler
/**
* Add post shortcode handler
*
* @param array $atts
* @return string
*/
function shortcode_handler($atts)
{
extract(shortcode_atts(array('id' => 0, 'type' => 'registration'), $atts));
//registration time redirect to subscription
if ($type == 'registration') {
$is_fource_pack = wpuf_get_option('register_subscription', 'wpuf_payment');
if ($is_fource_pack == 'on' && !isset($_GET['type']) || $is_fource_pack == 'on' && $_GET['type'] != 'wpuf_sub') {
$subscription_page_id = wpuf_get_option('subscription_page', 'wpuf_payment');
if (empty($subscription_page_id)) {
_e('Please select subscription page', 'wpuf');
return;
} else {
wp_redirect(get_permalink($subscription_page_id));
exit;
}
}
}
ob_start();
$form_vars = wpuf_get_form_fields($id);
//get_post_meta( $id, self::$meta_key, true );
$form_settings = wpuf_get_form_settings($id);
if (!$form_vars) {
return;
}
if ($type == 'profile') {
if (is_user_logged_in()) {
if (isset($_GET['msg']) && $_GET['msg'] == 'profile_update') {
echo '<div class="wpuf-success">';
echo $form_settings['update_message'];
echo '</div>';
}
$this->profile_edit($id, $form_vars, $form_settings);
} else {
echo '<div class="wpuf-info">' . __('Please login to update your profile!', 'wpuf') . '</div>';
}
} elseif ($type == 'registration') {
if (is_user_logged_in()) {
echo '<div class="wpuf-info">' . __('You are already logged in!', 'wpuf') . '</div>';
} else {
if (get_option('users_can_register') != '1') {
echo '<div class="wpuf-info">';
_e('User registration is currently not allowed.');
echo '</div>';
return;
}
$this->profile_edit($id, $form_vars, $form_settings);
}
}
// var_dump( $id, $type, $form_vars, $form_settings );
$content = ob_get_contents();
ob_end_clean();
return $content;
}
开发者ID:beatindub, 项目名称:dumdiddy-wpufpro, 代码行数:59, 代码来源:frontend-form-profile.php
示例9: validate_re_captcha
/**
* reCaptcha Validation
*
* @return void
*/
function validate_re_captcha($no_captcha = '')
{
$private_key = wpuf_get_option('recaptcha_private', 'wpuf_general');
if ($no_captcha == 1) {
$response = null;
$reCaptcha = new ReCaptcha($private_key);
$resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"]);
if (!$resp->success) {
$this->send_error(__('reCAPTCHA validation failed', 'wpuf'));
}
} elseif ($no_captcha == 0) {
$recap_challenge = isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : '';
$recap_response = isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : '';
$resp = recaptcha_check_answer($private_key, $_SERVER["REMOTE_ADDR"], $recap_challenge, $recap_response);
if (!$resp->is_valid) {
$this->send_error(__('reCAPTCHA validation failed', 'wpuf'));
}
}
}
开发者ID:qhuit, 项目名称:UrbanPekor, 代码行数:24, 代码来源:render-form.php
示例10: add_post_fields
function add_post_fields($post_type, $post_obj = null)
{
//var_dump($post_type, $post_obj);
$attachments = array();
if ($post_obj) {
$attachments = wpfu_get_attachments($post_obj->ID);
}
?>
<li>
<label><?php
echo wpuf_get_option('attachment_label', 'wpuf_labels', 'Attachments');
?>
</label>
<div class="clear"></div>
</li>
<li>
<div id="wpuf-attachment-upload-container">
<div id="wpuf-attachment-upload-filelist">
<ul class="wpuf-attachment-list">
<script>window.wpufFileCount = 0;</script>
<?php
if ($attachments) {
foreach ($attachments as $attach) {
echo $this->attach_html($attach['id']);
echo '<script>window.wpufFileCount += 1;</script>';
}
}
?>
</ul>
</div>
<a id="wpuf-attachment-upload-pickfiles" class="button" href="#"><?php
echo wpuf_get_option('attachment_btn_label', 'wpuf_labels', 'Add another');
?>
</a>
</div>
<div class="clear"></div>
</li>
<?php
}
开发者ID:par-orillonsoft, 项目名称:elearning-wordpress, 代码行数:39, 代码来源:attachment.php
示例11: set_mode
/**
* Set the payment mode to sandbox or live
*
* @since 0.8
*/
function set_mode()
{
if (wpuf_get_option('sandbox_mode', 'wpuf_payment') == 'on') {
$this->gateway_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr/?';
$this->gateway_cancel_url = 'https://api-3t.sandbox.paypal.com/nvp';
$this->test_mode = true;
}
}
开发者ID:qhuit, 项目名称:UrbanPekor, 代码行数:13, 代码来源:paypal.php
示例12: send_to_gateway
/**
* Send payment handler to the gateway
*
* This function sends the payment handler mechanism to the selected
* gateway. If 'paypal' is selected, then a particular action is being
* called. A listener function can be invoked for that gateway to handle
* the request and send it to the gateway.
*
* Need to use `wpuf_gateway_{$gateway_name}
*/
function send_to_gateway()
{
if (isset($_POST['wpuf_payment_submit']) && $_POST['action'] == 'wpuf_pay' && wp_verify_nonce($_POST['_wpnonce'], 'wpuf_payment_gateway')) {
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$pack_id = isset($_REQUEST['pack_id']) ? intval($_REQUEST['pack_id']) : 0;
$gateway = $_POST['wpuf_payment_method'];
$type = $_POST['type'];
if (is_user_logged_in()) {
$userdata = wp_get_current_user();
} else {
$user_id = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : 0;
if ($user_id) {
$userdata = get_userdata($user_id);
} else {
$userdata = new stdClass();
$userdata->ID = 0;
$userdata->user_email = '';
$userdata->first_name = '';
$userdata->last_name = '';
}
}
switch ($type) {
case 'post':
$post = get_post($post_id);
$amount = wpuf_get_option('cost_per_post', 'wpuf_payment');
$item_number = get_post_meta($post_id, '_wpuf_order_id', true);
$item_name = $post->post_title;
break;
case 'pack':
$pack = WPUF_Subscription::init()->get_subscription($pack_id);
$custom = $pack->meta_value;
$amount = $this->coupon_discount($_POST['coupon_code'], $pack->meta_value['billing_amount'], $pack_id);
$item_name = $pack->post_title;
$item_number = $pack->ID;
break;
}
$payment_vars = array('currency' => wpuf_get_option('currency', 'wpuf_payment'), 'price' => $amount, 'item_number' => $item_number, 'item_name' => $item_name, 'type' => $type, 'user_info' => array('id' => $userdata->ID, 'email' => $userdata->user_email, 'first_name' => $userdata->first_name, 'last_name' => $userdata->last_name), 'date' => date('Y-m-d H:i:s'), 'post_data' => $_POST, 'custom' => isset($custom) ? $custom : '');
do_action('wpuf_gateway_' . $gateway, $payment_vars);
}
}
开发者ID:areszn, 项目名称:wordpress, 代码行数:50, 代码来源:payment.php
示例13: add_post_info
/**
* Show a info message when posting if payment is enabled
*/
function add_post_info()
{
if ($this->has_post_error()) {
?>
<div class="info">
<?php
printf(__('This will cost you <strong>%s</strong>. to add a new post. You may buy some bulk package too. ', 'wpuf'), wpuf_get_option('currency_symbol') . wpuf_get_option('cost_per_post'));
?>
</div>
<?php
}
}
开发者ID:dewavi, 项目名称:occupysandy.net, 代码行数:15, 代码来源:wpuf-subscription.php
示例14: send_to_gateway
/**
* Send payment handler to the gateway
*
* This function sends the payment handler mechanism to the selected
* gateway. If 'paypal' is selected, then a particular action is being
* called. A listener function can be invoked for that gateway to handle
* the request and send it to the gateway.
*
* Need to use `wpuf_gateway_{$gateway_name}
*/
function send_to_gateway()
{
if (isset($_POST['wpuf_payment_submit']) && $_POST['action'] == 'wpuf_pay' && wp_verify_nonce($_POST['_wpnonce'], 'wpuf_payment_gateway')) {
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$pack_id = isset($_REQUEST['pack_id']) ? intval($_REQUEST['pack_id']) : 0;
$gateway = $_POST['wpuf_payment_method'];
$type = $_POST['type'];
$userdata = wp_get_current_user();
switch ($type) {
case 'post':
$post = get_post($post_id);
$amount = wpuf_get_option('cost_per_post');
$item_number = get_post_meta($post_id, 'wpuf_order_id', true);
$item_name = $post->post_title;
break;
case 'pack':
$subscription = new WPUF_Subscription();
$pack = $subscription->get_subscription($pack_id);
$amount = $pack->cost;
$item_name = $pack->name;
$item_number = $pack->id;
break;
}
$payment_vars = array('currency' => wpuf_get_option('currency'), 'price' => $amount, 'item_number' => $item_number, 'item_name' => $item_name, 'type' => $type, 'user_info' => array('id' => $userdata->ID, 'email' => $userdata->user_email, 'first_name' => $userdata->first_name, 'last_name' => $userdata->last_name), 'date' => date('Y-m-d H:i:s'), 'post_data' => $_POST);
do_action('wpuf_gateway_' . $gateway, $payment_vars);
}
}
开发者ID:dewavi, 项目名称:occupysandy.net, 代码行数:37, 代码来源:wpuf-payment.php
示例15: user_register
//.........这里部分代码省略.........
$username = '';
$user_email = '';
$firstname = '';
$lastname = '';
// don't let to be registered if no email address given
if (!isset($_POST['user_email'])) {
$this->send_error(__('An Email address is required', 'wpuf'));
}
// if any username given, check if it exists
if ($this->search($user_vars, 'name', 'user_login')) {
$has_username_field = true;
$username = sanitize_user(trim($_POST['user_login']));
if (username_exists($username)) {
$this->send_error(__('Username already exists.', 'wpuf'));
}
}
// if any email address given, check if it exists
if ($this->search($user_vars, 'name', 'user_email')) {
$user_email = trim($_POST['user_email']);
if (email_exists($user_email)) {
$this->send_error(__('E-mail address already exists.', 'wpuf'));
}
}
// if there isn't any username field in the form, lets guess a username
if (!$has_username_field) {
$username = $this->guess_username($user_email);
}
if (!validate_username($username)) {
$this->send_error(__('Username is not valid', 'wpuf'));
}
// verify password
if ($pass_element = $this->search($user_vars, 'name', 'password')) {
$pass_element = current($pass_element);
$password = $_POST['pass1'];
$password_repeat = isset($_POST['pass2']) ? $_POST['pass2'] : false;
// min length check
if (strlen($password) < intval($pass_element['min_length'])) {
$this->send_error(sprintf(__('Password must be %s character long', 'wpuf'), $pass_element['min_length']));
}
// repeat password check
if ($password != $password_repeat && $password_repeat !== false) {
$this->send_error(__('Password didn\'t match', 'wpuf'));
}
} else {
$password = wp_generate_password();
}
// default WP registration hook
$errors = new WP_Error();
do_action('register_post', $username, $user_email, $errors);
$errors = apply_filters('registration_errors', $errors, $username, $user_email);
if ($errors->get_error_code()) {
$this->send_error($errors->get_error_message());
}
// seems like we don't have any error. Lets register the user
$user_id = wp_create_user($username, $password, $user_email);
if (is_wp_error($user_id)) {
$this->send_error($user_id->get_error_message());
} else {
$userdata = array('ID' => $user_id, 'first_name' => $this->search($user_vars, 'name', 'first_name') ? $_POST['first_name'] : '', 'last_name' => $this->search($user_vars, 'name', 'last_name') ? $_POST['last_name'] : '', 'nickname' => $this->search($user_vars, 'name', 'nickname') ? $_POST['nickname'] : '', 'user_url' => $this->search($user_vars, 'name', 'user_url') ? $_POST['user_url'] : '', 'description' => $this->search($user_vars, 'name', 'description') ? $_POST['description'] : '', 'role' => $form_settings['role']);
$user_id = wp_update_user(apply_filters('wpuf_register_user_args', $userdata));
if ($user_id) {
// update meta fields
$this->update_user_meta($meta_vars, $user_id);
// send user notification or email verification
if (isset($form_settings['enable_email_verification']) && $form_settings['enable_email_verification'] != 'yes') {
wp_send_new_user_notifications($user_id);
} else {
$this->send_verification_mail($user_id, $user_email);
}
do_action('wpuf_after_register', $user_id, $userdata, $form_id, $form_settings);
//redirect URL
$show_message = false;
$redirect_to = '';
if ($form_settings['redirect_to'] == 'page') {
$redirect_to = get_permalink($form_settings['page_id']);
} elseif ($form_settings['redirect_to'] == 'url') {
$redirect_to = $form_settings['url'];
} elseif ($form_settings['redirect_to'] == 'same') {
$show_message = true;
} else {
$redirect_to = get_permalink($post_id);
}
// send the response
$response = array('success' => true, 'post_id' => $user_id, 'redirect_to' => $redirect_to, 'show_message' => $show_message, 'message' => isset($form_settings['enable_email_verification']) && $form_settings['enable_email_verification'] == 'yes' ? __('Please check your email for activation link', 'wpuf') : $form_settings['message']);
$autologin_after_registration = wpuf_get_option('autologin_after_registration', 'wpuf_profile');
if ($autologin_after_registration == 'on') {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id);
}
$response = apply_filters('wpuf_user_register_redirect', $response, $user_id, $userdata, $form_id, $form_settings);
wpuf_clear_buffer();
echo json_encode($response);
exit;
}
// endif
}
wpuf_clear_buffer();
echo json_encode(array('success' => false, 'error' => __('Something went wrong', 'wpuf')));
exit;
}
开发者ID:ChristianWhiting, 项目名称:DIY, 代码行数:101, 代码来源:frontend-form-profile.php
示例16: has_user_error
/**
* Checks against the user, if he is valid for posting new post
*
* @global object $userdata
* @return bool
*/
public static function has_user_error($form_settings = null)
{
global $userdata;
$user_id = isset($userdata->ID) ? $userdata->ID : '';
// bail out if charging is not enabled
if (wpuf_get_option('charge_posting', 'wpuf_payment') != 'yes') {
return false;
}
// check form if subscription is disabled
if (isset($form_settings['subscription_disabled']) && $form_settings['subscription_disabled'] == 'yes') {
return false;
}
$user_sub_meta = self::get_user_pack($user_id);
$form_post_type = isset($form_settings['post_type']) ? $form_settings['post_type'] : 'post';
$post_count = isset($user_sub_meta['posts'][$form_post_type]) ? $user_sub_meta['posts'][$form_post_type] : 0;
if (isset($user_sub_meta['recurring']) && $user_sub_meta['recurring'] == 'yes') {
// user has recurring subscription
if ($post_count > 0 || $post_count == '-1') {
return false;
} else {
return true;
}
} else {
$expire = isset($user_sub_meta['expire']) ? $user_sub_meta['expire'] : 0;
if (strtolower($expire) == 'unlimited' || empty($expire)) {
$expire_status = false;
} else {
if (strtotime(date('Y-m-d', strtotime($expire))) >= strtotime(date('Y-m-d', time())) && ($post_count > 0 || $post_count == '-1')) {
$expire_status = false;
} else {
$expire_status = true;
}
}
if ($post_count > 0 || $post_count == '-1') {
$post_count_status = false;
} else {
$post_count_status = true;
}
if ($expire_status || $post_count_status) {
return true;
}
}
return false;
}
开发者ID:mithublue, 项目名称:testrepo, 代码行数:50, 代码来源:subscription.php
示例17: profile_subscription_details
/**
* Adds the postlock form in users profile
*
* @param object $profileuser
*/
function profile_subscription_details($profileuser)
{
if (!current_user_can('edit_users')) {
return;
}
if (wpuf_get_option('charge_posting', 'wpuf_payment') != 'yes') {
return;
}
$userdata = get_userdata($profileuser->ID);
//wp 3.3 fix
$packs = WPUF_Subscription::init()->get_subscriptions();
$user_sub = WPUF_Subscription::get_user_pack($userdata->ID);
$pack_id = isset($user_sub['pack_id']) ? $user_sub['pack_id'] : '';
?>
<div class="wpuf-user-subscription">
<h3><?php
_e('WPUF Subscription', 'wpuf');
?>
</h3>
<?php
if (isset($user_sub['pack_id'])) {
$pack = WPUF_Subscription::get_subscription($user_sub['pack_id']);
$details_meta = WPUF_Subscription::init()->get_details_meta_value();
$billing_amount = intval($pack->meta_value['billing_amount']) > 0 ? $details_meta['symbol'] . $pack->meta_value['billing_amount'] : __('Free', 'wpuf');
if ($billing_amount && $pack->meta_value['recurring_pay'] == 'yes') {
$recurring_des = sprintf('For each %s %s', $pack->meta_value['billing_cycle_number'], $pack->meta_value['cycle_period'], $pack->meta_value['trial_duration_type']);
$recurring_des .= !empty($pack->meta_value['billing_limit']) ? sprintf(', for %s installments', $pack->meta_value['billing_limit']) : '';
$recurring_des = $recurring_des;
} else {
$recurring_des = '';
}
?>
<div class="wpuf-user-sub-info">
<h3><?php
_e('Subscription Details', 'wpuf');
?>
</h3>
<?php
if (isset($user_sub['recurring']) && $user_sub['recurring'] == 'yes') {
?>
<div class="updated">
<p><?php
_e('This user is using recurring subscription pack', 'wpuf');
?>
</p>
</div>
<?php
}
?>
<div class="wpuf-text">
<div><strong><?php
_e('Subcription Name: ', 'wpuf');
?>
</strong><?php
echo $pack->post_title;
?>
</div>
<div>
<strong><?php
_e('Package billing details: ');
?>
</strong>
<div class="wpuf-pricing-wrap">
<div class="wpuf-sub-amount">
<?php
echo $billing_amount;
?>
<?php
echo $recurring_des;
?>
</div>
</div>
</div>
<strong><?php
_e('Remaining post: ', 'wpuf');
?>
</strong>
<table class="form-table">
<?php
foreach ($user_sub['posts'] as $key => $value) {
?>
<tr>
<th><label><?php
echo $key;
?>
</label></th>
<td><input type="text" value="<?php
echo $value;
?>
" name="<?php
echo $key;
?>
//.........这里部分代码省略.........
开发者ID:vanlong200880, 项目名称:tmdt, 代码行数:101, 代码来源:subscription.php
示例18: submit_post
function submit_post()
{
global $userdata;
$errors = array();
$title = trim($_POST['wpuf_post_title']);
$content = trim($_POST['wpuf_post_content']);
$tags = '';
$cat = '';
if (isset($_POST['wpuf_post_tags'])) {
$tags = wpuf_clean_tags($_POST['wpuf_post_tags']);
}
//if there is some attachement, validate them
if (!empty($_FILES['wpuf_post_attachments'])) {
$errors = wpuf_check_upload();
}
if (empty($title)) {
$errors[] = __('Empty post title', 'wpuf');
} else {
$title = trim(strip_tags($title));
}
//validate cat
$cat_type = wpuf_get_option('cat_type');
if (!isset($_POST['category'])) {
$errors[] = __('Please choose a category', 'wpuf');
} else {
if ($cat_type == 'normal' && $_POST['category'][0] == '-1') {
$errors[] = __('Please choose a category', 'wpuf');
} else {
if (count($_POST['category']) < 1) {
$errors[] = __('Please choose a category', 'wpuf');
}
}
}
if (empty($content)) {
$errors[] = __('Empty post content', 'wpuf');
} else {
$content = trim($content);
}
if (!empty($tags)) {
$tags = explode(',', $tags);
}
//process the custom fields
$custom_fields = array();
$fields = wpuf_get_custom_fields();
if (is_array($fields)) {
foreach ($fields as $cf) {
if (array_key_exists($cf['field'], $_POST)) {
$temp = trim(strip_tags($_POST[$cf['field']]));
//var_dump($temp, $cf);
if ($cf['type'] == 'yes' && !$temp) {
$errors[] = sprintf(__('%s is missing', 'wpuf'), $cf['label']);
} else {
$custom_fields[$cf['field']] = $temp;
}
}
//array_key_exists
}
//foreach
}
//is_array
//post attachment
$attach_id = isset($_POST['wpuf_featured_img']) ? intval($_POST['wpuf_featured_img']) : 0;
$errors = apply_filters('wpuf_edit_post_validation', $errors);
if (!$errors) {
//users are allowed to choose category
if (wpuf_get_option('allow_cats') == 'on') {
$post_category = $_POST['category'];
} else {
$post_category = array(get_option('wpuf_default_cat'));
}
$post_update = array('ID' => trim($_POST['post_id']), 'post_title' => $title, 'post_content' => $content, 'post_category' => $post_category, 'tags_input' => $tags);
//plugin API to extend the functionality
$post_update = apply_filters('wpuf_edit_post_args', $post_update);
$post_id = wp_update_post($post_update);
if ($post_id) {
echo '<div class="success">' . __('Post updated succesfully.', 'wpuf') . '</div>';
//upload attachment to the post
wpuf_upload_attachment($post_id);
//set post thumbnail if has any
if ($attach_id) {
set_post_thumbnail($post_id, $attach_id);
}
//add the custom fields
if ($custom_fields) {
foreach ($custom_fields as $key => $val) {
update_post_meta($post_id, $key, $val, false);
}
}
do_action('wpuf_edit_post_after_update', $post_id);
}
} else {
echo wpuf_error_msg($errors);
}
}
开发者ID:alphaomegahost, 项目名称:FIN, 代码行数:94, 代码来源:wpuf-edit-post.php
示例19: profile_subscription_details
/**
* Adds the postlock form in users profile
*
* @param object $profileuser
*/
function profile_subscription_details($profileuser)
{
if (!is_admin() && !current_user_can('edit_users')) {
return;
}
if (wpuf_get_option('charge_posting', 'wpuf_payment') != 'yes') {
return;
}
$userdata = get_userdata($profileuser->ID);
//wp 3.3 fix
$packs = WPUF_Subscription::init()->get_subscriptions();
$user_sub = WPUF_Subscription::get_user_pack($userdata->ID);
$pack_id = isset($user_sub['pack_id']) ? $user_sub['pack_id'] : '';
?>
<div class="wpuf-user-subscription">
<h3><?php
_e('WPUF Subscription', 'wpuf');
?>
</h3>
<a class="btn button-primary wpuf-assing-pack-btn wpuf-add-pack" href="#"><?php
_e('Assign Package', 'wpuf');
?>
</a>
<a class="btn button-primary wpuf-assing-pack-btn wpuf-cancel-pack" style="display:none;" href="#"><?php
_e('Show Package', 'wpuf');
?>
</a>
<table class="form-table wpuf-pack-dropdown" disabled="disabled" style="display: none;">
<tr>
<th><label for="wpuf_sub_pack"><?php
_e('Pack:', 'wpuf');
?>
</label></th>
<td>
<select name="pack_id" id="wpuf_sub_pack">
<option value="-1"><?php
_e('--Select--', 'wpuf');
?>
</option>
<?php
$this->packdropdown_without_recurring($packs, $pack_id);
//WPUF_Subscription::init()->packdropdown( $packs, $selected = '' );
?>
</select>
</td>
</tr>
</table>
<?php
if (!isset($user_sub['pack_id'])) {
return;
}
$pack = WPUF_Subscription::get_subscription($user_sub['pack_id']);
$details_meta = WPUF_Subscription::init()->get_details_meta_value();
$billing_amount = intval($pack->meta_value['billing_amount']) > 0 ? $details_meta['symbol'] . $pack->meta_value['billing_amount'] : __('Free', 'wpuf');
if ($billing_amount && $pack->meta_value['recurring_pay'] == 'yes') {
$recurring_des = sprintf('For each %s %s', $pack->meta_value['billing_cycle_number'], $pack->meta_value['cycle_period'], $pack->meta_value['trial_duration_type']);
$recurring_des .= !empty($pack->meta_value['billing_limit']) ? sprintf(', for %s installments', $pack->meta_value['billing_limit']) : '';
$recurring_des = $recurring_des;
} else {
$recurring_des = '';
}
?>
<div class="wpuf-user-sub-info">
<h3><?php
_e('Subscription Details', 'wpuf');
?>
</h3>
<div class="wpuf-text">
<div><strong><?php
_e('Subcription Name: ', 'wpuf');
?>
</strong><?php
echo $pack->post_title;
?>
</div>
<div>
<strong><?php
_e('Package billing details: ');
?>
</strong>
<div class="wpuf-pricing-wrap">
<div class="wpuf-sub-amount">
<?php
echo $billing_amount;
?>
<?php
echo $recurring_des;
?>
</div>
</div>
</div>
//.........这里部分代码省略.........
开发者ID:areszn, 项目名称:wordpress, 代码行数:101, 代码来源:subscription.php
GitbookIO/gitbook:
阅读:956| 2022-08-17
juleswhite/mobile-cloud-asgn1
阅读:1032| 2022-08-30
Delphi的FireDAC连接管理与配置过程:使用FireDAC技术连接数据库,主要是使用 TFDCon
阅读:884| 2022-07-18
kyamagu/matlab-json: Use official API: https://mathworks.com/help/matlab/json-fo
阅读:926| 2022-08-17
书名:墙壁眼睛膝盖 作者:温柔一刀 类别:欲望丛林,饮食男女。 簡介:Wall(我)Eye(爱)Kn
阅读:656| 2022-11-06
Authenticated (admin or higher user role) Reflected Cross-Site Scripting (XSS) v
阅读:1037| 2022-07-29
sevenjay/cpp-markdown: Cpp-Markdown is a freely-available Markdown text-to-HTML
阅读:582| 2022-08-18
Karumi/MaxibonKataKotlin: Maxibon kata for Kotlin Developers. The main goal is t
阅读:623| 2022-08-13
mathjax/MathJax-i18n: MathJax localization
阅读:388| 2022-08-16
众所周知,我们的身份证号码里面包含的信息有很多,如出生日期、性别和识别码等,如果
阅读:252| 2022-11-06
请发表评论