register_hooks(); $apiFilters=new SFApiFilters(); $apiFilters->register_hooks(); //integration add_action('wp_ajax_rednao_smart_forms_get_campaigns','rednao_smart_forms_get_campaigns'); add_action('admin_init','rednao_smart_forms_plugin_was_activated'); register_activation_hook(__FILE__,'rednao_smart_forms_plugin_was_activated'); add_action('admin_menu','rednao_smart_forms_create_menu'); add_filter('smart_forms_add_form_elements_dependencies','rednao_add_form_elements_dependencies'); add_action('admin_notices', 'ShowAllInOneNotice'); add_action( 'admin_init', 'smart_forms_admin_notices' ); add_action('wp_ajax_smart_forms_aio_dismiss','smart_forms_aio_dismiss'); function smart_forms_aio_dismiss() { $nonce=$_POST['nonce']; if(!wp_verify_nonce($nonce,'wp_sf_aio_dismiss')) die('Invalid request'); update_option('SFAIONotShowAgain',true); } function smart_forms_admin_notices() { if ( is_multisite() ) { add_action( 'network_admin_notices', 'smart_forms_maybe_add_aio_notice' ); } else { add_action( 'admin_notices','smart_forms_maybe_add_aio_notice' ); } } function smart_forms_maybe_add_aio_notice() { if(get_option('SFAIONotShowAgain',false)) return; ?>

If you like Smart Forms you will love our new form builder AIO Forms

What is AIO Forms and why should I use it Dismiss notice and not show again
All in one forms

Are you enjoing Smart Forms? Try our new form builder!

