本文整理汇总了PHP中FrmAppHelper::get_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::get_settings方法的具体用法?PHP FrmAppHelper::get_settings怎么用?PHP FrmAppHelper::get_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::get_settings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_get_settings
/**
* @covers FrmAppHelper::get_settings
*/
function test_get_settings()
{
$settings = FrmAppHelper::get_settings();
$this->assertNotEmpty($settings);
$this->assertTrue(is_object($settings));
$this->assertNotEmpty($settings->success_msg);
}
示例2: process_form
public static function process_form($stop_load = false)
{
global $frm_vars;
$frm_settings = FrmAppHelper::get_settings();
$process_form = FrmAppHelper::get_post_param('process_form', '', 'sanitize_text_field');
if (!wp_verify_nonce($process_form, 'process_form_nonce')) {
wp_die($frm_settings->admin_permission);
}
$errors = array();
$message = '';
if (!isset($frm_vars['settings_routed']) || !$frm_vars['settings_routed']) {
//$errors = $frm_settings->validate($_POST,array());
$frm_settings->update(stripslashes_deep($_POST));
if (empty($errors)) {
$frm_settings->store();
$message = __('Settings Saved', 'formidable');
}
} else {
$message = __('Settings Saved', 'formidable');
}
if ($stop_load == 'stop_load') {
$frm_vars['settings_routed'] = true;
return;
}
self::display_form($errors, $message);
}
示例3: test_add_js
public function test_add_js()
{
$frm_settings = FrmAppHelper::get_settings();
global $frm_vars;
if ($frm_settings->jquery_css) {
$this->assertNotEmpty($frm_vars['datepicker_loaded']);
}
if ($frm_settings->accordion_js) {
$this->assertTrue(wp_script_is('jquery-ui-widget', 'enqueued'));
$this->assertTrue(wp_script_is('jquery-ui-accordion', 'enqueued'));
}
}
示例4: validate
public static function validate($params, $fields, $form, $title, $description)
{
global $frm_vars;
$frm_settings = FrmAppHelper::get_settings();
if (($_POST && isset($_POST['frm_page_order_' . $form->id]) || FrmProFormsHelper::going_to_prev($form->id)) && !FrmProFormsHelper::saving_draft()) {
$errors = '';
$fields = FrmFieldsHelper::get_form_fields($form->id);
$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
$values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
add_filter('frm_continue_to_create', '__return_false');
} else {
if ($form->editable && isset($form->options['single_entry']) && $form->options['single_entry'] && $form->options['single_entry_type'] == 'user') {
$user_ID = get_current_user_id();
if ($user_ID) {
$entry = FrmEntry::getAll(array('it.user_id' => $user_ID, 'it.form_id' => $form->id), '', 1, true);
if ($entry) {
$entry = reset($entry);
}
} else {
$entry = false;
}
if ($entry && !empty($entry) && (!isset($frm_vars['created_entries'][$form->id]) || !isset($frm_vars['created_entries'][$form->id]['entry_id']) || $entry->id != $frm_vars['created_entries'][$form->id]['entry_id'])) {
FrmProEntriesController::show_responses($entry, $fields, $form, $title, $description);
} else {
$record = $frm_vars['created_entries'][$form->id]['entry_id'];
$saved_message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
if (FrmProFormsHelper::saving_draft()) {
$saved_message = isset($form->options['draft_msg']) ? $form->options['draft_msg'] : __('Your draft has been saved.', 'formidable');
}
$saved_message = apply_filters('frm_content', $saved_message, $form, $record ? $record : false);
$message = wpautop(do_shortcode($record ? $saved_message : $frm_settings->failed_msg));
$message = '<div class="frm_message" id="message">' . $message . '</div>';
FrmProEntriesController::show_responses($record, $fields, $form, $title, $description, $message);
}
add_filter('frm_continue_to_create', '__return_false');
} else {
if (FrmProFormsHelper::saving_draft()) {
$record = isset($frm_vars['created_entries']) && isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0;
if (!$record) {
return;
}
$saved_message = '';
FrmProFormsHelper::save_draft_msg($saved_message, $form, $record);
$message = FrmFormsHelper::get_success_message(array('message' => $saved_message, 'form' => $form, 'entry_id' => $record, 'class' => 'frm_message'));
FrmProEntriesController::show_responses($record, $fields, $form, $title, $description, $message);
add_filter('frm_continue_to_create', '__return_false');
}
}
}
}
示例5: setup_new_vars
public static function setup_new_vars($fields, $form = '', $reset = false, $args = array())
{
global $frm_vars;
$values = array();
foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default) {
$values[$var] = FrmAppHelper::get_post_param($var, $default);
}
$values['fields'] = array();
if (empty($fields)) {
return apply_filters('frm_setup_new_entry', $values);
}
foreach ((array) $fields as $field) {
$new_value = self::get_field_value_for_new_entry($field, $reset);
$field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => $field->default_value, 'name' => $field->name, 'description' => $field->description, 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), 'options' => $field->options, 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id, 'parent_form_id' => isset($args['parent_form_id']) ? $args['parent_form_id'] : $field->form_id);
$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
$opt_defaults['required_indicator'] = '';
$opt_defaults['original_type'] = $field->type;
foreach ($opt_defaults as $opt => $default_opt) {
$field_array[$opt] = isset($field->field_options[$opt]) && $field->field_options[$opt] != '' ? $field->field_options[$opt] : $default_opt;
unset($opt, $default_opt);
}
unset($opt_defaults);
if ($field_array['custom_html'] == '') {
$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
}
$field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
$field_array = array_merge($field->field_options, $field_array);
$values['fields'][] = $field_array;
if (!$form || !isset($form->id)) {
$form = FrmForm::getOne($field->form_id);
}
}
$form->options = maybe_unserialize($form->options);
if (is_array($form->options)) {
foreach ($form->options as $opt => $value) {
$values[$opt] = FrmAppHelper::get_post_param($opt, $value);
unset($opt, $value);
}
}
$form_defaults = FrmFormsHelper::get_default_opts();
$frm_settings = FrmAppHelper::get_settings();
$form_defaults['custom_style'] = $frm_settings->load_style != 'none';
$values = array_merge($form_defaults, $values);
return apply_filters('frm_setup_new_entry', $values);
}
示例6: test_front_head
/**
* Make sure the stylesheet is loaded at the right times
*/
public function test_front_head()
{
$this->set_front_end();
if (defined('DOING_AJAX') && DOING_AJAX) {
$this->markTestSkipped('Run with --group styles');
}
ob_start();
do_action('wp_head');
$styles = ob_get_contents();
ob_end_clean();
$this->assertNotEmpty($styles);
$frm_settings = FrmAppHelper::get_settings();
$stylesheet_urls = $this->get_custom_stylesheet();
$style_included = strpos($styles, $stylesheet_urls['formidable']);
if ($frm_settings->load_style == 'all') {
$this->assertTrue($style_included !== false, 'The formidablepro stylesheet is missing');
} else {
$this->assertFalse($style_included, 'The formidablepro stylesheet is included when it should not be');
}
}
示例7: uninstall
public static function uninstall()
{
if (!current_user_can('administrator')) {
$frm_settings = FrmAppHelper::get_settings();
wp_die($frm_settings->admin_permission);
}
global $wpdb;
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'frm_display');
delete_option('frmpro_options');
delete_option('frmpro_db_version');
//locations
delete_option('frm_usloc_options');
delete_option('frmpro_copies_db_version');
delete_option('frmpro_copies_checked');
// updating
delete_site_option('frmpro-authorized');
delete_site_option('frmpro-credentials');
delete_site_option('frm_autoupdate');
delete_site_option('frmpro-wpmu-sitewide');
}
示例8: pro_cred_form
public function pro_cred_form()
{
global $frm_vars;
if ($_POST && isset($_POST['process_cred_form']) && $_POST['process_cred_form'] == 'Y') {
if (!isset($_POST['frm_cred']) || !wp_verify_nonce($_POST['frm_cred'], 'frm_cred_nonce')) {
$frm_settings = FrmAppHelper::get_settings();
$response = array('response' => $frm_settings->admin_permission, 'auth' => false);
} else {
$response = $this->activate();
}
if ($response['auth']) {
$frm_vars['pro_is_authorized'] = true;
?>
<div id="message" class="updated"><strong><?php
_e('Your Pro installation is now active. Enjoy!', 'formidable');
?>
</strong></div>
<?php
} else {
?>
<div class="error">
<strong><?php
_e('ERROR', 'formidable');
?>
</strong>: <?php
echo $response['response'];
?>
</div>
<?php
}
}
?>
<div id="frm_license_top">
<?php
$this->display_form();
if (!$frm_vars['pro_is_authorized']) {
?>
<p>Already signed up? <a href="https://formidablepro.com/account/?action=licenses" target="_blank"><?php
_e('Click here', 'formidable');
?>
</a> to get your license number.</p>
<?php
}
?>
</div>
<?php
if ($frm_vars['pro_is_authorized']) {
?>
<div class="frm_pro_installed">
<div><strong class="alignleft" style="margin-right:10px;"><?php
_e('Formidable Pro is Installed', 'formidable');
?>
</strong>
<a href="javascript:void(0)" class="frm_show_auth_form button-secondary alignleft"><?php
_e('Enter new license', 'formidable');
?>
</a>
<a href="#" id="frm_deauthorize_link" class="button-secondary alignright"><?php
_e('Deauthorize this site', 'formidable');
?>
</a>
<div class="spinner"></div>
</div>
<div class="clear"></div>
</div>
<p class="frm_aff_link"><a href="https://formidablepro.com/account/?action=licenses" target="_blank"><?php
_e('Account', 'formidable');
?>
</a></p>
<?php
}
?>
<div class="clear"></div>
<?php
}
示例9: validate_recaptcha
public static function validate_recaptcha(&$errors, $field, $args)
{
if ($field->type != 'captcha' || FrmAppHelper::is_admin() || apply_filters('frm_is_field_hidden', false, $field, stripslashes_deep($_POST))) {
return;
}
$frm_settings = FrmAppHelper::get_settings();
if (empty($frm_settings->pubkey)) {
// don't require the captcha if it shouldn't be shown
return;
}
if (!isset($_POST['g-recaptcha-response'])) {
// If captcha is missing, check if it was already verified
if (!isset($_POST['recaptcha_checked']) || !wp_verify_nonce($_POST['recaptcha_checked'], 'frm_ajax')) {
// There was no captcha submitted
$errors['field' . $args['id']] = __('The captcha is missing from this form', 'formidable');
}
return;
}
$arg_array = array('body' => array('secret' => $frm_settings->privkey, 'response' => $_POST['g-recaptcha-response'], 'remoteip' => FrmAppHelper::get_ip_address()));
$resp = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', $arg_array);
$response = json_decode(wp_remote_retrieve_body($resp), true);
if (isset($response['success']) && !$response['success']) {
// What happens when the CAPTCHA was entered incorrectly
$errors['field' . $args['id']] = !isset($field->field_options['invalid']) || $field->field_options['invalid'] == '' ? $frm_settings->re_msg : $field->field_options['invalid'];
} else {
if (is_wp_error($resp)) {
$error_string = $resp->get_error_message();
$errors['field' . $args['id']] = __('There was a problem verifying your recaptcha', 'formidable');
$errors['field' . $args['id']] .= ' ' . $error_string;
}
}
}
示例10: destroy_all
public static function destroy_all()
{
if (!current_user_can('frm_delete_entries')) {
$frm_settings = FrmAppHelper::get_settings();
wp_die($frm_settings->admin_permission);
}
global $wpdb;
$params = FrmForm::get_admin_params();
$message = '';
$errors = array();
$form_id = (int) $params['form'];
if ($form_id) {
$entry_ids = FrmDb::get_col('frm_items', array('form_id' => $form_id));
$action = FrmFormAction::get_action_for_form($form_id, 'wppost', 1);
if ($action) {
// this action takes a while, so only trigger it if there are posts to delete
foreach ($entry_ids as $entry_id) {
do_action('frm_before_destroy_entry', $entry_id);
unset($entry_id);
}
}
$wpdb->query($wpdb->prepare("DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id));
$results = $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id));
if ($results) {
$message = __('Entries were Successfully Destroyed', 'formidable');
}
} else {
$errors = __('No entries were specified', 'formidable');
}
self::display_list($message, $errors);
}
示例11: get_form_contents
public static function get_form_contents($form, $title, $description, $atts)
{
global $frm_vars;
$frm_settings = FrmAppHelper::get_settings();
$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
$user_ID = get_current_user_id();
$params = FrmForm::get_params($form);
$message = $errors = '';
if ($params['posted_form_id'] == $form->id && $_POST) {
$errors = isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['errors'] : array();
}
$include_form_tag = apply_filters('frm_include_form_tag', true, $form);
$fields = FrmFieldsHelper::get_form_fields($form->id, isset($errors) && !empty($errors));
if ($params['action'] != 'create' || $params['posted_form_id'] != $form->id || !$_POST) {
do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
if (apply_filters('frm_continue_to_new', true, $form->id, $params['action'])) {
$values = FrmEntriesHelper::setup_new_vars($fields, $form);
include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
}
return;
}
if (!empty($errors)) {
$values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
return;
}
do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
if (!apply_filters('frm_continue_to_create', true, $form->id)) {
return;
}
$values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
$created = isset($frm_vars['created_entries']) && isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0;
$conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
if ($created && is_numeric($created) && $conf_method != 'message') {
do_action('frm_success_action', $conf_method, $form, $form->options, $created);
do_action('frm_after_entry_processed', array('entry_id' => $created, 'form' => $form));
return;
}
if ($created && is_numeric($created)) {
$message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
$class = 'frm_message';
} else {
$message = $frm_settings->failed_msg;
$class = 'frm_error_style';
}
$message = FrmFormsHelper::get_success_message(array('message' => $message, 'form' => $form, 'entry_id' => $created, 'class' => $class));
$message = apply_filters('frm_main_feedback', $message, $form, $created);
if (!isset($form->options['show_form']) || $form->options['show_form']) {
require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
} else {
global $frm_vars;
self::maybe_load_css($form, $values['custom_style'], $frm_vars['load_css']);
$include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class($values);
include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php';
}
do_action('frm_after_entry_processed', array('entry_id' => $created, 'form' => $form));
}
示例12: display_recaptcha
public static function display_recaptcha($field)
{
$frm_settings = FrmAppHelper::get_settings();
$lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
$api_js_url = 'https://www.google.com/recaptcha/api.js';
if ($lang != 'en') {
$api_js_url .= '?hl=' . $lang;
}
$api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
wp_register_script('recaptcha-api', $api_js_url, '', true);
wp_enqueue_script('recaptcha-api');
?>
<div id="field_<?php
echo esc_attr($field['field_key']);
?>
" class="g-recaptcha" data-sitekey="<?php
echo esc_attr($frm_settings->pubkey);
?>
"></div>
<?php
}
示例13: display_recaptcha
public static function display_recaptcha($field)
{
$frm_settings = FrmAppHelper::get_settings();
$lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
$class_prefix = '';
$api_js_url = 'https://www.google.com/recaptcha/api.js?';
$allow_mutiple = $frm_settings->re_multi;
if ($allow_mutiple) {
$api_js_url .= '&onload=frmRecaptcha&render=explicit';
$class_prefix = 'frm-';
}
if ($lang != 'en') {
$api_js_url .= '&hl=' . $lang;
}
$api_js_url = apply_filters('frm_recaptcha_js_url', $api_js_url);
wp_register_script('recaptcha-api', $api_js_url, '', true);
wp_enqueue_script('recaptcha-api');
?>
<div id="field_<?php
echo esc_attr($field['field_key']);
?>
" class="<?php
echo esc_attr($class_prefix);
?>
g-recaptcha" data-sitekey="<?php
echo esc_attr($frm_settings->pubkey);
?>
" data-size="<?php
echo esc_attr($field['captcha_size']);
?>
" data-theme="<?php
echo esc_attr($field['captcha_theme']);
?>
"></div>
<?php
}
示例14: show_errors
/**
* Display the validation error messages when an entry is submitted
*
* @param array $args - includes img, errors
* @since 2.0.6
*/
public static function show_errors($args)
{
$frm_settings = FrmAppHelper::get_settings();
if (empty($frm_settings->invalid_msg)) {
$show_img = false;
} else {
echo wp_kses_post($frm_settings->invalid_msg);
$show_img = true;
}
self::show_error(array('img' => $args['img'], 'errors' => $args['errors'], 'show_img' => $show_img));
}
示例15: get_new_vars
public static function get_new_vars($errors = array(), $form = false, $message = '')
{
global $frm_vars;
$description = true;
$title = false;
$form = apply_filters('frm_pre_display_form', $form);
if (!$form) {
wp_die(__('You are trying to access an entry that does not exist.', 'formidable'));
return;
}
$fields = FrmFieldsHelper::get_form_fields($form->id, !empty($errors));
$values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
$frm_settings = FrmAppHelper::get_settings();
$submit = isset($frm_vars['next_page'][$form->id]) ? $frm_vars['next_page'][$form->id] : (isset($values['submit_value']) ? $values['submit_value'] : $frm_settings->submit_value);
if (is_object($submit)) {
$submit = $submit->name;
}
require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-entries/new.php';
}