本文整理汇总了PHP中ninja_forms_stripslashes_deep函数的典型用法代码示例。如果您正苦于以下问题:PHP ninja_forms_stripslashes_deep函数的具体用法?PHP ninja_forms_stripslashes_deep怎么用?PHP ninja_forms_stripslashes_deep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ninja_forms_stripslashes_deep函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ninja_forms_get_form_by_id
function ninja_forms_get_form_by_id($form_id)
{
global $wpdb;
$form_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . NINJA_FORMS_TABLE_NAME . " WHERE id = %d", $form_id), ARRAY_A);
$form_row['data'] = unserialize($form_row['data']);
$form_row['data'] = ninja_forms_stripslashes_deep($form_row['data']);
return $form_row;
}
示例2: ninja_forms_output_tab_metabox
//.........这里部分代码省略.........
}
if (isset($s['size'])) {
$size = $s['size'];
} else {
$size = '';
}
if (isset($s['min'])) {
$min = $s['min'];
} else {
$min = 0;
}
if (isset($s['max'])) {
$max = $s['max'];
} else {
$max = '';
}
if (is_array($name_array)) {
$tmp = '';
foreach ($name_array as $n) {
if ($tmp == '') {
if (isset($current_settings[$n])) {
$tmp = $current_settings[$n];
}
} else {
if (isset($tmp[$n])) {
$tmp = $tmp[$n];
}
}
}
$value = !is_array($tmp) && !is_object($tmp) ? $tmp : '';
} else {
if (isset($current_settings[$name])) {
if (is_array($current_settings[$name])) {
$value = ninja_forms_stripslashes_deep($current_settings[$name]);
} else {
$value = stripslashes($current_settings[$name]);
}
} else {
$value = '';
}
}
if ($value == '') {
$value = $default_value;
}
?>
<tr id="row_<?php
echo $name;
?>
" <?php
if ($tr_class != '') {
?>
class="<?php
echo $tr_class;
?>
"<?php
}
?>
<?php
if ($style != '') {
?>
style="<?php
echo $style;
?>
"<?php
}
示例3: export
/**
* Export submissions.
*
* @access public
* @param array $sub_ids
* @param bool @return
* @since 2.7
* @return void
*/
public function export($sub_ids = '', $return = false)
{
global $ninja_forms_fields;
// Bail if we haven't been sent any IDs.
if (empty($sub_ids)) {
return false;
}
if (!is_array($sub_ids)) {
$sub_ids = array($sub_ids);
}
$plugin_settings = nf_get_settings();
$date_format = $plugin_settings['date_format'];
$label_array = array();
// Get our Form ID.
$form_id = Ninja_Forms()->sub($sub_ids[0])->form_id;
// Get our list of fields.
$fields = Ninja_Forms()->form($form_id)->fields;
// Add our sequential number.
$label_array[0]['_seq_num'] = __('#', 'ninja-forms');
// Add our "Date" label.
$label_array[0]['_date_submitted'] = __('Date Submitted', 'ninja-forms');
$label_array = apply_filters('nf_subs_csv_label_array_before_fields', $label_array, $sub_ids);
foreach ($fields as $field_id => $field) {
// Get our field type
$field_type = $field['type'];
// Check to see if our field type has been set as a "process_field".
if (isset($ninja_forms_fields[$field_type])) {
$reg_field = $ninja_forms_fields[$field_type];
$process_field = $reg_field['process_field'];
} else {
$process_field = false;
}
// If this field's "process_field" is set to true, then add its label to the array.
if ($process_field) {
if (isset($field['data']['admin_label']) && $field['data']['admin_label'] != '') {
$label = $field['data']['admin_label'];
} else {
if (isset($field['data']['label'])) {
$label = $field['data']['label'];
} else {
$label = '';
}
}
$label_array[0][$field_id] = apply_filters('nf_subs_csv_field_label', $label, $field_id);
}
}
$label_array = ninja_forms_stripslashes_deep($label_array);
$label_array = apply_filters('nf_subs_csv_label_array', $label_array, $sub_ids);
$value_array = array();
$x = 0;
// Loop through our submissions and create a new row for each one.
foreach ($sub_ids as $sub_id) {
foreach ($label_array[0] as $field_id => $label) {
// Make sure we aren't working with our date field, which will always have a field id of 0.
if ($field_id !== 0) {
// Check to see if our field_id is numeric. If it isn't, then we're working with meta, not a field.
if (is_numeric($field_id)) {
// We're working with a field, grab the value.
$user_value = Ninja_Forms()->sub($sub_id)->get_field($field_id);
} else {
if ('_date_submitted' == $field_id) {
// Get the date of our submission.
$date = strtotime(Ninja_Forms()->sub($sub_id)->date_submitted);
// The first item is our date field.
$user_value = date($date_format, $date);
} else {
if ('_seq_num' == $field_id) {
$user_value = Ninja_Forms()->sub($sub_id)->get_seq_num();
} else {
// We're working with a piece of meta, grabe the value.
$user_value = Ninja_Forms()->sub($sub_id)->get_meta($field_id);
}
}
}
// Run our value through the appropriate filters before we flatten any arrays.
$user_value = apply_filters('nf_subs_export_pre_value', $user_value, $field_id);
// Implode any arrays we might have.
if (is_array($user_value)) {
$user_value = implode(',', $user_value);
}
// Add an ' to the beginning = sign to prevent any CSV/Excel security issues.
if (strpos($user_value, '=') === 0) {
$user_value = "'" . $user_value;
}
// Run our final value through the appropriate filters and assign it to the array.
$value_array[$x][$field_id] = htmlspecialchars_decode(apply_filters('nf_subs_csv_field_value', $user_value, $field_id), ENT_QUOTES);
}
}
$x++;
}
$value_array = ninja_forms_stripslashes_deep($value_array);
//.........这里部分代码省略.........
示例4: setup_submitted_vars
/**
* Add the submitted vars to $this->data['fields'].
* Also runs any functions registered to the field's pre_process hook.
*
*
*/
function setup_submitted_vars()
{
global $ninja_forms_fields, $wp;
$form_ID = $this->data['form_ID'];
//Get our plugin settings
$plugin_settings = nf_get_settings();
$req_field_error = __($plugin_settings['req_field_error'], 'ninja-forms');
if (empty($this->data)) {
return '';
}
$this->data['action'] = 'submit';
$this->data['form']['form_url'] = $this->get_current_url();
$cache = isset($_SESSION['ninja_forms_transient_id']) ? get_transient($_SESSION['ninja_forms_transient_id']) : null;
// If we have fields in our $_POST object, then loop through the $_POST'd field values and add them to our global variable.
if (isset($_POST['_ninja_forms_display_submit']) or isset($_POST['_ninja_forms_edit_sub'])) {
$field_results = ninja_forms_get_fields_by_form_id($form_ID);
//$field_results = apply_filters('ninja_forms_display_fields_array', $field_results, $form_ID);
foreach ($field_results as $field) {
$data = $field['data'];
$field_id = $field['id'];
$field_type = $field['type'];
if (isset($_POST['ninja_forms_field_' . $field_id])) {
$val = ninja_forms_stripslashes_deep($_POST['ninja_forms_field_' . $field_id]);
$this->data['submitted_fields'][] = $field_id;
} else {
$val = false;
}
$this->data['fields'][$field_id] = $val;
$field_row = ninja_forms_get_field_by_id($field_id);
$field_row['data']['field_class'] = 'ninja-forms-field';
$this->data['field_data'][$field_id] = $field_row;
}
foreach ($_POST as $key => $val) {
if (substr($key, 0, 1) == '_') {
$this->data['extra'][$key] = $val;
}
}
//Grab the form info from the database and store it in our global form variables.
$form_row = ninja_forms_get_form_by_id($form_ID);
$form_data = $form_row['data'];
if (isset($_REQUEST['_sub_id']) and !empty($_REQUEST['_sub_id'])) {
$form_data['sub_id'] = absint($_REQUEST['_sub_id']);
} else {
$form_data['sub_id'] = '';
}
//Loop through the form data and set the global $ninja_form_data variable.
if (is_array($form_data) and !empty($form_data)) {
foreach ($form_data as $key => $val) {
if (!is_array($val)) {
$value = stripslashes($val);
//$value = esc_html($value);
//$value = htmlspecialchars($value);
} else {
$value = $val;
}
$this->data['form'][$key] = $value;
}
$this->data['form']['admin_attachments'] = array();
$this->data['form']['user_attachments'] = array();
}
} else {
if ($cache !== false) {
// Check to see if we have $_SESSION values from a submission.
if (is_array($cache['field_values'])) {
// We do have a submission contained in our $_SESSION variable. We'll populate the field values with that data.
foreach ($cache['field_values'] as $field_id => $val) {
$field_row = ninja_forms_get_field_by_id($field_id);
if (is_array($field_row) and !empty($field_row)) {
if (isset($field_row['type'])) {
$field_type = $field_row['type'];
} else {
$field_type = '';
}
if (isset($field_row['data']['req'])) {
$req = $field_row['data']['req'];
} else {
$req = '';
}
$val = ninja_forms_stripslashes_deep($val);
//$val = ninja_forms_esc_html_deep( $val );
$this->data['fields'][$field_id] = $val;
if (isset($cache['field_settings'][$field_id])) {
$field_row = $cache['field_settings'][$field_id];
} else {
$field_row = ninja_forms_get_field_by_id($field_id);
}
$field_row['data']['field_class'] = 'ninja-forms-field';
$this->data['field_data'][$field_id] = $field_row;
}
}
}
$this->data['form'] = $cache['form_settings'];
$this->data['success'] = $cache['success_msgs'];
$this->data['errors'] = $cache['error_msgs'];
//.........这里部分代码省略.........
示例5: ninja_forms_add_fav
function ninja_forms_add_fav()
{
global $wpdb;
// Bail if we aren't in the admin
if (!is_admin()) {
return false;
}
check_ajax_referer('nf_ajax', 'nf_ajax_nonce');
$field_data = $_REQUEST['field_data'];
$field_id = absint($_REQUEST['field_id']);
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$form_id = 1;
$data = array();
foreach ($field_data as $key => $val) {
$key = stripslashes($key);
$key = str_replace('"', '', $key);
if (strpos($key, '[')) {
$key = str_replace(']', '', $key);
$key = explode('[', $key);
$multi = array();
$temp =& $multi;
$x = 0;
$count = count($key) - 1;
foreach ($key as $item) {
$temp[$item] = array();
if ($x < $count) {
$temp =& $temp[$item];
} else {
$temp[$item] = $val;
}
$x++;
}
$data = ninja_forms_array_merge_recursive($data, $multi);
} else {
$data[$key] = $val;
}
}
$name = stripslashes(esc_html($_REQUEST['fav_name']));
if (!isset($data['label']) or empty($data['label'])) {
$data['label'] = $name;
}
$data = ninja_forms_stripslashes_deep($data);
$data = serialize($data);
$wpdb->insert(NINJA_FORMS_FAV_FIELDS_TABLE_NAME, array('row_type' => 1, 'type' => $field_type, 'order' => 0, 'data' => $data, 'name' => $name));
$fav_id = $wpdb->insert_id;
$update_array = array('fav_id' => $fav_id);
$wpdb->update(NINJA_FORMS_FIELDS_TABLE_NAME, $update_array, array('id' => $field_id));
$new_html = '<p class="button-controls" id="ninja_forms_insert_fav_field_' . $fav_id . '_p">
<a class="button add-new-h2 ninja-forms-insert-fav-field" id="ninja_forms_insert_fav_field_' . $fav_id . '" name="" href="#">' . __($name, 'ninja-forms') . '</a>
</p>';
header("Content-type: application/json");
$array = array('fav_id' => $fav_id, 'fav_name' => $name, 'link_html' => $new_html);
echo json_encode($array);
die;
}
示例6: ninja_forms_export_subs_to_csv
function ninja_forms_export_subs_to_csv($sub_ids = '', $return = false)
{
global $ninja_forms_fields, $ninja_forms_processing;
$plugin_settings = get_option("ninja_forms_settings");
if (isset($plugin_settings['date_format'])) {
$date_format = $plugin_settings['date_format'];
} else {
$date_format = 'm/d/Y';
}
//Create a $label_array that contains all of the field labels.
//Get the Form ID.
if (isset($ninja_forms_processing)) {
$form_id = $ninja_forms_processing->get_form_ID();
} else {
if (isset($_REQUEST['form_id'])) {
$form_id = absint($_REQUEST['form_id']);
}
}
//Get the fields attached to the Form ID
$field_results = ninja_forms_get_fields_by_form_id($form_id);
//Set the label array to a blank
$label_array = array();
$value_array = array();
$sub_id_array = array();
$label_array[0][] = "Date";
if (is_array($field_results) and !empty($field_results)) {
foreach ($field_results as $field) {
$field_type = $field['type'];
$field_id = $field['id'];
if (isset($ninja_forms_fields[$field_type]['process_field'])) {
$process_field = $ninja_forms_fields[$field_type]['process_field'];
} else {
$process_field = true;
}
if (isset($field['data']['label'])) {
$label = $field['data']['label'];
} else {
$label = '';
}
if ($process_field) {
$label_array[0][$field_id] = apply_filters('ninja_forms_export_sub_label', $label, $field_id);
}
}
}
if (is_array($sub_ids) and !empty($sub_ids)) {
$x = 0;
foreach ($sub_ids as $id) {
$sub_row = ninja_forms_get_sub_by_id($id);
$sub_id_array[$x] = $id;
$date_updated = date($date_format, strtotime($sub_row['date_updated']));
$value_array[$x][] = $date_updated;
if (is_array($sub_row['data']) and !empty($sub_row['data'])) {
foreach ($label_array[0] as $field_id => $label) {
if ($field_id != 0) {
$found = false;
foreach ($sub_row['data'] as $data) {
$data['user_value'] = ninja_forms_stripslashes_deep($data['user_value']);
$data['user_value'] = ninja_forms_html_entity_decode_deep($data['user_value'], ENT_QUOTES);
if ($data['field_id'] == $field_id) {
if (is_array($data['user_value'])) {
$user_value = implode_r(',', $data['user_value']);
} else {
$user_value = $data['user_value'];
}
$found = true;
}
}
if (!$found) {
$user_value = '';
}
$value_array[$x][] = apply_filters('ninja_forms_export_sub_value', $user_value, $field_id);
}
}
}
$x++;
}
}
$value_array = ninja_forms_stripslashes_deep($value_array);
$value_array = apply_filters('ninja_forms_export_subs_value_array', $value_array, $sub_id_array);
$label_array = ninja_forms_stripslashes_deep($label_array);
$label_array = apply_filters('ninja_forms_export_subs_label_array', $label_array, $sub_id_array);
$array = array($label_array, $value_array);
$today = date($date_format);
$filename = apply_filters('ninja_forms_export_subs_csv_file_name', 'ninja_forms_subs_' . $today);
$filename = $filename . ".csv";
if ($return) {
return str_putcsv($array, apply_filters('ninja_forms_csv_delimiter', ','), apply_filters('ninja_forms_csv_enclosure', '"'), apply_filters('ninja_forms_csv_terminator', "\n"));
} else {
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=" . $filename);
header("Pragma: no-cache");
header("Expires: 0");
echo apply_filters('ninja_forms_csv_bom', "");
// Byte Order Mark
echo str_putcsv($array, apply_filters('ninja_forms_csv_delimiter', ','), apply_filters('ninja_forms_csv_enclosure', '"'), apply_filters('ninja_forms_csv_terminator', "\n"));
die;
}
}
示例7: ninja_forms_admin_save
function ninja_forms_admin_save()
{
global $ninja_forms_tabs, $ninja_forms_sidebars, $ninja_forms_tabs_metaboxes, $ninja_forms_admin_update_message;
if (!empty($_POST) and !empty($_POST['_ninja_forms_admin_submit']) and $_POST['_ninja_forms_admin_submit'] != '') {
if (wp_verify_nonce($_POST['_ninja_forms_admin_submit'], '_ninja_forms_save') and check_admin_referer('_ninja_forms_save', '_ninja_forms_admin_submit')) {
$current_page = esc_html($_REQUEST['page']);
$current_tab = ninja_forms_get_current_tab();
$data_array = array();
if (isset($_REQUEST['form_id']) and $_REQUEST['form_id'] != 'new') {
$form_id = absint($_REQUEST['form_id']);
} else {
if (isset($_REQUEST['form_id']) and $_REQUEST['form_id'] == 'new') {
$form_id = 'new';
} else {
$form_id = '';
}
}
foreach ($_POST as $key => $val) {
if (substr($key, 0, 1) != '_') {
$data_array[$key] = $val;
}
}
$data_array = ninja_forms_stripslashes_deep($data_array);
//$data_array = ninja_forms_esc_html_deep( $data_array );
//Call any save functions registered to metaboxes
if (isset($ninja_forms_tabs_metaboxes[$current_page][$current_tab]) and is_array($ninja_forms_tabs_metaboxes[$current_page][$current_tab]) and !empty($ninja_forms_tabs_metaboxes[$current_page][$current_tab])) {
foreach ($ninja_forms_tabs_metaboxes[$current_page][$current_tab] as $slug => $opts) {
// Get the save function of our options, if set, and call them, passing the data that has been posted.
if (isset($opts['settings']) and !empty($opts['settings'])) {
foreach ($opts['settings'] as $setting) {
if (isset($setting['save_function'])) {
if (isset($form_id) and $form_id != '') {
$arguments['form_id'] = $form_id;
}
$arguments['data'] = $data_array;
if ($setting['save_function'] != '') {
if ($ninja_forms_admin_update_message != '') {
$ninja_forms_admin_update_message .= ' ';
}
$ninja_forms_admin_update_message .= call_user_func_array($setting['save_function'], $arguments);
do_action('ninja_forms_save_admin_metabox_option', $setting, $form_id, $data_array);
}
}
}
}
if (isset($opts['save_function'])) {
$save_function = $opts['save_function'];
$arguments = func_get_args();
array_shift($arguments);
// We need to remove the first arg ($function_name)
if (isset($form_id) and $form_id != '') {
$arguments['form_id'] = $form_id;
}
$arguments['data'] = $data_array;
if ($save_function != '') {
if ($ninja_forms_admin_update_message != '') {
$ninja_forms_admin_update_message .= ' ';
}
$ninja_forms_admin_update_message .= call_user_func_array($save_function, $arguments);
do_action('ninja_forms_save_admin_metabox', $slug, $form_id, $data_array);
}
}
}
}
// Get the save function of our current sidebars, if present, and call them, passing the data that has been posted.
if (isset($ninja_forms_sidebars[$current_page][$current_tab]) and is_array($ninja_forms_sidebars[$current_page][$current_tab])) {
foreach ($ninja_forms_sidebars[$current_page][$current_tab] as $slug => $sidebar) {
if ($sidebar['save_function'] != '') {
$save_function = $sidebar['save_function'];
$arguments = func_get_args();
array_shift($arguments);
// We need to remove the first arg ($function_name)
if (isset($form_id) and $form_id != '') {
$arguments['form_id'] = $form_id;
}
$arguments['data'] = $data_array;
if ($save_function != '') {
if ($ninja_forms_admin_update_message != '') {
$ninja_forms_admin_update_message .= ' ';
}
$ninja_forms_admin_update_message .= call_user_func_array($save_function, $arguments);
do_action('ninja_forms_save_admin_sidebar', $slug, $form_id, $data_array);
}
}
}
}
// Get the save function of our current tab and call it, passing the data that has been posted.
$save_function = $ninja_forms_tabs[$current_page][$current_tab]['save_function'];
$tab_reload = $ninja_forms_tabs[$current_page][$current_tab]['tab_reload'];
$arguments = func_get_args();
array_shift($arguments);
// We need to remove the first arg ($function_name)
if (isset($form_id) and $form_id != '') {
$arguments['form_id'] = $form_id;
}
$arguments['data'] = $data_array;
if ($save_function != '') {
$ninja_forms_admin_update_message = call_user_func_array($save_function, $arguments);
do_action('ninja_forms_save_admin_tab', $current_tab, $form_id, $data_array);
}
//.........这里部分代码省略.........
示例8: ninja_forms_tab_view_subs
//.........这里部分代码省略.........
<?php
/**
* ninja_forms_sub_table_row_actions hook
* hook in here to allow extra row actions
*
* @hooked ninja_forms_sub_table_row_actions_edit - 10
* @hooked ninja_forms_sub_table_row_actions_delete - 20
* @hooked ninja_forms_sub_table_row_actions_export - 30
*/
$row_actions = apply_filters('ninja_forms_sub_table_row_actions', array(), $data, $sub['id'], $form_id);
echo implode(" | ", $row_actions);
?>
</div>
</td>
<?php
do_action('ninja_forms_view_sub_table_row', $form_id, $sub['id']);
$x = 0;
while ($x <= $col_count) {
if (isset($field_results[$x]['id'])) {
$field_id = $field_results[$x]['id'];
?>
<td id="ninja_forms_sub_<?php
echo $sub['id'];
?>
_field_<?php
echo $field_id;
?>
">
<?php
foreach ($data as $d) {
if ($field_id == $d['field_id']) {
$user_value = $d['user_value'];
$user_value = ninja_forms_stripslashes_deep($user_value);
$user_value = ninja_forms_strip_tags_deep($user_value);
$user_value = apply_filters('ninja_forms_view_sub_td', $user_value, $d['field_id'], $sub['id']);
if (is_array($user_value) and !empty($user_value)) {
$y = 1;
foreach ($user_value as $val) {
echo ninja_forms_stripslashes_deep($val);
if ($y != count($user_value)) {
echo ", ";
}
$y++;
}
} else {
echo stripslashes($user_value);
}
}
}
?>
</td>
<?php
}
$x++;
}
?>
</tr>
<?php
}
} else {
if ($edit_sub_form == 1) {
$sub_row = ninja_forms_get_sub_by_id($sub_id);
$data = $sub_row['data'];
$date_updated = strtotime($sub_row['date_updated']);
示例9: get_value
/**
* Get value of a setting field
*
* @author Aman Saini
* @since 1.1
* @param [type] $current_settings [description]
* @param [type] $name [description]
* @return [type] [description]
*/
public static function get_value($current_settings, $name)
{
if (isset($current_settings[$name])) {
if (is_array($current_settings[$name])) {
$value = ninja_forms_stripslashes_deep($current_settings[$name]);
} else {
$value = stripslashes($current_settings[$name]);
}
} else {
$value = '';
}
return $value;
}
示例10: ninja_forms_strip_sub_td_slashes
/**
* Remove slashes from the submission form td
*
* @param $field_value - the value of the field
* @param $field_id - the field id
* @param $sub_id - the submission id
* @return string - the value of the user history field
*/
function ninja_forms_strip_sub_td_slashes($field_value, $field_id, $sub_id)
{
// remove slashes
$field_value = ninja_forms_stripslashes_deep($field_value);
return $field_value;
}