PluginProbe
Smart Forms – when you need more than just a contact form / 0.8.5
Smart Forms – when you need more than just a contact form v0.8.5
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.8.5, at smartforms.php

152 lines 5.0 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.8.5
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-ajax.php');
44 require_once(SMART_FORMS_DIR.'widgets/smart-form-widget.php');
45
46 add_shortcode('sform','rednao_smart_form_short_code');
47
48
49 add_action('init', 'rednao_smart_forms_init');
50 add_action( 'wp_ajax_rednao_smart_forms_save', 'rednao_smart_forms_save' );
51 add_action( 'wp_ajax_rednao_smart_form_list', 'rednao_smart_form_list' );
52 add_action( 'wp_ajax_rednao_smart_forms_entries_list', 'rednao_smart_forms_entries_list' );
53 add_action( 'wp_ajax_rednao_smart_forms_save_form_values','rednao_smart_forms_save_form_values');
54 add_action( 'wp_ajax_nopriv_rednao_smart_forms_save_form_values','rednao_smart_forms_save_form_values');
55 add_action( 'wp_ajax_rednao_smart_form_send_test_email','rednao_smart_form_send_test_email');
56 add_action('wp_ajax_rednao_smart_forms_submit_license','rednao_smart_forms_submit_license');
57
58 add_action('admin_init','rednao_smart_forms_plugin_was_activated');
59 register_activation_hook(__FILE__,'rednao_smart_forms_plugin_was_activated');
60
61 add_action('admin_menu','rednao_smart_forms_create_menu');
62
63
64 function rednao_smart_forms_create_menu(){
65
66 add_menu_page('Smart Forms','Smart Forms','manage_options',__FILE__,'rednao_forms',plugin_dir_url(__FILE__).'images/smartFormsIcon.png');
67 add_submenu_page(__FILE__,'Entries','Entries','manage_options',__FILE__.'entries', 'rednao_smart_forms_entries');
68
69 }
70
71
72
73 function rednao_smart_forms_plugin_was_activated()
74 {
75 $dbversion=get_option(SMART_FORMS_LATEST_DB_VERSION);
76
77
78 global $wpdb;
79 if( $dbversion<SMART_FORMS_LATEST_DB_VERSION )
80 {
81 require_once(ABSPATH.'wp-admin/includes/upgrade.php');
82
83 $sql="CREATE TABLE ".SMART_FORMS_TABLE_NAME." (
84 form_id int AUTO_INCREMENT,
85 form_name VARCHAR(200) NOT NULL,
86 element_options MEDIUMTEXT NOT NULL,
87 client_form_options MEDIUMTEXT NOT NULL,
88 form_options MEDIUMTEXT NOT NULL,
89 PRIMARY KEY (form_id)
90 );";
91 dbDelta($sql);
92
93 $sql="CREATE TABLE ".SMART_FORMS_ENTRY." (
94 entry_id int AUTO_INCREMENT,
95 form_id int,
96 date datetime NOT NULL,
97 data MEDIUMTEXT NOT NULL,
98 ip VARCHAR(39),
99 PRIMARY KEY (entry_id)
100 );";
101 dbDelta($sql);
102
103 update_option("SMART_FORMS_LATEST_DB_VERSION",$dbversion);
104 }
105 }
106
107
108
109
110 function rednao_forms()
111 {
112 include(SMART_FORMS_DIR.'main_screens/smart-forms-list.php');
113 }
114
115 function rednao_smart_form_short_code($attr,$content)
116 {
117 require_once('smart-forms-helpers.php');
118 return rednao_smart_forms_load_form(null,$content,true);
119 }
120
121 function rednao_smart_forms_init()
122 {
123 if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
124 return;
125 }
126
127 if ( get_user_option('rich_editing') == 'true') {
128 add_filter( 'mce_external_plugins', 'rednao_smart_forms_add_plugin' );
129 add_filter( 'mce_buttons', 'rednao_smart_forms_register_button' );
130 }
131 }
132
133 function rednao_smart_forms_add_plugin($plugin_array)
134 {
135 wp_enqueue_script('isolated-slider',plugin_dir_url(__FILE__).'js/rednao-isolated-jq.js');
136 wp_enqueue_style('smart-forms-Slider',plugin_dir_url(__FILE__).'css/smartFormsSlider/jquery-ui-1.10.2.custom.min.css');
137 $plugin_array['rednao_smart_forms_button']=plugin_dir_url(__FILE__).'js/shortcode/smartFormsShortCodeButton.js';
138 return $plugin_array;
139 }
140
141 function rednao_smart_forms_register_button($buttons)
142 {
143 $buttons[]="rednao_smart_forms_button";
144 return $buttons;
145 }
146
147 function rednao_smart_forms_entries()
148 {
149 include(SMART_FORMS_DIR.'main_screens/smart-forms-entries.php');
150 }
151
152 ?>