| @@ -1,14 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Smart Forms |
| 4 | - * Plugin URI: http://smartforms.rednao.com/getit | |
| 4 | + * Plugin URI: http://rednao.com/smart-donations/ | |
| 5 | 5 | * Description: Place diferent form of donations on your blog... |
| 6 | 6 | * Author: RedNao |
| 7 | 7 | * Author URI: http://rednao.com |
| 8 | - * Version: 2.6.104 | |
| 9 | - * Text Domain: Smart Forms | |
| 8 | + * Version: 0.5 | |
| 9 | + * Text Domain: SmartDonations | |
| 10 | 10 | * Domain Path: /languages/ |
| 11 | + * Network: true | |
| 11 | 12 | * License: GPLv3 |
| 12 | 13 | * License URI: http://www.gnu.org/licenses/gpl-3.0 |
| 13 | 14 | * Slug: smartforms |
| 14 | 15 | */ |
| @@ -38,441 +39,69 @@ | ||
| 38 | 39 | * Marcis Gasuns (http://led24.de/iconset/) |
| 39 | 40 | */ |
| 40 | 41 | |
| 41 | 42 | require_once('smart-forms-config.php'); |
| 42 | -require_once(SMART_FORMS_DIR.'integration/smart-donations-integration-ajax.php'); | |
| 43 | 43 | require_once('smart-forms-ajax.php'); |
| 44 | 44 | require_once(SMART_FORMS_DIR.'widgets/smart-form-widget.php'); |
| 45 | -require_once (SMART_FORMS_DIR.'php_classes/api/SFApiActions.php'); | |
| 46 | -require_once (SMART_FORMS_DIR.'php_classes/api/SFApiFilters.php'); | |
| 47 | 45 | |
| 48 | 46 | add_shortcode('sform','rednao_smart_form_short_code'); |
| 49 | 47 | |
| 50 | -add_action( 'admin_notices', 'smart_forms_review_request' ); | |
| 48 | + | |
| 51 | 49 | add_action('init', 'rednao_smart_forms_init'); |
| 52 | -add_action( 'wp_ajax_rednao_smart_forms_export_entries', 'rednao_smart_forms_export_entries' ); | |
| 53 | -add_action( 'wp_ajax_rednao_smart_forms_resend_email', 'rednao_smart_forms_resend_email' ); | |
| 54 | -add_action( 'wp_ajax_rednao_smart_forms_export', 'rednao_smart_forms_export' ); | |
| 55 | 50 | add_action( 'wp_ajax_rednao_smart_forms_save', 'rednao_smart_forms_save' ); |
| 56 | -add_action( 'wp_ajax_rednao_smart_forms_send_files', 'rednao_smart_forms_send_files' ); | |
| 57 | -add_action( 'wp_ajax_nopriv_rednao_smart_forms_send_files', 'rednao_smart_forms_send_files' ); | |
| 58 | -add_action( 'wp_ajax_rednao_smart_form_short_code_setup', 'rednao_smart_form_short_code_setup' ); | |
| 59 | -add_action( 'wp_ajax_rednao_smart_form_delete_entries', 'rednao_smart_form_delete_entries' ); | |
| 51 | +add_action( 'wp_ajax_rednao_smart_form_list', 'rednao_smart_form_list' ); | |
| 60 | 52 | add_action( 'wp_ajax_rednao_smart_forms_entries_list', 'rednao_smart_forms_entries_list' ); |
| 61 | 53 | add_action( 'wp_ajax_rednao_smart_forms_save_form_values','rednao_smart_forms_save_form_values'); |
| 62 | -add_action( 'wp_ajax_rednao_smart_forms_edit_form_values','rednao_smart_forms_edit_form_values'); | |
| 63 | 54 | add_action( 'wp_ajax_nopriv_rednao_smart_forms_save_form_values','rednao_smart_forms_save_form_values'); |
| 64 | 55 | add_action( 'wp_ajax_rednao_smart_form_send_test_email','rednao_smart_form_send_test_email'); |
| 65 | 56 | add_action('wp_ajax_rednao_smart_forms_submit_license','rednao_smart_forms_submit_license'); |
| 66 | -add_action('wp_ajax_rednao_smart_forms_execute_op','rednao_smart_forms_execute_op'); | |
| 67 | -add_action('wp_ajax_rednao_smart_forms_generate_detail','rednao_smart_forms_generate_detail'); | |
| 68 | -add_action('wp_ajax_rednao_smart_forms_get_form_element_info','rednao_smart_forms_get_form_element_info'); | |
| 69 | -add_action('wp_ajax_rednao_smart_forms_get_form_options','rednao_smart_forms_get_form_options'); | |
| 70 | -add_action('wp_ajax_rednao_smart_forms_send_test','rednao_smart_forms_send_test'); | |
| 71 | -add_action('wp_ajax_smart_forms_skip_tutorial','smart_forms_skip_tutorial'); | |
| 72 | -add_action('wp_ajax_rednao_smartformsexport','smart_forms_export'); | |
| 73 | -add_action('wp_ajax_rednao_smart_forms_save_settings','smart_forms_save_settings'); | |
| 74 | -add_action('wp_ajax_rednao_smart_forms_update_order','rednao_smart_forms_update_order'); | |
| 75 | -add_action( 'admin_menu', 'smart_forms_remove_menu_items' ); | |
| 76 | -add_action('admin_enqueue_scripts','rednao_smart_forms_admin_header'); | |
| 77 | -add_action( 'enqueue_block_editor_assets', 'rednao_smart_forms_register_blocks' ); | |
| 78 | -add_action( 'init', 'smart_forms_register_block' ); | |
| 79 | -add_action( 'wp_ajax_rednao_sf_getfile','rednao_smart_forms_get_file'); | |
| 80 | -add_action( 'wp_ajax_nopriv_rednao_sf_getfile','rednao_smart_forms_get_file'); | |
| 81 | 57 | |
| 82 | -add_action( 'wp_ajax_rednao_sf_getsignature','rednao_sf_getsignature'); | |
| 83 | -add_action( 'wp_ajax_nopriv_rednao_sf_getsignature','rednao_sf_getsignature'); | |
| 84 | -//api | |
| 85 | -$apiActions=new SFApiActions(); | |
| 86 | -$apiActions->register_hooks(); | |
| 87 | -$apiFilters=new SFApiFilters(); | |
| 88 | -$apiFilters->register_hooks(); | |
| 89 | -//integration | |
| 90 | - | |
| 91 | -add_action('wp_ajax_rednao_smart_forms_get_campaigns','rednao_smart_forms_get_campaigns'); | |
| 92 | - | |
| 93 | - | |
| 94 | 58 | add_action('admin_init','rednao_smart_forms_plugin_was_activated'); |
| 95 | 59 | register_activation_hook(__FILE__,'rednao_smart_forms_plugin_was_activated'); |
| 96 | 60 | |
| 97 | 61 | add_action('admin_menu','rednao_smart_forms_create_menu'); |
| 98 | -add_filter('smart_forms_add_form_elements_dependencies','rednao_add_form_elements_dependencies'); | |
| 99 | -add_action('admin_notices', 'ShowAllInOneNotice'); | |
| 100 | 62 | |
| 101 | -add_action( 'admin_init', 'smart_forms_admin_notices' ); | |
| 102 | -add_action('wp_ajax_smart_forms_aio_dismiss','smart_forms_aio_dismiss'); | |
| 103 | 63 | |
| 104 | -function smart_forms_aio_dismiss() | |
| 105 | -{ | |
| 106 | - $nonce=$_POST['nonce']; | |
| 107 | - if(!wp_verify_nonce($nonce,'wp_sf_aio_dismiss')) | |
| 108 | - die('Invalid request'); | |
| 109 | - | |
| 110 | - | |
| 111 | - update_option('SFAIONotShowAgain',true); | |
| 112 | -} | |
| 113 | -function smart_forms_admin_notices() | |
| 114 | -{ | |
| 115 | - if ( is_multisite() ) { | |
| 116 | - add_action( 'network_admin_notices', 'smart_forms_maybe_add_aio_notice' ); | |
| 117 | - } else { | |
| 118 | - add_action( 'admin_notices','smart_forms_maybe_add_aio_notice' ); | |
| 119 | - } | |
| 120 | -} | |
| 121 | - | |
| 122 | -function smart_forms_maybe_add_aio_notice() | |
| 123 | -{ | |
| 124 | - if(get_option('SFAIONotShowAgain',false)) | |
| 125 | - return; | |
| 126 | - ?> | |
| 127 | - <div class="notice notice-success is-dismissible smart-forms-notice"> | |
| 128 | - <div style="display: flex;justify-content: flex-end;align-items: center"> | |
| 129 | - <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button> | |
| 130 | - </div> | |
| 131 | - <div style="display: flex;align-items: center;"> | |
| 132 | - <img src="<?php echo SMART_FORMS_DIR_URL?>images/aioicon.gif"/> | |
| 133 | - <div style="margin-right: 10px"> | |
| 134 | - | |
| 135 | - <p>If you like Smart Forms you will love our new form builder <a target="_blank" href="https://allinoneforms.rednao.com/migrating-to-aio-forms/">AIO Forms</a> </p> | |
| 136 | - <div style="margin-top: 10px"> | |
| 137 | - <a target="_blank" href="https://allinoneforms.rednao.com/migrating-to-aio-forms/" class="button-primary">What is AIO Forms and why should I use it</a> | |
| 138 | - <a href="#" class="button-secondary notShowAgain">Dismiss notice and not show again</a> | |
| 139 | - </div> | |
| 140 | - </div> | |
| 141 | - </div> | |
| 142 | - </div> | |
| 143 | - <script type="text/javascript"> | |
| 144 | - | |
| 145 | - document.querySelector('.notShowAgain').addEventListener('click',function(){ | |
| 146 | - | |
| 147 | - jQuery.post( ajaxurl, { action: 'smart_forms_aio_dismiss', | |
| 148 | - nonce: '<?php echo wp_create_nonce('wp_sf_aio_dismiss')?>' | |
| 149 | - } ); | |
| 150 | - | |
| 151 | - | |
| 152 | - document.querySelector('.smart-forms-notice').remove(); | |
| 153 | - }); | |
| 154 | - | |
| 155 | - document.querySelector('.smart-forms-notice .notice-dismiss').addEventListener('click',function(){ | |
| 156 | - document.querySelector('.smart-forms-notice').remove(); | |
| 157 | - }); | |
| 158 | - </script> | |
| 159 | - <?php | |
| 160 | - | |
| 161 | -} | |
| 162 | - | |
| 163 | -function ShowAllInOneNotice(){ | |
| 164 | - return; | |
| 165 | - if(isset($_GET['DismissAllInOneNotice'])&&intval($_GET['DismissAllInOneNotice'])==1) | |
| 166 | - { | |
| 167 | - update_option('AllInOneNoticeTime',-1); | |
| 168 | - return; | |
| 169 | - } | |
| 170 | - | |
| 171 | - if(get_option('AllInOneNoticeTime',false)==-1) | |
| 172 | - { | |
| 173 | - return; | |
| 174 | - } | |
| 175 | - | |
| 176 | - | |
| 177 | - echo '<div class="notice notice-info is-dismissible" data-dismissible="notice-one-forever" > | |
| 178 | - <div style="padding: 10px;display: flex;align-items: center;"> | |
| 179 | - <a target="_blank" href="https://wordpress.org/plugins/all-in-one-forms/" style="display: inline-flex;flex-direction: column;text-align: center;align-items: center"> | |
| 180 | - <img src="'.esc_attr(SMART_FORMS_DIR_URL).'images/allinonelogo.png" style="width: 100px;"/> | |
| 181 | - <strong style="font-size: 20px;margin-top: 5px;">All in one forms</strong> | |
| 182 | - </a> | |
| 183 | - | |
| 184 | - <div style="margin-left: 15px;"> | |
| 185 | - <h2 style="margin: 0">Are you enjoing Smart Forms? Try our new form builder!</h2> | |
| 186 | - <ul style="list-style: circle;list-style-position: inside;margin-left: 10px;"> | |
| 187 | - <li>More intuitive and easy to use</li> | |
| 188 | - <li>Support advance calculations and conditional logic</li> | |
| 189 | - <li>The entire form builder (that is all the fields, formulas conditions etc) are available in the free version!</li> | |
| 190 | - <li>If you have a license of smart forms <a target="_blank" href="https://allinoneforms.rednao.com/get-a-free-copy-of-the-plugin/">get an equivalent version for free!</a> (this copy is totally free, you can still keep using smart forms as you normaly do)</li> | |
| 191 | - | |
| 192 | - | |
| 193 | - </ul> | |
| 194 | - </div> | |
| 195 | - </div> | |
| 196 | - | |
| 197 | - <div style="margin-bottom: 10px"> | |
| 198 | - <a target="_blank" style="vertical-align: top;" href="https://wordpress.org/plugins/all-in-one-forms/" class="button-primary">Learn more</a> | |
| 199 | - <form style="display: inline-block;vertical-align: top;"> | |
| 200 | - <input type="hidden" name="DismissAllInOneNotice" value="1"/> | |
| 201 | - <button class="button-secondary">Do not show this again</button> | |
| 202 | - </form> | |
| 203 | - </div> | |
| 204 | - | |
| 205 | - </div>'; | |
| 206 | -} | |
| 207 | - | |
| 208 | - | |
| 209 | -function rednao_sf_getsignature(){ | |
| 210 | - global $wpdb; | |
| 211 | - if(!isset($_GET['id'])||!isset($_GET['tok'])) | |
| 212 | - { | |
| 213 | - echo "Invalid request"; | |
| 214 | - die(); | |
| 215 | - } | |
| 216 | - | |
| 217 | - $id=intval($_GET['id']); | |
| 218 | - $tok=sanitize_text_field($_GET['tok']); | |
| 219 | - | |
| 220 | - $entry=$wpdb->get_row($wpdb->prepare('select data from '.SMART_FORMS_ENTRY.' where entry_id=%s',$id)); | |
| 221 | - if($entry==null) | |
| 222 | - { | |
| 223 | - | |
| 224 | - echo "Invalid request"; | |
| 225 | - die(); | |
| 226 | - } | |
| 227 | - | |
| 228 | - $fields=json_decode($entry->data); | |
| 229 | - if($fields==null) | |
| 230 | - { | |
| 231 | - echo "Invalid request"; | |
| 232 | - die(); | |
| 233 | - } | |
| 234 | - | |
| 235 | - foreach($fields as $key=>$value) | |
| 236 | - { | |
| 237 | - if($value==null||!isset($value->tok)) | |
| 238 | - continue; | |
| 239 | - | |
| 240 | - if($value->tok!=$tok) | |
| 241 | - continue; | |
| 242 | - | |
| 243 | - header('Expires: 0'); | |
| 244 | - header('Cache-Control: must-revalidate'); | |
| 245 | - header('Pragma: public'); | |
| 246 | - header('Content-type: image/png'); | |
| 247 | - | |
| 248 | - echo base64_decode($value->image); | |
| 249 | - } | |
| 250 | - die(); | |
| 251 | -} | |
| 252 | - | |
| 253 | -function smart_forms_register_block(){ | |
| 254 | - if(function_exists('register_block_type')) | |
| 255 | - register_block_type( 'smartforms/sfform-selector', array( | |
| 256 | - 'attributes' => array( | |
| 257 | - 'formId' => array( | |
| 258 | - 'type' => 'string', | |
| 259 | - ) | |
| 260 | - ), | |
| 261 | - 'render_callback' => 'smart_forms_render_form' | |
| 262 | - )); | |
| 263 | -} | |
| 264 | - | |
| 265 | -function smart_forms_render_form($values){ | |
| 266 | - require_once('smart-forms-helpers.php'); | |
| 267 | - return rednao_smart_forms_load_form(null,$values['formId'],true); | |
| 268 | -} | |
| 269 | - | |
| 270 | -function rednao_smart_forms_register_blocks() | |
| 271 | -{ | |
| 272 | - wp_enqueue_script( | |
| 273 | - 'smartforms-gutenberg-form-selector', | |
| 274 | - SMART_FORMS_DIR_URL . 'js/blocks/dist/formSelector_bundle.js', | |
| 275 | - array( 'wp-blocks', 'wp-i18n', 'wp-element' ), | |
| 276 | - SMART_FORMS_FILE_VERSION, | |
| 277 | - true | |
| 278 | - ); | |
| 279 | - | |
| 280 | - global $wpdb; | |
| 281 | - $result=$wpdb->get_results("SELECT form_name label, form_id value FROM ".SMART_FORMS_TABLE_NAME,'ARRAY_A'); | |
| 282 | - wp_localize_script('smartforms-gutenberg-form-selector','smartformsblockvars',array( | |
| 283 | - 'forms'=>$result, | |
| 284 | - 'rootUrl'=>SMART_FORMS_DIR_URL | |
| 285 | - )); | |
| 286 | -} | |
| 287 | - | |
| 288 | - | |
| 289 | -function rednao_add_form_elements_dependencies($dependencies) | |
| 290 | -{ | |
| 291 | - wp_enqueue_script('smart-forms-data-store',SMART_FORMS_DIR_URL.'js/bundle/datastores_bundle.js',array(),SMART_FORMS_FILE_VERSION); | |
| 292 | - wp_enqueue_script('smart-forms-polyfill',SMART_FORMS_DIR_URL.'js/utilities/polyfill.js',array(),SMART_FORMS_FILE_VERSION); | |
| 293 | - wp_enqueue_script('smart-forms-promise',SMART_FORMS_DIR_URL.'js/utilities/es6-promise/es6-promise.min.js',array(),SMART_FORMS_FILE_VERSION); | |
| 294 | - $dependencies[]='smart-forms-data-store'; | |
| 295 | - $dependencies[]='smart-forms-promise'; | |
| 296 | - return $dependencies; | |
| 297 | -} | |
| 298 | - | |
| 299 | -function rednao_smart_forms_admin_header($hook){ | |
| 300 | - if($hook=='toplevel_page_smart_forms_menu'&&isset($_GET['id'])) | |
| 301 | - { | |
| 302 | - add_action('admin_print_styles','smart_forms_filter_not_needed_styles'); | |
| 303 | - add_action('admin_print_scripts','smart_forms_filter_not_needed_scripts'); | |
| 304 | - } | |
| 305 | - | |
| 306 | - // Enqueue sortable on the forms list page (no id = list view) | |
| 307 | - if($hook=='toplevel_page_smart_forms_menu'&&!isset($_GET['id'])) | |
| 308 | - { | |
| 309 | - wp_enqueue_script('jquery-ui-sortable'); | |
| 310 | - } | |
| 311 | -} | |
| 312 | - | |
| 313 | -function smart_forms_filter_not_needed_styles(){ | |
| 314 | - | |
| 315 | - global $wp_styles; | |
| 316 | - $styles=$wp_styles->queue; | |
| 317 | - $queuedStyles=$wp_styles->queue; | |
| 318 | - $allowedStyles=array('admin-bar','colors','ie','wp-auth-check'); | |
| 319 | - foreach($queuedStyles as $queue) | |
| 320 | - { | |
| 321 | - if(isset($wp_styles->registered[$queue])) | |
| 322 | - { | |
| 323 | - if($wp_styles->registered[$queue]->src) | |
| 324 | - { | |
| 325 | - if(strpos($wp_styles->registered[$queue]->src,'wp-includes/')!==false||strpos($wp_styles->registered[$queue]->src,'wp-admin/')!==false||$wp_styles->registered[$queue]->src===true) | |
| 326 | - continue; | |
| 327 | - if(in_array($queue,$allowedStyles)) | |
| 328 | - continue; | |
| 329 | - | |
| 330 | - if(strpos($queue,'smart-forms')!==false) | |
| 331 | - continue; | |
| 332 | - | |
| 333 | - wp_dequeue_style($queue); | |
| 334 | - | |
| 335 | - } | |
| 336 | - } | |
| 337 | - | |
| 338 | - } | |
| 339 | - | |
| 340 | -} | |
| 341 | - | |
| 342 | - | |
| 343 | -function smart_forms_filter_not_needed_scripts(){ | |
| 344 | - | |
| 345 | - global $wp_scripts; | |
| 346 | - $queuedScripts=$wp_scripts->queue; | |
| 347 | - $allowedScripts=array('jquery','common','jquery-ui-core','admin-bar','utils','svg-painter','wp-auth-check'); | |
| 348 | - foreach($queuedScripts as $queue) | |
| 349 | - { | |
| 350 | - if(isset($wp_scripts->registered[$queue])) | |
| 351 | - { | |
| 352 | - if($wp_scripts->registered[$queue]->src) | |
| 353 | - { | |
| 354 | - if(strpos($wp_scripts->registered[$queue]->src,'wp-includes/')!==false||strpos($wp_scripts->registered[$queue]->src,'wp-admin/')!==false||$wp_scripts->registered[$queue]->src===true) | |
| 355 | - continue; | |
| 356 | - if(in_array($queue,$allowedScripts)) | |
| 357 | - continue; | |
| 358 | - | |
| 359 | - if(strpos($queue,'smart-forms')!==false) | |
| 360 | - continue; | |
| 361 | - | |
| 362 | - wp_dequeue_script($queue); | |
| 363 | - | |
| 364 | - } | |
| 365 | - } | |
| 366 | - | |
| 367 | - } | |
| 368 | - | |
| 369 | -} | |
| 370 | - | |
| 371 | -function smart_forms_remove_menu_items() { | |
| 372 | - remove_menu_page( 'edit.php?post_type=smartforms_preview' ); | |
| 373 | -} | |
| 374 | - | |
| 375 | - | |
| 376 | - | |
| 377 | - | |
| 378 | - | |
| 379 | - | |
| 380 | 64 | function rednao_smart_forms_create_menu(){ |
| 381 | 65 | |
| 382 | - add_menu_page('Smart Forms','Smart Forms','manage_options',"smart_forms_menu",'rednao_forms',plugin_dir_url(__FILE__).'images/smartFormsIcon.png'); | |
| 383 | - if(current_user_can('manage_options')) | |
| 384 | - add_submenu_page("smart_forms_menu",'Entries','Entries','manage_options',__FILE__.'entries', 'rednao_smart_forms_entries'); | |
| 385 | - else if(current_user_can('smart_forms_view_entries')) | |
| 386 | - add_submenu_page("smart_forms_menu",'Entries','Entries','smart_forms_view_entries',__FILE__.'entries', 'rednao_smart_forms_entries'); | |
| 387 | - add_submenu_page("smart_forms_menu",'Support/Wish List','Support/Wish List','manage_options',__FILE__.'wish_list', 'rednao_smart_forms_wish_list'); | |
| 388 | - add_submenu_page("smart_forms_menu",'Settings','Settings','manage_options',__FILE__.'settings', 'rednao_smart_forms_settings'); | |
| 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'); | |
| 389 | 68 | |
| 390 | - do_action('add_smart_forms_menu_items'); | |
| 391 | - | |
| 392 | 69 | } |
| 393 | 70 | |
| 394 | 71 | |
| 395 | 72 | |
| 396 | -function smart_forms_indexing_is_requred() | |
| 73 | +function rednao_smart_forms_plugin_was_activated() | |
| 397 | 74 | { |
| 398 | - global $wpdb; | |
| 399 | - $entriesCount=$wpdb->get_var('select count(*) from '. SMART_FORMS_ENTRY); | |
| 400 | - $entriesDetailCount=$wpdb->get_var('select count(*) from '. SMART_FORMS_ENTRY_DETAIL); | |
| 75 | + $dbversion=get_option(SMART_FORMS_LATEST_DB_VERSION); | |
| 401 | 76 | |
| 402 | - return $entriesCount!=0&&$entriesDetailCount==0; | |
| 403 | -} | |
| 404 | 77 | |
| 405 | - | |
| 406 | -function rednao_smart_forms_plugin_was_activated() | |
| 407 | -{ | |
| 408 | - $dbversion=get_option("SMART_FORMS_LATEST_DB_VERSION"); | |
| 409 | - if($dbversion<SMART_FORMS_LATEST_DB_VERSION ) | |
| 78 | + global $wpdb; | |
| 79 | + if( $dbversion<SMART_FORMS_LATEST_DB_VERSION ) | |
| 410 | 80 | { |
| 411 | 81 | require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
| 412 | 82 | |
| 413 | 83 | $sql="CREATE TABLE ".SMART_FORMS_TABLE_NAME." ( |
| 414 | - form_id int AUTO_INCREMENT, | |
| 84 | + form_id int AUTO_INCREMENT, | |
| 415 | 85 | form_name VARCHAR(200) NOT NULL, |
| 416 | 86 | element_options MEDIUMTEXT NOT NULL, |
| 417 | 87 | client_form_options MEDIUMTEXT NOT NULL, |
| 418 | 88 | form_options MEDIUMTEXT NOT NULL, |
| 419 | - donation_email VARCHAR(200), | |
| 420 | - form_order int NOT NULL DEFAULT 0, | |
| 421 | 89 | PRIMARY KEY (form_id) |
| 422 | - ) COLLATE utf8_general_ci;"; | |
| 90 | + );"; | |
| 423 | 91 | dbDelta($sql); |
| 424 | 92 | |
| 425 | 93 | $sql="CREATE TABLE ".SMART_FORMS_ENTRY." ( |
| 426 | 94 | entry_id int AUTO_INCREMENT, |
| 427 | - uniq_id VARCHAR(50), | |
| 428 | - user_id VARCHAR(50), | |
| 429 | 95 | form_id int, |
| 430 | 96 | date datetime NOT NULL, |
| 431 | 97 | data MEDIUMTEXT NOT NULL, |
| 432 | 98 | ip VARCHAR(39), |
| 433 | - reference_id VARCHAR(200), | |
| 434 | - sequential_id BIGINT, | |
| 435 | 99 | PRIMARY KEY (entry_id) |
| 436 | - ) COLLATE utf8_general_ci;"; | |
| 100 | + );"; | |
| 437 | 101 | dbDelta($sql); |
| 438 | 102 | |
| 439 | - $sql="CREATE TABLE ".SMART_FORMS_ENTRY_DETAIL." ( | |
| 440 | - entry_detail_id int AUTO_INCREMENT, | |
| 441 | - entry_id int, | |
| 442 | - field_id varchar(50) NOT NULL, | |
| 443 | - json_value MEDIUMTEXT NOT NULL, | |
| 444 | - value MEDIUMTEXT NOT NULL, | |
| 445 | - exvalue1 MEDIUMTEXT NOT NULL, | |
| 446 | - exvalue2 MEDIUMTEXT NOT NULL, | |
| 447 | - exvalue3 MEDIUMTEXT NOT NULL, | |
| 448 | - exvalue4 MEDIUMTEXT NOT NULL, | |
| 449 | - exvalue5 MEDIUMTEXT NOT NULL, | |
| 450 | - exvalue6 MEDIUMTEXT NOT NULL, | |
| 451 | - numericvalue DOUBLE, | |
| 452 | - datevalue DATETIME, | |
| 453 | - PRIMARY KEY (entry_detail_id), | |
| 454 | - KEY entry_id (entry_id), | |
| 455 | - KEY field_id (field_id), | |
| 456 | - KEY numericvalue (numericvalue), | |
| 457 | - FULLTEXT KEY value (value) | |
| 458 | - ) COLLATE utf8_general_ci;"; | |
| 459 | - dbDelta($sql); | |
| 460 | - | |
| 461 | - | |
| 462 | - $sql="CREATE TABLE ".SMART_FORMS_UPLOADED_FILES." ( | |
| 463 | - uploaded_file_id INT AUTO_INCREMENT, | |
| 464 | - file_key VARCHAR(32), | |
| 465 | - file_name VARCHAR(500), | |
| 466 | - file_mime VARCHAR(500), | |
| 467 | - original_name VARCHAR(500), | |
| 468 | - PRIMARY KEY (uploaded_file_id) | |
| 469 | - )"; | |
| 470 | - dbDelta($sql); | |
| 471 | - if(smart_forms_indexing_is_requred()) | |
| 472 | - update_site_option('SMART_FORMS_REQUIRE_DB_DETAIL_GENERATION','y'); | |
| 473 | - | |
| 474 | - update_site_option("SMART_FORMS_LATEST_DB_VERSION",SMART_FORMS_LATEST_DB_VERSION); | |
| 103 | + update_option("SMART_FORMS_LATEST_DB_VERSION",$dbversion); | |
| 475 | 104 | } |
| 476 | 105 | } |
| 477 | 106 | |
| 478 | 107 | |
| @@ -482,9 +111,9 @@ | ||
| 482 | 111 | { |
| 483 | 112 | include(SMART_FORMS_DIR.'main_screens/smart-forms-list.php'); |
| 484 | 113 | } |
| 485 | 114 | |
| 486 | -function rednao_smart_form_short_code(/** @noinspection PhpUnusedParameterInspection */ $attr,$content) | |
| 115 | +function rednao_smart_form_short_code($attr,$content) | |
| 487 | 116 | { |
| 488 | 117 | require_once('smart-forms-helpers.php'); |
| 489 | 118 | return rednao_smart_forms_load_form(null,$content,true); |
| 490 | 119 | } |
| @@ -498,27 +127,13 @@ | ||
| 498 | 127 | if ( get_user_option('rich_editing') == 'true') { |
| 499 | 128 | add_filter( 'mce_external_plugins', 'rednao_smart_forms_add_plugin' ); |
| 500 | 129 | add_filter( 'mce_buttons', 'rednao_smart_forms_register_button' ); |
| 501 | 130 | } |
| 502 | - | |
| 503 | - register_post_type('smartforms_preview', | |
| 504 | - array( | |
| 505 | - 'labels' => array( | |
| 506 | - 'name' => __( 'SmartFormsPreview' ), | |
| 507 | - 'singular_name' => __( 'SmartFormsPreview' ) | |
| 508 | - ), | |
| 509 | - 'public' => true, | |
| 510 | - 'has_archive' => false, | |
| 511 | - ) | |
| 512 | - ); | |
| 513 | 131 | } |
| 514 | 132 | |
| 515 | 133 | function rednao_smart_forms_add_plugin($plugin_array) |
| 516 | 134 | { |
| 517 | 135 | wp_enqueue_script('isolated-slider',plugin_dir_url(__FILE__).'js/rednao-isolated-jq.js'); |
| 518 | - wp_localize_script('isolated-slider','smartformsvars',array( | |
| 519 | - 'nonce'=>wp_create_nonce('short_code_setup') | |
| 520 | - )); | |
| 521 | 136 | wp_enqueue_style('smart-forms-Slider',plugin_dir_url(__FILE__).'css/smartFormsSlider/jquery-ui-1.10.2.custom.min.css'); |
| 522 | 137 | $plugin_array['rednao_smart_forms_button']=plugin_dir_url(__FILE__).'js/shortcode/smartFormsShortCodeButton.js'; |
| 523 | 138 | return $plugin_array; |
| 524 | 139 | } |
| @@ -528,63 +143,10 @@ | ||
| 528 | 143 | $buttons[]="rednao_smart_forms_button"; |
| 529 | 144 | return $buttons; |
| 530 | 145 | } |
| 531 | 146 | |
| 532 | -function rednao_smart_forms_settings() | |
| 533 | -{ | |
| 534 | - include(SMART_FORMS_DIR.'main_screens/smart-forms-settings.php'); | |
| 535 | -} | |
| 536 | - | |
| 537 | 147 | function rednao_smart_forms_entries() |
| 538 | 148 | { |
| 539 | - include(SMART_FORMS_DIR.'main_screens/smart-forms-entries2.php'); | |
| 149 | + include(SMART_FORMS_DIR.'main_screens/smart-forms-entries.php'); | |
| 540 | 150 | } |
| 541 | -function rednao_smart_forms_wish_list() | |
| 542 | -{ | |
| 543 | - include(SMART_FORMS_DIR.'main_screens/smart-forms-wishlist.php'); | |
| 544 | -} | |
| 545 | 151 | |
| 546 | - | |
| 547 | -require_once(SMART_FORMS_DIR.'pr/smart-forms-pr.php'); | |
| 548 | - | |
| 549 | - | |
| 550 | - | |
| 551 | -function rednao_smart_forms_generate_detail() | |
| 552 | -{ | |
| 553 | - if(!wp_verify_nonce($_GET['nonce'],'save_nonce')||!current_user_can('edit_pages')) | |
| 554 | - { | |
| 555 | - echo json_encode(array( | |
| 556 | - 'success'=>false, | |
| 557 | - 'errorMessage'=>'Invalid Request' | |
| 558 | - )); | |
| 559 | - die(); | |
| 560 | - } | |
| 561 | - include(SMART_FORMS_DIR.'utilities/smart-forms-detail-generator.php'); | |
| 562 | -} | |
| 563 | - | |
| 564 | - | |
| 565 | - | |
| 566 | - | |
| 567 | -add_filter('query_vars','smart_forms_add_trigger'); | |
| 568 | -function smart_forms_add_trigger($vars) { | |
| 569 | - $vars[] = 'smartformspreview'; | |
| 570 | - return $vars; | |
| 571 | -} | |
| 572 | - | |
| 573 | -add_action('template_redirect', 'smart_forms_check_if_preview'); | |
| 574 | -function smart_forms_check_if_preview() | |
| 575 | -{ | |
| 576 | - | |
| 577 | - $val=get_query_var('smartformspreview')?get_query_var('smartformspreview'):""; | |
| 578 | - if($val==""&&isset($_GET["smartformspreview"])) | |
| 579 | - $val=intval($_GET["smartformspreview"]); | |
| 580 | - | |
| 581 | - if($val!=0&&$val!='') | |
| 582 | - { | |
| 583 | - require_once('smart-forms-helpers.php'); | |
| 584 | - rednao_smart_forms_load_preview(); | |
| 585 | - } | |
| 586 | - | |
| 587 | -} | |
| 588 | -function smart_forms_review_request(){ | |
| 589 | - return; | |
| 590 | -} | |
| 152 | +?> | |