PluginProbe
Contact Forms by Cimatti / 1.4.1
Contact Forms by Cimatti v1.4.1
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
contact-forms / accua-form-api.php

accua-form-api.php in Contact Forms by Cimatti 1.4.1, at accua-form-api.php

83 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 function accua_form_Load($class) {
3 if (substr($class,0,10) === 'AccuaForm_') {
4 $class = substr($class, 10);
5 $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . str_replace("_", DIRECTORY_SEPARATOR, $class) . ".php";
6 if(is_file($file)) {
7 include_once $file;
8 }
9 }
10 }
11 spl_autoload_register("accua_form_Load");
12
13 require_once('PFBC/Form.php');
14 require_once('AccuaForm.php');
15
16 add_action('plugins_loaded', 'accua_form_init');
17 add_action( 'wp_print_scripts', 'accua_form_init_scripts');
18
19 define('ACCUA_FORM_API_PLUGIN_TEXTDOMAIN_PATH', dirname( plugin_basename( __FILE__ ) ) . '/languages/');
20
21 function accua_form_init_scripts(){
22 global $wp_scripts;
23 wp_enqueue_script('jquery');
24
25 if(!wp_script_is('wp-color-picker', 'registered')) {
26 if (!wp_script_is('iris', 'registered')) {
27 $wp_scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 );
28 }
29
30 if ( ! defined( 'SCRIPT_DEBUG' ) ) {
31 define( 'SCRIPT_DEBUG', false );
32 }
33 $suffix = SCRIPT_DEBUG ? '' : '.min';
34 $wp_scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
35 $wp_scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array(
36 'clear' => __( 'Clear' ),
37 'defaultString' => __( 'Default' ),
38 'pick' => __( 'Select Color' ),
39 'current' => __( 'Current Color' ),
40 ) );
41 }
42 wp_enqueue_script('wp-color-picker');
43 }
44 function accua_form_init(){
45
46 wp_enqueue_style( 'wp-color-picker' );
47 wp_enqueue_style( 'accua-forms-api-base', plugins_url('accua-form-api.css', __FILE__), array(), '2');
48
49 load_plugin_textdomain( 'accua-form-api', false, ACCUA_FORM_API_PLUGIN_TEXTDOMAIN_PATH);
50 AccuaForm::isValid();
51 }
52
53 add_action('wp_ajax_accua_form_submit', 'accua_form_ajax_submit_handler');
54 add_action('wp_ajax_nopriv_accua_form_submit', 'accua_form_ajax_submit_handler');
55 function accua_form_ajax_submit_handler(){
56 header('Content-Type: text/html; charset='.get_option('blog_charset'));
57
58 echo '<html><head></head><body><pre id="accua-form-ajax-response">';
59
60 echo strtr(json_encode(AccuaForm::ajaxSubmit(), JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP),
61 array(
62 '&' => '\\u0026',
63 '<' => '\\u003C',
64 '>' => '\\u003E',
65 ));
66
67 echo '</pre><div id="accua-form-ajax-response-loaded"></div>';
68
69 echo <<<EOJS
70 <script type="text/javascript">
71 <!--
72 try {
73 window.parent.postMessage(document.getElementById("accua-form-ajax-response").innerHTML, '*');
74 } catch (err) {
75 }
76 // -->
77 </script>
78 EOJS;
79
80 echo '</body></html>';
81 die('');
82 }
83