本文整理汇总了PHP中Ninja_Forms::template方法的典型用法代码示例。如果您正苦于以下问题:PHP Ninja_Forms::template方法的具体用法?PHP Ninja_Forms::template怎么用?PHP Ninja_Forms::template使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ninja_Forms
的用法示例。
在下文中一共展示了Ninja_Forms::template方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
if (isset($_GET['form_id'])) {
if ('new' == $_GET['form_id']) {
$form_id = 'tmp-' . time();
} else {
$form_id = is_numeric($_GET['form_id']) ? absint($_GET['form_id']) : '';
}
/*
* FORM BUILDER
*/
Ninja_Forms::template('admin-menu-new-form.html.php');
$this->_enqueue_the_things($form_id);
delete_user_option(get_current_user_id(), 'nf_form_preview_' . $form_id);
if (!isset($_GET['ajax'])) {
$this->_localize_form_data($form_id);
$this->_localize_field_type_data();
$this->_localize_action_type_data();
$this->_localize_form_settings();
$this->_localize_merge_tags();
}
} else {
/*
* ALL FORMS TABLE
*/
$this->table->prepare_items();
Ninja_Forms::template('admin-menu-all-forms.html.php', array('table' => $this->table, 'add_new_url' => admin_url('admin.php?page=ninja-forms&form_id=new'), 'add_new_text' => __('Add New Form', 'ninja-forms')));
}
}
示例2: import_from_template
private function import_from_template()
{
$template = sanitize_title($_GET['form_id']);
$form = Ninja_Forms::template($template . '.nff', array(), TRUE);
if (!$form) {
die('Template not found');
}
$form = base64_decode($form);
$form_id = Ninja_Forms()->form()->import_form($form);
header("Location: " . admin_url("admin.php?page=ninja-forms&form_id={$form_id}"));
exit;
}
示例3: display
public function display()
{
Ninja_Forms::template('admin-menu-add-field.html.php');
wp_enqueue_style('nf-builder', Ninja_Forms::$url . 'assets/css/builder.css');
wp_enqueue_style('qtip2', Ninja_Forms::$url . 'assets/css/jquery.qtip.css');
wp_enqueue_script('backbone-marionette', Ninja_Forms::$url . 'assets/js/lib/backbone.marionette.min.js', array('jquery', 'backbone'));
wp_enqueue_script('backbone-radio', Ninja_Forms::$url . 'assets/js/lib/backbone.radio.min.js', array('jquery', 'backbone'));
wp_enqueue_script('jquery-perfect-scrollbar', Ninja_Forms::$url . 'assets/js/lib/perfect-scrollbar.jquery.min.js', array('jquery'));
wp_enqueue_script('jquery-hotkeys-new', Ninja_Forms::$url . 'assets/js/lib/jquery.hotkeys.js');
wp_enqueue_script('jquery-qtip2', Ninja_Forms::$url . 'assets/js/lib/jquery.qtip.js');
wp_enqueue_script('requirejs', Ninja_Forms::$url . 'assets/js/lib/require.js', array('jquery', 'backbone'));
wp_enqueue_script('nf-builder', Ninja_Forms::$url . 'assets/js/builder/main.js', array('jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable'));
wp_localize_script('nf-builder', 'nfAdmin', array('ajaxNonce' => wp_create_nonce('ninja_forms_ajax_nonce'), 'requireBaseUrl' => Ninja_Forms::$url . 'assets/js/'));
}
示例4: import_from_template
private function import_from_template()
{
$template = sanitize_title($_GET['form_id']);
$form = Ninja_Forms::template($template . '.nff', array(), TRUE);
if (!$form) {
die('Template not found');
}
$form = json_decode(html_entity_decode($form), true);
$form_id = Ninja_Forms()->form()->import_form($form);
if (!$form_id) {
$error_message = function_exists('json_last_error_msg') && json_last_error_msg() ? json_last_error_msg() : __('Form Template Import Error.', 'ninja-forms');
wp_die($error_message);
}
header("Location: " . admin_url("admin.php?page=ninja-forms&form_id={$form_id}"));
exit;
}
示例5: display
public function display()
{
$tabs = apply_filters('ninja_forms_settings_tabs', array('settings' => __('Settings', 'ninja-forms'), 'licenses' => __('Licenses', 'ninja-forms')));
$tab_keys = array_keys($tabs);
$active_tab = isset($_GET['tab']) ? $_GET['tab'] : reset($tab_keys);
wp_enqueue_style('nf-admin-settings', Ninja_Forms::$url . 'assets/css/admin-settings.css');
$groups = Ninja_Forms()->config('PluginSettingsGroups');
$grouped_settings = $this->get_settings();
$save_button_text = __('Save Settings', 'ninja-forms');
$setting_defaults = Ninja_Forms()->get_settings();
$errors = array();
foreach ($grouped_settings as $group => $settings) {
foreach ($settings as $id => $setting) {
$value = isset($setting_defaults[$id]) ? $setting_defaults[$id] : '';
$grouped_settings[$group][$id]['id'] = $this->prefix($grouped_settings[$group][$id]['id']);
$grouped_settings[$group][$id]['value'] = $value;
$grouped_settings[$group][$id] = apply_filters('ninja_forms_check_setting_' . $id, $grouped_settings[$group][$id]);
if (!isset($grouped_settings[$group][$id]['errors']) || !$grouped_settings[$group][$id]['errors']) {
continue;
}
if (!is_array($grouped_settings[$group][$id]['errors'])) {
$grouped_settings[$group][$id]['errors'] = array($grouped_settings[$group][$id]['errors']);
}
foreach ($grouped_settings[$group][$id]['errors'] as $old_key => $error) {
$new_key = $grouped_settings[$group][$id]['id'] . "[" . $old_key . "]";
$errors[$new_key] = $error;
$grouped_settings[$group][$id]['errors'][$new_key] = $error;
unset($grouped_settings[$group][$id]['errors'][$old_key]);
}
}
}
$grouped_settings['general']['version']['value'] = Ninja_Forms::VERSION;
$saved_fields = Ninja_Forms()->form()->get_fields(array('saved' => 1));
foreach ($saved_fields as $saved_field) {
$saved_field_id = $saved_field->get_id();
$grouped_settings['saved_fields'][] = array('id' => '', 'type' => 'html', 'html' => '<a class="js-delete-saved-field button button-secondary" data-id="' . $saved_field_id . '">' . __('Delete') . '</a>', 'label' => $saved_field->get_setting('label'));
}
if ($saved_fields) {
wp_register_script('ninja_forms_admin_menu_settings', Ninja_Forms::$url . 'assets/js/admin-settings.js', array('jquery'), FALSE, TRUE);
wp_localize_script('ninja_forms_admin_menu_settings', 'nf_settings', array('ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce("ninja_forms_settings_nonce")));
wp_enqueue_script('ninja_forms_admin_menu_settings');
}
Ninja_Forms::template('admin-menu-settings.html.php', compact('tabs', 'active_tab', 'groups', 'grouped_settings', 'save_button_text', 'errors'));
}
示例6: display
public function display()
{
wp_enqueue_style('nf-admin-addons', Ninja_Forms::$url . 'assets/css/admin-addons.css');
$items = wp_remote_get('https://ninjaforms.com/?extend_feed=jlhrbgf89734go7387o4g3h');
$items = wp_remote_retrieve_body($items);
$items = json_decode($items, true);
//shuffle( $items );
$notices = array();
foreach ($items as $item) {
$plugin_data = array();
if (!empty($item['plugin']) && file_exists(WP_PLUGIN_DIR . '/' . $item['plugin'])) {
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $item['plugin'], false, true);
}
$version = isset($plugin_data['Version']) ? $plugin_data['Version'] : '';
if (!empty($version) && $version < $item['version']) {
$notices[] = array('title' => $item['title'], 'old_version' => $version, 'new_version' => $item['version']);
}
}
Ninja_Forms::template('admin-menu-addons.html.php', compact('items', 'notices'));
}
示例7: add_filters
/**
* Add Filters
*
* @return bool
*/
public function add_filters()
{
global $typenow;
// Bail if we aren't in our submission custom post type.
if ($typenow != 'nf_sub') {
return false;
}
$forms = Ninja_Forms()->form()->get_forms();
$form_options = array();
foreach ($forms as $form) {
$form_options[$form->get_id()] = $form->get_setting('title');
}
$form_options = apply_filters('ninja_forms_submission_filter_form_options', $form_options);
if (isset($_GET['form_id'])) {
$form_selected = $_GET['form_id'];
} else {
$form_selected = 0;
}
if (isset($_GET['begin_date'])) {
$begin_date = $_GET['begin_date'];
} else {
$begin_date = '';
}
if (isset($_GET['end_date'])) {
$end_date = $_GET['end_date'];
} else {
$end_date = '';
}
Ninja_Forms::template('admin-menu-subs-filter.html.php', compact('form_options', 'form_selected', 'begin_date', 'end_date'));
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_style('jquery-ui-datepicker', Ninja_Forms::$url . 'deprecated/assets/css/jquery-ui-fresh.min.css');
}
示例8: display
public function display()
{
Ninja_Forms::template('admin-menu-edit-settings.html.php');
wp_enqueue_style('nf-builder', Ninja_Forms::$url . 'assets/css/builder.css');
}
示例9: info_meta_box
/**
* Info Meta Box
*
* @param $post
*/
public function info_meta_box($post)
{
$sub = Ninja_Forms()->form()->sub($post->ID)->get();
$seq_num = $sub->get_seq_num();
$status = ucwords($sub->get_status());
$user = $sub->get_user()->data->user_nicename;
$form_title = $sub->get_form_title();
$sub_date = $sub->get_sub_date('m/d/Y H:i');
$mod_date = $sub->get_mod_date('m/d/Y H:i');
Ninja_Forms::template('admin-metabox-sub-info.html.php', compact('seq_num', 'status', 'user', 'form_title', 'sub_date', 'mod_date'));
}
示例10: foreach
<?php
} else {
?>
<form action="" method="POST">
<?php
if ($errors) {
?>
<?php
foreach ($errors as $error_id => $error) {
?>
<?php
$message = $error . " <a href='#{$error_id}'>" . __('Fix it.', 'ninja-forms') . '</a>';
?>
<?php
Ninja_Forms::template('admin-notice.html.php', array('class' => 'error', 'message' => $message));
?>
<?php
}
?>
<?php
}
?>
<?php
foreach ($grouped_settings as $group => $settings) {
?>
<div id="ninja_forms_metabox_<?php
echo $group;
?>
_settings" class="postbox">
示例11: column_title
function column_title($item)
{
$title = $item['title'];
$edit_url = add_query_arg('form_id', $item['id'], admin_url('admin.php?page=ninja-forms'));
$delete_url = add_query_arg(array('action' => 'delete', 'id' => $item['id'], '_wpnonce' => wp_create_nonce('nf_delete_form')));
$duplicate_url = add_query_arg(array('action' => 'duplicate', 'id' => $item['id'], '_wpnonce' => wp_create_nonce('nf_duplicate_form')));
$preview_url = add_query_arg('nf_preview_form', $item['id'], site_url());
$submissions_url = add_query_arg('form_id', $item['id'], admin_url('edit.php?post_status=all&post_type=nf_sub'));
$form = Ninja_Forms()->form($item['id'])->get();
$locked = $form->get_setting('lock');
Ninja_Forms::template('admin-menu-all-forms-column-title.html.php', compact('title', 'edit_url', 'delete_url', 'duplicate_url', 'preview_url', 'submissions_url', 'locked'));
}
示例12: display
public function display()
{
/** @global wpdb $wpdb */
global $wpdb;
wp_enqueue_style('nf-admin-system-status', Ninja_Forms::$url . 'assets/css/admin-system-status.css');
wp_enqueue_script('nf-admin-system-status-script', Ninja_Forms::$url . 'assets/js/admin-system-status.js', array('jquery'));
//PHP locale
$locale = localeconv();
if (is_multisite()) {
$multisite = __('Yes', 'ninja-forms');
} else {
$multisite = __('No', 'ninja-forms');
}
//TODO: Possible refactor
foreach ($locale as $key => $val) {
if (is_string($val)) {
$data = $key . ': ' . $val . '</br>';
}
}
//TODO: Ask if this check is need
//if ( function_exists( 'phpversion' ) ) echo esc_html( phpversion() );
//WP_DEBUG
if (defined('WP_DEBUG') && WP_DEBUG) {
$debug = __('Yes', 'ninja-forms');
} else {
$debug = __('No', 'ninja-forms');
}
//WPLANG
if (defined('WPLANG') && WPLANG) {
$lang = WPLANG;
} else {
$lang = __('Default', 'ninja-forms');
}
//TODO: Ask if this long list of ini_get checks are need?
// if( function_exists( 'ini_get' ) ){
// $get_ini = size_format( ini_get('post_max_size') );
// }
//SUHOSIN
if (extension_loaded('suhosin')) {
$suhosin = __('Yes', 'ninja-forms');
} else {
$suhosin = __('No', 'ninja-forms');
}
//Time Zone Check
//TODO: May need refactored
$default_timezone = get_option('timezone_string');
//Check for active plugins
$active_plugins = (array) get_option('active_plugins', array());
if (is_multisite()) {
$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
}
$all_plugins = array();
foreach ($active_plugins as $plugin) {
$plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
$dirname = dirname($plugin);
$version_string = '';
if (!empty($plugin_data['Name'])) {
// link the plugin name to the plugin url if available
$plugin_name = $plugin_data['Name'];
if (!empty($plugin_data['PluginURI'])) {
$plugin_name = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __('Visit plugin homepage', 'ninja-forms') . '">' . $plugin_name . '</a>';
}
$all_plugins[] = $plugin_name . ' ' . __('by', 'ninja-forms') . ' ' . $plugin_data['Author'] . ' ' . __('version', 'ninja-forms') . ' ' . $plugin_data['Version'] . $version_string;
}
}
if (sizeof($all_plugins) == 0) {
$site_wide_plugins = '-';
} else {
$site_wide_plugins = implode(', <br/>', $all_plugins);
}
$server_ip = $_SERVER['SERVER_ADDR'];
$host_name = gethostbyaddr($server_ip);
//Output array
$environment = array(__('Home URL', 'ninja-forms') => home_url(), __('Site URL', 'ninja-forms') => site_url(), __('Ninja Forms Version', 'ninja-forms') => esc_html(Ninja_Forms::VERSION), __('WP Version', 'ninja-forms') => get_bloginfo('version'), __('WP Multisite Enabled', 'ninja-forms') => $multisite, __('Web Server Info', 'ninja-forms') => esc_html($_SERVER['SERVER_SOFTWARE']), __('PHP Version', 'ninja-forms') => esc_html(phpversion()), __('MySQL Version', 'ninja-forms') => $wpdb->db_version(), __('PHP Locale', 'ninja-forms') => $data, __('WP Memory Limit', 'ninja-forms') => number_format_i18n(WP_MEMORY_LIMIT), __('WP Debug Mode', 'ninja-forms') => $debug, __('WP Language', 'ninja-forms') => $lang, __('WP Max Upload Size', 'ninja-forms') => size_format(wp_max_upload_size()), __('PHP Post Max Size', 'ninja-forms') => number_format_i18n(ini_get('post_max_size')), __('Max Input Nesting Level', 'ninja-forms') => ini_get('max_input_nesting_level'), __('PHP Time Limit', 'ninja-forms') => ini_get('max_execution_time'), __('PHP Max Input Vars', 'ninja-forms') => ini_get('max_input_vars'), __('SUHOSIN Installed', 'ninja-forms') => $suhosin, __('Server IP Address', 'ninja-forms') => $server_ip, __('Host Name', 'ninja-forms') => $host_name, __('SMTP', 'ninja-forms') => ini_get('SMTP'), __('smtp_port', 'ninja-forms') => ini_get('smtp_port'), __('Default Timezone', 'ninja-forms') => $default_timezone);
Ninja_Forms::template('admin-menu-system-status.html.php', compact('environment', 'site_wide_plugins'));
}
示例13: template_export_favorite_fields
public function template_export_favorite_fields()
{
$fields = Ninja_Forms()->form()->get_fields(array('saved' => 1));
Ninja_Forms::template('admin-metabox-import-export-favorite-fields-export.html.php', compact('fields'));
}
示例14:
</div>
<div class="nf-one-third">
<div class="nf-item">Constant Contact</div>
</div>
<div class="nf-one-third">
<div class="nf-item">Campaign Monitor</div>
</div>
<div class="nf-one-third">
<div class="nf-item">Slack</div>
</div>
<div class="nf-one-third">
<div class="nf-item">Trello</div>
</div>
<div class="nf-one-third">
<div class="nf-item">Create Post</div>
</div>
<div class="nf-one-third">
<div class="nf-item">Salesforce</div>
</div>
<div class="nf-one-third">
<div class="nf-item">Text Message</div>
</div>
</section>
<?php
Ninja_Forms::template('ui-nf-toggle-drawer.html.php');
?>
</div>
</div>
示例15: localize_preview
public static function localize_preview($form_id)
{
$capability = apply_filters('ninja_forms_display_test_values_capabilities', 'read');
if (isset($_GET['ninja_forms_test_values']) && current_user_can($capability)) {
self::$use_test_values = TRUE;
}
add_action('wp_footer', 'NF_Display_Render::output_templates', 9999);
$form = get_user_option('nf_form_preview_' . $form_id);
if (!$form) {
self::localize($form_id);
return;
}
if (isset($form['settings']['logged_in']) && $form['settings']['logged_in'] && !is_user_logged_in()) {
echo $form['settings']['not_logged_in_msg'];
return;
}
$form['settings']['is_preview'] = TRUE;
$before_form = apply_filters('ninja_forms_display_before_form', '', $form_id, TRUE);
$form['settings']['beforeForm'] = $before_form;
$before_fields = apply_filters('ninja_forms_display_before_fields', '', $form_id, TRUE);
$form['settings']['beforeFields'] = $before_fields;
$after_fields = apply_filters('ninja_forms_display_after_fields', '', $form_id, TRUE);
$form['settings']['afterFields'] = $after_fields;
$after_form = apply_filters('ninja_forms_display_after_form', '', $form_id, TRUE);
$form['settings']['afterForm'] = $after_form;
$fields = array();
if (empty($form['fields'])) {
echo __('No Fields Found.', 'ninja-forms');
} else {
foreach ($form['fields'] as $field_id => $field) {
$field_type = $field['settings']['type'];
if (!isset(Ninja_Forms()->fields[$field_type])) {
continue;
}
if (!apply_filters('ninja_forms_preview_display_type_' . $field_type, TRUE)) {
continue;
}
if (!apply_filters('ninja_forms_preview_display_field', $field)) {
continue;
}
$field['settings']['id'] = $field_id;
$field = apply_filters('ninja_forms_localize_fields_preview', $field);
$field = apply_filters('ninja_forms_localize_field_' . $field_type . '_preview', $field);
$display_before = apply_filters('ninja_forms_display_before_field_type_' . $field['settings']['type'], '');
$display_before = apply_filters('ninja_forms_display_before_field_key_' . $field['settings']['key'], $display_before);
$field['settings']['beforeField'] = $display_before;
$display_after = apply_filters('ninja_forms_display_after_field_type_' . $field['settings']['type'], '');
$display_after = apply_filters('ninja_forms_display_after_field_key_' . $field['settings']['key'], $display_after);
$field['settings']['afterField'] = $display_after;
foreach ($field['settings'] as $key => $setting) {
if (is_numeric($setting)) {
$field['settings'][$key] = floatval($setting);
}
}
if (!isset($field['settings']['label_pos']) || 'default' == $field['settings']['label_pos']) {
if (isset($form['settings']['default_label_pos'])) {
$field['settings']['label_pos'] = $form['settings']['default_label_pos'];
}
}
$field_class = Ninja_Forms()->fields[$field_type];
$templates = $field_class->get_templates();
if (!array($templates)) {
$templates = array($templates);
}
foreach ($templates as $template) {
self::load_template('fields-' . $template);
}
if (self::$use_test_values) {
$field['settings']['value'] = $field_class->get_test_value();
}
$field['settings']['parentType'] = $field_class->get_parent_type();
if ('list' == $field['settings']['parentType'] && isset($field['settings']['options']) && is_array($field['settings']['options'])) {
$field['settings']['options'] = apply_filters('ninja_forms_render_options', $field['settings']['options'], $field['settings']);
}
if (isset($field['settings']['default'])) {
$default_value = apply_filters('ninja_forms_render_default_value', $field['settings']['default'], $field_type, $field['settings']);
$default_value = preg_replace('/{.*}/', '', $default_value);
if ($default_value) {
$field['settings']['value'] = $default_value;
ob_start();
do_shortcode($field['settings']['value']);
$ob = ob_get_clean();
if ($ob) {
$field['settings']['value'] = $ob;
}
}
}
// TODO: Find a better way to do this.
if ('shipping' == $field['settings']['type']) {
$field['settings']['shipping_cost'] = str_replace(array('$', '£', '€'), '', $field['settings']['shipping_cost']);
$field['settings']['shipping_cost'] = str_replace(Ninja_Forms()->get_setting('currency_symbol'), '', $field['settings']['shipping_cost']);
$field['settings']['shipping_cost'] = number_format($field['settings']['shipping_cost'], 2);
} elseif ('product' == $field['settings']['type']) {
// TODO: Does the currency marker need to stripped here?
$field['settings']['product_price'] = str_replace(array('$', '£', '€'), '', $field['settings']['product_price']);
$field['settings']['product_price'] = str_replace(Ninja_Forms()->get_setting('currency_symbol'), '', $field['settings']['product_price']);
$field['settings']['product_price'] = number_format($field['settings']['product_price'], 2);
} elseif ('total' == $field['settings']['type']) {
if (!isset($field['settings']['value'])) {
$field['settings']['value'] = 0;
//.........这里部分代码省略.........