Learn more
'; } function rednao_sf_getsignature(){ global $wpdb; if(!isset($_GET['id'])||!isset($_GET['tok'])) { echo "Invalid request"; die(); } $id=intval($_GET['id']); $tok=sanitize_text_field($_GET['tok']); $entry=$wpdb->get_row($wpdb->prepare('select data from '.SMART_FORMS_ENTRY.' where entry_id=%s',$id)); if($entry==null) { echo "Invalid request"; die(); } $fields=json_decode($entry->data); if($fields==null) { echo "Invalid request"; die(); } foreach($fields as $key=>$value) { if($value==null||!isset($value->tok)) continue; if($value->tok!=$tok) continue; header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-type: image/png'); echo base64_decode($value->image); } die(); } function smart_forms_register_block(){ if(function_exists('register_block_type')) register_block_type( 'smartforms/sfform-selector', array( 'attributes' => array( 'formId' => array( 'type' => 'string', ) ), 'render_callback' => 'smart_forms_render_form' )); } function smart_forms_render_form($values){ require_once('smart-forms-helpers.php'); return rednao_smart_forms_load_form(null,$values['formId'],true); } function rednao_smart_forms_register_blocks() { wp_enqueue_script( 'smartforms-gutenberg-form-selector', SMART_FORMS_DIR_URL . 'js/blocks/dist/formSelector_bundle.js', array( 'wp-blocks', 'wp-i18n', 'wp-element' ), SMART_FORMS_FILE_VERSION, true ); global $wpdb; $result=$wpdb->get_results("SELECT form_name label, form_id value FROM ".SMART_FORMS_TABLE_NAME,'ARRAY_A'); wp_localize_script('smartforms-gutenberg-form-selector','smartformsblockvars',array( 'forms'=>$result, 'rootUrl'=>SMART_FORMS_DIR_URL )); } function rednao_add_form_elements_dependencies($dependencies) { wp_enqueue_script('smart-forms-data-store',SMART_FORMS_DIR_URL.'js/bundle/datastores_bundle.js',array(),SMART_FORMS_FILE_VERSION); wp_enqueue_script('smart-forms-polyfill',SMART_FORMS_DIR_URL.'js/utilities/polyfill.js',array(),SMART_FORMS_FILE_VERSION); wp_enqueue_script('smart-forms-promise',SMART_FORMS_DIR_URL.'js/utilities/es6-promise/es6-promise.min.js',array(),SMART_FORMS_FILE_VERSION); $dependencies[]='smart-forms-data-store'; $dependencies[]='smart-forms-promise'; return $dependencies; } function rednao_smart_forms_admin_header($hook){ if($hook=='toplevel_page_smart_forms_menu'&&isset($_GET['id'])) { add_action('admin_print_styles','smart_forms_filter_not_needed_styles'); add_action('admin_print_scripts','smart_forms_filter_not_needed_scripts'); } // Enqueue sortable on the forms list page (no id = list view) if($hook=='toplevel_page_smart_forms_menu'&&!isset($_GET['id'])) { wp_enqueue_script('jquery-ui-sortable'); } } function smart_forms_filter_not_needed_styles(){ global $wp_styles; $styles=$wp_styles->queue; $queuedStyles=$wp_styles->queue; $allowedStyles=array('admin-bar','colors','ie','wp-auth-check'); foreach($queuedStyles as $queue) { if(isset($wp_styles->registered[$queue])) { if($wp_styles->registered[$queue]->src) { 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) continue; if(in_array($queue,$allowedStyles)) continue; if(strpos($queue,'smart-forms')!==false) continue; wp_dequeue_style($queue); } } } } function smart_forms_filter_not_needed_scripts(){ global $wp_scripts; $queuedScripts=$wp_scripts->queue; $allowedScripts=array('jquery','common','jquery-ui-core','admin-bar','utils','svg-painter','wp-auth-check'); foreach($queuedScripts as $queue) { if(isset($wp_scripts->registered[$queue])) { if($wp_scripts->registered[$queue]->src) { 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) continue; if(in_array($queue,$allowedScripts)) continue; if(strpos($queue,'smart-forms')!==false) continue; wp_dequeue_script($queue); } } } } function smart_forms_remove_menu_items() { remove_menu_page( 'edit.php?post_type=smartforms_preview' ); } function rednao_smart_forms_create_menu(){ add_menu_page('Smart Forms','Smart Forms','manage_options',"smart_forms_menu",'rednao_forms',plugin_dir_url(__FILE__).'images/smartFormsIcon.png'); if(current_user_can('manage_options')) add_submenu_page("smart_forms_menu",'Entries','Entries','manage_options',__FILE__.'entries', 'rednao_smart_forms_entries'); else if(current_user_can('smart_forms_view_entries')) add_submenu_page("smart_forms_menu",'Entries','Entries','smart_forms_view_entries',__FILE__.'entries', 'rednao_smart_forms_entries'); add_submenu_page("smart_forms_menu",'Support/Wish List','Support/Wish List','manage_options',__FILE__.'wish_list', 'rednao_smart_forms_wish_list'); add_submenu_page("smart_forms_menu",'Settings','Settings','manage_options',__FILE__.'settings', 'rednao_smart_forms_settings'); do_action('add_smart_forms_menu_items'); } function smart_forms_indexing_is_requred() { global $wpdb; $entriesCount=$wpdb->get_var('select count(*) from '. SMART_FORMS_ENTRY); $entriesDetailCount=$wpdb->get_var('select count(*) from '. SMART_FORMS_ENTRY_DETAIL); return $entriesCount!=0&&$entriesDetailCount==0; } function rednao_smart_forms_plugin_was_activated() { $dbversion=get_option("SMART_FORMS_LATEST_DB_VERSION"); if($dbversion array( 'name' => __( 'SmartFormsPreview' ), 'singular_name' => __( 'SmartFormsPreview' ) ), 'public' => true, 'has_archive' => false, ) ); } function rednao_smart_forms_add_plugin($plugin_array) { wp_enqueue_script('isolated-slider',plugin_dir_url(__FILE__).'js/rednao-isolated-jq.js'); wp_localize_script('isolated-slider','smartformsvars',array( 'nonce'=>wp_create_nonce('short_code_setup') )); wp_enqueue_style('smart-forms-Slider',plugin_dir_url(__FILE__).'css/smartFormsSlider/jquery-ui-1.10.2.custom.min.css'); $plugin_array['rednao_smart_forms_button']=plugin_dir_url(__FILE__).'js/shortcode/smartFormsShortCodeButton.js'; return $plugin_array; } function rednao_smart_forms_register_button($buttons) { $buttons[]="rednao_smart_forms_button"; return $buttons; } function rednao_smart_forms_settings() { include(SMART_FORMS_DIR.'main_screens/smart-forms-settings.php'); } function rednao_smart_forms_entries() { include(SMART_FORMS_DIR.'main_screens/smart-forms-entries2.php'); } function rednao_smart_forms_wish_list() { include(SMART_FORMS_DIR.'main_screens/smart-forms-wishlist.php'); } require_once(SMART_FORMS_DIR.'pr/smart-forms-pr.php'); function rednao_smart_forms_generate_detail() { if(!wp_verify_nonce($_GET['nonce'],'save_nonce')||!current_user_can('edit_pages')) { echo json_encode(array( 'success'=>false, 'errorMessage'=>'Invalid Request' )); die(); } include(SMART_FORMS_DIR.'utilities/smart-forms-detail-generator.php'); } add_filter('query_vars','smart_forms_add_trigger'); function smart_forms_add_trigger($vars) { $vars[] = 'smartformspreview'; return $vars; } add_action('template_redirect', 'smart_forms_check_if_preview'); function smart_forms_check_if_preview() { $val=get_query_var('smartformspreview')?get_query_var('smartformspreview'):""; if($val==""&&isset($_GET["smartformspreview"])) $val=intval($_GET["smartformspreview"]); if($val!=0&&$val!='') { require_once('smart-forms-helpers.php'); rednao_smart_forms_load_preview(); } } function smart_forms_review_request(){ return; }