Warning: Fast Secure Contact Form cannot import settings because the previous version is too old. Installed as new.', 'si-contact-form' ), 'error');
self::$global_options['import_success'] = false;
self::$global_options['import_msg'] = true;
update_option( 'fs_contact_global', self::$global_options );
}
}
return;
}
static function fscf_init_languages() {
if (function_exists('load_plugin_textdomain')) {
load_plugin_textdomain('si-contact-form', false, 'si-contact-form/languages' );
}
}
static function fscf_init_session() {
self::get_global_options();
// start the PHP session if enabled - used by shortcode attributes (and the CAPTCHA, but only when enable_php_sessions)
// PHP Sessions are no longer enabled by default allowing for best compatibility with servers, caching, themes, and other plugins.
// This should resolve any PHP sessions related issues some users had.
if ( self::$global_options['enable_php_sessions'] == 'true' ) {
FSCF_Util::start_session();
}
}
static function enqueue_admin_scripts( $hook ) {
// Add jquery and css for tabs on options page only for this plugin
if( strpos ( $hook, 'si-contact-form' ) > 0 ) {
wp_enqueue_script('thickbox'); // for constant contact addon
wp_enqueue_style('thickbox'); // for constant contact addon
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-tabs' );
wp_enqueue_script( 'jquery-ui-sortable' ); // used for drag and drop ordering of fields
wp_enqueue_script( 'fscf_scripts_admin', plugins_url( 'si-contact-form/includes/fscf-scripts-admin.js' ), false, FSCF_BUILD );
wp_enqueue_script( 'fscf_scripts', plugins_url( 'si-contact-form/includes/fscf-scripts.js' ), false, FSCF_BUILD );
// Load jquery-ui css, depending on WP version
if ( version_compare( get_bloginfo('version'), '3.5', '<' ) )
wp_enqueue_style( 'jquery-ui', plugins_url( 'si-contact-form/includes/jquery-ui-1820.css' ) );
else
wp_enqueue_style( 'jquery-ui', plugins_url( 'si-contact-form/includes/jquery-ui-191.css' ) );
// Set up array of phrases used in scripts-admin.js for translation
// NOTE: Some of the phrases below are used to match button values in FSCF_Option.
// These must match EXACTLY, or the button presses will not be recognized
// XXX consider storing button values in constants so that they WILL be the same
$translation_array = array(
'show_details' => __('Show Details', 'si-contact-form'),
'hide_details' => __('Hide Details', 'si-contact-form'),
'save_changes' => __('Save Changes', 'si-contact-form'),
'send_test' => __('Send Test', 'si-contact-form'),
'copy_settings' => __('Copy Settings', 'si-contact-form'),
'backup_settings' => __('Backup Settings', 'si-contact-form'),
'restore_settings' => __('Restore Settings', 'si-contact-form'),
'confirm_change' => __('Are you sure you want to permanently make this change?', 'si-contact-form'),
'unsaved_changes' => __('You have unsaved changes.', 'si-contact-form'),
'reset_form' => __('Reset Form', 'si-contact-form'),
'reset_all_styles' => __('Reset Styles on all forms', 'si-contact-form'),
'delete_form' => __('Delete Form', 'si-contact-form'),
'import_old_forms' => __('Import forms from 3.xx version', 'si-contact-form'),
);
wp_localize_script( 'fscf_scripts_admin', 'fscf_transl', $translation_array );
wp_enqueue_style( 'fscf-styles-admin', plugins_url( 'si-contact-form/includes/fscf-styles-admin.css' ), false, FSCF_BUILD );
}
}
static function add_recaptcha_js() {
global $fs_recaptcha_add_script;
// for loading recaptcha js in footer conditionally if form has recaptcha enabled or not
// makes multiforms compatible on same page
$string = '
\n\n";
echo $string;
}
static function add_date_js() {
// add js for forms with date fields
// makes multiforms compatible on same page
//wp_enqueue_style( 'fscf_date_style', plugins_url( 'si-contact-form/date/ctf_epoch_styles.css' ), false, FSCF_BUILD );
wp_enqueue_script( 'fscf_date_js', plugins_url( 'si-contact-form/date/ctf_epoch_classes.js' ), false, FSCF_BUILD );
echo FSCF_Display::$add_date_js;
$string = ' var';
$date_var_string = '';
foreach ( FSCF_Display::$add_date_js_array as $v ) {
$date_var_string .= ' dp_cal' . "$v,";
}
$date_var_string = substr( $date_var_string, 0, -1 );
$string .= "$date_var_string;\n";
if (FSCF_Display::$fscf_use_window_onload)
$string .= ' window.onload = function () {
';
foreach ( FSCF_Display::$add_date_js_array as $v ) {
$string .= " dp_cal$v = new Epoch('epoch_popup$v','popup',document.getElementById('fscf_field$v'));\n";
}
if (FSCF_Display::$fscf_use_window_onload)
$string .= " };\n";
$string .= "\n";
echo $string;
?>
\n\n";
}
static function fscf_wp_footer() {
// Add js and css needed for the forms
if ( isset(FSCF_Display::$add_fscf_script) && FSCF_Display::$add_fscf_script ) {
// only include if a form is on this page or post
wp_enqueue_script( 'jquery-ui-core' ); // needed for the feature "Has the form already been submitted? If so, reset the form"
//wp_enqueue_style( 'fscf-styles', plugins_url( 'si-contact-form/includes/fscf-styles.css' ), false, FSCF_BUILD );
wp_enqueue_script( 'fscf_scripts', plugins_url( 'si-contact-form/includes/fscf-scripts.js' ), false, FSCF_BUILD );
}
if ( isset(FSCF_Display::$add_placeholder_script) && FSCF_Display::$add_placeholder_script ) {
// makes placeholder work on old browsers
wp_enqueue_script( 'fscf_placeholders', plugins_url( 'si-contact-form/includes/fscf-placeholders.min.js' ), false, FSCF_BUILD );
}
if ( isset(FSCF_Display::$add_date_js) && FSCF_Display::$add_date_js != '' ) {
// add js for forms with date fields
FSCF_Util::add_date_js();
}
if ( isset(FSCF_Display::$add_recaptcha_script) && FSCF_Display::$add_recaptcha_script ) {
//wp_enqueue_script( 'fscf-recaptcha', 'https://www.google.com/recaptcha/api.js' );
// loads conditionally if forms have recaptcha enabled
// makes multiforms compatible on same page
wp_enqueue_script( 'fscf-recaptcha', 'https://www.google.com/recaptcha/api.js?onload=fscfReCAPTCHA&render=explicit' );
FSCF_Util::add_recaptcha_js();
}
}
static function fscf_admin_footer() {
// add placeholder javascript in form preview page only if needed
if ( isset(FSCF_Display::$placeholder) && FSCF_Display::$placeholder) {
// makes placeholder work on old browsers
wp_enqueue_script( 'fscf_placeholders', plugins_url( 'si-contact-form/includes/fscf-placeholders.min.js' ), false, FSCF_BUILD );
}
if ( isset(FSCF_Display::$add_date_js) && FSCF_Display::$add_date_js != '' ) {
// add js for forms with date fields
FSCF_Util::add_date_js();
}
if ( isset(FSCF_Display::$add_recaptcha_script) && FSCF_Display::$add_recaptcha_script ) {
//wp_enqueue_script( 'fscf-recaptcha', 'https://www.google.com/recaptcha/api.js' );
// loads conditionally if forms have recaptcha enabled
// makes multiforms compatible on same page
wp_enqueue_script( 'fscf-recaptcha', 'https://www.google.com/recaptcha/api.js?onload=fscfReCAPTCHA&render=explicit' );
FSCF_Util::add_recaptcha_js();
}
}
static function make_fscf_script_async( $tag, $handle, $src ) {
// to support multiple forms on one page, google recaptcha js needs to be loded async
// make wordpress wp_enqueue_script load js async, but only for this fscf-recaptcha handle
if ( 'fscf-recaptcha' != $handle ) {
return $tag;
}
return str_replace( '