PluginProbe
Smart Forms – when you need more than just a contact form / 0.9.1
Smart Forms – when you need more than just a contact form v0.9.1
trunk 0.5 0.5.5 0.6 0.7 0.8 0.8.5 0.9.1
smart-forms / smartforms.php

smartforms.php in Smart Forms – when you need more than just a contact form 0.9.1, at smartforms.php

164 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Smart Forms
4 * Plugin URI: http://rednao.com/smart-donations/
5 * Description: Place diferent form of donations on your blog...
6 * Author: RedNao
7 * Author URI: http://rednao.com
8 * Version: 0.9.1
9 * Text Domain: SmartDonations
10 * Domain Path: /languages/
11 * Network: true
12 * License: GPLv3
13 * License URI: http://www.gnu.org/licenses/gpl-3.0
14 * Slug: smartforms
15 */
16
17 /**
18 * Copyright (C) 2012-2013 RedNao (email: contactus@rednao.com)
19 *
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2
23 * of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 *
34 * Thanks to:
35 * Jakub Stacho (http://www.iconfinder.com/iconsets/checkout-icons#readme)
36 * Eggib (http://openclipart.org/detail/174878/)
37 * Aha-Soft (http://www.iconfinder.com/iconsets/24x24-free-pixel-icons#readme)
38 * Kevin Liew (http://www.queness.com/post/106/jquery-tabbed-interfacetabbed-structure-menu-tutorial)
39 * Marcis Gasuns (http://led24.de/iconset/)
40 */
41
42 require_once('smart-forms-config.php');
43 require_once(SMART_FORMS_DIR.'integration/smart-forms-integration-ajax.php');
44 require_once('smart-forms-ajax.php');
45 require_once(SMART_FORMS_DIR.'widgets/smart-form-widget.php');
46
47 add_shortcode('sform','rednao_smart_form_short_code');
48
49
50 add_action('init', 'rednao_smart_forms_init');
51 add_action( 'wp_ajax_rednao_smart_forms_save', 'rednao_smart_forms_save' );
52 add_action( 'wp_ajax_rednao_smart_form_list', 'rednao_smart_form_list' );
53 add_action( 'wp_ajax_rednao_smart_forms_entries_list', 'rednao_smart_forms_entries_list' );
54 add_action( 'wp_ajax_rednao_smart_forms_save_form_values','rednao_smart_forms_save_form_values');
55 add_action( 'wp_ajax_nopriv_rednao_smart_forms_save_form_values','rednao_smart_forms_save_form_values');
56 add_action( 'wp_ajax_rednao_smart_form_send_test_email','rednao_smart_form_send_test_email');
57 add_action('wp_ajax_rednao_smart_forms_submit_license','rednao_smart_forms_submit_license');
58
59 //integration
60
61 add_action('wp_ajax_rednao_smart_forms_get_campaigns','rednao_smart_forms_get_campaigns');
62
63
64
65 add_action('admin_init','rednao_smart_forms_plugin_was_activated');
66 register_activation_hook(__FILE__,'rednao_smart_forms_plugin_was_activated');
67
68 add_action('admin_menu','rednao_smart_forms_create_menu');
69
70
71 function rednao_smart_forms_create_menu(){
72
73 add_menu_page('Smart Forms','Smart Forms','manage_options',__FILE__,'rednao_forms',plugin_dir_url(__FILE__).'images/smartFormsIcon.png');
74 add_submenu_page(__FILE__,'Entries','Entries','manage_options',__FILE__.'entries', 'rednao_smart_forms_entries');
75 add_submenu_page(__FILE__,'Wish List/Support','Wish List/Support','manage_options',__FILE__.'wish_list', 'rednao_smart_forms_wish_list');
76
77 }
78
79
80
81 function rednao_smart_forms_plugin_was_activated()
82 {
83 $dbversion=get_option(SMART_FORMS_LATEST_DB_VERSION);
84
85
86 global $wpdb;
87 if( $dbversion<SMART_FORMS_LATEST_DB_VERSION )
88 {
89 require_once(ABSPATH.'wp-admin/includes/upgrade.php');
90
91 $sql="CREATE TABLE ".SMART_FORMS_TABLE_NAME." (
92 form_id int AUTO_INCREMENT,
93 form_name VARCHAR(200) NOT NULL,
94 element_options MEDIUMTEXT NOT NULL,
95 client_form_options MEDIUMTEXT NOT NULL,
96 form_options MEDIUMTEXT NOT NULL,
97 PRIMARY KEY (form_id)
98 );";
99 dbDelta($sql);
100
101 $sql="CREATE TABLE ".SMART_FORMS_ENTRY." (
102 entry_id int AUTO_INCREMENT,
103 form_id int,
104 date datetime NOT NULL,
105 data MEDIUMTEXT NOT NULL,
106 ip VARCHAR(39),
107 PRIMARY KEY (entry_id)
108 );";
109 dbDelta($sql);
110
111 update_option("SMART_FORMS_LATEST_DB_VERSION",$dbversion);
112 }
113 }
114
115
116
117
118 function rednao_forms()
119 {
120 include(SMART_FORMS_DIR.'main_screens/smart-forms-list.php');
121 }
122
123 function rednao_smart_form_short_code($attr,$content)
124 {
125 require_once('smart-forms-helpers.php');
126 return rednao_smart_forms_load_form(null,$content,true);
127 }
128
129 function rednao_smart_forms_init()
130 {
131 if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
132 return;
133 }
134
135 if ( get_user_option('rich_editing') == 'true') {
136 add_filter( 'mce_external_plugins', 'rednao_smart_forms_add_plugin' );
137 add_filter( 'mce_buttons', 'rednao_smart_forms_register_button' );
138 }
139 }
140
141 function rednao_smart_forms_add_plugin($plugin_array)
142 {
143 wp_enqueue_script('isolated-slider',plugin_dir_url(__FILE__).'js/rednao-isolated-jq.js');
144 wp_enqueue_style('smart-forms-Slider',plugin_dir_url(__FILE__).'css/smartFormsSlider/jquery-ui-1.10.2.custom.min.css');
145 $plugin_array['rednao_smart_forms_button']=plugin_dir_url(__FILE__).'js/shortcode/smartFormsShortCodeButton.js';
146 return $plugin_array;
147 }
148
149 function rednao_smart_forms_register_button($buttons)
150 {
151 $buttons[]="rednao_smart_forms_button";
152 return $buttons;
153 }
154
155 function rednao_smart_forms_entries()
156 {
157 include(SMART_FORMS_DIR.'main_screens/smart-forms-entries.php');
158 }
159 function rednao_smart_forms_wish_list()
160 {
161 include(SMART_FORMS_DIR.'main_screens/smart-forms-wishlist.php');
162 }
163
164 ?>