m' )::POST_TYPES; } return $args; } /** * Add user templates to the form templates list. * * @since 1.8.8 * * @param array $templates Form templates. * * @return array Form templates. */ public function add_form_templates( array $templates ): array { $user_templates = wpforms()->obj( 'form' )->get( '', [ 'post_type' => 'wpforms-template' ] ); if ( empty( $user_templates ) ) { return $templates; } foreach ( $user_templates as $template ) { $template_data = wpforms_decode( $template->post_content ); $edit_url = add_query_arg( [ 'page' => 'wpforms-builder', 'form_id' => $template->ID, ], admin_url( 'admin.php' ) ); $create_url = add_query_arg( [ 'page' => 'wpforms-builder', 'form_id' => $template->ID, 'action' => 'template_to_form', '_wpnonce' => wp_create_nonce( 'wpforms_template_to_form_form_nonce' ), ], admin_url( 'admin.php' ) ); $templates[] = [ 'name' => $template->post_title, 'slug' => 'wpforms-user-template-' . $template->ID, 'action_text' => wpforms_is_admin_page( 'builder' ) || wp_doing_ajax() ? esc_html__( 'Use Template', 'wpforms-lite' ) : esc_html__( 'Create Form', 'wpforms-lite' ), 'edit_action_text' => esc_html__( 'Edit Template', 'wpforms-lite' ), 'description' => ! empty( $template_data['settings']['template_description'] ) ? $template_data['settings']['template_description'] : '', 'source' => 'wpforms-user-template', 'create_url' => $create_url, 'edit_url' => $edit_url, 'categories' => [ 'user' ], 'has_access' => true, 'data' => $template_data, 'post_id' => $template->ID, ]; } return $templates; } /** * AJAX handler for removing user templates. * * @since 1.8.8 */ public function ajax_remove_user_template(): void { // Run a security check. check_ajax_referer( 'wpforms-form-templates', 'nonce' ); $template_id = isset( $_POST['template'] ) ? absint( $_POST['template'] ) : 0; if ( ! $template_id ) { wp_send_json_error(); } // Check for permissions for the specific template. if ( ! wpforms_current_user_can( 'delete_form_single', $template_id ) ) { wp_send_json_error( esc_html__( 'You do not have permission to delete this template.', 'wpforms-lite' ) ); } // Verify the post exists and is a template. $template = get_post( $template_id ); if ( ! $template || $template->post_type !== 'wpforms-template' ) { wp_send_json_error( esc_html__( 'Template not found.', 'wpforms-lite' ) ); } // Delete the template. $result = wp_delete_post( $template_id, true ); if ( ! $result ) { wp_send_json_error( esc_html__( 'Failed to delete the template.', 'wpforms-lite' ) ); } wp_send_json_success(); } /** * Add purge entry task. * * @since 1.8.8 * * @param array $tasks Task class list. */ public function add_purge_entry_task( $tasks ) { $tasks[] = PurgeTemplateEntryTask::class; return $tasks; } /** * Modify the form data before it is processed to disable payment processing. * * @since 1.8.8 * * @param array $form_data Form data. * * @return array */ public function process_before_form_data( $form_data ) { if ( ! isset( $form_data['id'] ) ) { return $form_data; } if ( wpforms_is_form_template( $form_data['id'] ) ) { $form_data['payments'] = []; } return $form_data; } /** * Disable Lite Connect integration for user templates while processing submission. * * @since 1.8.8 * * @param array $fields Form fields. * @param array $entry Form entry. * @param array $form_data Form data. */ public function process_entry( array $fields, array $entry, array $form_data ) { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks if ( ! wpforms_is_form_template( $form_data['id'] ) ) { return; } add_filter( 'wpforms_integrations_lite_connect_is_allowed', '__return_false' ); } } Comments on: ලොව වැඩීම කොරෝනා රෝගීන් වාර්තා වු රට වීම ගෞරවයක් – අමෙරිකානු ජනපති https://ttvnews.lk/trump-says-us-topping-world-virus-cases-is-badge-of-honour/?utm_source=rss&utm_medium=rss&utm_campaign=trump-says-us-topping-world-virus-cases-is-badge-of-honour ශ්‍රී ලංකාවේ ප්‍රමුඛතම, විශ්වසනීය පුවත් අඩවිය. Most reliarble 24x7 news web in Sri Lanka. Thu, 21 May 2020 05:23:23 +0000 hourly 1 https://wordpress.org/?v=7.0