/** * Script printer for head */ public function print_to_head() { if (!empty(self::$head_raw_scripts)) { echo "<!-- Front End Form Extension for ACF JavaScript head -->\n<script type=\"text/javascript\">\njQuery(function(\$) {"; // Sanitize self::$head_raw_scripts = self::sanitize_js(self::$head_raw_scripts); echo self::$head_raw_scripts . "});\n</script>\n"; } }
/** * Enqueue pointers and add script to page. * @param array $pointers */ public function enqueue_acffef_pointers($pointers) { $pointers = json_encode($pointers); wp_enqueue_style('wp-pointer'); wp_enqueue_script('wp-pointer'); ACFFrontendFormAdminRawScripts::add_to_footer("\n\t\t\tjQuery( function( \$ ) {\n\t\t\t\tvar acffef_pointers = {$pointers};\n\n\t\t\t\tsetTimeout( init_acffef_pointers, 800 );\n\n\t\t\t\tfunction init_acffef_pointers() {\n\t\t\t\t\t\$.each( acffef_pointers.pointers, function( i ) {\n\t\t\t\t\t\tshow_acffef_pointer( i );\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfunction show_acffef_pointer( id ) {\n\t\t\t\t\tvar pointer = acffef_pointers.pointers[ id ];\n\t\t\t\t\tvar options = \$.extend( pointer.options, {\n\t\t\t\t\t\tclose: function() {\n\t\t\t\t\t\t\tif ( pointer.next ) {\n\t\t\t\t\t\t\t\tshow_acffef_pointer( pointer.next );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t\tvar this_pointer = \$( pointer.target ).pointer( options );\n\t\t\t\t\tthis_pointer.pointer( 'open' );\n\n\t\t\t\t\tif ( pointer.next_trigger ) {\n\t\t\t\t\t\t\$( pointer.next_trigger.target ).on( pointer.next_trigger.event, function() {\n\t\t\t\t\t\t\tsetTimeout( function() { this_pointer.pointer( 'close' ); }, 400 );\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t"); }
<?php /** * Plugin Name: Front End Form Extension for ACF (Free) * Description: Display an ACF Form with the custom fields you created on the front end. You can use the short code <code>[acf_form group_id="x"]</code>, where x are field group ids separated by a comma. e.g. <code>[acf_form group_id="1,6,10"]</code>, You can also set whether to create a new entry by using <code>[acf_form group_id="x" create_new_post="true" post_type="post-type"]</code> the type is an argument that sets the type of post. Type is set to 'post' by default. * Author: The Portland Company * Author URI: https://profiles.wordpress.org/d363f86b/ * Plugin URI: http://www.theportlandcompany.com * Version: 1.0.9 */ define('ACFFEF_FREE_VERSION', '1.0.9'); require_once dirname(__FILE__) . '/classes/ACFFrontendFormAdminRawScripts.php'; require_once dirname(__FILE__) . '/classes/ACFFrontendFormAdminNotices.php'; require_once dirname(__FILE__) . '/classes/ACFFrontendFormActivation.php'; require_once dirname(__FILE__) . '/classes/ACFFrontendFormPointers.php'; require_once dirname(__FILE__) . '/classes/ACFFrontendForm.php'; ACFFrontendForm::instance(); ACFFrontendFormPointers::instance(); ACFFrontendFormAdminRawScripts::instance(); ACFFrontendFormAdminNotices::instance(); ACFFrontendFormActivation::instance(); register_activation_hook(__FILE__, 'acffef_free_activation_hook'); function acffef_free_activation_hook() { ACFFrontendFormActivation::intro_notice(); } $current_version = get_option('acffef_free_version'); if (!is_string($current_version) || $current_version != ACFFEF_FREE_VERSION) { update_option('acffef_free_version', ACFFEF_FREE_VERSION); }