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' );
}
}
අපි කුමන්ත්රණ කළේ නෑ ..ඔය පුටු ෂුවර් නෑ …- මහින්ද රාජපක්ෂ කියයි – ttvnews.lk
No Result
View All Result
මුදල් අමාත්යවරයා වශයෙන් මංගල සමරවීර මහතා විසින් අද දිනයේදී ඉදිරිපත් කළ අවස්ථාවේදී ආණ්ඩුව ලබා ගත්තේ කුමන්ත්රණය කර ඇති බවට කල ප්රකාශය ප්රතික්ෂේප කරන බව හිටපු ජනාධිපති මහින්ද රාජපක්ෂ මහතා පවසයි.
ඒ මහතා අද (21) පාර්ලිමේන්තුවේ අදහස් ප්රකාශ කරමින් කියා සිටියේ ආණ්ඩු පක්ෂයේ පුටු වල වාඩි වී සිටිමේ කාලය එතරම් විශ්වාස කළ නොහැකි බවයි.
මන්ද ඔය පුටුවල තම කණ්ඩායමද වාඩි වී සිටි බව හෙතෙම පැවසිය. කොයි වෙලාවේදී කොයි අවස්ථාවේදී විරුද්ධ පක්ෂය නැඟී සිටිම සිදුවේද යන්න විශ්වාස කළ නොහැකිය. පසුගිය කාල සිමාවලදී රටේ ආර්ථිකය කඩා වැටීමක් සිදුවු බවත් ඉදිරියේදී හෝ ජනතාවාදීව සිතා ආර්ථිකය ගොඩ නගා ගත යුතු බව මහින්ද රාජපක්ෂ මහතා වැඩිදුරටත් කියා සිටියේය.
Post Views: 24
No Result
View All Result