'array', 'sanitize_callback' => array( 'Logvia_Texts', 'sanitize' ), ) ); } /** * Builder assets on Settings → Logvia → Form builder. * * @param string $hook Admin page hook. */ public static function assets( $hook ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Tab check only. if ( 'settings_page_logvia' !== $hook || ! isset( $_GET['tab'] ) || 'forms' !== $_GET['tab'] ) { return; } wp_enqueue_style( 'logvia-builder', LOGVIA_URL . 'assets/css/admin-builder.css', array(), LOGVIA_VERSION ); wp_enqueue_script( 'logvia-builder', LOGVIA_URL . 'assets/js/admin-builder.js', array(), LOGVIA_VERSION, true ); $types = array(); foreach ( Logvia_Forms::types() as $key => $t ) { $types[] = array( 'type' => $key, 'label' => $t[0], 'group' => $t[1], 'icon' => $t[2], ); } $preview = Logvia_Plugin::page_id() ? Logvia_Plugin::url( 'register', array( 'logvia_preview' => '1' ) ) : ''; wp_localize_script( 'logvia-builder', 'LogviaBuilder', array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'logvia_save_form' ), 'fields' => Logvia_Forms::fields(), 'defaults' => Logvia_Forms::default_fields(), 'types' => $types, 'core' => array( 'core_email' => __( 'Email', 'logvia' ), 'core_password' => __( 'Password', 'logvia' ), 'core_password_confirm' => __( 'Confirm password', 'logvia' ), ), 'maps' => Logvia_Forms::maps(), 'mapsFor' => array_combine( array_keys( Logvia_Forms::types() ), array_map( array( 'Logvia_Forms', 'maps_for' ), array_keys( Logvia_Forms::types() ) ) ), 'singles' => Logvia_Forms::single_types(), 'roles' => Logvia_Forms::assignable_roles(), 'hasWoo' => class_exists( 'WooCommerce' ), 'preview' => $preview, 'i18n' => array( 'groups' => array( 'input' => __( 'Inputs', 'logvia' ), 'choice' => __( 'Choices', 'logvia' ), 'content' => __( 'Content', 'logvia' ), 'account' => __( 'Account', 'logvia' ), 'upload' => __( 'Uploads', 'logvia' ), ), 'countryCode' => __( 'Show a country code picker', 'logvia' ), 'fileTypes' => __( 'Allowed files', 'logvia' ), 'images' => __( 'Images (JPG, PNG, GIF, WebP)', 'logvia' ), 'documents' => __( 'Documents (PDF, Word, Excel, text)', 'logvia' ), 'anyFile' => __( 'Images and documents', 'logvia' ), 'maxSize' => __( 'Maximum size (MB)', 'logvia' ), 'roles' => __( 'Account types visitors can choose', 'logvia' ), 'rolesHint' => __( 'Only roles without admin, editing or shop-management rights are listed.', 'logvia' ), 'fixedSave' => __( 'Saved automatically', 'logvia' ), 'single' => __( 'Already in the form', 'logvia' ), 'addHint' => __( 'Drag a field into the form, or click it to add it at the end.', 'logvia' ), 'empty' => __( 'Select a field to edit its settings.', 'logvia' ), 'save' => __( 'Save form', 'logvia' ), 'saving' => __( 'Saving…', 'logvia' ), 'saved' => __( 'Saved', 'logvia' ), 'saveFailed' => __( 'Could not save. Please reload the page and try again.', 'logvia' ), 'unsaved' => __( 'Unsaved changes', 'logvia' ), 'preview' => __( 'Preview', 'logvia' ), 'reset' => __( 'Reset to default', 'logvia' ), 'resetConfirm' => __( 'Replace the form with the default fields? Your custom fields will be removed after you save.', 'logvia' ), 'leave' => __( 'You have unsaved changes.', 'logvia' ), 'label' => __( 'Label', 'logvia' ), 'headingText' => __( 'Heading text', 'logvia' ), 'placeholder' => __( 'Placeholder', 'logvia' ), 'help' => __( 'Help text', 'logvia' ), 'required' => __( 'Required', 'logvia' ), 'width' => __( 'Width', 'logvia' ), 'full' => __( 'Full width', 'logvia' ), 'half' => __( 'Half width', 'logvia' ), 'options' => __( 'Options (one per line)', 'logvia' ), 'default' => __( 'Default value', 'logvia' ), 'checkedDefault'=> __( 'Checked by default', 'logvia' ), 'content' => __( 'Text (links allowed)', 'logvia' ), 'checkboxText' => __( 'Checkbox text (links allowed)', 'logvia' ), 'checkboxHint' => __( 'Example: I agree to the terms', 'logvia' ), 'maxlength' => __( 'Maximum length (0 = no limit)', 'logvia' ), 'saveTo' => __( 'Save value to', 'logvia' ), 'metaKey' => __( 'Meta key', 'logvia' ), 'metaHint' => __( 'Lowercase letters, numbers, - and _. Leave empty to generate one.', 'logvia' ), 'enabled' => __( 'Ask visitors to type the password twice', 'logvia' ), 'coreNote' => __( 'Built-in field: it can be moved and renamed but not removed.', 'logvia' ), 'moveUp' => __( 'Move up', 'logvia' ), 'moveDown' => __( 'Move down', 'logvia' ), 'duplicate' => __( 'Duplicate', 'logvia' ), 'remove' => __( 'Remove', 'logvia' ), 'drag' => __( 'Drag to reorder', 'logvia' ), 'fieldSettings' => __( 'Field settings', 'logvia' ), 'hidden' => __( 'Off', 'logvia' ), 'newField' => __( 'New field', 'logvia' ), 'required_star' => __( 'Required', 'logvia' ), ), ) ); } /** * Builder screen markup (the JavaScript renders the rest). */ public static function render_builder() { ?>
|
ID, $f['meta_key'], true ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in display_value(). ?>
>
|