本文整理汇总了PHP中wpuf_get_form_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP wpuf_get_form_settings函数的具体用法?PHP wpuf_get_form_settings怎么用?PHP wpuf_get_form_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpuf_get_form_settings函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: upload_file
function upload_file($image_only = false)
{
$this->validate_nonce();
// a valid request will have a form ID
$form_id = isset($_POST['form_id']) ? intval($_POST['form_id']) : false;
if (!$form_id) {
die('error');
}
// check if guest post enabled for guests
if (!is_user_logged_in()) {
$guest_post = false;
$form_settings = wpuf_get_form_settings($form_id);
if (isset($form_settings['guest_post']) && $form_settings['guest_post'] == 'true') {
$guest_post = true;
}
if (!$guest_post) {
die('error');
}
}
$upload = array('name' => $_FILES['wpuf_file']['name'], 'type' => $_FILES['wpuf_file']['type'], 'tmp_name' => $_FILES['wpuf_file']['tmp_name'], 'error' => $_FILES['wpuf_file']['error'], 'size' => $_FILES['wpuf_file']['size']);
header('Content-Type: text/html; charset=' . get_option('blog_charset'));
$attach = $this->handle_upload($upload);
if ($attach['success']) {
$response = array('success' => true);
if ($image_only) {
$image_size = wpuf_get_option('insert_photo_size', 'wpuf_general', 'thumbnail');
$image_type = wpuf_get_option('insert_photo_type', 'wpuf_general', 'link');
if ($image_type == 'link') {
$response['html'] = wp_get_attachment_link($attach['attach_id'], $image_size);
} else {
$response['html'] = wp_get_attachment_image($attach['attach_id'], $image_size);
}
} else {
$response['html'] = $this->attach_html($attach['attach_id']);
}
echo $response['html'];
} else {
echo 'error';
}
// $response = array('success' => false, 'message' => $attach['error']);
// echo json_encode( $response );
exit;
}
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:43,代码来源:upload.php
示例2: render_form
function render_form($form_id, $post_id = null, $preview = false)
{
global $post;
$form_id = get_post_meta($post->ID, '_wpuf_form_id', true);
$form_settings = wpuf_get_form_settings($form_id);
// hide the metabox itself if no form ID is set
if (!$form_id) {
$this->hide_form();
return;
}
list($post_fields, $taxonomy_fields, $custom_fields) = $this->get_input_fields($form_id);
if (empty($custom_fields)) {
_e('No custom fields found.', 'wpuf');
return;
}
?>
<input type="hidden" name="wpuf_cf_update" value="<?php
echo wp_create_nonce(plugin_basename(__FILE__));
?>
" />
<input type="hidden" name="wpuf_cf_form_id" value="<?php
echo $form_id;
?>
" />
<table class="form-table wpuf-cf-table">
<tbody>
<?php
$this->render_items($custom_fields, $post->ID, 'post', $form_id, $form_settings);
?>
</tbody>
</table>
<?php
$this->scripts_styles();
}
开发者ID:ycms,项目名称:wp-user-frontend-pro,代码行数:36,代码来源:posting.php
示例3: form_settings_profile
/**
* Display settings for user profile builder
*
* @return void
*/
function form_settings_profile()
{
global $post;
$form_settings = wpuf_get_form_settings($post->ID);
$email_verification = isset($form_settings['enable_email_verification']) ? $form_settings['enable_email_verification'] : 'no';
$role_selected = isset($form_settings['role']) ? $form_settings['role'] : 'subscriber';
$redirect_to = isset($form_settings['redirect_to']) ? $form_settings['redirect_to'] : 'post';
$message = isset($form_settings['message']) ? $form_settings['message'] : __('Registration successful', 'wpuf');
$update_message = isset($form_settings['update_message']) ? $form_settings['update_message'] : __('Profile updated successfully', 'wpuf');
$page_id = isset($form_settings['page_id']) ? $form_settings['page_id'] : 0;
$url = isset($form_settings['url']) ? $form_settings['url'] : '';
$submit_text = isset($form_settings['submit_text']) ? $form_settings['submit_text'] : __('Register', 'wpuf');
$update_text = isset($form_settings['update_text']) ? $form_settings['update_text'] : __('Update Profile', 'wpuf');
?>
<table class="form-table">
<tr class="wpuf-post-type">
<th><?php
_e('Enable Email Verfication', 'wpuf');
?>
</th>
<td>
<input type="hidden" name="wpuf_settings[enable_email_verification]" value="no">
<input type="checkbox" id="wpuf-enable_email_verification" name="wpuf_settings[enable_email_verification]" value="yes" <?php
checked($email_verification, 'yes');
?>
> <label for="wpuf-enable_email_verification">Enable Email Verification</label>
</td>
</tr>
<tr class="wpuf-post-type">
<th><?php
_e('New User Role', 'wpuf');
?>
</th>
<td>
<select name="wpuf_settings[role]">
<?php
$user_roles = wpuf_get_user_roles();
foreach ($user_roles as $role => $label) {
printf('<option value="%s"%s>%s</option>', $role, selected($role_selected, $role, false), $label);
}
?>
</select>
</td>
</tr>
<tr class="wpuf-redirect-to">
<th><?php
_e('Redirect To', 'wpuf');
?>
</th>
<td>
<select name="wpuf_settings[redirect_to]">
<?php
$redirect_options = array('same' => __('Same Page', 'wpuf'), 'page' => __('To a page', 'wpuf'), 'url' => __('To a custom URL', 'wpuf'));
foreach ($redirect_options as $to => $label) {
printf('<option value="%s"%s>%s</option>', $to, selected($redirect_to, $to, false), $label);
}
?>
</select>
<div class="description">
<?php
_e('After successfull submit, where the page will redirect to', 'wpuf');
?>
</div>
</td>
</tr>
<tr class="wpuf-same-page">
<th><?php
_e('Registration success message', 'wpuf');
?>
</th>
<td>
<textarea rows="3" cols="40" name="wpuf_settings[message]"><?php
echo esc_textarea($message);
?>
</textarea>
</td>
</tr>
<tr class="wpuf-same-page">
<th><?php
_e('Update profile message', 'wpuf');
?>
</th>
<td>
<textarea rows="3" cols="40" name="wpuf_settings[update_message]"><?php
echo esc_textarea($update_message);
?>
</textarea>
</td>
</tr>
<tr class="wpuf-page-id">
//.........这里部分代码省略.........
开发者ID:ycms,项目名称:framework,代码行数:101,代码来源:form.php
示例4: update_profile
function update_profile()
{
check_ajax_referer('wpuf_form_add');
@header('Content-Type: application/json; charset=' . get_option('blog_charset'));
$form_id = isset($_POST['form_id']) ? intval($_POST['form_id']) : 0;
$form_vars = $this->get_input_fields($form_id);
$form_settings = wpuf_get_form_settings($form_id);
list($user_vars, $taxonomy_vars, $meta_vars) = $form_vars;
$user_id = get_current_user_id();
$userdata = array('ID' => $user_id);
if ($this->search($user_vars, 'name', 'first_name')) {
$userdata['first_name'] = $_POST['first_name'];
}
if ($this->search($user_vars, 'name', 'last_name')) {
$userdata['last_name'] = $_POST['last_name'];
}
if ($this->search($user_vars, 'name', 'nickname')) {
$userdata['nickname'] = $_POST['nickname'];
}
if ($this->search($user_vars, 'name', 'user_url')) {
$userdata['user_url'] = $_POST['user_url'];
}
if ($this->search($user_vars, 'name', 'user_email')) {
$userdata['user_email'] = $_POST['user_email'];
}
if ($this->search($user_vars, 'name', 'description')) {
$userdata['description'] = $_POST['description'];
}
// check if password filled out
// verify password
if ($pass_element = $this->search($user_vars, 'name', 'password')) {
$pass_element = current($pass_element);
$password = $_POST['pass1'];
$password_repeat = $_POST['pass2'];
// check only if it's filled
if ($pass_length = strlen($password)) {
// min length check
if ($pass_length < 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) {
$this->send_error(__('Password didn\'t match', 'wpuf'));
}
// seems like he want to change the password
$userdata['user_pass'] = $password;
}
}
$userdata = apply_filters('wpuf_update_profile_vars', $userdata, $form_id, $form_settings);
$user_id = wp_update_user($userdata);
if ($user_id) {
// update meta fields
$this->update_user_meta($meta_vars, $user_id);
do_action('wpuf_update_profile', $user_id, $form_id, $form_settings);
}
//redirect URL
$show_message = false;
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') {
$redirect_to = get_permalink($_POST['page_id']);
$redirect_to = add_query_arg(array('msg' => 'profile_update'), $redirect_to);
}
// send the response
$response = array('success' => true, 'redirect_to' => $redirect_to, 'show_message' => $show_message, 'message' => $form_settings['update_message']);
$response = apply_filters('wpuf_update_profile_resp', $response, $user_id, $form_id, $form_settings);
wpuf_clear_buffer();
echo json_encode($response);
exit;
}
开发者ID:proj-2014,项目名称:vlan247-test-wp,代码行数:72,代码来源:frontend-form-profile.php
示例5: draft_post
function draft_post()
{
check_ajax_referer('wpuf_form_add');
@header('Content-Type: application/json; charset=' . get_option('blog_charset'));
$form_id = isset($_POST['form_id']) ? intval($_POST['form_id']) : 0;
$form_vars = $this->get_input_fields($form_id);
$form_settings = wpuf_get_form_settings($form_id);
list($post_vars, $taxonomy_vars, $meta_vars) = $form_vars;
// echo json_encode( $_POST );
// print_r( $post_vars );
// print_r( $taxonomy_vars );
// print_r( $meta_vars );
$postarr = array('post_type' => $form_settings['post_type'], 'post_status' => 'draft', 'post_author' => get_current_user_id(), 'post_title' => isset($_POST['post_title']) ? trim($_POST['post_title']) : '', 'post_content' => isset($_POST['post_content']) ? trim($_POST['post_content']) : '', 'post_excerpt' => isset($_POST['post_excerpt']) ? trim($_POST['post_excerpt']) : '');
if (isset($_POST['category'])) {
$category = $_POST['category'];
$postarr['post_category'] = is_array($category) ? $category : array($category);
}
if (isset($_POST['tags'])) {
$postarr['tags_input'] = explode(',', $_POST['tags']);
}
// if post_id is passed, we update the post
if (isset($_POST['post_id'])) {
$is_update = true;
$postarr['ID'] = $_POST['post_id'];
$postarr['comment_status'] = 'open';
}
$post_id = wp_insert_post($postarr);
if ($post_id) {
self::update_post_meta($meta_vars, $post_id);
// set the post form_id for later usage
update_post_meta($post_id, self::$config_id, $form_id);
// save post formats if have any
if (isset($form_settings['post_format']) && $form_settings['post_format'] != '0') {
if (post_type_supports($form_settings['post_type'], 'post-formats')) {
set_post_format($post_id, $form_settings['post_format']);
}
}
// save any custom taxonomies
foreach ($taxonomy_vars as $taxonomy) {
if (isset($_POST[$taxonomy['name']])) {
if (is_object_in_taxonomy($form_settings['post_type'], $taxonomy['name'])) {
$tax = $_POST[$taxonomy['name']];
// if it's not an array, make it one
if (!is_array($tax)) {
$tax = array($tax);
}
wp_set_post_terms($post_id, $_POST[$taxonomy['name']], $taxonomy['name']);
}
}
}
}
wpuf_clear_buffer();
echo json_encode(array('post_id' => $post_id, 'action' => $_POST['action'], 'date' => current_time('mysql'), 'post_author' => get_current_user_id(), 'comment_status' => get_option('default_comment_status'), 'url' => add_query_arg('preview', 'true', get_permalink($post_id))));
exit;
}
开发者ID:EfncoPlugins,项目名称:WP-User-Frontend,代码行数:55,代码来源:frontend-form-post.php
示例6: set_post_status
/**
* Maintain post status from the form settings
*
* @since 2.1.9
* @param int $post_id
*/
function set_post_status($post_id)
{
$post_status = 'publish';
$form_id = get_post_meta($post_id, '_wpuf_form_id', true);
if ($form_id) {
$form_settings = wpuf_get_form_settings($form_id);
$post_status = $form_settings['post_status'];
}
$update_post = array('ID' => $post_id, 'post_status' => $post_status);
wp_update_post($update_post);
}
开发者ID:mithublue,项目名称:testrepo,代码行数:17,代码来源:subscription.php
示例7: render_form
/**
* Handles the add post shortcode
*
* @param $atts
*/
function render_form($form_id, $post_id = NULL, $preview = false)
{
$form_vars = wpuf_get_form_fields($form_id);
$form_settings = wpuf_get_form_settings($form_id);
if (!is_user_logged_in() && $form_settings['guest_post'] != 'true') {
echo '<div class="wpuf-message">' . $form_settings['message_restrict'] . '</div>';
wp_login_form();
return;
}
if ($form_vars) {
?>
<?php
if (!$preview) {
?>
<form class="wpuf-form-add" action="" method="post">
<?php
}
?>
<ul class="wpuf-form">
<?php
if (!$post_id) {
do_action('wpuf_add_post_form_top', $form_id, $form_settings);
} else {
do_action('wpuf_edit_post_form_top', $form_id, $post_id, $form_settings);
}
if (!is_user_logged_in() && $form_settings['guest_post'] == 'true' && $form_settings['guest_details'] == 'true') {
$this->guest_fields($form_settings);
}
$this->render_items($form_vars, $post_id, 'post', $form_id, $form_settings);
$this->submit_button($form_id, $form_settings, $post_id);
if (!$post_id) {
do_action('wpuf_add_post_form_bottom', $form_id, $form_settings);
} else {
do_action('wpuf_edit_post_form_bottom', $form_id, $post_id, $form_settings);
}
?>
</ul>
<?php
if (!$preview) {
?>
</form>
<?php
}
?>
<?php
}
//endif
}
开发者ID:BurlesonBrad,项目名称:WP-User-Frontend,代码行数:59,代码来源:render-form.php
示例8: form_settings_posts_edit
/**
* Displays settings on post form builder
*
* @global object $post
*/
function form_settings_posts_edit()
{
global $post;
$form_settings = wpuf_get_form_settings($post->ID);
$post_status_selected = isset($form_settings['edit_post_status']) ? $form_settings['edit_post_status'] : 'publish';
$redirect_to = isset($form_settings['edit_redirect_to']) ? $form_settings['edit_redirect_to'] : 'same';
$update_message = isset($form_settings['update_message']) ? $form_settings['update_message'] : __('Post updated successfully', 'wpuf');
$page_id = isset($form_settings['edit_page_id']) ? $form_settings['edit_page_id'] : 0;
$url = isset($form_settings['edit_url']) ? $form_settings['edit_url'] : '';
$update_text = isset($form_settings['update_text']) ? $form_settings['update_text'] : __('Update', 'wpuf');
$subscription = isset($form_settings['subscription']) ? $form_settings['subscription'] : null;
?>
<table class="form-table">
<tr class="wpuf-post-status">
<th><?php
_e('Set Post Status to', 'wpuf');
?>
</th>
<td>
<select name="wpuf_settings[edit_post_status]">
<?php
$statuses = get_post_statuses();
foreach ($statuses as $status => $label) {
printf('<option value="%s"%s>%s</option>', $status, selected($post_status_selected, $status, false), $label);
}
printf('<option value="_nochange"%s>%s</option>', selected($post_status_selected, '_nochange', false), __('No Change', 'wpuf'));
?>
</select>
</td>
</tr>
<tr class="wpuf-redirect-to">
<th><?php
_e('Redirect To', 'wpuf');
?>
</th>
<td>
<select name="wpuf_settings[edit_redirect_to]">
<?php
$redirect_options = array('post' => __('Newly created post', 'wpuf'), 'same' => __('Same Page', 'wpuf'), 'page' => __('To a page', 'wpuf'), 'url' => __('To a custom URL', 'wpuf'));
foreach ($redirect_options as $to => $label) {
printf('<option value="%s"%s>%s</option>', $to, selected($redirect_to, $to, false), $label);
}
?>
</select>
<p class="description">
<?php
_e('After successfull submit, where the page will redirect to', $domain = 'default');
?>
</p>
</td>
</tr>
<tr class="wpuf-same-page">
<th><?php
_e('Post Update Message', 'wpuf');
?>
</th>
<td>
<textarea rows="3" cols="40" name="wpuf_settings[update_message]"><?php
echo esc_textarea($update_message);
?>
</textarea>
</td>
</tr>
<tr class="wpuf-page-id">
<th><?php
_e('Page', 'wpuf');
?>
</th>
<td>
<select name="wpuf_settings[edit_page_id]">
<?php
$pages = get_posts(array('numberposts' => -1, 'post_type' => 'page'));
foreach ($pages as $page) {
printf('<option value="%s"%s>%s</option>', $page->ID, selected($page_id, $page->ID, false), esc_attr($page->post_title));
}
?>
</select>
</td>
</tr>
<tr class="wpuf-url">
<th><?php
_e('Custom URL', 'wpuf');
?>
</th>
<td>
<input type="url" name="wpuf_settings[edit_url]" value="<?php
echo esc_attr($url);
?>
">
</td>
//.........这里部分代码省略.........
开发者ID:mithublue,项目名称:testrepo,代码行数:101,代码来源:form.php
示例9: render_registration_settings
/**
* Render registration settings
*/
public static function render_registration_settings()
{
global $post;
$form_settings = wpuf_get_form_settings($post->ID);
$email_verification = 'no';
$role_selected = 'subscriber';
$redirect_to = 'post';
$message = __('Registration successful', 'wpuf');
$update_message = __('Profile updated successfully', 'wpuf');
$page_id = 0;
$url = '';
$submit_text = __('Register', 'wpuf');
$update_text = __('Update Profile', 'wpuf');
?>
<tr>
<td colspan="2">
<?php
self::get_pro_prompt();
?>
</td>
</tr>
<tr class="wpuf-post-type">
<th><?php
_e('Enable Email Verfication', 'wpuf');
?>
</th>
<td>
<input type="hidden" name="" value="no">
<input disabled type="checkbox" id="wpuf-enable_email_verification" name="" value="yes" <?php
checked($email_verification, 'yes');
?>
> <label for="wpuf-enable_email_verification">Enable Email Verification</label>
</td>
</tr>
<tr class="wpuf-post-type">
<th><?php
_e('New User Role', 'wpuf');
?>
</th>
<td>
<select disabled name="">
<?php
$user_roles = wpuf_get_user_roles();
foreach ($user_roles as $role => $label) {
printf('<option value="%s"%s>%s</option>', $role, selected($role_selected, $role, false), $label);
}
?>
</select>
</td>
</tr>
<tr class="wpuf-redirect-to">
<th><?php
_e('Redirect To', 'wpuf');
?>
</th>
<td>
<select disabled name="">
<?php
$redirect_options = array('same' => __('Same Page', 'wpuf'), 'page' => __('To a page', 'wpuf'), 'url' => __('To a custom URL', 'wpuf'));
foreach ($redirect_options as $to => $label) {
printf('<option value="%s"%s>%s</option>', $to, selected($redirect_to, $to, false), $label);
}
?>
</select>
<div class="description">
<?php
_e('After successfull submit, where the page will redirect to', 'wpuf');
?>
</div>
</td>
</tr>
<tr class="wpuf-same-page">
<th><?php
_e('Registration success message', 'wpuf');
?>
</th>
<td>
<textarea disabled rows="3" cols="40" name=""><?php
echo esc_textarea($message);
?>
</textarea>
</td>
</tr>
<tr class="wpuf-same-page">
<th><?php
_e('Update profile message', 'wpuf');
?>
</th>
<td>
<textarea disabled rows="3" cols="40" name=""><?php
echo esc_textarea($update_message);
?>
</textarea>
//.........这里部分代码省略.........
开发者ID:mithublue,项目名称:testrepo,代码行数:101,代码来源:form.php
示例10: render_custom_taxonomies_element
/**
* Render custom taxonomies
*/
public static function render_custom_taxonomies_element()
{
//$custom_taxonomies = get_taxonomies(array('_builtin' => false ) );
$custom_taxonomies = get_taxonomies(array('_builtin' => false), 'objects');
if (function_exists('wc_get_attribute_taxonomies')) {
$product_attributes = wc_get_attribute_taxonomies();
} else {
$product_attributes = array();
}
$attr_name = array();
foreach ($product_attributes as $attr) {
$attr_name[] = $attr->attribute_name;
}
//pri($custom_taxonomies);
$form_settings = wpuf_get_form_settings(get_the_ID());
if ($custom_taxonomies) {
?>
<div class="wpuf-taxonomies-holder">
<?php
$product_attr_tax = '';
foreach ($custom_taxonomies as $tax_name => $tax) {
if (strstr($tax_name, 'pa_') && strpos($tax_name, 'pa_') == 0 && in_array('product', $tax->object_type) && in_array(substr($tax_name, 3), $attr_name)) {
$product_attr_tax .= '<button class="wpuf-custom-tax-btn button ' . implode(' ', $tax->object_type) . '" style="' . (isset($form_settings['post_type']) && !in_array($form_settings['post_type'], $tax->object_type) ? 'display:none' : '') . '" data-name="taxonomy" data-type="' . $tax_name . '" title="' . __('Click to add to the editor', 'wpuf') . '">' . $tax_name . '</button>';
} else {
?>
<button class="wpuf-custom-tax-btn button <?php
echo implode(' ', $tax->object_type);
?>
" style="<?php
echo isset($form_settings['post_type']) && !in_array($form_settings['post_type'], $tax->object_type) ? 'display:none' : '';
?>
" data-name="taxonomy" data-type="<?php
echo $tax_name;
?>
" title="<?php
_e('Click to add to the editor', 'wpuf');
?>
"><?php
echo $tax_name;
?>
</button>
<?php
}
}
?>
<div class="attributes_holder product" style="<?php
echo isset($form_settings['post_type']) && !in_array($form_settings['post_type'], $tax->object_type) ? 'display:none' : '';
?>
">
<h2>Product Attributes</h2>
<?php
echo $product_attr_tax;
?>
</div>
</div>
<?php
} else {
_e('No custom taxonomies found', 'wpuf');
}
}
开发者ID:ChristianWhiting,项目名称:DIY,代码行数:63,代码来源:form.php
注:本文中的wpuf_get_form_settings函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论