if ($print_val) { echo pc_sanitize_input($fdata['tel']); } ?> " maxlength="20" autocomplete="off" /> </td> </tr> <tr> <td class="pc_label_td"><?php $fist_last_name ? _e('Last name', 'pc_ml') : _e('Surname', 'pc_ml'); ?> </td> <td class="pc_field_td"> <input type="text" name="surname" value="<?php if ($print_val) { echo pc_sanitize_input($fdata['surname']); } ?> " maxlength="150" autocomplete="off" /> </td> <td class="pc_label_td" style="border-left: 1px solid #DFDFDF;"><?php _e("Disable user private page", 'pc_ml'); ?> ?</td> <td class="pc_field_td"> <input type="checkbox" name="disable_pvt_page" value="1" <?php if ($upd && $fdata['disable_pvt_page'] == 1) { echo 'checked="checked"'; } ?>
</tr> </table> <h3><?php _e("Registration Form Message"); ?> </h3> <table class="widefat pc_table"> <tr> <td class="pc_label_td"><?php _e("Default message for succesfully registered users", 'pc_ml'); ?> </td> <td class="pc_field_td"> <input type="text" name="pg_default_sr_mex" value="<?php echo pc_sanitize_input($fdata['pg_default_sr_mex']); ?> " maxlength="170" autocomplete="off" /> <p class="info"><?php _e('By default is "Registration was successful. Welcome!"', 'pc_ml'); ?> </p> </td> </tr> </table> <?php // PC-ACTION - insert custom messages customizer - has $fdata param - must print code do_action('pc_settings_messages', $fdata); ?>
public function form_code($fields, $custom_fields = false, $user_id = false) { $included = $fields['include']; $required = $fields['require']; $disclaimers = ''; $txt_count = 0; $texts = isset($fields['texts']) && is_array($fields['texts']) ? $fields['texts'] : array(); if (!is_array($included)) { return false; } // if is specified the user id get data to fill the field if ($user_id) { include_once 'users_manag.php'; $user = new pc_users(); $query = $user->get_users(array('user_id' => $user_id, 'to_get' => $included)); $ud = $query[0]; } else { $ud = false; } $form = '<ul class="pc_form_flist">'; foreach ($included as $field) { // if is a text block if ($field == 'custom|||text') { if (isset($texts[$txt_count])) { $form .= ' <li class="pc_form_txt_block pc_ftb_' . $txt_count . '"> ' . do_shortcode($texts[$txt_count]) . ' <hr class="pc_clear" /> </li>'; $txt_count++; } } else { $fdata = $this->get_field($field); if ($fdata) { // required message $req = in_array($field, $required) || isset($fdata['sys_req']) && $fdata['sys_req'] ? '<span class="pc_req_field">*</span>' : ''; // field classes $field_class = sanitize_title(urldecode($field)); if ($fdata['type'] == 'text' && ($fdata['subtype'] == 'eu_date' || $fdata['subtype'] == 'us_date')) { $field_class .= ' pcud_datepicker pcud_dp_' . $fdata['subtype']; } $type_class = 'class="' . $field_class . '"'; // options for specific types if ($fdata['type'] != 'assoc_select') { $opts = $this->get_field_options($fdata['opt']); } // field class - for field wrapper $multiselect_class = ($fdata['type'] == 'select' || $fdata['type'] == 'assoc_select') && isset($fdata['multiple']) && $fdata['multiple'] ? 'pc_multiselect' : ''; $singlecheck_class = $fdata['type'] == 'single_checkbox' && (!isset($fdata['disclaimer']) || empty($fdata['disclaimer'])) ? 'pc_single_check' : ''; $f_class = 'class="pc_rf_field pc_rf_' . sanitize_title(urldecode($field)) . ' ' . $multiselect_class . ' ' . $singlecheck_class . '"'; // placeholder $placeh = isset($fdata['placeh']) && !empty($fdata['placeh']) ? 'placeholder="' . $fdata['placeh'] . '"' : ''; // text types if ($fdata['type'] == 'text') { $val = $ud ? $ud[$field] : false; $form .= ' <li ' . $f_class . '> <label>' . __($fdata['label'], 'pc_ml') . ' ' . $req . '</label> <input type="' . $fdata['type'] . '" name="' . $field . '" value="' . pc_sanitize_input($val) . '" maxlength="' . $fdata['maxlen'] . '" ' . $placeh . ' autocomplete="off" ' . $type_class . ' /> <hr class="pc_clear" /> </li>'; } elseif ($fdata['type'] == 'password') { $form .= ' <li ' . $f_class . '> <label>' . __($fdata['label'], 'pc_ml') . ' ' . $req . '</label> <input type="' . $fdata['type'] . '" name="' . $field . '" value="" maxlength="' . $fdata['maxlen'] . '" ' . $type_class . ' autocomplete="off" /> <hr class="pc_clear" /> </li> <li class="pc_rf_field pc_rf_psw_confirm"> <label>' . __('Repeat password', 'pc_ml') . ' ' . $req . '</label> <input type="' . $fdata['type'] . '" name="check_' . $field . '" value="" maxlength="' . $fdata['maxlen'] . '" autocomplete="off" ' . $type_class . ' /> <hr class="pc_clear" /> </li>'; } elseif ($fdata['type'] == 'textarea') { $val = $ud ? $ud[$field] : false; $form .= ' <li ' . $f_class . '> <label class="pc_textarea_label">' . __($fdata['label'], 'pc_ml') . ' ' . $req . '</label> <textarea name="' . $field . '" class="pc_textarea ' . $field_class . '" ' . $placeh . ' autocomplete="off">' . $val . '</textarea> <hr class="pc_clear" /> </li>'; } elseif ($fdata['type'] == 'select') { $multiple = isset($fdata['multiple']) && $fdata['multiple'] ? 'multiple="multiple"' : ''; $multi_name = $multiple ? '[]' : ''; $form .= ' <li ' . $f_class . '> <label>' . __($fdata['label'], 'pc_ml') . ' ' . $req . '</label> <select name="' . $field . $multi_name . '" ' . $type_class . ' ' . $multiple . ' autocomplete="off">'; foreach ($opts as $opt) { $sel = $ud && in_array($opt, (array) $ud[$field]) ? 'selected="selected"' : false; $form .= '<option value="' . $opt . '" ' . $sel . '>' . $opt . '</option>'; } $form .= ' </select> <hr class="pc_clear" /> </li>'; } elseif ($fdata['type'] == 'assoc_select') { $multiple = isset($fdata['multiple']) && $fdata['multiple'] ? 'multiple="multiple"' : ''; $multi_name = $multiple ? '[]' : ''; $form .= ' <li ' . $f_class . '> <label>' . __($fdata['label'], 'pc_ml') . ' ' . $req . '</label> <select name="' . $field . $multi_name . '" ' . $multiple . ' autocomplete="off">'; foreach ($fdata['opt'] as $key => $val) { $sel = $ud && $ud[$field] == $key ? 'selected="selected"' : false; $form .= '<option value="' . $key . '" ' . $sel . '>' . $val . '</option>'; } $form .= ' </select> <hr class="pc_clear" /> </li>'; } elseif ($fdata['type'] == 'checkbox') { $form .= ' <li ' . $f_class . '> <label class="pc_cb_block_label">' . __($fdata['label'], 'pc_ml') . ' ' . $req . '</label> <div class="pc_check_wrap">'; foreach ($opts as $opt) { $sel = $ud && in_array($opt, (array) $ud[$field]) ? 'checked="checked"' : false; $form .= '<input type="checkbox" name="' . $field . '[]" value="' . $opt . '" ' . $sel . ' autocomplete="off" /> <label class="pc_check_label">' . $opt . '</label>'; } $form .= ' </div> <hr class="pc_clear" /> </li>'; } elseif ($fdata['type'] == 'single_checkbox') { $sel = $ud && !empty($ud[$field]) ? 'checked="checked"' : ''; if (!isset($fdata['disclaimer']) || empty($fdata['disclaimer'])) { $form .= ' <li ' . $f_class . '> <input type="checkbox" name="' . $field . '" value="1" ' . $sel . ' autocomplete="off" /> <label>' . $fdata['check_txt'] . ' ' . $req . '</label> <hr class="pc_clear" /> </li>'; } else { $disclaimers .= ' <li class="pc_rf_disclaimer"> <div class="pc_disclaimer_check"><input type="checkbox" name="' . $field . '" value="1" ' . $sel . ' autocomplete="off" /></div> <div class="pc_disclaimer_txt">' . $fdata['check_txt'] . '</div> </li>'; } } } } } if ($custom_fields) { $form .= $custom_fields; } if (!empty($disclaimers)) { $form .= '<li class="pc_rf_disclaimer_sep"></li>' . $disclaimers; } return $form . '</ul>'; }
function user_page_admin_script() { global $post_type; global $wpdb; if ('pg_user_page' == $post_type) { // hide ADD PAGE ?> <style type="text/css"> .page-title-action, .add-new-h2, #titlediv, #slugdiv.postbox, .qtrans_title_wrap, .qtrans_title { display: none; } #submitpost .misc-pub-post-status, #submitpost #visibility, #submitpost .misc-pub-curtime, #minor-publishing-actions, #delete-action { display: none; } .updated.notice.notice-success a { display: none !important; } </style> <?php // append username to the edit-page title $user_data = $wpdb->get_row($wpdb->prepare("SELECT id, username FROM " . PC_USERS_TABLE . " WHERE page_id = %d", $_REQUEST['post'])); $username = $user_data->username; ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery(".wrap > h1, .wrap > h2").append(" - <?php echo addslashes($username); ?> "); }); </script> <?php // add preview link $container_id = get_option('pg_target_page'); if (!empty($container_id)) { $link = get_permalink($container_id); $conj = strpos($link, '?') === false ? '?' : '&'; $preview_link = $link . $conj . 'pc_pvtpag=' . $user_data->id . '&pc_utok=' . wp_create_nonce('lcwp_nonce'); ?> <script type="text/javascript"> jQuery(document).ready(function(){ var pc_live_preview = '<a href="<?php echo $preview_link; ?> " target="_blank" id="pc_pp_preview_link"><?php echo pc_sanitize_input(__("Live preview", 'pc_ml')); ?> »</a>'; jQuery('#major-publishing-actions').prepend(pc_live_preview); }); </script> <?php } // if pvt pag container exists - end } }
function pcud_form_builder() { require_once PCUD_DIR . '/functions.php'; require_once PC_DIR . '/classes/pc_form_framework.php'; if (!isset($_POST['form_id'])) { die('data is missing'); } $form_id = addslashes($_POST['form_id']); // get all the fields $f_fw = new pc_form(); // retrieve form term $term = get_term_by('id', $form_id, 'pcud_forms'); if (!$term) { die('form not found'); } // field selector ?> <h3><?php echo $term->name; ?> </h3> <div id="pcud_form_builder_top" class="postbox"> <h3 class="hndle"><?php _e('Add Form Fields', 'pcud_ml'); ?> </h3> <div class="inside"> <div> <table class="widefat pc_table"> <tr> <td class="pc_label_td"><?php _e('Select field', 'pcud_ml'); ?> </td> <td class="pc_field_td"> <select data-placeholder="<?php _e('Select field', 'pcud_ml'); ?> .." name="pcud_fields_list" id="pcud_fields_list" class="lcweb-chosen" autocomplete="off" style="width: 400px;"> <?php foreach ($f_fw->fields as $field => $data) { if (!in_array($field, array_merge(pcud_wizards_ignore_fields(), array('username')))) { echo '<option value="' . $field . '">' . $data['label'] . '</option>'; } } ?> <option value="custom|||text"><?php _e('TEXT BLOCK', 'pc_ml'); ?> </option> </select> </td> <td> <div id="add_field_btn"> <input type="button" name="add_field" value="<?php _e('Add', 'pcud_ml'); ?> " class="button-secondary" /> <div style="width: 30px; padding-left: 7px; float: right;"></div> </div> </td> </tr> </table> <div> </div> </div> </div> </div> <?php // get form fields if (empty($term->description)) { // retrocompatibility $form_fields = (array) get_option('pcud_form_' . $form_id, array()); } else { $form_fields = unserialize(base64_decode($term->description)); } ?> <h3><?php _e('Form Structure', 'pcud_ml'); ?> </h3> <table id="pcud_form_table" class="widefat pc_table"> <thead> <tr> <th style="width: 15px;"></th> <th style="width: 15px;"></th> <th style="padding-left: 15px;"><?php _e('Field name', 'pcud_ml'); ?> </th> <th><?php _e('Required?', 'pcud_ml'); ?> </th> </tr> </thead> <tbody> <?php if (!empty($form_fields)) { $form_fields = pcud_v2_field_names_sanitize($form_fields); $incl = (array) $form_fields['include']; $req = (array) $form_fields['require']; $texts = isset($form_fields['texts']) ? (array) $form_fields['texts'] : array(); $txt_id = 0; foreach ($incl as $f_name) { if ($f_name == 'custom|||text' && isset($texts[$txt_id])) { echo ' <tr rel="' . $field . '"> <td><span class="pc_del_field"></span></td> <td><span class="pc_move_field"></span></td> <td colspan="2"> <input type="hidden" name="pcud_include_field[]" value="' . $field . '" class="pcud_incl_f" /> <textarea name="pcud_form_texts[]" placeholder="' . __('Supports HTML and shortcodes', 'pc_ml') . '">' . $texts[$txt_id] . '</textarea> </td> </tr>'; $txt_id++; } else { if (isset($f_fw->fields[$f_name])) { $field_data = $f_fw->fields[$f_name]; $sel = in_array($f_name, $req) ? 'checked="checked"' : ''; // if password or required email disable "required" switch if ($f_name == 'psw' || $f_name == 'email' && $f_fw->mail_is_required) { $dis_check = 'disabled="disabled"'; $sel = 'checked="checked"'; } else { $dis_check = ''; } echo ' <tr rel="' . $f_name . '"> <td><span class="pc_del_field"></span></td> <td><span class="pc_move_field"></span></td> <td style="padding-left: 15px;"> <input type="hidden" name="pcud_include_field[]" value="' . $f_name . '" class="pcud_incl_f" /> <span>' . $field_data['label'] . '</span> </td> <td><input type="checkbox" name="pcud_require_field[]" value="' . $f_name . '" ' . $sel . ' ' . $dis_check . ' class="pcud_req_f ip_checks" /></td> </tr> '; } } } } ?> </tbody> </table> <?php // form redirect $redirect = is_array($form_fields) && isset($form_fields['redirect']) ? $form_fields['redirect'] : ''; // custom redirect $custom_red = $redirect == 'custom' ? $form_fields['cust_redir'] : ''; // pages list $pages = get_pages(); ?> <h3><?php _e('Form Redirect', 'pcud_ml'); ?> </h3> <table id="pcud_form_table" class="widefat pc_table"> </tbody> <tr> <td class="pc_label_td" rowspan="2"><?php _e("Redirect target", 'pcud_ml'); ?> </td> <td class="pc_field_td"> <select name="pcud_redirect" id="pcud_redirect" class="lcweb-chosen" data-placeholder="<?php _e('Select a page', 'pcud_ml'); ?> .." autocomplete="off"> <option value=""><?php _e('No redirect', 'pcud_ml'); ?> </option> <option value="custom" <?php if ($redirect == 'custom') { echo 'selected="selected"'; } ?> ><?php _e('Custom redirect', 'pcud_ml'); ?> </option> <?php foreach ($pages as $pag) { $selected = $redirect == $pag->ID ? 'selected="selected"' : ''; echo '<option value="' . $pag->ID . '" ' . $selected . '>' . $pag->post_title . '</option>'; } ?> </select> </td> <td><span class="info"><?php _e('Redirect target after successful form submission', 'pcud_ml'); ?> </span></td> </tr> <tr id="pcud_cust_redir_wrap"> <td colspan="2" <?php if ($redirect != 'custom') { echo 'style="display: none;"'; } ?> > <input type="text" name="pcud_cust_redir" value="<?php echo pc_sanitize_input($custom_red); ?> " autocomplete="off" placeholder="<?php _e('insert a valid URL', 'pcud_ml'); ?> " style="width: 100%;" /> </td> </tr> </tbody> </table> <?php die; }
<td><span class="info"><?php _e('Select a valid CSV file containing users', 'pc_ml'); ?> </span></td> </tr> <tr> <td class="pc_label_td"><?php _e("Fields Delimiter", 'pc_ml'); ?> </td> <td class="pc_field_td"> <?php isset($fdata['pc_imp_separator']) && $fdata['pc_imp_separator'] ? $val = $fdata['pc_imp_separator'] : ($val = ';'); ?> <input type="text" name="pc_imp_separator" value="<?php echo pc_sanitize_input($val); ?> " maxlength="1" style="text-align: center; width: 30px;" /> </td> <td><span class="info"><?php _e('CSV fields delimiter (normally is ";")', 'pc_ml'); ?> </span></td> </tr> <tr> <td class="pc_label_td"><?php _e("Enable private page?", 'pc_ml'); ?> </td> <td class="pc_field_td"> <?php
_e('Apply', 'pc_ml'); ?> " class="button-secondary pc_submit" name="ucat_action" style="margin-right: 15px;"> <?php } ?> <?php if (!pc_get_param_exists('advanced_search')) { ?> <label for="basic_search"><?php _e('Search', 'pc_ml'); ?> </label> <input type="text" name="basic_search" value="<?php echo isset($_GET['basic_search']) ? pc_sanitize_input($_GET['basic_search']) : ''; ?> " size="25" class="pc_ulist_search_field" placeholder="<?php _e('username, name, surname, e-mail', 'pc_ml'); ?> " autocomplete="off" /> <select name="pc_cat" id="pc_ulist_filter" style="margin-left: 15px;" autocomplete="off"> <option value=""><?php _e('All Categories', 'pc_ml'); ?> </option> <?php foreach ($user_categories as $cat_id => $cat_name) { $ucat_sel = isset($_GET['pc_cat']) && (int) $_GET['pc_cat'] == $cat_id ? 'selected="selected"' : ''; echo '<option value="' . $cat_id . '" ' . $ucat_sel . '>' . $cat_name . '</selected>';
function pcud_pcma_tab_content() { $enable = isset($_POST['pcud_sf_admin_notif']) ? $_POST['pcud_sf_admin_notif'] : get_option('pcud_sf_admin_notif'); $receivers = isset($_POST['pcud_sfan_receivers']) ? $_POST['pcud_sfan_receivers'] : get_option('pcud_sfan_receivers'); $title = isset($_POST['pcud_sfan_title']) ? stripslashes($_POST['pcud_sfan_title']) : get_option('pcud_sfan_title', __("User's data updated", 'pcud_ml')); $txt = isset($_POST['pcud_sfan_txt']) ? stripslashes($_POST['pcud_sfan_txt']) : get_option('pcud_sfan_txt', __('Hello, %USERNAME% has just updated its data through custom form.', 'pcma_ml')); ?> <div id="pcud_data_update"> <h3>User Data add-on</h3> <table class="widefat pc_table"> <tr> <td class="pc_label_td"><?php _e("E-mail admins on custom form submission?", 'pcud_ml'); ?> </td> <td class="pc_field_td"> <?php $checked = $enable ? 'checked="checked"' : ''; ?> <input type="checkbox" name="pcud_sf_admin_notif" value="1" <?php echo $checked; ?> class="ip_checks" /> </td> <td><span class="info"><?php _e('If checked, notifies admins if a custom form is submitted by an user', 'pcud_ml'); ?> </span></td> </tr> <tr> <td class="pc_label_td"><?php _e('Receiver e-mail address', 'pcma_ml'); ?> </td> <td class="pc_field_td" colspan="2"> <?php $receivers = is_array($receivers) ? implode(',', $receivers) : $receivers; ?> <input type="text" name="pcud_sfan_receivers" value="<?php echo pc_sanitize_input(stripslashes($receivers)); ?> " style="width: 90%; min-width: 200px;" autocomplete="off" /> <p><span class="info"><?php _e('Notification receivers - multiple addresses supported, <strong>comma split</strong>', 'pcud_ml'); ?> </span></p> </td> </tr> </table> <h3><?php _e("E-mail builder", 'pcma_ml'); ?> </h3> <table class="widefat pc_table"> <tr> <td class="pc_label_td"><?php _e("Allowed Variables for title and text", 'pcma_ml'); ?> </td> <td> <table class="pcma_legend_table"> <tr> <td style="width: 180px;">%SITE-URL%</td> <td><span class="info"><?php _e("Website url (link)", 'pcma_ml'); ?> </span></td> </tr> <tr> <td style="width: 180px;">%SITE-TITLE%</td> <td><span class="info"><?php _e("Website title specified in the WP settings", 'pcma_ml'); ?> </span></td> </tr> <tr> <td style="width: 180px;">%NAME%</td> <td><span class="info"><?php _e("User's Name", 'pcma_ml'); ?> </span></td> </tr> <tr> <td style="width: 180px;">%SURNAME%</td> <td><span class="info"><?php _e("User's Surname", 'pcma_ml'); ?> </span></td> </tr> <tr> <td style="width: 180px;">%USERNAME%</td> <td><span class="info"><?php _e("User's Username", 'pcma_ml'); ?> </span></td> </tr> <tr> <td style="width: 180px;">%CAT%</td> <td><span class="info"><?php _e("User Categories", 'pcma_ml'); ?> </span></td> </tr> <tr> <td colspan="2"><?php _e('Remember you can user User Data add-on shortcodes to print custom data', 'pcud_ml'); ?> </td> </tr> </table> </td> </tr> <tr> <td class="pc_label_td"><?php _e("E-mail title", 'pcma_ml'); ?> </td> <td> <input type="text" name="pcud_sfan_title" value="<?php echo pc_sanitize_input($title); ?> " maxlength="255" style="width: 75%; min-width: 200px;" autocomplete="off" /> </td> </tr> <tr> <td class="pc_label_td"><?php _e("E-mail text", 'pcma_ml'); ?> </td> <td> <?php $args = array('textarea_rows' => 9); echo wp_editor($txt, 'pcud_sfan_txt', $args); ?> </td> </tr> </table> </div> <?php }
function pg_sanitize_input($val) { return pc_sanitize_input($val); }
</select> </div> <div class="pcud_field pcud_placeh" <?php if (!in_array($val['type'], array('text', 'textarea'))) { echo 'style="display: none;"'; } ?> > <label><?php _e('Field Placeholder', 'pcud_ml'); ?> </label> <input type="text" name="pcud_f_placeh[]" value="<?php echo pc_sanitize_input($val['placeh']); ?> " maxlength="200" autocomplete="off" /> </div> <div class="pcud_field pcud_f_check_txt" <?php if ($val['type'] != 'single_checkbox') { echo 'style="display: none;"'; } ?> > <label><?php _e('Checkbox text', 'pcud_ml'); ?> </label>