本文整理汇总了PHP中nf_get_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP nf_get_settings函数的具体用法?PHP nf_get_settings怎么用?PHP nf_get_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nf_get_settings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ninja_forms_display_process_message
/**
* Outputs the HTML for the ajax processing div. Only used when submitting via ajax.
*
**/
function ninja_forms_display_process_message($form_id)
{
global $ninja_forms_processing_error, $ninja_forms_processing_response;
$plugin_settings = nf_get_settings();
$form_row = ninja_forms_get_form_by_id($form_id);
$process_label = __($plugin_settings['process_label'], 'ninja-forms');
if (isset($form_row['data']['ajax'])) {
$ajax = $form_row['data']['ajax'];
} else {
$ajax = 0;
}
if ($ajax == 1) {
?>
<div id="ninja_forms_form_<?php
echo $form_id;
?>
_process_msg" style="display:none;" class="ninja-forms-processing">
<?php
echo $process_label;
?>
<img src="<?php
echo NINJA_FORMS_URL;
?>
/images/loading.gif" alt="loading">
</div>
<?php
}
}
示例2: ninja_forms_admin_js
function ninja_forms_admin_js()
{
global $version_compare;
if (defined('NINJA_FORMS_JS_DEBUG') && NINJA_FORMS_JS_DEBUG) {
$suffix = '';
$src = 'dev';
} else {
$suffix = '.min';
$src = 'min';
}
$plugin_settings = nf_get_settings();
if (isset($plugin_settings['date_format'])) {
$date_format = $plugin_settings['date_format'];
} else {
$date_format = 'm/d/Y';
}
$date_format = ninja_forms_date_to_datepicker($date_format);
wp_enqueue_script('ninja-forms-admin', NINJA_FORMS_URL . '/js/' . $src . '/ninja-forms-admin' . $suffix . '.js', array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
wp_localize_script('ninja-forms-admin', 'ninja_forms_settings', array('date_format' => $date_format));
/*
wp_enqueue_script('jquery.ui.nestedSortable',
NINJA_FORMS_URL .'/js/dev/jquery.ui.nestedSortable.js',
array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-dialog', 'jquery-ui-datepicker'));
*/
//wp_localize_script( 'ninja_forms_admin_js', 'settings', array( 'plugin_url' => NINJA_FORMS_URL, 'help_size' => $plugin_settings['help_size'], 'help_color' => $plugin_settings['help_color'], 'admin_help' => $plugin_settings['admin_help']) );
}
示例3: ninja_forms_preview_link
function ninja_forms_preview_link($form_id = '', $echo = true)
{
if ($form_id == '') {
if (isset($_REQUEST['form_id'])) {
$form_id = absint($_REQUEST['form_id']);
} else {
$form_id = '';
}
}
$base = home_url();
$form_data = ninja_forms_get_form_by_id($form_id);
$append_page = Ninja_Forms()->form($form_id)->get_setting('append_page');
if (empty($append_page)) {
$opt = nf_get_settings();
if (isset($opt['preview_id'])) {
$page_id = $opt['preview_id'];
} else {
$page_id = '';
}
} else {
$page_id = $append_page;
}
if ($echo) {
$preview_link = '<a target="_blank" href="' . $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id . '">' . __('Preview Form', 'ninja-forms') . '</a>';
} else {
$preview_link = $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id;
}
return $preview_link;
}
示例4: ninja_forms_replyto_change
function ninja_forms_replyto_change()
{
$plugin_settings = nf_get_settings();
if (!isset($plugin_settings['fix_field_reply_to']) or $plugin_settings['fix_field_reply_to'] != 1) {
$fields = ninja_forms_get_all_fields();
foreach ($fields as $field) {
if ($field['type'] = '_text') {
$change_required = false;
if (isset($field['data']['from_email']) and $field['data']['from_email'] == 1) {
$field['data']['replyto_email'] = 1;
unset($field['data']['from_email']);
$change_required = true;
} elseif (isset($field['data']['from_email']) and $field['data']['from_email'] == 0) {
$field['data']['replyto_email'] = 0;
unset($field['data']['from_email']);
$change_required = true;
}
if ($change_required) {
$data = serialize($field['data']);
$args = array('update_array' => array('data' => $data), 'where' => array('id' => $field['id']));
ninja_forms_update_field($args);
}
}
}
$plugin_settings['fix_field_reply_to'] = 1;
update_option('ninja_forms_settings', $plugin_settings);
}
}
示例5: ninja_forms_display_field_help
/**
* Outputs the HTML of the help icon if it is set to display.
*
**/
function ninja_forms_display_field_help($field_id, $data)
{
$plugin_settings = nf_get_settings();
if (isset($data['show_help'])) {
$show_help = $data['show_help'];
} else {
$show_help = 0;
}
if (isset($data['help_text'])) {
$help_text = $data['help_text'];
} else {
$help_text = '';
}
$help_text = htmlspecialchars($help_text);
if ($show_help) {
?>
<img class='ninja-forms-help-text' src="<?php
echo NINJA_FORMS_URL;
?>
images/question-ico.gif" title="<?php
echo $help_text;
?>
" alt="<?php
_e('Help Text', 'ninja-forms');
?>
">
<?php
}
}
示例6: ninja_forms_display_req_items
function ninja_forms_display_req_items($form_id)
{
$plugin_settings = nf_get_settings();
if (isset($plugin_settings['req_div_label'])) {
$req_div_label = __($plugin_settings['req_div_label'], 'ninja-forms');
} else {
$req_div_label = __('Fields marked with a * are required.', 'ninja-forms');
}
$all_fields = ninja_forms_get_fields_by_form_id($form_id);
$output = false;
if (is_array($all_fields) and !empty($all_fields)) {
foreach ($all_fields as $field) {
if (isset($field['data']['req']) and $field['data']['req'] == 1) {
$output = true;
}
}
}
if ($output && $req_div_label != '') {
?>
<div class="ninja-forms-required-items"><?php
echo $req_div_label;
?>
</div>
<?php
}
}
示例7: compare
/**
* Process our date submitted trigger.
* When this function is called, it will be passed the value of the parameter and will expect a bool return.
*
* @since 1.2.8
* @return bool
*/
function compare($value, $compare)
{
$plugin_settings = nf_get_settings();
$date_format = $plugin_settings['date_format'];
$now = date($date_format, current_time('timestamp'));
return ninja_forms_conditional_compare($now, $value, $compare);
}
示例8: ninja_forms_preview_link
function ninja_forms_preview_link($form_id = '', $echo = true)
{
if ($form_id == '') {
if (isset($_REQUEST['form_id'])) {
$form_id = absint($_REQUEST['form_id']);
} else {
$form_id = '';
}
}
$base = home_url();
$form_data = ninja_forms_get_form_by_id($form_id);
//if( '' == $form_data['data']['append_page'] ) {
if (!isset($form_data['data']['append_page']) or empty($form_data['data']['append_page'])) {
// See the comment above about this check. !empty will ensure that it's not either empty quotes or null.
$opt = nf_get_settings();
if (isset($opt['preview_id'])) {
$page_id = $opt['preview_id'];
} else {
$page_id = '';
}
} else {
$page_id = $form_data['data']['append_page'];
}
if ($echo) {
$preview_link = '<a target="_blank" href="' . $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id . '">' . __('Preview Form', 'ninja-forms') . '</a>';
} else {
$preview_link = $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id;
}
return $preview_link;
}
示例9: ninja_forms_inside_label_hidden
function ninja_forms_inside_label_hidden($field_id, $data)
{
if (isset($data['label_pos']) and $data['label_pos'] == 'inside') {
$plugin_settings = nf_get_settings();
if (isset($data['label'])) {
$label = $data['label'];
} else {
$label = '';
}
if (isset($data['req'])) {
$req = $data['req'];
} else {
$req = '';
}
if (isset($plugin_settings['req_field_symbol'])) {
$req_symbol = $plugin_settings['req_field_symbol'];
} else {
$req_symbol = '';
}
if ($req == 1) {
$req_span = "<span class='ninja-forms-req-symbol'>{$req_symbol}</span>";
} else {
$req_span = '';
}
?>
<input type="hidden" id="ninja_forms_field_<?php
echo $field_id;
?>
_label_hidden" value="<?php
echo $label;
?>
">
<?php
}
}
示例10: ninja_forms_display_response_message
function ninja_forms_display_response_message($form_id)
{
global $ninja_forms_processing;
// if ( ! is_object( $ninja_forms_processing ) || $ninja_forms_processing->get_form_ID() != $form_id ) {
// return false;
// }
$plugin_settings = nf_get_settings();
$form_row = ninja_forms_get_form_by_id($form_id);
if (isset($form_row['data']['ajax'])) {
$ajax = $form_row['data']['ajax'];
} else {
$ajax = 0;
}
if ($ajax == 0 and (is_object($ninja_forms_processing) and !$ninja_forms_processing->get_all_errors() and !$ninja_forms_processing->get_all_success_msgs())) {
$display = 'display:none;';
} else {
$display = '';
}
if (is_object($ninja_forms_processing)) {
if ($ninja_forms_processing->get_errors_by_location('general')) {
$class = 'ninja-forms-error-msg';
} else {
if ($ninja_forms_processing->get_all_success_msgs()) {
$class = 'ninja-forms-success-msg';
} else {
$class = '';
}
}
} else {
$class = '';
}
$class = apply_filters('ninja_forms_display_response_message_class', $class, $form_id);
//if ( $class != '' ) {
echo '<div id="ninja_forms_form_' . $form_id . '_response_msg" style="' . $display . '" class="ninja-forms-response-msg ' . $class . '">';
if (isset($ninja_forms_processing) && $ninja_forms_processing->get_form_ID() == $form_id) {
if (is_object($ninja_forms_processing)) {
if ($ninja_forms_processing->get_form_ID() == $form_id) {
if ($ninja_forms_processing->get_errors_by_location('general')) {
foreach ($ninja_forms_processing->get_errors_by_location('general') as $error) {
echo '<div>';
echo $error['msg'];
echo '</div>';
}
}
if ($ninja_forms_processing->get_all_success_msgs()) {
foreach ($ninja_forms_processing->get_all_success_msgs() as $success) {
echo '<div>';
echo $success;
echo '</div>';
}
}
}
}
}
echo '</div>';
//}
}
示例11: ninja_forms_display_field_desc
function ninja_forms_display_field_desc($field_id, $data)
{
$plugin_settings = nf_get_settings();
if (isset($data['show_desc']) and $data['show_desc'] == 1 and isset($data['desc_text'])) {
echo '<div class="ninja-forms-field-description">';
echo do_shortcode(wpautop($data['desc_text']));
echo '</div>';
}
}
示例12: ninja_forms_save_label_settings
function ninja_forms_save_label_settings($data)
{
$plugin_settings = nf_get_settings();
foreach ($data as $key => $val) {
$plugin_settings[$key] = $val;
}
update_option("ninja_forms_settings", $plugin_settings);
$update_msg = __('Settings Saved', 'ninja-forms');
return $update_msg;
}
示例13: ninja_forms_save_impexp_fields
function ninja_forms_save_impexp_fields($data)
{
global $wpdb, $ninja_forms_admin_update_message;
$plugin_settings = nf_get_settings();
$update_message = '';
if ($_POST['submit'] == __('Export Fields', 'ninja-forms')) {
if (isset($_POST['ninja_forms_fav']) and !empty($_POST['ninja_forms_fav'])) {
$fav_ids = ninja_forms_esc_html_deep($_POST['ninja_forms_fav']);
if (isset($plugin_settings['date_format'])) {
$date_format = $plugin_settings['date_format'];
} else {
$date_format = 'm/d/Y';
}
//$today = date($date_format);
$current_time = current_time('timestamp');
$today = date($date_format, $current_time);
$favorites = array();
if (is_array($fav_ids) and !empty($fav_ids)) {
$x = 0;
foreach ($fav_ids as $fav_id) {
$fav_row = ninja_forms_get_fav_by_id($fav_id);
$fav_row['id'] = NULL;
$favorites[$x] = $fav_row;
$x++;
}
}
$favorites = serialize($favorites);
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=favorites-" . $today . ".nff");
header("Pragma: no-cache");
header("Expires: 0");
echo $favorites;
die;
} else {
$update_message = __('Please select favorite fields to export.', 'ninja-forms');
}
} elseif ($_POST['submit'] == __('Import Favorites', 'ninja-forms')) {
if ($_FILES['userfile']['error'] == UPLOAD_ERR_OK and is_uploaded_file($_FILES['userfile']['tmp_name'])) {
$file = file_get_contents($_FILES['userfile']['tmp_name']);
$favorites = unserialize($file);
if (is_array($favorites)) {
foreach ($favorites as $fav) {
$fav['data'] = serialize($fav['data']);
$wpdb->insert(NINJA_FORMS_FAV_FIELDS_TABLE_NAME, $fav);
}
}
$update_message = __('Favorites imported successfully.', 'ninja-forms');
} else {
$update_message = __('Please select a valid favorite fields file.', 'ninja-forms');
}
}
return $update_message;
}
示例14: ninja_forms_field_honeypot_pre_process
function ninja_forms_field_honeypot_pre_process($field_id, $user_value)
{
global $ninja_forms_processing;
$plugin_settings = nf_get_settings();
if (isset($plugin_settings['honeypot_error'])) {
$honeypot_error = __($plugin_settings['honeypot_error'], 'ninja-forms');
}
if ($ninja_forms_processing->get_action() != 'save' and $ninja_forms_processing->get_action() != 'mp_save' and !isset($_POST['_wp_login']) and $user_value != '') {
if (is_object($ninja_forms_processing)) {
$ninja_forms_processing->add_error('honeypot-' . $field_id, $honeypot_error, $field_id);
}
}
}
示例15: ninja_forms_admin_js
function ninja_forms_admin_js()
{
global $version_compare, $public_query_vars;
$form_id = isset($_REQUEST['form_id']) ? absint($_REQUEST['form_id']) : '';
if (defined('NINJA_FORMS_JS_DEBUG') && NINJA_FORMS_JS_DEBUG) {
$suffix = '';
$src = 'dev';
} else {
$suffix = '.min';
$src = 'min';
}
$plugin_settings = nf_get_settings();
if (isset($plugin_settings['date_format'])) {
$date_format = $plugin_settings['date_format'];
} else {
$date_format = 'm/d/Y';
}
$date_format = ninja_forms_date_to_datepicker($date_format);
$datepicker_args = array();
if (!empty($date_format)) {
$datepicker_args['dateFormat'] = $date_format;
}
wp_enqueue_script('ninja-forms-admin', NINJA_FORMS_URL . 'js/' . $src . '/ninja-forms-admin' . $suffix . '.js?nf_ver=' . NF_PLUGIN_VERSION, array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'nf-admin-modal'));
wp_localize_script('ninja-forms-admin', 'ninja_forms_settings', array('nf_ajax_nonce' => wp_create_nonce('nf_ajax'), 'form_id' => $form_id, 'datepicker_args' => apply_filters('ninja_forms_admin_forms_datepicker_args', $datepicker_args), 'add_fav_prompt' => __('What would you like to name this favorite?', 'ninja-forms'), 'add_fav_error' => __('You must supply a name for this favorite.', 'ninja-forms'), 'deactivate_all_licenses_confirm' => __('Really deactivate all licenses?', 'ninja-forms')));
wp_localize_script('ninja-forms-admin', 'nf_conversion_title', __('Reset the form conversion process for v2.9+', 'ninja-forms'));
wp_localize_script('ninja-forms-admin', 'nf_nuke_title', __('Remove ALL Ninja Forms data upon uninstall?', 'ninja-forms'));
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ninja-forms' && isset($_REQUEST['tab'])) {
wp_enqueue_script('nf-builder', NINJA_FORMS_URL . 'assets/js/' . $src . '/builder' . $suffix . '.js?nf_ver=' . NF_PLUGIN_VERSION, array('backbone'));
if ('' != $form_id) {
$fields = Ninja_Forms()->form($form_id)->fields;
$current_tab = ninja_forms_get_current_tab();
$current_page = isset($_REQUEST['page']) ? esc_html($_REQUEST['page']) : '';
foreach ($fields as $field_id => $field) {
$fields[$field_id]['metabox_state'] = 0;
}
$form_status = Ninja_Forms()->form($form_id)->get_setting('status');
$form_title = Ninja_Forms()->form($form_id)->get_setting('form_title');
wp_localize_script('nf-builder', 'nf_admin', array('edit_form_text' => __('Edit Form', 'ninja-forms'), 'form_title' => $form_title, 'form_status' => $form_status, 'fields' => $fields, 'saved_text' => __('Saved', 'ninja-forms'), 'save_text' => __('Save', 'ninja-forms'), 'saving_text' => __('Saving...', 'ninja-forms'), 'remove_field' => __('Remove this field? It will be removed even if you do not save.', 'ninja-forms')));
$reserved_terms = array('attachment', 'attachment_id', 'author', 'author_name', 'calendar', 'cat', 'category', 'category__and', 'category__in', 'category__not_in', 'category_name', 'comments_per_page', 'comments_popup', 'customize_messenger_channel', 'customized', 'cpage', 'day', 'debug', 'error', 'exact', 'feed', 'hour', 'link_category', 'm', 'minute', 'monthnum', 'more', 'name', 'nav_menu', 'nonce', 'nopaging', 'offset', 'order', 'orderby', 'p', 'page', 'page_id', 'paged', 'pagename', 'pb', 'perm', 'post', 'post__in', 'post__not_in', 'post_format', 'post_mime_type', 'post_status', 'post_tag', 'post_type', 'posts', 'posts_per_archive_page', 'posts_per_page', 'preview', 'robots', 's', 'search', 'second', 'sentence', 'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id', 'tag_slug__and', 'tag_slug__in', 'taxonomy', 'tb', 'term', 'theme', 'type', 'w', 'withcomments', 'withoutcomments', 'year');
wp_localize_script('nf-builder', 'wp_reserved_terms', $reserved_terms);
}
}
}