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


PHP wpuf_get_option函数代码示例

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


在下文中一共展示了wpuf_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = __('&infin;', '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


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